|
|
@ -1,4 +1,10 @@ |
|
|
|
import { Currency, PrismaClient, Role, Type } from '@prisma/client'; |
|
|
|
import { |
|
|
|
AccountType, |
|
|
|
Currency, |
|
|
|
PrismaClient, |
|
|
|
Role, |
|
|
|
Type |
|
|
|
} from '@prisma/client'; |
|
|
|
const prisma = new PrismaClient(); |
|
|
|
|
|
|
|
async function main() { |
|
|
@ -88,12 +94,42 @@ async function main() { |
|
|
|
create: { |
|
|
|
accessToken: |
|
|
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjliMTEyYjRkLTNiN2QtNGJhZC05YmRkLTNiMGY3YjRkYWMyZiIsImlhdCI6MTYxODUxMjAxNCwiZXhwIjoxNjIxMTA0MDE0fQ.l3WUxpI0hxuQtdPrD0kd7sem6S2kx_7CrdNvkmlKuWw', |
|
|
|
Account: { |
|
|
|
create: [ |
|
|
|
{ |
|
|
|
accountType: AccountType.SECURITIES, |
|
|
|
id: 'd804de69-0429-42dc-b6ca-b308fd7dd926', |
|
|
|
name: 'Coinbase Account', |
|
|
|
platformId: platformCoinbase.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountType: AccountType.SECURITIES, |
|
|
|
id: '65cfb79d-b6c7-4591-9d46-73426bc62094', |
|
|
|
name: 'DEGIRO Account', |
|
|
|
platformId: platformDegiro.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountType: AccountType.SECURITIES, |
|
|
|
id: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
isDefault: true, |
|
|
|
name: 'Interactive Brokers Account', |
|
|
|
platformId: platformInteractiveBrokers.id |
|
|
|
} |
|
|
|
] |
|
|
|
}, |
|
|
|
alias: 'Demo', |
|
|
|
id: '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f', |
|
|
|
role: Role.DEMO, |
|
|
|
Order: { |
|
|
|
create: [ |
|
|
|
role: Role.DEMO |
|
|
|
}, |
|
|
|
update: {}, |
|
|
|
where: { id: '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f' } |
|
|
|
}); |
|
|
|
|
|
|
|
await prisma.order.createMany({ |
|
|
|
data: [ |
|
|
|
{ |
|
|
|
accountId: '65cfb79d-b6c7-4591-9d46-73426bc62094', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2017, 0, 3, 0, 0, 0)), |
|
|
|
fee: 30, |
|
|
@ -102,9 +138,12 @@ async function main() { |
|
|
|
quantity: 50, |
|
|
|
symbol: 'TSLA', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 42.97 |
|
|
|
unitPrice: 42.97, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: 'd804de69-0429-42dc-b6ca-b308fd7dd926', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2017, 7, 16, 0, 0, 0)), |
|
|
|
fee: 29.9, |
|
|
@ -113,9 +152,12 @@ async function main() { |
|
|
|
quantity: 0.5614682, |
|
|
|
symbol: 'BTCUSD', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 3562.089535970158 |
|
|
|
unitPrice: 3562.089535970158, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2018, 9, 1, 0, 0, 0)), |
|
|
|
fee: 80.79, |
|
|
@ -124,9 +166,12 @@ async function main() { |
|
|
|
quantity: 5, |
|
|
|
symbol: 'AMZN', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 2021.99 |
|
|
|
unitPrice: 2021.99, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2019, 2, 1, 0, 0, 0)), |
|
|
|
fee: 19.9, |
|
|
@ -135,9 +180,12 @@ async function main() { |
|
|
|
quantity: 10, |
|
|
|
symbol: 'VTI', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 144.38 |
|
|
|
unitPrice: 144.38, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2019, 8, 3, 0, 0, 0)), |
|
|
|
fee: 19.9, |
|
|
@ -146,9 +194,12 @@ async function main() { |
|
|
|
quantity: 10, |
|
|
|
symbol: 'VTI', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 147.99 |
|
|
|
unitPrice: 147.99, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2020, 2, 2, 0, 0, 0)), |
|
|
|
fee: 19.9, |
|
|
@ -157,9 +208,12 @@ async function main() { |
|
|
|
quantity: 10, |
|
|
|
symbol: 'VTI', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 151.41 |
|
|
|
unitPrice: 151.41, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2020, 8, 1, 0, 0, 0)), |
|
|
|
fee: 19.9, |
|
|
@ -168,9 +222,12 @@ async function main() { |
|
|
|
quantity: 10, |
|
|
|
symbol: 'VTI', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 177.69 |
|
|
|
unitPrice: 177.69, |
|
|
|
userId: userDemo.id |
|
|
|
}, |
|
|
|
{ |
|
|
|
accountId: '480269ce-e12a-4fd1-ac88-c4b0ff3f899c', |
|
|
|
accountUserId: userDemo.id, |
|
|
|
currency: Currency.USD, |
|
|
|
date: new Date(Date.UTC(2020, 2, 1, 0, 0, 0)), |
|
|
|
fee: 19.9, |
|
|
@ -179,13 +236,11 @@ async function main() { |
|
|
|
quantity: 10, |
|
|
|
symbol: 'VTI', |
|
|
|
type: Type.BUY, |
|
|
|
unitPrice: 203.15 |
|
|
|
unitPrice: 203.15, |
|
|
|
userId: userDemo.id |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
}, |
|
|
|
update: {}, |
|
|
|
where: { id: '9b112b4d-3b7d-4bad-9bdd-3b0f7b4dac2f' } |
|
|
|
], |
|
|
|
skipDuplicates: true |
|
|
|
}); |
|
|
|
|
|
|
|
console.log({ |
|
|
|