adaptic-backend 1.0.151 → 1.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Account.cjs +1029 -0
- package/Action.cjs +3460 -0
- package/Alert.cjs +3800 -0
- package/AlpacaAccount.cjs +2888 -0
- package/Asset.cjs +3659 -0
- package/Authenticator.cjs +1029 -0
- package/Customer.cjs +1029 -0
- package/NewsArticle.cjs +892 -0
- package/NewsArticleAssetSentiment.cjs +1243 -0
- package/Order.cjs +4500 -0
- package/Position.cjs +4288 -0
- package/Session.cjs +1029 -0
- package/StopLoss.cjs +1832 -0
- package/TakeProfit.cjs +1832 -0
- package/Trade.cjs +5276 -0
- package/User.cjs +3103 -0
- package/package.json +1 -1
- package/server/Account.d.ts.map +1 -1
- package/server/Account.js.map +1 -1
- package/server/Account.mjs +1029 -0
- package/server/Action.d.ts.map +1 -1
- package/server/Action.js.map +1 -1
- package/server/Action.mjs +3460 -0
- package/server/Alert.d.ts.map +1 -1
- package/server/Alert.js.map +1 -1
- package/server/Alert.mjs +3800 -0
- package/server/AlpacaAccount.d.ts.map +1 -1
- package/server/AlpacaAccount.js.map +1 -1
- package/server/AlpacaAccount.mjs +2888 -0
- package/server/Asset.d.ts.map +1 -1
- package/server/Asset.js.map +1 -1
- package/server/Asset.mjs +3659 -0
- package/server/Authenticator.d.ts.map +1 -1
- package/server/Authenticator.js.map +1 -1
- package/server/Authenticator.mjs +1029 -0
- package/server/Customer.d.ts.map +1 -1
- package/server/Customer.js.map +1 -1
- package/server/Customer.mjs +1029 -0
- package/server/NewsArticle.d.ts.map +1 -1
- package/server/NewsArticle.js.map +1 -1
- package/server/NewsArticle.mjs +892 -0
- package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
- package/server/NewsArticleAssetSentiment.js.map +1 -1
- package/server/NewsArticleAssetSentiment.mjs +1243 -0
- package/server/Order.d.ts.map +1 -1
- package/server/Order.js.map +1 -1
- package/server/Order.mjs +4500 -0
- package/server/Position.d.ts.map +1 -1
- package/server/Position.js.map +1 -1
- package/server/Position.mjs +4288 -0
- package/server/Session.d.ts.map +1 -1
- package/server/Session.js.map +1 -1
- package/server/Session.mjs +1029 -0
- package/server/StopLoss.d.ts.map +1 -1
- package/server/StopLoss.js.map +1 -1
- package/server/StopLoss.mjs +1832 -0
- package/server/TakeProfit.d.ts.map +1 -1
- package/server/TakeProfit.js.map +1 -1
- package/server/TakeProfit.mjs +1832 -0
- package/server/Trade.d.ts.map +1 -1
- package/server/Trade.js.map +1 -1
- package/server/Trade.mjs +5276 -0
- package/server/User.d.ts.map +1 -1
- package/server/User.js.map +1 -1
- package/server/User.mjs +3103 -0
package/Asset.cjs
CHANGED
@@ -340,6 +340,115 @@ exports.Asset = {
|
|
340
340
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
341
341
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
342
342
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
343
|
+
user: item.alpacaAccount.user ?
|
344
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
345
|
+
? { connect: {
|
346
|
+
id: item.alpacaAccount.user.id
|
347
|
+
}
|
348
|
+
}
|
349
|
+
: { connectOrCreate: {
|
350
|
+
where: {
|
351
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
352
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
353
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
354
|
+
equals: item.alpacaAccount.user.name
|
355
|
+
} : undefined,
|
356
|
+
},
|
357
|
+
create: {
|
358
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
359
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
360
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
361
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
362
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
363
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
364
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
365
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
366
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
367
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
368
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
369
|
+
},
|
370
|
+
}
|
371
|
+
} : undefined,
|
372
|
+
orders: item.alpacaAccount.orders ?
|
373
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
374
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
375
|
+
id: item.id
|
376
|
+
}))
|
377
|
+
}
|
378
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
379
|
+
where: {
|
380
|
+
id: item.id !== undefined ? item.id : undefined,
|
381
|
+
},
|
382
|
+
create: {
|
383
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
384
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
385
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
386
|
+
side: item.side !== undefined ? item.side : undefined,
|
387
|
+
type: item.type !== undefined ? item.type : undefined,
|
388
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
389
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
390
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
391
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
392
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
393
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
394
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
395
|
+
status: item.status !== undefined ? item.status : undefined,
|
396
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
397
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
398
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
399
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
400
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
401
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
402
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
403
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
404
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
405
|
+
},
|
406
|
+
}))
|
407
|
+
} : undefined,
|
408
|
+
positions: item.alpacaAccount.positions ?
|
409
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
410
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
411
|
+
id: item.id
|
412
|
+
}))
|
413
|
+
}
|
414
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
415
|
+
where: {
|
416
|
+
id: item.id !== undefined ? item.id : undefined,
|
417
|
+
},
|
418
|
+
create: {
|
419
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
420
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
421
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
422
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
423
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
424
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
425
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
426
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
427
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
428
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
429
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
430
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
431
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
432
|
+
},
|
433
|
+
}))
|
434
|
+
} : undefined,
|
435
|
+
alerts: item.alpacaAccount.alerts ?
|
436
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
437
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
438
|
+
id: item.id
|
439
|
+
}))
|
440
|
+
}
|
441
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
442
|
+
where: {
|
443
|
+
id: item.id !== undefined ? item.id : undefined,
|
444
|
+
},
|
445
|
+
create: {
|
446
|
+
message: item.message !== undefined ? item.message : undefined,
|
447
|
+
type: item.type !== undefined ? item.type : undefined,
|
448
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
449
|
+
},
|
450
|
+
}))
|
451
|
+
} : undefined,
|
343
452
|
},
|
344
453
|
}
|
345
454
|
} : undefined,
|
@@ -359,6 +468,42 @@ exports.Asset = {
|
|
359
468
|
note: item.note !== undefined ? item.note : undefined,
|
360
469
|
status: item.status !== undefined ? item.status : undefined,
|
361
470
|
fee: item.fee !== undefined ? item.fee : undefined,
|
471
|
+
order: item.order ?
|
472
|
+
typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
|
473
|
+
? { connect: {
|
474
|
+
id: item.order.id
|
475
|
+
}
|
476
|
+
}
|
477
|
+
: { connectOrCreate: {
|
478
|
+
where: {
|
479
|
+
id: item.order.id !== undefined ? item.order.id : undefined,
|
480
|
+
},
|
481
|
+
create: {
|
482
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
483
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
484
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
485
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
486
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
487
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
488
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
489
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
490
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
491
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
492
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
493
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
494
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
495
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
496
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
497
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
498
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
499
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
500
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
501
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
502
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
503
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
504
|
+
},
|
505
|
+
}
|
506
|
+
} : undefined,
|
362
507
|
},
|
363
508
|
}))
|
364
509
|
} : undefined,
|
@@ -450,6 +595,104 @@ exports.Asset = {
|
|
450
595
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
451
596
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
452
597
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
598
|
+
user: item.alpacaAccount.user ?
|
599
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
600
|
+
? { connect: {
|
601
|
+
id: item.alpacaAccount.user.id
|
602
|
+
}
|
603
|
+
}
|
604
|
+
: { connectOrCreate: {
|
605
|
+
where: {
|
606
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
607
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
608
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
609
|
+
equals: item.alpacaAccount.user.name
|
610
|
+
} : undefined,
|
611
|
+
},
|
612
|
+
create: {
|
613
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
614
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
615
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
616
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
617
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
618
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
619
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
620
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
621
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
622
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
623
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
624
|
+
},
|
625
|
+
}
|
626
|
+
} : undefined,
|
627
|
+
trades: item.alpacaAccount.trades ?
|
628
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
629
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
630
|
+
id: item.id
|
631
|
+
}))
|
632
|
+
}
|
633
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
634
|
+
where: {
|
635
|
+
id: item.id !== undefined ? item.id : undefined,
|
636
|
+
},
|
637
|
+
create: {
|
638
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
639
|
+
price: item.price !== undefined ? item.price : undefined,
|
640
|
+
total: item.total !== undefined ? item.total : undefined,
|
641
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
642
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
643
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
644
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
645
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
646
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
647
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
648
|
+
status: item.status !== undefined ? item.status : undefined,
|
649
|
+
},
|
650
|
+
}))
|
651
|
+
} : undefined,
|
652
|
+
positions: item.alpacaAccount.positions ?
|
653
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
654
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
655
|
+
id: item.id
|
656
|
+
}))
|
657
|
+
}
|
658
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
659
|
+
where: {
|
660
|
+
id: item.id !== undefined ? item.id : undefined,
|
661
|
+
},
|
662
|
+
create: {
|
663
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
664
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
665
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
666
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
667
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
668
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
669
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
670
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
671
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
672
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
673
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
674
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
675
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
676
|
+
},
|
677
|
+
}))
|
678
|
+
} : undefined,
|
679
|
+
alerts: item.alpacaAccount.alerts ?
|
680
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
681
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
682
|
+
id: item.id
|
683
|
+
}))
|
684
|
+
}
|
685
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
686
|
+
where: {
|
687
|
+
id: item.id !== undefined ? item.id : undefined,
|
688
|
+
},
|
689
|
+
create: {
|
690
|
+
message: item.message !== undefined ? item.message : undefined,
|
691
|
+
type: item.type !== undefined ? item.type : undefined,
|
692
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
693
|
+
},
|
694
|
+
}))
|
695
|
+
} : undefined,
|
453
696
|
},
|
454
697
|
}
|
455
698
|
} : undefined,
|
@@ -469,6 +712,31 @@ exports.Asset = {
|
|
469
712
|
note: item.action.note !== undefined ? item.action.note : undefined,
|
470
713
|
status: item.action.status !== undefined ? item.action.status : undefined,
|
471
714
|
fee: item.action.fee !== undefined ? item.action.fee : undefined,
|
715
|
+
trade: item.action.trade ?
|
716
|
+
typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
|
717
|
+
? { connect: {
|
718
|
+
id: item.action.trade.id
|
719
|
+
}
|
720
|
+
}
|
721
|
+
: { connectOrCreate: {
|
722
|
+
where: {
|
723
|
+
id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
|
724
|
+
},
|
725
|
+
create: {
|
726
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
727
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
728
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
729
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
730
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
731
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
732
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
733
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
734
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
735
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
736
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
737
|
+
},
|
738
|
+
}
|
739
|
+
} : undefined,
|
472
740
|
},
|
473
741
|
}
|
474
742
|
} : undefined,
|
@@ -519,6 +787,113 @@ exports.Asset = {
|
|
519
787
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
520
788
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
521
789
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
790
|
+
user: item.alpacaAccount.user ?
|
791
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
792
|
+
? { connect: {
|
793
|
+
id: item.alpacaAccount.user.id
|
794
|
+
}
|
795
|
+
}
|
796
|
+
: { connectOrCreate: {
|
797
|
+
where: {
|
798
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
799
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
800
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
801
|
+
equals: item.alpacaAccount.user.name
|
802
|
+
} : undefined,
|
803
|
+
},
|
804
|
+
create: {
|
805
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
806
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
807
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
808
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
809
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
810
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
811
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
812
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
813
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
814
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
815
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
816
|
+
},
|
817
|
+
}
|
818
|
+
} : undefined,
|
819
|
+
trades: item.alpacaAccount.trades ?
|
820
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
821
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
822
|
+
id: item.id
|
823
|
+
}))
|
824
|
+
}
|
825
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
826
|
+
where: {
|
827
|
+
id: item.id !== undefined ? item.id : undefined,
|
828
|
+
},
|
829
|
+
create: {
|
830
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
831
|
+
price: item.price !== undefined ? item.price : undefined,
|
832
|
+
total: item.total !== undefined ? item.total : undefined,
|
833
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
834
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
835
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
836
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
837
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
838
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
839
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
840
|
+
status: item.status !== undefined ? item.status : undefined,
|
841
|
+
},
|
842
|
+
}))
|
843
|
+
} : undefined,
|
844
|
+
orders: item.alpacaAccount.orders ?
|
845
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
846
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
847
|
+
id: item.id
|
848
|
+
}))
|
849
|
+
}
|
850
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
851
|
+
where: {
|
852
|
+
id: item.id !== undefined ? item.id : undefined,
|
853
|
+
},
|
854
|
+
create: {
|
855
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
856
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
857
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
858
|
+
side: item.side !== undefined ? item.side : undefined,
|
859
|
+
type: item.type !== undefined ? item.type : undefined,
|
860
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
861
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
862
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
863
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
864
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
865
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
866
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
867
|
+
status: item.status !== undefined ? item.status : undefined,
|
868
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
869
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
870
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
871
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
872
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
873
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
874
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
875
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
876
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
877
|
+
},
|
878
|
+
}))
|
879
|
+
} : undefined,
|
880
|
+
alerts: item.alpacaAccount.alerts ?
|
881
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
882
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
883
|
+
id: item.id
|
884
|
+
}))
|
885
|
+
}
|
886
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
887
|
+
where: {
|
888
|
+
id: item.id !== undefined ? item.id : undefined,
|
889
|
+
},
|
890
|
+
create: {
|
891
|
+
message: item.message !== undefined ? item.message : undefined,
|
892
|
+
type: item.type !== undefined ? item.type : undefined,
|
893
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
894
|
+
},
|
895
|
+
}))
|
896
|
+
} : undefined,
|
522
897
|
},
|
523
898
|
}
|
524
899
|
} : undefined,
|
@@ -1012,6 +1387,266 @@ exports.Asset = {
|
|
1012
1387
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
|
1013
1388
|
set: item.alpacaAccount.volumeThreshold
|
1014
1389
|
} : undefined,
|
1390
|
+
user: item.alpacaAccount.user ? {
|
1391
|
+
upsert: {
|
1392
|
+
where: {
|
1393
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
1394
|
+
equals: item.alpacaAccount.user.id
|
1395
|
+
} : undefined,
|
1396
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
1397
|
+
equals: item.alpacaAccount.user.name
|
1398
|
+
} : undefined,
|
1399
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
1400
|
+
equals: item.alpacaAccount.user.email
|
1401
|
+
} : undefined,
|
1402
|
+
},
|
1403
|
+
update: {
|
1404
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
1405
|
+
set: item.alpacaAccount.user.id
|
1406
|
+
} : undefined,
|
1407
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
1408
|
+
set: item.alpacaAccount.user.name
|
1409
|
+
} : undefined,
|
1410
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
1411
|
+
set: item.alpacaAccount.user.email
|
1412
|
+
} : undefined,
|
1413
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
|
1414
|
+
set: item.alpacaAccount.user.emailVerified
|
1415
|
+
} : undefined,
|
1416
|
+
image: item.alpacaAccount.user.image !== undefined ? {
|
1417
|
+
set: item.alpacaAccount.user.image
|
1418
|
+
} : undefined,
|
1419
|
+
role: item.alpacaAccount.user.role !== undefined ? {
|
1420
|
+
set: item.alpacaAccount.user.role
|
1421
|
+
} : undefined,
|
1422
|
+
bio: item.alpacaAccount.user.bio !== undefined ? {
|
1423
|
+
set: item.alpacaAccount.user.bio
|
1424
|
+
} : undefined,
|
1425
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
|
1426
|
+
set: item.alpacaAccount.user.jobTitle
|
1427
|
+
} : undefined,
|
1428
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
|
1429
|
+
set: item.alpacaAccount.user.currentAccount
|
1430
|
+
} : undefined,
|
1431
|
+
plan: item.alpacaAccount.user.plan !== undefined ? {
|
1432
|
+
set: item.alpacaAccount.user.plan
|
1433
|
+
} : undefined,
|
1434
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
1435
|
+
set: item.alpacaAccount.user.openaiAPIKey
|
1436
|
+
} : undefined,
|
1437
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? {
|
1438
|
+
set: item.alpacaAccount.user.openaiModel
|
1439
|
+
} : undefined,
|
1440
|
+
},
|
1441
|
+
create: {
|
1442
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
1443
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
1444
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
1445
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
1446
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
1447
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
1448
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
1449
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
1450
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
1451
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
1452
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
1453
|
+
},
|
1454
|
+
}
|
1455
|
+
} : undefined,
|
1456
|
+
orders: item.alpacaAccount.orders ? {
|
1457
|
+
upsert: item.alpacaAccount.orders.map((item) => ({
|
1458
|
+
where: {
|
1459
|
+
id: item.id !== undefined ? item.id : undefined,
|
1460
|
+
},
|
1461
|
+
update: {
|
1462
|
+
id: item.id !== undefined ? {
|
1463
|
+
set: item.id
|
1464
|
+
} : undefined,
|
1465
|
+
clientOrderId: item.clientOrderId !== undefined ? {
|
1466
|
+
set: item.clientOrderId
|
1467
|
+
} : undefined,
|
1468
|
+
qty: item.qty !== undefined ? {
|
1469
|
+
set: item.qty
|
1470
|
+
} : undefined,
|
1471
|
+
notional: item.notional !== undefined ? {
|
1472
|
+
set: item.notional
|
1473
|
+
} : undefined,
|
1474
|
+
side: item.side !== undefined ? {
|
1475
|
+
set: item.side
|
1476
|
+
} : undefined,
|
1477
|
+
type: item.type !== undefined ? {
|
1478
|
+
set: item.type
|
1479
|
+
} : undefined,
|
1480
|
+
orderClass: item.orderClass !== undefined ? {
|
1481
|
+
set: item.orderClass
|
1482
|
+
} : undefined,
|
1483
|
+
timeInForce: item.timeInForce !== undefined ? {
|
1484
|
+
set: item.timeInForce
|
1485
|
+
} : undefined,
|
1486
|
+
limitPrice: item.limitPrice !== undefined ? {
|
1487
|
+
set: item.limitPrice
|
1488
|
+
} : undefined,
|
1489
|
+
stopPrice: item.stopPrice !== undefined ? {
|
1490
|
+
set: item.stopPrice
|
1491
|
+
} : undefined,
|
1492
|
+
trailPrice: item.trailPrice !== undefined ? {
|
1493
|
+
set: item.trailPrice
|
1494
|
+
} : undefined,
|
1495
|
+
trailPercent: item.trailPercent !== undefined ? {
|
1496
|
+
set: item.trailPercent
|
1497
|
+
} : undefined,
|
1498
|
+
extendedHours: item.extendedHours !== undefined ? {
|
1499
|
+
set: item.extendedHours
|
1500
|
+
} : undefined,
|
1501
|
+
status: item.status !== undefined ? {
|
1502
|
+
set: item.status
|
1503
|
+
} : undefined,
|
1504
|
+
submittedAt: item.submittedAt !== undefined ? {
|
1505
|
+
set: item.submittedAt
|
1506
|
+
} : undefined,
|
1507
|
+
filledAt: item.filledAt !== undefined ? {
|
1508
|
+
set: item.filledAt
|
1509
|
+
} : undefined,
|
1510
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? {
|
1511
|
+
set: item.filledAvgPrice
|
1512
|
+
} : undefined,
|
1513
|
+
fee: item.fee !== undefined ? {
|
1514
|
+
set: item.fee
|
1515
|
+
} : undefined,
|
1516
|
+
strikePrice: item.strikePrice !== undefined ? {
|
1517
|
+
set: item.strikePrice
|
1518
|
+
} : undefined,
|
1519
|
+
expirationDate: item.expirationDate !== undefined ? {
|
1520
|
+
set: item.expirationDate
|
1521
|
+
} : undefined,
|
1522
|
+
optionType: item.optionType !== undefined ? {
|
1523
|
+
set: item.optionType
|
1524
|
+
} : undefined,
|
1525
|
+
stopLossId: item.stopLossId !== undefined ? {
|
1526
|
+
set: item.stopLossId
|
1527
|
+
} : undefined,
|
1528
|
+
takeProfitId: item.takeProfitId !== undefined ? {
|
1529
|
+
set: item.takeProfitId
|
1530
|
+
} : undefined,
|
1531
|
+
},
|
1532
|
+
create: {
|
1533
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
1534
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1535
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
1536
|
+
side: item.side !== undefined ? item.side : undefined,
|
1537
|
+
type: item.type !== undefined ? item.type : undefined,
|
1538
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
1539
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
1540
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
1541
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
1542
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
1543
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
1544
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
1545
|
+
status: item.status !== undefined ? item.status : undefined,
|
1546
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
1547
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
1548
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
1549
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
1550
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
1551
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
1552
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
1553
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
1554
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
1555
|
+
},
|
1556
|
+
}))
|
1557
|
+
} : undefined,
|
1558
|
+
positions: item.alpacaAccount.positions ? {
|
1559
|
+
upsert: item.alpacaAccount.positions.map((item) => ({
|
1560
|
+
where: {
|
1561
|
+
id: item.id !== undefined ? item.id : undefined,
|
1562
|
+
},
|
1563
|
+
update: {
|
1564
|
+
id: item.id !== undefined ? {
|
1565
|
+
set: item.id
|
1566
|
+
} : undefined,
|
1567
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
1568
|
+
set: item.averageEntryPrice
|
1569
|
+
} : undefined,
|
1570
|
+
qty: item.qty !== undefined ? {
|
1571
|
+
set: item.qty
|
1572
|
+
} : undefined,
|
1573
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
1574
|
+
set: item.qtyAvailable
|
1575
|
+
} : undefined,
|
1576
|
+
marketValue: item.marketValue !== undefined ? {
|
1577
|
+
set: item.marketValue
|
1578
|
+
} : undefined,
|
1579
|
+
costBasis: item.costBasis !== undefined ? {
|
1580
|
+
set: item.costBasis
|
1581
|
+
} : undefined,
|
1582
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
1583
|
+
set: item.unrealizedPL
|
1584
|
+
} : undefined,
|
1585
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
1586
|
+
set: item.unrealizedPLPC
|
1587
|
+
} : undefined,
|
1588
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
1589
|
+
set: item.unrealisedIntradayPL
|
1590
|
+
} : undefined,
|
1591
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
1592
|
+
set: item.unrealisedIntradayPLPC
|
1593
|
+
} : undefined,
|
1594
|
+
currentPrice: item.currentPrice !== undefined ? {
|
1595
|
+
set: item.currentPrice
|
1596
|
+
} : undefined,
|
1597
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
1598
|
+
set: item.lastTradePrice
|
1599
|
+
} : undefined,
|
1600
|
+
changeToday: item.changeToday !== undefined ? {
|
1601
|
+
set: item.changeToday
|
1602
|
+
} : undefined,
|
1603
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
1604
|
+
set: item.assetMarginable
|
1605
|
+
} : undefined,
|
1606
|
+
},
|
1607
|
+
create: {
|
1608
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1609
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1610
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1611
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1612
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1613
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1614
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1615
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1616
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1617
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1618
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1619
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1620
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1621
|
+
},
|
1622
|
+
}))
|
1623
|
+
} : undefined,
|
1624
|
+
alerts: item.alpacaAccount.alerts ? {
|
1625
|
+
upsert: item.alpacaAccount.alerts.map((item) => ({
|
1626
|
+
where: {
|
1627
|
+
id: item.id !== undefined ? item.id : undefined,
|
1628
|
+
},
|
1629
|
+
update: {
|
1630
|
+
id: item.id !== undefined ? {
|
1631
|
+
set: item.id
|
1632
|
+
} : undefined,
|
1633
|
+
message: item.message !== undefined ? {
|
1634
|
+
set: item.message
|
1635
|
+
} : undefined,
|
1636
|
+
type: item.type !== undefined ? {
|
1637
|
+
set: item.type
|
1638
|
+
} : undefined,
|
1639
|
+
isRead: item.isRead !== undefined ? {
|
1640
|
+
set: item.isRead
|
1641
|
+
} : undefined,
|
1642
|
+
},
|
1643
|
+
create: {
|
1644
|
+
message: item.message !== undefined ? item.message : undefined,
|
1645
|
+
type: item.type !== undefined ? item.type : undefined,
|
1646
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
1647
|
+
},
|
1648
|
+
}))
|
1649
|
+
} : undefined,
|
1015
1650
|
},
|
1016
1651
|
create: {
|
1017
1652
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -1023,6 +1658,115 @@ exports.Asset = {
|
|
1023
1658
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
1024
1659
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
1025
1660
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
1661
|
+
user: item.alpacaAccount.user ?
|
1662
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
1663
|
+
? { connect: {
|
1664
|
+
id: item.alpacaAccount.user.id
|
1665
|
+
}
|
1666
|
+
}
|
1667
|
+
: { connectOrCreate: {
|
1668
|
+
where: {
|
1669
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
1670
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
1671
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
1672
|
+
equals: item.alpacaAccount.user.name
|
1673
|
+
} : undefined,
|
1674
|
+
},
|
1675
|
+
create: {
|
1676
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
1677
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
1678
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
1679
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
1680
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
1681
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
1682
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
1683
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
1684
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
1685
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
1686
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
1687
|
+
},
|
1688
|
+
}
|
1689
|
+
} : undefined,
|
1690
|
+
orders: item.alpacaAccount.orders ?
|
1691
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1692
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
1693
|
+
id: item.id
|
1694
|
+
}))
|
1695
|
+
}
|
1696
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
1697
|
+
where: {
|
1698
|
+
id: item.id !== undefined ? item.id : undefined,
|
1699
|
+
},
|
1700
|
+
create: {
|
1701
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
1702
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1703
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
1704
|
+
side: item.side !== undefined ? item.side : undefined,
|
1705
|
+
type: item.type !== undefined ? item.type : undefined,
|
1706
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
1707
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
1708
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
1709
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
1710
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
1711
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
1712
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
1713
|
+
status: item.status !== undefined ? item.status : undefined,
|
1714
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
1715
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
1716
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
1717
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
1718
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
1719
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
1720
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
1721
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
1722
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
1723
|
+
},
|
1724
|
+
}))
|
1725
|
+
} : undefined,
|
1726
|
+
positions: item.alpacaAccount.positions ?
|
1727
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1728
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
1729
|
+
id: item.id
|
1730
|
+
}))
|
1731
|
+
}
|
1732
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
1733
|
+
where: {
|
1734
|
+
id: item.id !== undefined ? item.id : undefined,
|
1735
|
+
},
|
1736
|
+
create: {
|
1737
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1738
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1739
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1740
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1741
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1742
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1743
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1744
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1745
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1746
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1747
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1748
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1749
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1750
|
+
},
|
1751
|
+
}))
|
1752
|
+
} : undefined,
|
1753
|
+
alerts: item.alpacaAccount.alerts ?
|
1754
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1755
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
1756
|
+
id: item.id
|
1757
|
+
}))
|
1758
|
+
}
|
1759
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
1760
|
+
where: {
|
1761
|
+
id: item.id !== undefined ? item.id : undefined,
|
1762
|
+
},
|
1763
|
+
create: {
|
1764
|
+
message: item.message !== undefined ? item.message : undefined,
|
1765
|
+
type: item.type !== undefined ? item.type : undefined,
|
1766
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
1767
|
+
},
|
1768
|
+
}))
|
1769
|
+
} : undefined,
|
1026
1770
|
},
|
1027
1771
|
}
|
1028
1772
|
} : undefined,
|
@@ -1050,6 +1794,110 @@ exports.Asset = {
|
|
1050
1794
|
fee: item.fee !== undefined ? {
|
1051
1795
|
set: item.fee
|
1052
1796
|
} : undefined,
|
1797
|
+
order: item.order ? {
|
1798
|
+
upsert: {
|
1799
|
+
where: {
|
1800
|
+
id: item.order.id !== undefined ? {
|
1801
|
+
equals: item.order.id
|
1802
|
+
} : undefined,
|
1803
|
+
},
|
1804
|
+
update: {
|
1805
|
+
id: item.order.id !== undefined ? {
|
1806
|
+
set: item.order.id
|
1807
|
+
} : undefined,
|
1808
|
+
clientOrderId: item.order.clientOrderId !== undefined ? {
|
1809
|
+
set: item.order.clientOrderId
|
1810
|
+
} : undefined,
|
1811
|
+
qty: item.order.qty !== undefined ? {
|
1812
|
+
set: item.order.qty
|
1813
|
+
} : undefined,
|
1814
|
+
notional: item.order.notional !== undefined ? {
|
1815
|
+
set: item.order.notional
|
1816
|
+
} : undefined,
|
1817
|
+
side: item.order.side !== undefined ? {
|
1818
|
+
set: item.order.side
|
1819
|
+
} : undefined,
|
1820
|
+
type: item.order.type !== undefined ? {
|
1821
|
+
set: item.order.type
|
1822
|
+
} : undefined,
|
1823
|
+
orderClass: item.order.orderClass !== undefined ? {
|
1824
|
+
set: item.order.orderClass
|
1825
|
+
} : undefined,
|
1826
|
+
timeInForce: item.order.timeInForce !== undefined ? {
|
1827
|
+
set: item.order.timeInForce
|
1828
|
+
} : undefined,
|
1829
|
+
limitPrice: item.order.limitPrice !== undefined ? {
|
1830
|
+
set: item.order.limitPrice
|
1831
|
+
} : undefined,
|
1832
|
+
stopPrice: item.order.stopPrice !== undefined ? {
|
1833
|
+
set: item.order.stopPrice
|
1834
|
+
} : undefined,
|
1835
|
+
trailPrice: item.order.trailPrice !== undefined ? {
|
1836
|
+
set: item.order.trailPrice
|
1837
|
+
} : undefined,
|
1838
|
+
trailPercent: item.order.trailPercent !== undefined ? {
|
1839
|
+
set: item.order.trailPercent
|
1840
|
+
} : undefined,
|
1841
|
+
extendedHours: item.order.extendedHours !== undefined ? {
|
1842
|
+
set: item.order.extendedHours
|
1843
|
+
} : undefined,
|
1844
|
+
status: item.order.status !== undefined ? {
|
1845
|
+
set: item.order.status
|
1846
|
+
} : undefined,
|
1847
|
+
submittedAt: item.order.submittedAt !== undefined ? {
|
1848
|
+
set: item.order.submittedAt
|
1849
|
+
} : undefined,
|
1850
|
+
filledAt: item.order.filledAt !== undefined ? {
|
1851
|
+
set: item.order.filledAt
|
1852
|
+
} : undefined,
|
1853
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? {
|
1854
|
+
set: item.order.filledAvgPrice
|
1855
|
+
} : undefined,
|
1856
|
+
fee: item.order.fee !== undefined ? {
|
1857
|
+
set: item.order.fee
|
1858
|
+
} : undefined,
|
1859
|
+
strikePrice: item.order.strikePrice !== undefined ? {
|
1860
|
+
set: item.order.strikePrice
|
1861
|
+
} : undefined,
|
1862
|
+
expirationDate: item.order.expirationDate !== undefined ? {
|
1863
|
+
set: item.order.expirationDate
|
1864
|
+
} : undefined,
|
1865
|
+
optionType: item.order.optionType !== undefined ? {
|
1866
|
+
set: item.order.optionType
|
1867
|
+
} : undefined,
|
1868
|
+
stopLossId: item.order.stopLossId !== undefined ? {
|
1869
|
+
set: item.order.stopLossId
|
1870
|
+
} : undefined,
|
1871
|
+
takeProfitId: item.order.takeProfitId !== undefined ? {
|
1872
|
+
set: item.order.takeProfitId
|
1873
|
+
} : undefined,
|
1874
|
+
},
|
1875
|
+
create: {
|
1876
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
1877
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
1878
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
1879
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
1880
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
1881
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
1882
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
1883
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
1884
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
1885
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
1886
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
1887
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
1888
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
1889
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
1890
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
1891
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
1892
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
1893
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
1894
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
1895
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
1896
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
1897
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
1898
|
+
},
|
1899
|
+
}
|
1900
|
+
} : undefined,
|
1053
1901
|
},
|
1054
1902
|
create: {
|
1055
1903
|
sequence: item.sequence !== undefined ? item.sequence : undefined,
|
@@ -1057,6 +1905,42 @@ exports.Asset = {
|
|
1057
1905
|
note: item.note !== undefined ? item.note : undefined,
|
1058
1906
|
status: item.status !== undefined ? item.status : undefined,
|
1059
1907
|
fee: item.fee !== undefined ? item.fee : undefined,
|
1908
|
+
order: item.order ?
|
1909
|
+
typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
|
1910
|
+
? { connect: {
|
1911
|
+
id: item.order.id
|
1912
|
+
}
|
1913
|
+
}
|
1914
|
+
: { connectOrCreate: {
|
1915
|
+
where: {
|
1916
|
+
id: item.order.id !== undefined ? item.order.id : undefined,
|
1917
|
+
},
|
1918
|
+
create: {
|
1919
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
1920
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
1921
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
1922
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
1923
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
1924
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
1925
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
1926
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
1927
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
1928
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
1929
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
1930
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
1931
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
1932
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
1933
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
1934
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
1935
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
1936
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
1937
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
1938
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
1939
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
1940
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
1941
|
+
},
|
1942
|
+
}
|
1943
|
+
} : undefined,
|
1060
1944
|
},
|
1061
1945
|
}))
|
1062
1946
|
} : undefined,
|
@@ -1093,6 +1977,115 @@ exports.Asset = {
|
|
1093
1977
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
1094
1978
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
1095
1979
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
1980
|
+
user: item.alpacaAccount.user ?
|
1981
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
1982
|
+
? { connect: {
|
1983
|
+
id: item.alpacaAccount.user.id
|
1984
|
+
}
|
1985
|
+
}
|
1986
|
+
: { connectOrCreate: {
|
1987
|
+
where: {
|
1988
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
1989
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
1990
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
1991
|
+
equals: item.alpacaAccount.user.name
|
1992
|
+
} : undefined,
|
1993
|
+
},
|
1994
|
+
create: {
|
1995
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
1996
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
1997
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
1998
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
1999
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
2000
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
2001
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
2002
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
2003
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
2004
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
2005
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
2006
|
+
},
|
2007
|
+
}
|
2008
|
+
} : undefined,
|
2009
|
+
orders: item.alpacaAccount.orders ?
|
2010
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2011
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
2012
|
+
id: item.id
|
2013
|
+
}))
|
2014
|
+
}
|
2015
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
2016
|
+
where: {
|
2017
|
+
id: item.id !== undefined ? item.id : undefined,
|
2018
|
+
},
|
2019
|
+
create: {
|
2020
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
2021
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2022
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
2023
|
+
side: item.side !== undefined ? item.side : undefined,
|
2024
|
+
type: item.type !== undefined ? item.type : undefined,
|
2025
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
2026
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
2027
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
2028
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
2029
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
2030
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
2031
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
2032
|
+
status: item.status !== undefined ? item.status : undefined,
|
2033
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
2034
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
2035
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
2036
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
2037
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
2038
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
2039
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2040
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
2041
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
2042
|
+
},
|
2043
|
+
}))
|
2044
|
+
} : undefined,
|
2045
|
+
positions: item.alpacaAccount.positions ?
|
2046
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2047
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
2048
|
+
id: item.id
|
2049
|
+
}))
|
2050
|
+
}
|
2051
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
2052
|
+
where: {
|
2053
|
+
id: item.id !== undefined ? item.id : undefined,
|
2054
|
+
},
|
2055
|
+
create: {
|
2056
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2057
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2058
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2059
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2060
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2061
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2062
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2063
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2064
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2065
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2066
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2067
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2068
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2069
|
+
},
|
2070
|
+
}))
|
2071
|
+
} : undefined,
|
2072
|
+
alerts: item.alpacaAccount.alerts ?
|
2073
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2074
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
2075
|
+
id: item.id
|
2076
|
+
}))
|
2077
|
+
}
|
2078
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
2079
|
+
where: {
|
2080
|
+
id: item.id !== undefined ? item.id : undefined,
|
2081
|
+
},
|
2082
|
+
create: {
|
2083
|
+
message: item.message !== undefined ? item.message : undefined,
|
2084
|
+
type: item.type !== undefined ? item.type : undefined,
|
2085
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2086
|
+
},
|
2087
|
+
}))
|
2088
|
+
} : undefined,
|
1096
2089
|
},
|
1097
2090
|
}
|
1098
2091
|
} : undefined,
|
@@ -1112,6 +2105,42 @@ exports.Asset = {
|
|
1112
2105
|
note: item.note !== undefined ? item.note : undefined,
|
1113
2106
|
status: item.status !== undefined ? item.status : undefined,
|
1114
2107
|
fee: item.fee !== undefined ? item.fee : undefined,
|
2108
|
+
order: item.order ?
|
2109
|
+
typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
|
2110
|
+
? { connect: {
|
2111
|
+
id: item.order.id
|
2112
|
+
}
|
2113
|
+
}
|
2114
|
+
: { connectOrCreate: {
|
2115
|
+
where: {
|
2116
|
+
id: item.order.id !== undefined ? item.order.id : undefined,
|
2117
|
+
},
|
2118
|
+
create: {
|
2119
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
2120
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
2121
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
2122
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
2123
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
2124
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
2125
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
2126
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
2127
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
2128
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
2129
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
2130
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
2131
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
2132
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
2133
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
2134
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
2135
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
2136
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
2137
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
2138
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
2139
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
2140
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
2141
|
+
},
|
2142
|
+
}
|
2143
|
+
} : undefined,
|
1115
2144
|
},
|
1116
2145
|
}))
|
1117
2146
|
} : undefined,
|
@@ -1279,6 +2308,222 @@ exports.Asset = {
|
|
1279
2308
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
|
1280
2309
|
set: item.alpacaAccount.volumeThreshold
|
1281
2310
|
} : undefined,
|
2311
|
+
user: item.alpacaAccount.user ? {
|
2312
|
+
upsert: {
|
2313
|
+
where: {
|
2314
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
2315
|
+
equals: item.alpacaAccount.user.id
|
2316
|
+
} : undefined,
|
2317
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
2318
|
+
equals: item.alpacaAccount.user.name
|
2319
|
+
} : undefined,
|
2320
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
2321
|
+
equals: item.alpacaAccount.user.email
|
2322
|
+
} : undefined,
|
2323
|
+
},
|
2324
|
+
update: {
|
2325
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
2326
|
+
set: item.alpacaAccount.user.id
|
2327
|
+
} : undefined,
|
2328
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
2329
|
+
set: item.alpacaAccount.user.name
|
2330
|
+
} : undefined,
|
2331
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
2332
|
+
set: item.alpacaAccount.user.email
|
2333
|
+
} : undefined,
|
2334
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
|
2335
|
+
set: item.alpacaAccount.user.emailVerified
|
2336
|
+
} : undefined,
|
2337
|
+
image: item.alpacaAccount.user.image !== undefined ? {
|
2338
|
+
set: item.alpacaAccount.user.image
|
2339
|
+
} : undefined,
|
2340
|
+
role: item.alpacaAccount.user.role !== undefined ? {
|
2341
|
+
set: item.alpacaAccount.user.role
|
2342
|
+
} : undefined,
|
2343
|
+
bio: item.alpacaAccount.user.bio !== undefined ? {
|
2344
|
+
set: item.alpacaAccount.user.bio
|
2345
|
+
} : undefined,
|
2346
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
|
2347
|
+
set: item.alpacaAccount.user.jobTitle
|
2348
|
+
} : undefined,
|
2349
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
|
2350
|
+
set: item.alpacaAccount.user.currentAccount
|
2351
|
+
} : undefined,
|
2352
|
+
plan: item.alpacaAccount.user.plan !== undefined ? {
|
2353
|
+
set: item.alpacaAccount.user.plan
|
2354
|
+
} : undefined,
|
2355
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
2356
|
+
set: item.alpacaAccount.user.openaiAPIKey
|
2357
|
+
} : undefined,
|
2358
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? {
|
2359
|
+
set: item.alpacaAccount.user.openaiModel
|
2360
|
+
} : undefined,
|
2361
|
+
},
|
2362
|
+
create: {
|
2363
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
2364
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
2365
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
2366
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
2367
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
2368
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
2369
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
2370
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
2371
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
2372
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
2373
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
2374
|
+
},
|
2375
|
+
}
|
2376
|
+
} : undefined,
|
2377
|
+
trades: item.alpacaAccount.trades ? {
|
2378
|
+
upsert: item.alpacaAccount.trades.map((item) => ({
|
2379
|
+
where: {
|
2380
|
+
id: item.id !== undefined ? item.id : undefined,
|
2381
|
+
},
|
2382
|
+
update: {
|
2383
|
+
id: item.id !== undefined ? {
|
2384
|
+
set: item.id
|
2385
|
+
} : undefined,
|
2386
|
+
qty: item.qty !== undefined ? {
|
2387
|
+
set: item.qty
|
2388
|
+
} : undefined,
|
2389
|
+
price: item.price !== undefined ? {
|
2390
|
+
set: item.price
|
2391
|
+
} : undefined,
|
2392
|
+
total: item.total !== undefined ? {
|
2393
|
+
set: item.total
|
2394
|
+
} : undefined,
|
2395
|
+
optionType: item.optionType !== undefined ? {
|
2396
|
+
set: item.optionType
|
2397
|
+
} : undefined,
|
2398
|
+
signal: item.signal !== undefined ? {
|
2399
|
+
set: item.signal
|
2400
|
+
} : undefined,
|
2401
|
+
strategy: item.strategy !== undefined ? {
|
2402
|
+
set: item.strategy
|
2403
|
+
} : undefined,
|
2404
|
+
analysis: item.analysis !== undefined ? {
|
2405
|
+
set: item.analysis
|
2406
|
+
} : undefined,
|
2407
|
+
summary: item.summary !== undefined ? {
|
2408
|
+
set: item.summary
|
2409
|
+
} : undefined,
|
2410
|
+
confidence: item.confidence !== undefined ? {
|
2411
|
+
set: item.confidence
|
2412
|
+
} : undefined,
|
2413
|
+
timestamp: item.timestamp !== undefined ? {
|
2414
|
+
set: item.timestamp
|
2415
|
+
} : undefined,
|
2416
|
+
status: item.status !== undefined ? {
|
2417
|
+
set: item.status
|
2418
|
+
} : undefined,
|
2419
|
+
},
|
2420
|
+
create: {
|
2421
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2422
|
+
price: item.price !== undefined ? item.price : undefined,
|
2423
|
+
total: item.total !== undefined ? item.total : undefined,
|
2424
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2425
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2426
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2427
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2428
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2429
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2430
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2431
|
+
status: item.status !== undefined ? item.status : undefined,
|
2432
|
+
},
|
2433
|
+
}))
|
2434
|
+
} : undefined,
|
2435
|
+
positions: item.alpacaAccount.positions ? {
|
2436
|
+
upsert: item.alpacaAccount.positions.map((item) => ({
|
2437
|
+
where: {
|
2438
|
+
id: item.id !== undefined ? item.id : undefined,
|
2439
|
+
},
|
2440
|
+
update: {
|
2441
|
+
id: item.id !== undefined ? {
|
2442
|
+
set: item.id
|
2443
|
+
} : undefined,
|
2444
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
2445
|
+
set: item.averageEntryPrice
|
2446
|
+
} : undefined,
|
2447
|
+
qty: item.qty !== undefined ? {
|
2448
|
+
set: item.qty
|
2449
|
+
} : undefined,
|
2450
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
2451
|
+
set: item.qtyAvailable
|
2452
|
+
} : undefined,
|
2453
|
+
marketValue: item.marketValue !== undefined ? {
|
2454
|
+
set: item.marketValue
|
2455
|
+
} : undefined,
|
2456
|
+
costBasis: item.costBasis !== undefined ? {
|
2457
|
+
set: item.costBasis
|
2458
|
+
} : undefined,
|
2459
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
2460
|
+
set: item.unrealizedPL
|
2461
|
+
} : undefined,
|
2462
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
2463
|
+
set: item.unrealizedPLPC
|
2464
|
+
} : undefined,
|
2465
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
2466
|
+
set: item.unrealisedIntradayPL
|
2467
|
+
} : undefined,
|
2468
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
2469
|
+
set: item.unrealisedIntradayPLPC
|
2470
|
+
} : undefined,
|
2471
|
+
currentPrice: item.currentPrice !== undefined ? {
|
2472
|
+
set: item.currentPrice
|
2473
|
+
} : undefined,
|
2474
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
2475
|
+
set: item.lastTradePrice
|
2476
|
+
} : undefined,
|
2477
|
+
changeToday: item.changeToday !== undefined ? {
|
2478
|
+
set: item.changeToday
|
2479
|
+
} : undefined,
|
2480
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
2481
|
+
set: item.assetMarginable
|
2482
|
+
} : undefined,
|
2483
|
+
},
|
2484
|
+
create: {
|
2485
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2486
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2487
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2488
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2489
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2490
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2491
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2492
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2493
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2494
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2495
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2496
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2497
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2498
|
+
},
|
2499
|
+
}))
|
2500
|
+
} : undefined,
|
2501
|
+
alerts: item.alpacaAccount.alerts ? {
|
2502
|
+
upsert: item.alpacaAccount.alerts.map((item) => ({
|
2503
|
+
where: {
|
2504
|
+
id: item.id !== undefined ? item.id : undefined,
|
2505
|
+
},
|
2506
|
+
update: {
|
2507
|
+
id: item.id !== undefined ? {
|
2508
|
+
set: item.id
|
2509
|
+
} : undefined,
|
2510
|
+
message: item.message !== undefined ? {
|
2511
|
+
set: item.message
|
2512
|
+
} : undefined,
|
2513
|
+
type: item.type !== undefined ? {
|
2514
|
+
set: item.type
|
2515
|
+
} : undefined,
|
2516
|
+
isRead: item.isRead !== undefined ? {
|
2517
|
+
set: item.isRead
|
2518
|
+
} : undefined,
|
2519
|
+
},
|
2520
|
+
create: {
|
2521
|
+
message: item.message !== undefined ? item.message : undefined,
|
2522
|
+
type: item.type !== undefined ? item.type : undefined,
|
2523
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2524
|
+
},
|
2525
|
+
}))
|
2526
|
+
} : undefined,
|
1282
2527
|
},
|
1283
2528
|
create: {
|
1284
2529
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -1290,6 +2535,104 @@ exports.Asset = {
|
|
1290
2535
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
1291
2536
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
1292
2537
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
2538
|
+
user: item.alpacaAccount.user ?
|
2539
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
2540
|
+
? { connect: {
|
2541
|
+
id: item.alpacaAccount.user.id
|
2542
|
+
}
|
2543
|
+
}
|
2544
|
+
: { connectOrCreate: {
|
2545
|
+
where: {
|
2546
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
2547
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
2548
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
2549
|
+
equals: item.alpacaAccount.user.name
|
2550
|
+
} : undefined,
|
2551
|
+
},
|
2552
|
+
create: {
|
2553
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
2554
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
2555
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
2556
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
2557
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
2558
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
2559
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
2560
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
2561
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
2562
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
2563
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
2564
|
+
},
|
2565
|
+
}
|
2566
|
+
} : undefined,
|
2567
|
+
trades: item.alpacaAccount.trades ?
|
2568
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2569
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
2570
|
+
id: item.id
|
2571
|
+
}))
|
2572
|
+
}
|
2573
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
2574
|
+
where: {
|
2575
|
+
id: item.id !== undefined ? item.id : undefined,
|
2576
|
+
},
|
2577
|
+
create: {
|
2578
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2579
|
+
price: item.price !== undefined ? item.price : undefined,
|
2580
|
+
total: item.total !== undefined ? item.total : undefined,
|
2581
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2582
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2583
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2584
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2585
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2586
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2587
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2588
|
+
status: item.status !== undefined ? item.status : undefined,
|
2589
|
+
},
|
2590
|
+
}))
|
2591
|
+
} : undefined,
|
2592
|
+
positions: item.alpacaAccount.positions ?
|
2593
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2594
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
2595
|
+
id: item.id
|
2596
|
+
}))
|
2597
|
+
}
|
2598
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
2599
|
+
where: {
|
2600
|
+
id: item.id !== undefined ? item.id : undefined,
|
2601
|
+
},
|
2602
|
+
create: {
|
2603
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2604
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2605
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2606
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2607
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2608
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2609
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2610
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2611
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2612
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2613
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2614
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2615
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2616
|
+
},
|
2617
|
+
}))
|
2618
|
+
} : undefined,
|
2619
|
+
alerts: item.alpacaAccount.alerts ?
|
2620
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2621
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
2622
|
+
id: item.id
|
2623
|
+
}))
|
2624
|
+
}
|
2625
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
2626
|
+
where: {
|
2627
|
+
id: item.id !== undefined ? item.id : undefined,
|
2628
|
+
},
|
2629
|
+
create: {
|
2630
|
+
message: item.message !== undefined ? item.message : undefined,
|
2631
|
+
type: item.type !== undefined ? item.type : undefined,
|
2632
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2633
|
+
},
|
2634
|
+
}))
|
2635
|
+
} : undefined,
|
1293
2636
|
},
|
1294
2637
|
}
|
1295
2638
|
} : undefined,
|
@@ -1319,6 +2662,66 @@ exports.Asset = {
|
|
1319
2662
|
fee: item.action.fee !== undefined ? {
|
1320
2663
|
set: item.action.fee
|
1321
2664
|
} : undefined,
|
2665
|
+
trade: item.action.trade ? {
|
2666
|
+
upsert: {
|
2667
|
+
where: {
|
2668
|
+
id: item.action.trade.id !== undefined ? {
|
2669
|
+
equals: item.action.trade.id
|
2670
|
+
} : undefined,
|
2671
|
+
},
|
2672
|
+
update: {
|
2673
|
+
id: item.action.trade.id !== undefined ? {
|
2674
|
+
set: item.action.trade.id
|
2675
|
+
} : undefined,
|
2676
|
+
qty: item.action.trade.qty !== undefined ? {
|
2677
|
+
set: item.action.trade.qty
|
2678
|
+
} : undefined,
|
2679
|
+
price: item.action.trade.price !== undefined ? {
|
2680
|
+
set: item.action.trade.price
|
2681
|
+
} : undefined,
|
2682
|
+
total: item.action.trade.total !== undefined ? {
|
2683
|
+
set: item.action.trade.total
|
2684
|
+
} : undefined,
|
2685
|
+
optionType: item.action.trade.optionType !== undefined ? {
|
2686
|
+
set: item.action.trade.optionType
|
2687
|
+
} : undefined,
|
2688
|
+
signal: item.action.trade.signal !== undefined ? {
|
2689
|
+
set: item.action.trade.signal
|
2690
|
+
} : undefined,
|
2691
|
+
strategy: item.action.trade.strategy !== undefined ? {
|
2692
|
+
set: item.action.trade.strategy
|
2693
|
+
} : undefined,
|
2694
|
+
analysis: item.action.trade.analysis !== undefined ? {
|
2695
|
+
set: item.action.trade.analysis
|
2696
|
+
} : undefined,
|
2697
|
+
summary: item.action.trade.summary !== undefined ? {
|
2698
|
+
set: item.action.trade.summary
|
2699
|
+
} : undefined,
|
2700
|
+
confidence: item.action.trade.confidence !== undefined ? {
|
2701
|
+
set: item.action.trade.confidence
|
2702
|
+
} : undefined,
|
2703
|
+
timestamp: item.action.trade.timestamp !== undefined ? {
|
2704
|
+
set: item.action.trade.timestamp
|
2705
|
+
} : undefined,
|
2706
|
+
status: item.action.trade.status !== undefined ? {
|
2707
|
+
set: item.action.trade.status
|
2708
|
+
} : undefined,
|
2709
|
+
},
|
2710
|
+
create: {
|
2711
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
2712
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
2713
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
2714
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
2715
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
2716
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
2717
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
2718
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
2719
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
2720
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
2721
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
2722
|
+
},
|
2723
|
+
}
|
2724
|
+
} : undefined,
|
1322
2725
|
},
|
1323
2726
|
create: {
|
1324
2727
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -1326,6 +2729,31 @@ exports.Asset = {
|
|
1326
2729
|
note: item.action.note !== undefined ? item.action.note : undefined,
|
1327
2730
|
status: item.action.status !== undefined ? item.action.status : undefined,
|
1328
2731
|
fee: item.action.fee !== undefined ? item.action.fee : undefined,
|
2732
|
+
trade: item.action.trade ?
|
2733
|
+
typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
|
2734
|
+
? { connect: {
|
2735
|
+
id: item.action.trade.id
|
2736
|
+
}
|
2737
|
+
}
|
2738
|
+
: { connectOrCreate: {
|
2739
|
+
where: {
|
2740
|
+
id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
|
2741
|
+
},
|
2742
|
+
create: {
|
2743
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
2744
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
2745
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
2746
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
2747
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
2748
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
2749
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
2750
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
2751
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
2752
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
2753
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
2754
|
+
},
|
2755
|
+
}
|
2756
|
+
} : undefined,
|
1329
2757
|
},
|
1330
2758
|
}
|
1331
2759
|
} : undefined,
|
@@ -1405,6 +2833,104 @@ exports.Asset = {
|
|
1405
2833
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
1406
2834
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
1407
2835
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
2836
|
+
user: item.alpacaAccount.user ?
|
2837
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
2838
|
+
? { connect: {
|
2839
|
+
id: item.alpacaAccount.user.id
|
2840
|
+
}
|
2841
|
+
}
|
2842
|
+
: { connectOrCreate: {
|
2843
|
+
where: {
|
2844
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
2845
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
2846
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
2847
|
+
equals: item.alpacaAccount.user.name
|
2848
|
+
} : undefined,
|
2849
|
+
},
|
2850
|
+
create: {
|
2851
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
2852
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
2853
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
2854
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
2855
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
2856
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
2857
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
2858
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
2859
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
2860
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
2861
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
2862
|
+
},
|
2863
|
+
}
|
2864
|
+
} : undefined,
|
2865
|
+
trades: item.alpacaAccount.trades ?
|
2866
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2867
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
2868
|
+
id: item.id
|
2869
|
+
}))
|
2870
|
+
}
|
2871
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
2872
|
+
where: {
|
2873
|
+
id: item.id !== undefined ? item.id : undefined,
|
2874
|
+
},
|
2875
|
+
create: {
|
2876
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2877
|
+
price: item.price !== undefined ? item.price : undefined,
|
2878
|
+
total: item.total !== undefined ? item.total : undefined,
|
2879
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2880
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2881
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2882
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2883
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2884
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2885
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2886
|
+
status: item.status !== undefined ? item.status : undefined,
|
2887
|
+
},
|
2888
|
+
}))
|
2889
|
+
} : undefined,
|
2890
|
+
positions: item.alpacaAccount.positions ?
|
2891
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2892
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
2893
|
+
id: item.id
|
2894
|
+
}))
|
2895
|
+
}
|
2896
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
2897
|
+
where: {
|
2898
|
+
id: item.id !== undefined ? item.id : undefined,
|
2899
|
+
},
|
2900
|
+
create: {
|
2901
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2902
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2903
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2904
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2905
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2906
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2907
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2908
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2909
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2910
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2911
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2912
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2913
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2914
|
+
},
|
2915
|
+
}))
|
2916
|
+
} : undefined,
|
2917
|
+
alerts: item.alpacaAccount.alerts ?
|
2918
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2919
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
2920
|
+
id: item.id
|
2921
|
+
}))
|
2922
|
+
}
|
2923
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
2924
|
+
where: {
|
2925
|
+
id: item.id !== undefined ? item.id : undefined,
|
2926
|
+
},
|
2927
|
+
create: {
|
2928
|
+
message: item.message !== undefined ? item.message : undefined,
|
2929
|
+
type: item.type !== undefined ? item.type : undefined,
|
2930
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2931
|
+
},
|
2932
|
+
}))
|
2933
|
+
} : undefined,
|
1408
2934
|
},
|
1409
2935
|
}
|
1410
2936
|
} : undefined,
|
@@ -1424,6 +2950,31 @@ exports.Asset = {
|
|
1424
2950
|
note: item.action.note !== undefined ? item.action.note : undefined,
|
1425
2951
|
status: item.action.status !== undefined ? item.action.status : undefined,
|
1426
2952
|
fee: item.action.fee !== undefined ? item.action.fee : undefined,
|
2953
|
+
trade: item.action.trade ?
|
2954
|
+
typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
|
2955
|
+
? { connect: {
|
2956
|
+
id: item.action.trade.id
|
2957
|
+
}
|
2958
|
+
}
|
2959
|
+
: { connectOrCreate: {
|
2960
|
+
where: {
|
2961
|
+
id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
|
2962
|
+
},
|
2963
|
+
create: {
|
2964
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
2965
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
2966
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
2967
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
2968
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
2969
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
2970
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
2971
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
2972
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
2973
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
2974
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
2975
|
+
},
|
2976
|
+
}
|
2977
|
+
} : undefined,
|
1427
2978
|
},
|
1428
2979
|
}
|
1429
2980
|
} : undefined,
|
@@ -1516,6 +3067,258 @@ exports.Asset = {
|
|
1516
3067
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
|
1517
3068
|
set: item.alpacaAccount.volumeThreshold
|
1518
3069
|
} : undefined,
|
3070
|
+
user: item.alpacaAccount.user ? {
|
3071
|
+
upsert: {
|
3072
|
+
where: {
|
3073
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
3074
|
+
equals: item.alpacaAccount.user.id
|
3075
|
+
} : undefined,
|
3076
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
3077
|
+
equals: item.alpacaAccount.user.name
|
3078
|
+
} : undefined,
|
3079
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
3080
|
+
equals: item.alpacaAccount.user.email
|
3081
|
+
} : undefined,
|
3082
|
+
},
|
3083
|
+
update: {
|
3084
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
3085
|
+
set: item.alpacaAccount.user.id
|
3086
|
+
} : undefined,
|
3087
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
3088
|
+
set: item.alpacaAccount.user.name
|
3089
|
+
} : undefined,
|
3090
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
3091
|
+
set: item.alpacaAccount.user.email
|
3092
|
+
} : undefined,
|
3093
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
|
3094
|
+
set: item.alpacaAccount.user.emailVerified
|
3095
|
+
} : undefined,
|
3096
|
+
image: item.alpacaAccount.user.image !== undefined ? {
|
3097
|
+
set: item.alpacaAccount.user.image
|
3098
|
+
} : undefined,
|
3099
|
+
role: item.alpacaAccount.user.role !== undefined ? {
|
3100
|
+
set: item.alpacaAccount.user.role
|
3101
|
+
} : undefined,
|
3102
|
+
bio: item.alpacaAccount.user.bio !== undefined ? {
|
3103
|
+
set: item.alpacaAccount.user.bio
|
3104
|
+
} : undefined,
|
3105
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
|
3106
|
+
set: item.alpacaAccount.user.jobTitle
|
3107
|
+
} : undefined,
|
3108
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
|
3109
|
+
set: item.alpacaAccount.user.currentAccount
|
3110
|
+
} : undefined,
|
3111
|
+
plan: item.alpacaAccount.user.plan !== undefined ? {
|
3112
|
+
set: item.alpacaAccount.user.plan
|
3113
|
+
} : undefined,
|
3114
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
3115
|
+
set: item.alpacaAccount.user.openaiAPIKey
|
3116
|
+
} : undefined,
|
3117
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? {
|
3118
|
+
set: item.alpacaAccount.user.openaiModel
|
3119
|
+
} : undefined,
|
3120
|
+
},
|
3121
|
+
create: {
|
3122
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
3123
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
3124
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
3125
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
3126
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
3127
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
3128
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
3129
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
3130
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
3131
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
3132
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
3133
|
+
},
|
3134
|
+
}
|
3135
|
+
} : undefined,
|
3136
|
+
trades: item.alpacaAccount.trades ? {
|
3137
|
+
upsert: item.alpacaAccount.trades.map((item) => ({
|
3138
|
+
where: {
|
3139
|
+
id: item.id !== undefined ? item.id : undefined,
|
3140
|
+
},
|
3141
|
+
update: {
|
3142
|
+
id: item.id !== undefined ? {
|
3143
|
+
set: item.id
|
3144
|
+
} : undefined,
|
3145
|
+
qty: item.qty !== undefined ? {
|
3146
|
+
set: item.qty
|
3147
|
+
} : undefined,
|
3148
|
+
price: item.price !== undefined ? {
|
3149
|
+
set: item.price
|
3150
|
+
} : undefined,
|
3151
|
+
total: item.total !== undefined ? {
|
3152
|
+
set: item.total
|
3153
|
+
} : undefined,
|
3154
|
+
optionType: item.optionType !== undefined ? {
|
3155
|
+
set: item.optionType
|
3156
|
+
} : undefined,
|
3157
|
+
signal: item.signal !== undefined ? {
|
3158
|
+
set: item.signal
|
3159
|
+
} : undefined,
|
3160
|
+
strategy: item.strategy !== undefined ? {
|
3161
|
+
set: item.strategy
|
3162
|
+
} : undefined,
|
3163
|
+
analysis: item.analysis !== undefined ? {
|
3164
|
+
set: item.analysis
|
3165
|
+
} : undefined,
|
3166
|
+
summary: item.summary !== undefined ? {
|
3167
|
+
set: item.summary
|
3168
|
+
} : undefined,
|
3169
|
+
confidence: item.confidence !== undefined ? {
|
3170
|
+
set: item.confidence
|
3171
|
+
} : undefined,
|
3172
|
+
timestamp: item.timestamp !== undefined ? {
|
3173
|
+
set: item.timestamp
|
3174
|
+
} : undefined,
|
3175
|
+
status: item.status !== undefined ? {
|
3176
|
+
set: item.status
|
3177
|
+
} : undefined,
|
3178
|
+
},
|
3179
|
+
create: {
|
3180
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3181
|
+
price: item.price !== undefined ? item.price : undefined,
|
3182
|
+
total: item.total !== undefined ? item.total : undefined,
|
3183
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3184
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
3185
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
3186
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
3187
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
3188
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
3189
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
3190
|
+
status: item.status !== undefined ? item.status : undefined,
|
3191
|
+
},
|
3192
|
+
}))
|
3193
|
+
} : undefined,
|
3194
|
+
orders: item.alpacaAccount.orders ? {
|
3195
|
+
upsert: item.alpacaAccount.orders.map((item) => ({
|
3196
|
+
where: {
|
3197
|
+
id: item.id !== undefined ? item.id : undefined,
|
3198
|
+
},
|
3199
|
+
update: {
|
3200
|
+
id: item.id !== undefined ? {
|
3201
|
+
set: item.id
|
3202
|
+
} : undefined,
|
3203
|
+
clientOrderId: item.clientOrderId !== undefined ? {
|
3204
|
+
set: item.clientOrderId
|
3205
|
+
} : undefined,
|
3206
|
+
qty: item.qty !== undefined ? {
|
3207
|
+
set: item.qty
|
3208
|
+
} : undefined,
|
3209
|
+
notional: item.notional !== undefined ? {
|
3210
|
+
set: item.notional
|
3211
|
+
} : undefined,
|
3212
|
+
side: item.side !== undefined ? {
|
3213
|
+
set: item.side
|
3214
|
+
} : undefined,
|
3215
|
+
type: item.type !== undefined ? {
|
3216
|
+
set: item.type
|
3217
|
+
} : undefined,
|
3218
|
+
orderClass: item.orderClass !== undefined ? {
|
3219
|
+
set: item.orderClass
|
3220
|
+
} : undefined,
|
3221
|
+
timeInForce: item.timeInForce !== undefined ? {
|
3222
|
+
set: item.timeInForce
|
3223
|
+
} : undefined,
|
3224
|
+
limitPrice: item.limitPrice !== undefined ? {
|
3225
|
+
set: item.limitPrice
|
3226
|
+
} : undefined,
|
3227
|
+
stopPrice: item.stopPrice !== undefined ? {
|
3228
|
+
set: item.stopPrice
|
3229
|
+
} : undefined,
|
3230
|
+
trailPrice: item.trailPrice !== undefined ? {
|
3231
|
+
set: item.trailPrice
|
3232
|
+
} : undefined,
|
3233
|
+
trailPercent: item.trailPercent !== undefined ? {
|
3234
|
+
set: item.trailPercent
|
3235
|
+
} : undefined,
|
3236
|
+
extendedHours: item.extendedHours !== undefined ? {
|
3237
|
+
set: item.extendedHours
|
3238
|
+
} : undefined,
|
3239
|
+
status: item.status !== undefined ? {
|
3240
|
+
set: item.status
|
3241
|
+
} : undefined,
|
3242
|
+
submittedAt: item.submittedAt !== undefined ? {
|
3243
|
+
set: item.submittedAt
|
3244
|
+
} : undefined,
|
3245
|
+
filledAt: item.filledAt !== undefined ? {
|
3246
|
+
set: item.filledAt
|
3247
|
+
} : undefined,
|
3248
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? {
|
3249
|
+
set: item.filledAvgPrice
|
3250
|
+
} : undefined,
|
3251
|
+
fee: item.fee !== undefined ? {
|
3252
|
+
set: item.fee
|
3253
|
+
} : undefined,
|
3254
|
+
strikePrice: item.strikePrice !== undefined ? {
|
3255
|
+
set: item.strikePrice
|
3256
|
+
} : undefined,
|
3257
|
+
expirationDate: item.expirationDate !== undefined ? {
|
3258
|
+
set: item.expirationDate
|
3259
|
+
} : undefined,
|
3260
|
+
optionType: item.optionType !== undefined ? {
|
3261
|
+
set: item.optionType
|
3262
|
+
} : undefined,
|
3263
|
+
stopLossId: item.stopLossId !== undefined ? {
|
3264
|
+
set: item.stopLossId
|
3265
|
+
} : undefined,
|
3266
|
+
takeProfitId: item.takeProfitId !== undefined ? {
|
3267
|
+
set: item.takeProfitId
|
3268
|
+
} : undefined,
|
3269
|
+
},
|
3270
|
+
create: {
|
3271
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
3272
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3273
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
3274
|
+
side: item.side !== undefined ? item.side : undefined,
|
3275
|
+
type: item.type !== undefined ? item.type : undefined,
|
3276
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
3277
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
3278
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
3279
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
3280
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
3281
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
3282
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
3283
|
+
status: item.status !== undefined ? item.status : undefined,
|
3284
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
3285
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
3286
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
3287
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
3288
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
3289
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
3290
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3291
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
3292
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
3293
|
+
},
|
3294
|
+
}))
|
3295
|
+
} : undefined,
|
3296
|
+
alerts: item.alpacaAccount.alerts ? {
|
3297
|
+
upsert: item.alpacaAccount.alerts.map((item) => ({
|
3298
|
+
where: {
|
3299
|
+
id: item.id !== undefined ? item.id : undefined,
|
3300
|
+
},
|
3301
|
+
update: {
|
3302
|
+
id: item.id !== undefined ? {
|
3303
|
+
set: item.id
|
3304
|
+
} : undefined,
|
3305
|
+
message: item.message !== undefined ? {
|
3306
|
+
set: item.message
|
3307
|
+
} : undefined,
|
3308
|
+
type: item.type !== undefined ? {
|
3309
|
+
set: item.type
|
3310
|
+
} : undefined,
|
3311
|
+
isRead: item.isRead !== undefined ? {
|
3312
|
+
set: item.isRead
|
3313
|
+
} : undefined,
|
3314
|
+
},
|
3315
|
+
create: {
|
3316
|
+
message: item.message !== undefined ? item.message : undefined,
|
3317
|
+
type: item.type !== undefined ? item.type : undefined,
|
3318
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
3319
|
+
},
|
3320
|
+
}))
|
3321
|
+
} : undefined,
|
1519
3322
|
},
|
1520
3323
|
create: {
|
1521
3324
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -1527,6 +3330,113 @@ exports.Asset = {
|
|
1527
3330
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
1528
3331
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
1529
3332
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
3333
|
+
user: item.alpacaAccount.user ?
|
3334
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
3335
|
+
? { connect: {
|
3336
|
+
id: item.alpacaAccount.user.id
|
3337
|
+
}
|
3338
|
+
}
|
3339
|
+
: { connectOrCreate: {
|
3340
|
+
where: {
|
3341
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
3342
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
3343
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
3344
|
+
equals: item.alpacaAccount.user.name
|
3345
|
+
} : undefined,
|
3346
|
+
},
|
3347
|
+
create: {
|
3348
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
3349
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
3350
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
3351
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
3352
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
3353
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
3354
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
3355
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
3356
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
3357
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
3358
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
3359
|
+
},
|
3360
|
+
}
|
3361
|
+
} : undefined,
|
3362
|
+
trades: item.alpacaAccount.trades ?
|
3363
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3364
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
3365
|
+
id: item.id
|
3366
|
+
}))
|
3367
|
+
}
|
3368
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
3369
|
+
where: {
|
3370
|
+
id: item.id !== undefined ? item.id : undefined,
|
3371
|
+
},
|
3372
|
+
create: {
|
3373
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3374
|
+
price: item.price !== undefined ? item.price : undefined,
|
3375
|
+
total: item.total !== undefined ? item.total : undefined,
|
3376
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3377
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
3378
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
3379
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
3380
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
3381
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
3382
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
3383
|
+
status: item.status !== undefined ? item.status : undefined,
|
3384
|
+
},
|
3385
|
+
}))
|
3386
|
+
} : undefined,
|
3387
|
+
orders: item.alpacaAccount.orders ?
|
3388
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3389
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
3390
|
+
id: item.id
|
3391
|
+
}))
|
3392
|
+
}
|
3393
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
3394
|
+
where: {
|
3395
|
+
id: item.id !== undefined ? item.id : undefined,
|
3396
|
+
},
|
3397
|
+
create: {
|
3398
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
3399
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3400
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
3401
|
+
side: item.side !== undefined ? item.side : undefined,
|
3402
|
+
type: item.type !== undefined ? item.type : undefined,
|
3403
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
3404
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
3405
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
3406
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
3407
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
3408
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
3409
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
3410
|
+
status: item.status !== undefined ? item.status : undefined,
|
3411
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
3412
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
3413
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
3414
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
3415
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
3416
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
3417
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3418
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
3419
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
3420
|
+
},
|
3421
|
+
}))
|
3422
|
+
} : undefined,
|
3423
|
+
alerts: item.alpacaAccount.alerts ?
|
3424
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3425
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
3426
|
+
id: item.id
|
3427
|
+
}))
|
3428
|
+
}
|
3429
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
3430
|
+
where: {
|
3431
|
+
id: item.id !== undefined ? item.id : undefined,
|
3432
|
+
},
|
3433
|
+
create: {
|
3434
|
+
message: item.message !== undefined ? item.message : undefined,
|
3435
|
+
type: item.type !== undefined ? item.type : undefined,
|
3436
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
3437
|
+
},
|
3438
|
+
}))
|
3439
|
+
} : undefined,
|
1530
3440
|
},
|
1531
3441
|
}
|
1532
3442
|
} : undefined,
|
@@ -1565,6 +3475,113 @@ exports.Asset = {
|
|
1565
3475
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
1566
3476
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
1567
3477
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
3478
|
+
user: item.alpacaAccount.user ?
|
3479
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
3480
|
+
? { connect: {
|
3481
|
+
id: item.alpacaAccount.user.id
|
3482
|
+
}
|
3483
|
+
}
|
3484
|
+
: { connectOrCreate: {
|
3485
|
+
where: {
|
3486
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
3487
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
3488
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
3489
|
+
equals: item.alpacaAccount.user.name
|
3490
|
+
} : undefined,
|
3491
|
+
},
|
3492
|
+
create: {
|
3493
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
3494
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
3495
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
3496
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
3497
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
3498
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
3499
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
3500
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
3501
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
3502
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
3503
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
3504
|
+
},
|
3505
|
+
}
|
3506
|
+
} : undefined,
|
3507
|
+
trades: item.alpacaAccount.trades ?
|
3508
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3509
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
3510
|
+
id: item.id
|
3511
|
+
}))
|
3512
|
+
}
|
3513
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
3514
|
+
where: {
|
3515
|
+
id: item.id !== undefined ? item.id : undefined,
|
3516
|
+
},
|
3517
|
+
create: {
|
3518
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3519
|
+
price: item.price !== undefined ? item.price : undefined,
|
3520
|
+
total: item.total !== undefined ? item.total : undefined,
|
3521
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3522
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
3523
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
3524
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
3525
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
3526
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
3527
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
3528
|
+
status: item.status !== undefined ? item.status : undefined,
|
3529
|
+
},
|
3530
|
+
}))
|
3531
|
+
} : undefined,
|
3532
|
+
orders: item.alpacaAccount.orders ?
|
3533
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3534
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
3535
|
+
id: item.id
|
3536
|
+
}))
|
3537
|
+
}
|
3538
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
3539
|
+
where: {
|
3540
|
+
id: item.id !== undefined ? item.id : undefined,
|
3541
|
+
},
|
3542
|
+
create: {
|
3543
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
3544
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3545
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
3546
|
+
side: item.side !== undefined ? item.side : undefined,
|
3547
|
+
type: item.type !== undefined ? item.type : undefined,
|
3548
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
3549
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
3550
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
3551
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
3552
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
3553
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
3554
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
3555
|
+
status: item.status !== undefined ? item.status : undefined,
|
3556
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
3557
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
3558
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
3559
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
3560
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
3561
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
3562
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3563
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
3564
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
3565
|
+
},
|
3566
|
+
}))
|
3567
|
+
} : undefined,
|
3568
|
+
alerts: item.alpacaAccount.alerts ?
|
3569
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3570
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
3571
|
+
id: item.id
|
3572
|
+
}))
|
3573
|
+
}
|
3574
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
3575
|
+
where: {
|
3576
|
+
id: item.id !== undefined ? item.id : undefined,
|
3577
|
+
},
|
3578
|
+
create: {
|
3579
|
+
message: item.message !== undefined ? item.message : undefined,
|
3580
|
+
type: item.type !== undefined ? item.type : undefined,
|
3581
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
3582
|
+
},
|
3583
|
+
}))
|
3584
|
+
} : undefined,
|
1568
3585
|
},
|
1569
3586
|
}
|
1570
3587
|
} : undefined,
|
@@ -2055,6 +4072,266 @@ exports.Asset = {
|
|
2055
4072
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
|
2056
4073
|
set: item.alpacaAccount.volumeThreshold
|
2057
4074
|
} : undefined,
|
4075
|
+
user: item.alpacaAccount.user ? {
|
4076
|
+
upsert: {
|
4077
|
+
where: {
|
4078
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
4079
|
+
equals: item.alpacaAccount.user.id
|
4080
|
+
} : undefined,
|
4081
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
4082
|
+
equals: item.alpacaAccount.user.name
|
4083
|
+
} : undefined,
|
4084
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
4085
|
+
equals: item.alpacaAccount.user.email
|
4086
|
+
} : undefined,
|
4087
|
+
},
|
4088
|
+
update: {
|
4089
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
4090
|
+
set: item.alpacaAccount.user.id
|
4091
|
+
} : undefined,
|
4092
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
4093
|
+
set: item.alpacaAccount.user.name
|
4094
|
+
} : undefined,
|
4095
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
4096
|
+
set: item.alpacaAccount.user.email
|
4097
|
+
} : undefined,
|
4098
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
|
4099
|
+
set: item.alpacaAccount.user.emailVerified
|
4100
|
+
} : undefined,
|
4101
|
+
image: item.alpacaAccount.user.image !== undefined ? {
|
4102
|
+
set: item.alpacaAccount.user.image
|
4103
|
+
} : undefined,
|
4104
|
+
role: item.alpacaAccount.user.role !== undefined ? {
|
4105
|
+
set: item.alpacaAccount.user.role
|
4106
|
+
} : undefined,
|
4107
|
+
bio: item.alpacaAccount.user.bio !== undefined ? {
|
4108
|
+
set: item.alpacaAccount.user.bio
|
4109
|
+
} : undefined,
|
4110
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
|
4111
|
+
set: item.alpacaAccount.user.jobTitle
|
4112
|
+
} : undefined,
|
4113
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
|
4114
|
+
set: item.alpacaAccount.user.currentAccount
|
4115
|
+
} : undefined,
|
4116
|
+
plan: item.alpacaAccount.user.plan !== undefined ? {
|
4117
|
+
set: item.alpacaAccount.user.plan
|
4118
|
+
} : undefined,
|
4119
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
4120
|
+
set: item.alpacaAccount.user.openaiAPIKey
|
4121
|
+
} : undefined,
|
4122
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? {
|
4123
|
+
set: item.alpacaAccount.user.openaiModel
|
4124
|
+
} : undefined,
|
4125
|
+
},
|
4126
|
+
create: {
|
4127
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
4128
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
4129
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
4130
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
4131
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
4132
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
4133
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
4134
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
4135
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
4136
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
4137
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
4138
|
+
},
|
4139
|
+
}
|
4140
|
+
} : undefined,
|
4141
|
+
orders: item.alpacaAccount.orders ? {
|
4142
|
+
upsert: item.alpacaAccount.orders.map((item) => ({
|
4143
|
+
where: {
|
4144
|
+
id: item.id !== undefined ? item.id : undefined,
|
4145
|
+
},
|
4146
|
+
update: {
|
4147
|
+
id: item.id !== undefined ? {
|
4148
|
+
set: item.id
|
4149
|
+
} : undefined,
|
4150
|
+
clientOrderId: item.clientOrderId !== undefined ? {
|
4151
|
+
set: item.clientOrderId
|
4152
|
+
} : undefined,
|
4153
|
+
qty: item.qty !== undefined ? {
|
4154
|
+
set: item.qty
|
4155
|
+
} : undefined,
|
4156
|
+
notional: item.notional !== undefined ? {
|
4157
|
+
set: item.notional
|
4158
|
+
} : undefined,
|
4159
|
+
side: item.side !== undefined ? {
|
4160
|
+
set: item.side
|
4161
|
+
} : undefined,
|
4162
|
+
type: item.type !== undefined ? {
|
4163
|
+
set: item.type
|
4164
|
+
} : undefined,
|
4165
|
+
orderClass: item.orderClass !== undefined ? {
|
4166
|
+
set: item.orderClass
|
4167
|
+
} : undefined,
|
4168
|
+
timeInForce: item.timeInForce !== undefined ? {
|
4169
|
+
set: item.timeInForce
|
4170
|
+
} : undefined,
|
4171
|
+
limitPrice: item.limitPrice !== undefined ? {
|
4172
|
+
set: item.limitPrice
|
4173
|
+
} : undefined,
|
4174
|
+
stopPrice: item.stopPrice !== undefined ? {
|
4175
|
+
set: item.stopPrice
|
4176
|
+
} : undefined,
|
4177
|
+
trailPrice: item.trailPrice !== undefined ? {
|
4178
|
+
set: item.trailPrice
|
4179
|
+
} : undefined,
|
4180
|
+
trailPercent: item.trailPercent !== undefined ? {
|
4181
|
+
set: item.trailPercent
|
4182
|
+
} : undefined,
|
4183
|
+
extendedHours: item.extendedHours !== undefined ? {
|
4184
|
+
set: item.extendedHours
|
4185
|
+
} : undefined,
|
4186
|
+
status: item.status !== undefined ? {
|
4187
|
+
set: item.status
|
4188
|
+
} : undefined,
|
4189
|
+
submittedAt: item.submittedAt !== undefined ? {
|
4190
|
+
set: item.submittedAt
|
4191
|
+
} : undefined,
|
4192
|
+
filledAt: item.filledAt !== undefined ? {
|
4193
|
+
set: item.filledAt
|
4194
|
+
} : undefined,
|
4195
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? {
|
4196
|
+
set: item.filledAvgPrice
|
4197
|
+
} : undefined,
|
4198
|
+
fee: item.fee !== undefined ? {
|
4199
|
+
set: item.fee
|
4200
|
+
} : undefined,
|
4201
|
+
strikePrice: item.strikePrice !== undefined ? {
|
4202
|
+
set: item.strikePrice
|
4203
|
+
} : undefined,
|
4204
|
+
expirationDate: item.expirationDate !== undefined ? {
|
4205
|
+
set: item.expirationDate
|
4206
|
+
} : undefined,
|
4207
|
+
optionType: item.optionType !== undefined ? {
|
4208
|
+
set: item.optionType
|
4209
|
+
} : undefined,
|
4210
|
+
stopLossId: item.stopLossId !== undefined ? {
|
4211
|
+
set: item.stopLossId
|
4212
|
+
} : undefined,
|
4213
|
+
takeProfitId: item.takeProfitId !== undefined ? {
|
4214
|
+
set: item.takeProfitId
|
4215
|
+
} : undefined,
|
4216
|
+
},
|
4217
|
+
create: {
|
4218
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
4219
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
4220
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
4221
|
+
side: item.side !== undefined ? item.side : undefined,
|
4222
|
+
type: item.type !== undefined ? item.type : undefined,
|
4223
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
4224
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
4225
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
4226
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
4227
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
4228
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
4229
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
4230
|
+
status: item.status !== undefined ? item.status : undefined,
|
4231
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
4232
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
4233
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
4234
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
4235
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
4236
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
4237
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
4238
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
4239
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
4240
|
+
},
|
4241
|
+
}))
|
4242
|
+
} : undefined,
|
4243
|
+
positions: item.alpacaAccount.positions ? {
|
4244
|
+
upsert: item.alpacaAccount.positions.map((item) => ({
|
4245
|
+
where: {
|
4246
|
+
id: item.id !== undefined ? item.id : undefined,
|
4247
|
+
},
|
4248
|
+
update: {
|
4249
|
+
id: item.id !== undefined ? {
|
4250
|
+
set: item.id
|
4251
|
+
} : undefined,
|
4252
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
4253
|
+
set: item.averageEntryPrice
|
4254
|
+
} : undefined,
|
4255
|
+
qty: item.qty !== undefined ? {
|
4256
|
+
set: item.qty
|
4257
|
+
} : undefined,
|
4258
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
4259
|
+
set: item.qtyAvailable
|
4260
|
+
} : undefined,
|
4261
|
+
marketValue: item.marketValue !== undefined ? {
|
4262
|
+
set: item.marketValue
|
4263
|
+
} : undefined,
|
4264
|
+
costBasis: item.costBasis !== undefined ? {
|
4265
|
+
set: item.costBasis
|
4266
|
+
} : undefined,
|
4267
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
4268
|
+
set: item.unrealizedPL
|
4269
|
+
} : undefined,
|
4270
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
4271
|
+
set: item.unrealizedPLPC
|
4272
|
+
} : undefined,
|
4273
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
4274
|
+
set: item.unrealisedIntradayPL
|
4275
|
+
} : undefined,
|
4276
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
4277
|
+
set: item.unrealisedIntradayPLPC
|
4278
|
+
} : undefined,
|
4279
|
+
currentPrice: item.currentPrice !== undefined ? {
|
4280
|
+
set: item.currentPrice
|
4281
|
+
} : undefined,
|
4282
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
4283
|
+
set: item.lastTradePrice
|
4284
|
+
} : undefined,
|
4285
|
+
changeToday: item.changeToday !== undefined ? {
|
4286
|
+
set: item.changeToday
|
4287
|
+
} : undefined,
|
4288
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
4289
|
+
set: item.assetMarginable
|
4290
|
+
} : undefined,
|
4291
|
+
},
|
4292
|
+
create: {
|
4293
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
4294
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
4295
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
4296
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
4297
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
4298
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
4299
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
4300
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
4301
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
4302
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
4303
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
4304
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
4305
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
4306
|
+
},
|
4307
|
+
}))
|
4308
|
+
} : undefined,
|
4309
|
+
alerts: item.alpacaAccount.alerts ? {
|
4310
|
+
upsert: item.alpacaAccount.alerts.map((item) => ({
|
4311
|
+
where: {
|
4312
|
+
id: item.id !== undefined ? item.id : undefined,
|
4313
|
+
},
|
4314
|
+
update: {
|
4315
|
+
id: item.id !== undefined ? {
|
4316
|
+
set: item.id
|
4317
|
+
} : undefined,
|
4318
|
+
message: item.message !== undefined ? {
|
4319
|
+
set: item.message
|
4320
|
+
} : undefined,
|
4321
|
+
type: item.type !== undefined ? {
|
4322
|
+
set: item.type
|
4323
|
+
} : undefined,
|
4324
|
+
isRead: item.isRead !== undefined ? {
|
4325
|
+
set: item.isRead
|
4326
|
+
} : undefined,
|
4327
|
+
},
|
4328
|
+
create: {
|
4329
|
+
message: item.message !== undefined ? item.message : undefined,
|
4330
|
+
type: item.type !== undefined ? item.type : undefined,
|
4331
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
4332
|
+
},
|
4333
|
+
}))
|
4334
|
+
} : undefined,
|
2058
4335
|
},
|
2059
4336
|
create: {
|
2060
4337
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -2066,6 +4343,115 @@ exports.Asset = {
|
|
2066
4343
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
2067
4344
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
2068
4345
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
4346
|
+
user: item.alpacaAccount.user ?
|
4347
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
4348
|
+
? { connect: {
|
4349
|
+
id: item.alpacaAccount.user.id
|
4350
|
+
}
|
4351
|
+
}
|
4352
|
+
: { connectOrCreate: {
|
4353
|
+
where: {
|
4354
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
4355
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
4356
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
4357
|
+
equals: item.alpacaAccount.user.name
|
4358
|
+
} : undefined,
|
4359
|
+
},
|
4360
|
+
create: {
|
4361
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
4362
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
4363
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
4364
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
4365
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
4366
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
4367
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
4368
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
4369
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
4370
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
4371
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
4372
|
+
},
|
4373
|
+
}
|
4374
|
+
} : undefined,
|
4375
|
+
orders: item.alpacaAccount.orders ?
|
4376
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
4377
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
4378
|
+
id: item.id
|
4379
|
+
}))
|
4380
|
+
}
|
4381
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
4382
|
+
where: {
|
4383
|
+
id: item.id !== undefined ? item.id : undefined,
|
4384
|
+
},
|
4385
|
+
create: {
|
4386
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
4387
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
4388
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
4389
|
+
side: item.side !== undefined ? item.side : undefined,
|
4390
|
+
type: item.type !== undefined ? item.type : undefined,
|
4391
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
4392
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
4393
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
4394
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
4395
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
4396
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
4397
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
4398
|
+
status: item.status !== undefined ? item.status : undefined,
|
4399
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
4400
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
4401
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
4402
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
4403
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
4404
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
4405
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
4406
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
4407
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
4408
|
+
},
|
4409
|
+
}))
|
4410
|
+
} : undefined,
|
4411
|
+
positions: item.alpacaAccount.positions ?
|
4412
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
4413
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
4414
|
+
id: item.id
|
4415
|
+
}))
|
4416
|
+
}
|
4417
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
4418
|
+
where: {
|
4419
|
+
id: item.id !== undefined ? item.id : undefined,
|
4420
|
+
},
|
4421
|
+
create: {
|
4422
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
4423
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
4424
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
4425
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
4426
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
4427
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
4428
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
4429
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
4430
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
4431
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
4432
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
4433
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
4434
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
4435
|
+
},
|
4436
|
+
}))
|
4437
|
+
} : undefined,
|
4438
|
+
alerts: item.alpacaAccount.alerts ?
|
4439
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
4440
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
4441
|
+
id: item.id
|
4442
|
+
}))
|
4443
|
+
}
|
4444
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
4445
|
+
where: {
|
4446
|
+
id: item.id !== undefined ? item.id : undefined,
|
4447
|
+
},
|
4448
|
+
create: {
|
4449
|
+
message: item.message !== undefined ? item.message : undefined,
|
4450
|
+
type: item.type !== undefined ? item.type : undefined,
|
4451
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
4452
|
+
},
|
4453
|
+
}))
|
4454
|
+
} : undefined,
|
2069
4455
|
},
|
2070
4456
|
}
|
2071
4457
|
} : undefined,
|
@@ -2093,6 +4479,110 @@ exports.Asset = {
|
|
2093
4479
|
fee: item.fee !== undefined ? {
|
2094
4480
|
set: item.fee
|
2095
4481
|
} : undefined,
|
4482
|
+
order: item.order ? {
|
4483
|
+
upsert: {
|
4484
|
+
where: {
|
4485
|
+
id: item.order.id !== undefined ? {
|
4486
|
+
equals: item.order.id
|
4487
|
+
} : undefined,
|
4488
|
+
},
|
4489
|
+
update: {
|
4490
|
+
id: item.order.id !== undefined ? {
|
4491
|
+
set: item.order.id
|
4492
|
+
} : undefined,
|
4493
|
+
clientOrderId: item.order.clientOrderId !== undefined ? {
|
4494
|
+
set: item.order.clientOrderId
|
4495
|
+
} : undefined,
|
4496
|
+
qty: item.order.qty !== undefined ? {
|
4497
|
+
set: item.order.qty
|
4498
|
+
} : undefined,
|
4499
|
+
notional: item.order.notional !== undefined ? {
|
4500
|
+
set: item.order.notional
|
4501
|
+
} : undefined,
|
4502
|
+
side: item.order.side !== undefined ? {
|
4503
|
+
set: item.order.side
|
4504
|
+
} : undefined,
|
4505
|
+
type: item.order.type !== undefined ? {
|
4506
|
+
set: item.order.type
|
4507
|
+
} : undefined,
|
4508
|
+
orderClass: item.order.orderClass !== undefined ? {
|
4509
|
+
set: item.order.orderClass
|
4510
|
+
} : undefined,
|
4511
|
+
timeInForce: item.order.timeInForce !== undefined ? {
|
4512
|
+
set: item.order.timeInForce
|
4513
|
+
} : undefined,
|
4514
|
+
limitPrice: item.order.limitPrice !== undefined ? {
|
4515
|
+
set: item.order.limitPrice
|
4516
|
+
} : undefined,
|
4517
|
+
stopPrice: item.order.stopPrice !== undefined ? {
|
4518
|
+
set: item.order.stopPrice
|
4519
|
+
} : undefined,
|
4520
|
+
trailPrice: item.order.trailPrice !== undefined ? {
|
4521
|
+
set: item.order.trailPrice
|
4522
|
+
} : undefined,
|
4523
|
+
trailPercent: item.order.trailPercent !== undefined ? {
|
4524
|
+
set: item.order.trailPercent
|
4525
|
+
} : undefined,
|
4526
|
+
extendedHours: item.order.extendedHours !== undefined ? {
|
4527
|
+
set: item.order.extendedHours
|
4528
|
+
} : undefined,
|
4529
|
+
status: item.order.status !== undefined ? {
|
4530
|
+
set: item.order.status
|
4531
|
+
} : undefined,
|
4532
|
+
submittedAt: item.order.submittedAt !== undefined ? {
|
4533
|
+
set: item.order.submittedAt
|
4534
|
+
} : undefined,
|
4535
|
+
filledAt: item.order.filledAt !== undefined ? {
|
4536
|
+
set: item.order.filledAt
|
4537
|
+
} : undefined,
|
4538
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? {
|
4539
|
+
set: item.order.filledAvgPrice
|
4540
|
+
} : undefined,
|
4541
|
+
fee: item.order.fee !== undefined ? {
|
4542
|
+
set: item.order.fee
|
4543
|
+
} : undefined,
|
4544
|
+
strikePrice: item.order.strikePrice !== undefined ? {
|
4545
|
+
set: item.order.strikePrice
|
4546
|
+
} : undefined,
|
4547
|
+
expirationDate: item.order.expirationDate !== undefined ? {
|
4548
|
+
set: item.order.expirationDate
|
4549
|
+
} : undefined,
|
4550
|
+
optionType: item.order.optionType !== undefined ? {
|
4551
|
+
set: item.order.optionType
|
4552
|
+
} : undefined,
|
4553
|
+
stopLossId: item.order.stopLossId !== undefined ? {
|
4554
|
+
set: item.order.stopLossId
|
4555
|
+
} : undefined,
|
4556
|
+
takeProfitId: item.order.takeProfitId !== undefined ? {
|
4557
|
+
set: item.order.takeProfitId
|
4558
|
+
} : undefined,
|
4559
|
+
},
|
4560
|
+
create: {
|
4561
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
4562
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
4563
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
4564
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
4565
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
4566
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
4567
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
4568
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
4569
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
4570
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
4571
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
4572
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
4573
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
4574
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
4575
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
4576
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
4577
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
4578
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
4579
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
4580
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
4581
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
4582
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
4583
|
+
},
|
4584
|
+
}
|
4585
|
+
} : undefined,
|
2096
4586
|
},
|
2097
4587
|
create: {
|
2098
4588
|
sequence: item.sequence !== undefined ? item.sequence : undefined,
|
@@ -2100,6 +4590,42 @@ exports.Asset = {
|
|
2100
4590
|
note: item.note !== undefined ? item.note : undefined,
|
2101
4591
|
status: item.status !== undefined ? item.status : undefined,
|
2102
4592
|
fee: item.fee !== undefined ? item.fee : undefined,
|
4593
|
+
order: item.order ?
|
4594
|
+
typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
|
4595
|
+
? { connect: {
|
4596
|
+
id: item.order.id
|
4597
|
+
}
|
4598
|
+
}
|
4599
|
+
: { connectOrCreate: {
|
4600
|
+
where: {
|
4601
|
+
id: item.order.id !== undefined ? item.order.id : undefined,
|
4602
|
+
},
|
4603
|
+
create: {
|
4604
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
4605
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
4606
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
4607
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
4608
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
4609
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
4610
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
4611
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
4612
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
4613
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
4614
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
4615
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
4616
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
4617
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
4618
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
4619
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
4620
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
4621
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
4622
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
4623
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
4624
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
4625
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
4626
|
+
},
|
4627
|
+
}
|
4628
|
+
} : undefined,
|
2103
4629
|
},
|
2104
4630
|
}))
|
2105
4631
|
} : undefined,
|
@@ -2136,6 +4662,115 @@ exports.Asset = {
|
|
2136
4662
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
2137
4663
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
2138
4664
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
4665
|
+
user: item.alpacaAccount.user ?
|
4666
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
4667
|
+
? { connect: {
|
4668
|
+
id: item.alpacaAccount.user.id
|
4669
|
+
}
|
4670
|
+
}
|
4671
|
+
: { connectOrCreate: {
|
4672
|
+
where: {
|
4673
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
4674
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
4675
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
4676
|
+
equals: item.alpacaAccount.user.name
|
4677
|
+
} : undefined,
|
4678
|
+
},
|
4679
|
+
create: {
|
4680
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
4681
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
4682
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
4683
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
4684
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
4685
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
4686
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
4687
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
4688
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
4689
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
4690
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
4691
|
+
},
|
4692
|
+
}
|
4693
|
+
} : undefined,
|
4694
|
+
orders: item.alpacaAccount.orders ?
|
4695
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
4696
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
4697
|
+
id: item.id
|
4698
|
+
}))
|
4699
|
+
}
|
4700
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
4701
|
+
where: {
|
4702
|
+
id: item.id !== undefined ? item.id : undefined,
|
4703
|
+
},
|
4704
|
+
create: {
|
4705
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
4706
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
4707
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
4708
|
+
side: item.side !== undefined ? item.side : undefined,
|
4709
|
+
type: item.type !== undefined ? item.type : undefined,
|
4710
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
4711
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
4712
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
4713
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
4714
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
4715
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
4716
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
4717
|
+
status: item.status !== undefined ? item.status : undefined,
|
4718
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
4719
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
4720
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
4721
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
4722
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
4723
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
4724
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
4725
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
4726
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
4727
|
+
},
|
4728
|
+
}))
|
4729
|
+
} : undefined,
|
4730
|
+
positions: item.alpacaAccount.positions ?
|
4731
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
4732
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
4733
|
+
id: item.id
|
4734
|
+
}))
|
4735
|
+
}
|
4736
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
4737
|
+
where: {
|
4738
|
+
id: item.id !== undefined ? item.id : undefined,
|
4739
|
+
},
|
4740
|
+
create: {
|
4741
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
4742
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
4743
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
4744
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
4745
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
4746
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
4747
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
4748
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
4749
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
4750
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
4751
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
4752
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
4753
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
4754
|
+
},
|
4755
|
+
}))
|
4756
|
+
} : undefined,
|
4757
|
+
alerts: item.alpacaAccount.alerts ?
|
4758
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
4759
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
4760
|
+
id: item.id
|
4761
|
+
}))
|
4762
|
+
}
|
4763
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
4764
|
+
where: {
|
4765
|
+
id: item.id !== undefined ? item.id : undefined,
|
4766
|
+
},
|
4767
|
+
create: {
|
4768
|
+
message: item.message !== undefined ? item.message : undefined,
|
4769
|
+
type: item.type !== undefined ? item.type : undefined,
|
4770
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
4771
|
+
},
|
4772
|
+
}))
|
4773
|
+
} : undefined,
|
2139
4774
|
},
|
2140
4775
|
}
|
2141
4776
|
} : undefined,
|
@@ -2155,6 +4790,42 @@ exports.Asset = {
|
|
2155
4790
|
note: item.note !== undefined ? item.note : undefined,
|
2156
4791
|
status: item.status !== undefined ? item.status : undefined,
|
2157
4792
|
fee: item.fee !== undefined ? item.fee : undefined,
|
4793
|
+
order: item.order ?
|
4794
|
+
typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
|
4795
|
+
? { connect: {
|
4796
|
+
id: item.order.id
|
4797
|
+
}
|
4798
|
+
}
|
4799
|
+
: { connectOrCreate: {
|
4800
|
+
where: {
|
4801
|
+
id: item.order.id !== undefined ? item.order.id : undefined,
|
4802
|
+
},
|
4803
|
+
create: {
|
4804
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
4805
|
+
qty: item.order.qty !== undefined ? item.order.qty : undefined,
|
4806
|
+
notional: item.order.notional !== undefined ? item.order.notional : undefined,
|
4807
|
+
side: item.order.side !== undefined ? item.order.side : undefined,
|
4808
|
+
type: item.order.type !== undefined ? item.order.type : undefined,
|
4809
|
+
orderClass: item.order.orderClass !== undefined ? item.order.orderClass : undefined,
|
4810
|
+
timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
|
4811
|
+
limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
|
4812
|
+
stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
|
4813
|
+
trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
|
4814
|
+
trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
|
4815
|
+
extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
|
4816
|
+
status: item.order.status !== undefined ? item.order.status : undefined,
|
4817
|
+
submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
|
4818
|
+
filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
|
4819
|
+
filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
|
4820
|
+
fee: item.order.fee !== undefined ? item.order.fee : undefined,
|
4821
|
+
strikePrice: item.order.strikePrice !== undefined ? item.order.strikePrice : undefined,
|
4822
|
+
expirationDate: item.order.expirationDate !== undefined ? item.order.expirationDate : undefined,
|
4823
|
+
optionType: item.order.optionType !== undefined ? item.order.optionType : undefined,
|
4824
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
4825
|
+
takeProfitId: item.order.takeProfitId !== undefined ? item.order.takeProfitId : undefined,
|
4826
|
+
},
|
4827
|
+
}
|
4828
|
+
} : undefined,
|
2158
4829
|
},
|
2159
4830
|
}))
|
2160
4831
|
} : undefined,
|
@@ -2322,6 +4993,222 @@ exports.Asset = {
|
|
2322
4993
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
|
2323
4994
|
set: item.alpacaAccount.volumeThreshold
|
2324
4995
|
} : undefined,
|
4996
|
+
user: item.alpacaAccount.user ? {
|
4997
|
+
upsert: {
|
4998
|
+
where: {
|
4999
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
5000
|
+
equals: item.alpacaAccount.user.id
|
5001
|
+
} : undefined,
|
5002
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
5003
|
+
equals: item.alpacaAccount.user.name
|
5004
|
+
} : undefined,
|
5005
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
5006
|
+
equals: item.alpacaAccount.user.email
|
5007
|
+
} : undefined,
|
5008
|
+
},
|
5009
|
+
update: {
|
5010
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
5011
|
+
set: item.alpacaAccount.user.id
|
5012
|
+
} : undefined,
|
5013
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
5014
|
+
set: item.alpacaAccount.user.name
|
5015
|
+
} : undefined,
|
5016
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
5017
|
+
set: item.alpacaAccount.user.email
|
5018
|
+
} : undefined,
|
5019
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
|
5020
|
+
set: item.alpacaAccount.user.emailVerified
|
5021
|
+
} : undefined,
|
5022
|
+
image: item.alpacaAccount.user.image !== undefined ? {
|
5023
|
+
set: item.alpacaAccount.user.image
|
5024
|
+
} : undefined,
|
5025
|
+
role: item.alpacaAccount.user.role !== undefined ? {
|
5026
|
+
set: item.alpacaAccount.user.role
|
5027
|
+
} : undefined,
|
5028
|
+
bio: item.alpacaAccount.user.bio !== undefined ? {
|
5029
|
+
set: item.alpacaAccount.user.bio
|
5030
|
+
} : undefined,
|
5031
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
|
5032
|
+
set: item.alpacaAccount.user.jobTitle
|
5033
|
+
} : undefined,
|
5034
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
|
5035
|
+
set: item.alpacaAccount.user.currentAccount
|
5036
|
+
} : undefined,
|
5037
|
+
plan: item.alpacaAccount.user.plan !== undefined ? {
|
5038
|
+
set: item.alpacaAccount.user.plan
|
5039
|
+
} : undefined,
|
5040
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
5041
|
+
set: item.alpacaAccount.user.openaiAPIKey
|
5042
|
+
} : undefined,
|
5043
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? {
|
5044
|
+
set: item.alpacaAccount.user.openaiModel
|
5045
|
+
} : undefined,
|
5046
|
+
},
|
5047
|
+
create: {
|
5048
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
5049
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
5050
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
5051
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
5052
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
5053
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
5054
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
5055
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
5056
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
5057
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
5058
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
5059
|
+
},
|
5060
|
+
}
|
5061
|
+
} : undefined,
|
5062
|
+
trades: item.alpacaAccount.trades ? {
|
5063
|
+
upsert: item.alpacaAccount.trades.map((item) => ({
|
5064
|
+
where: {
|
5065
|
+
id: item.id !== undefined ? item.id : undefined,
|
5066
|
+
},
|
5067
|
+
update: {
|
5068
|
+
id: item.id !== undefined ? {
|
5069
|
+
set: item.id
|
5070
|
+
} : undefined,
|
5071
|
+
qty: item.qty !== undefined ? {
|
5072
|
+
set: item.qty
|
5073
|
+
} : undefined,
|
5074
|
+
price: item.price !== undefined ? {
|
5075
|
+
set: item.price
|
5076
|
+
} : undefined,
|
5077
|
+
total: item.total !== undefined ? {
|
5078
|
+
set: item.total
|
5079
|
+
} : undefined,
|
5080
|
+
optionType: item.optionType !== undefined ? {
|
5081
|
+
set: item.optionType
|
5082
|
+
} : undefined,
|
5083
|
+
signal: item.signal !== undefined ? {
|
5084
|
+
set: item.signal
|
5085
|
+
} : undefined,
|
5086
|
+
strategy: item.strategy !== undefined ? {
|
5087
|
+
set: item.strategy
|
5088
|
+
} : undefined,
|
5089
|
+
analysis: item.analysis !== undefined ? {
|
5090
|
+
set: item.analysis
|
5091
|
+
} : undefined,
|
5092
|
+
summary: item.summary !== undefined ? {
|
5093
|
+
set: item.summary
|
5094
|
+
} : undefined,
|
5095
|
+
confidence: item.confidence !== undefined ? {
|
5096
|
+
set: item.confidence
|
5097
|
+
} : undefined,
|
5098
|
+
timestamp: item.timestamp !== undefined ? {
|
5099
|
+
set: item.timestamp
|
5100
|
+
} : undefined,
|
5101
|
+
status: item.status !== undefined ? {
|
5102
|
+
set: item.status
|
5103
|
+
} : undefined,
|
5104
|
+
},
|
5105
|
+
create: {
|
5106
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5107
|
+
price: item.price !== undefined ? item.price : undefined,
|
5108
|
+
total: item.total !== undefined ? item.total : undefined,
|
5109
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
5110
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
5111
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
5112
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
5113
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
5114
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
5115
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
5116
|
+
status: item.status !== undefined ? item.status : undefined,
|
5117
|
+
},
|
5118
|
+
}))
|
5119
|
+
} : undefined,
|
5120
|
+
positions: item.alpacaAccount.positions ? {
|
5121
|
+
upsert: item.alpacaAccount.positions.map((item) => ({
|
5122
|
+
where: {
|
5123
|
+
id: item.id !== undefined ? item.id : undefined,
|
5124
|
+
},
|
5125
|
+
update: {
|
5126
|
+
id: item.id !== undefined ? {
|
5127
|
+
set: item.id
|
5128
|
+
} : undefined,
|
5129
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
5130
|
+
set: item.averageEntryPrice
|
5131
|
+
} : undefined,
|
5132
|
+
qty: item.qty !== undefined ? {
|
5133
|
+
set: item.qty
|
5134
|
+
} : undefined,
|
5135
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
5136
|
+
set: item.qtyAvailable
|
5137
|
+
} : undefined,
|
5138
|
+
marketValue: item.marketValue !== undefined ? {
|
5139
|
+
set: item.marketValue
|
5140
|
+
} : undefined,
|
5141
|
+
costBasis: item.costBasis !== undefined ? {
|
5142
|
+
set: item.costBasis
|
5143
|
+
} : undefined,
|
5144
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
5145
|
+
set: item.unrealizedPL
|
5146
|
+
} : undefined,
|
5147
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
5148
|
+
set: item.unrealizedPLPC
|
5149
|
+
} : undefined,
|
5150
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
5151
|
+
set: item.unrealisedIntradayPL
|
5152
|
+
} : undefined,
|
5153
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
5154
|
+
set: item.unrealisedIntradayPLPC
|
5155
|
+
} : undefined,
|
5156
|
+
currentPrice: item.currentPrice !== undefined ? {
|
5157
|
+
set: item.currentPrice
|
5158
|
+
} : undefined,
|
5159
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
5160
|
+
set: item.lastTradePrice
|
5161
|
+
} : undefined,
|
5162
|
+
changeToday: item.changeToday !== undefined ? {
|
5163
|
+
set: item.changeToday
|
5164
|
+
} : undefined,
|
5165
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
5166
|
+
set: item.assetMarginable
|
5167
|
+
} : undefined,
|
5168
|
+
},
|
5169
|
+
create: {
|
5170
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
5171
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5172
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
5173
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
5174
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
5175
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
5176
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
5177
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
5178
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
5179
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
5180
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
5181
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
5182
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
5183
|
+
},
|
5184
|
+
}))
|
5185
|
+
} : undefined,
|
5186
|
+
alerts: item.alpacaAccount.alerts ? {
|
5187
|
+
upsert: item.alpacaAccount.alerts.map((item) => ({
|
5188
|
+
where: {
|
5189
|
+
id: item.id !== undefined ? item.id : undefined,
|
5190
|
+
},
|
5191
|
+
update: {
|
5192
|
+
id: item.id !== undefined ? {
|
5193
|
+
set: item.id
|
5194
|
+
} : undefined,
|
5195
|
+
message: item.message !== undefined ? {
|
5196
|
+
set: item.message
|
5197
|
+
} : undefined,
|
5198
|
+
type: item.type !== undefined ? {
|
5199
|
+
set: item.type
|
5200
|
+
} : undefined,
|
5201
|
+
isRead: item.isRead !== undefined ? {
|
5202
|
+
set: item.isRead
|
5203
|
+
} : undefined,
|
5204
|
+
},
|
5205
|
+
create: {
|
5206
|
+
message: item.message !== undefined ? item.message : undefined,
|
5207
|
+
type: item.type !== undefined ? item.type : undefined,
|
5208
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
5209
|
+
},
|
5210
|
+
}))
|
5211
|
+
} : undefined,
|
2325
5212
|
},
|
2326
5213
|
create: {
|
2327
5214
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -2333,6 +5220,104 @@ exports.Asset = {
|
|
2333
5220
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
2334
5221
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
2335
5222
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
5223
|
+
user: item.alpacaAccount.user ?
|
5224
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
5225
|
+
? { connect: {
|
5226
|
+
id: item.alpacaAccount.user.id
|
5227
|
+
}
|
5228
|
+
}
|
5229
|
+
: { connectOrCreate: {
|
5230
|
+
where: {
|
5231
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
5232
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
5233
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
5234
|
+
equals: item.alpacaAccount.user.name
|
5235
|
+
} : undefined,
|
5236
|
+
},
|
5237
|
+
create: {
|
5238
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
5239
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
5240
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
5241
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
5242
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
5243
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
5244
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
5245
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
5246
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
5247
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
5248
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
5249
|
+
},
|
5250
|
+
}
|
5251
|
+
} : undefined,
|
5252
|
+
trades: item.alpacaAccount.trades ?
|
5253
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
5254
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
5255
|
+
id: item.id
|
5256
|
+
}))
|
5257
|
+
}
|
5258
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
5259
|
+
where: {
|
5260
|
+
id: item.id !== undefined ? item.id : undefined,
|
5261
|
+
},
|
5262
|
+
create: {
|
5263
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5264
|
+
price: item.price !== undefined ? item.price : undefined,
|
5265
|
+
total: item.total !== undefined ? item.total : undefined,
|
5266
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
5267
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
5268
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
5269
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
5270
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
5271
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
5272
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
5273
|
+
status: item.status !== undefined ? item.status : undefined,
|
5274
|
+
},
|
5275
|
+
}))
|
5276
|
+
} : undefined,
|
5277
|
+
positions: item.alpacaAccount.positions ?
|
5278
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
5279
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
5280
|
+
id: item.id
|
5281
|
+
}))
|
5282
|
+
}
|
5283
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
5284
|
+
where: {
|
5285
|
+
id: item.id !== undefined ? item.id : undefined,
|
5286
|
+
},
|
5287
|
+
create: {
|
5288
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
5289
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5290
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
5291
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
5292
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
5293
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
5294
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
5295
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
5296
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
5297
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
5298
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
5299
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
5300
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
5301
|
+
},
|
5302
|
+
}))
|
5303
|
+
} : undefined,
|
5304
|
+
alerts: item.alpacaAccount.alerts ?
|
5305
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
5306
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
5307
|
+
id: item.id
|
5308
|
+
}))
|
5309
|
+
}
|
5310
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
5311
|
+
where: {
|
5312
|
+
id: item.id !== undefined ? item.id : undefined,
|
5313
|
+
},
|
5314
|
+
create: {
|
5315
|
+
message: item.message !== undefined ? item.message : undefined,
|
5316
|
+
type: item.type !== undefined ? item.type : undefined,
|
5317
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
5318
|
+
},
|
5319
|
+
}))
|
5320
|
+
} : undefined,
|
2336
5321
|
},
|
2337
5322
|
}
|
2338
5323
|
} : undefined,
|
@@ -2362,6 +5347,66 @@ exports.Asset = {
|
|
2362
5347
|
fee: item.action.fee !== undefined ? {
|
2363
5348
|
set: item.action.fee
|
2364
5349
|
} : undefined,
|
5350
|
+
trade: item.action.trade ? {
|
5351
|
+
upsert: {
|
5352
|
+
where: {
|
5353
|
+
id: item.action.trade.id !== undefined ? {
|
5354
|
+
equals: item.action.trade.id
|
5355
|
+
} : undefined,
|
5356
|
+
},
|
5357
|
+
update: {
|
5358
|
+
id: item.action.trade.id !== undefined ? {
|
5359
|
+
set: item.action.trade.id
|
5360
|
+
} : undefined,
|
5361
|
+
qty: item.action.trade.qty !== undefined ? {
|
5362
|
+
set: item.action.trade.qty
|
5363
|
+
} : undefined,
|
5364
|
+
price: item.action.trade.price !== undefined ? {
|
5365
|
+
set: item.action.trade.price
|
5366
|
+
} : undefined,
|
5367
|
+
total: item.action.trade.total !== undefined ? {
|
5368
|
+
set: item.action.trade.total
|
5369
|
+
} : undefined,
|
5370
|
+
optionType: item.action.trade.optionType !== undefined ? {
|
5371
|
+
set: item.action.trade.optionType
|
5372
|
+
} : undefined,
|
5373
|
+
signal: item.action.trade.signal !== undefined ? {
|
5374
|
+
set: item.action.trade.signal
|
5375
|
+
} : undefined,
|
5376
|
+
strategy: item.action.trade.strategy !== undefined ? {
|
5377
|
+
set: item.action.trade.strategy
|
5378
|
+
} : undefined,
|
5379
|
+
analysis: item.action.trade.analysis !== undefined ? {
|
5380
|
+
set: item.action.trade.analysis
|
5381
|
+
} : undefined,
|
5382
|
+
summary: item.action.trade.summary !== undefined ? {
|
5383
|
+
set: item.action.trade.summary
|
5384
|
+
} : undefined,
|
5385
|
+
confidence: item.action.trade.confidence !== undefined ? {
|
5386
|
+
set: item.action.trade.confidence
|
5387
|
+
} : undefined,
|
5388
|
+
timestamp: item.action.trade.timestamp !== undefined ? {
|
5389
|
+
set: item.action.trade.timestamp
|
5390
|
+
} : undefined,
|
5391
|
+
status: item.action.trade.status !== undefined ? {
|
5392
|
+
set: item.action.trade.status
|
5393
|
+
} : undefined,
|
5394
|
+
},
|
5395
|
+
create: {
|
5396
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
5397
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
5398
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
5399
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
5400
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
5401
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
5402
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
5403
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
5404
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
5405
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
5406
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
5407
|
+
},
|
5408
|
+
}
|
5409
|
+
} : undefined,
|
2365
5410
|
},
|
2366
5411
|
create: {
|
2367
5412
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -2369,6 +5414,31 @@ exports.Asset = {
|
|
2369
5414
|
note: item.action.note !== undefined ? item.action.note : undefined,
|
2370
5415
|
status: item.action.status !== undefined ? item.action.status : undefined,
|
2371
5416
|
fee: item.action.fee !== undefined ? item.action.fee : undefined,
|
5417
|
+
trade: item.action.trade ?
|
5418
|
+
typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
|
5419
|
+
? { connect: {
|
5420
|
+
id: item.action.trade.id
|
5421
|
+
}
|
5422
|
+
}
|
5423
|
+
: { connectOrCreate: {
|
5424
|
+
where: {
|
5425
|
+
id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
|
5426
|
+
},
|
5427
|
+
create: {
|
5428
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
5429
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
5430
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
5431
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
5432
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
5433
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
5434
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
5435
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
5436
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
5437
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
5438
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
5439
|
+
},
|
5440
|
+
}
|
5441
|
+
} : undefined,
|
2372
5442
|
},
|
2373
5443
|
}
|
2374
5444
|
} : undefined,
|
@@ -2448,6 +5518,104 @@ exports.Asset = {
|
|
2448
5518
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
2449
5519
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
2450
5520
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
5521
|
+
user: item.alpacaAccount.user ?
|
5522
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
5523
|
+
? { connect: {
|
5524
|
+
id: item.alpacaAccount.user.id
|
5525
|
+
}
|
5526
|
+
}
|
5527
|
+
: { connectOrCreate: {
|
5528
|
+
where: {
|
5529
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
5530
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
5531
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
5532
|
+
equals: item.alpacaAccount.user.name
|
5533
|
+
} : undefined,
|
5534
|
+
},
|
5535
|
+
create: {
|
5536
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
5537
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
5538
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
5539
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
5540
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
5541
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
5542
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
5543
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
5544
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
5545
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
5546
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
5547
|
+
},
|
5548
|
+
}
|
5549
|
+
} : undefined,
|
5550
|
+
trades: item.alpacaAccount.trades ?
|
5551
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
5552
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
5553
|
+
id: item.id
|
5554
|
+
}))
|
5555
|
+
}
|
5556
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
5557
|
+
where: {
|
5558
|
+
id: item.id !== undefined ? item.id : undefined,
|
5559
|
+
},
|
5560
|
+
create: {
|
5561
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5562
|
+
price: item.price !== undefined ? item.price : undefined,
|
5563
|
+
total: item.total !== undefined ? item.total : undefined,
|
5564
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
5565
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
5566
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
5567
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
5568
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
5569
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
5570
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
5571
|
+
status: item.status !== undefined ? item.status : undefined,
|
5572
|
+
},
|
5573
|
+
}))
|
5574
|
+
} : undefined,
|
5575
|
+
positions: item.alpacaAccount.positions ?
|
5576
|
+
Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
5577
|
+
connect: item.alpacaAccount.positions.map((item) => ({
|
5578
|
+
id: item.id
|
5579
|
+
}))
|
5580
|
+
}
|
5581
|
+
: { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
|
5582
|
+
where: {
|
5583
|
+
id: item.id !== undefined ? item.id : undefined,
|
5584
|
+
},
|
5585
|
+
create: {
|
5586
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
5587
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5588
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
5589
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
5590
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
5591
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
5592
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
5593
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
5594
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
5595
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
5596
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
5597
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
5598
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
5599
|
+
},
|
5600
|
+
}))
|
5601
|
+
} : undefined,
|
5602
|
+
alerts: item.alpacaAccount.alerts ?
|
5603
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
5604
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
5605
|
+
id: item.id
|
5606
|
+
}))
|
5607
|
+
}
|
5608
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
5609
|
+
where: {
|
5610
|
+
id: item.id !== undefined ? item.id : undefined,
|
5611
|
+
},
|
5612
|
+
create: {
|
5613
|
+
message: item.message !== undefined ? item.message : undefined,
|
5614
|
+
type: item.type !== undefined ? item.type : undefined,
|
5615
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
5616
|
+
},
|
5617
|
+
}))
|
5618
|
+
} : undefined,
|
2451
5619
|
},
|
2452
5620
|
}
|
2453
5621
|
} : undefined,
|
@@ -2467,6 +5635,31 @@ exports.Asset = {
|
|
2467
5635
|
note: item.action.note !== undefined ? item.action.note : undefined,
|
2468
5636
|
status: item.action.status !== undefined ? item.action.status : undefined,
|
2469
5637
|
fee: item.action.fee !== undefined ? item.action.fee : undefined,
|
5638
|
+
trade: item.action.trade ?
|
5639
|
+
typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
|
5640
|
+
? { connect: {
|
5641
|
+
id: item.action.trade.id
|
5642
|
+
}
|
5643
|
+
}
|
5644
|
+
: { connectOrCreate: {
|
5645
|
+
where: {
|
5646
|
+
id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
|
5647
|
+
},
|
5648
|
+
create: {
|
5649
|
+
qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
|
5650
|
+
price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
|
5651
|
+
total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
|
5652
|
+
optionType: item.action.trade.optionType !== undefined ? item.action.trade.optionType : undefined,
|
5653
|
+
signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
|
5654
|
+
strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
|
5655
|
+
analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
|
5656
|
+
summary: item.action.trade.summary !== undefined ? item.action.trade.summary : undefined,
|
5657
|
+
confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
|
5658
|
+
timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
|
5659
|
+
status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
|
5660
|
+
},
|
5661
|
+
}
|
5662
|
+
} : undefined,
|
2470
5663
|
},
|
2471
5664
|
}
|
2472
5665
|
} : undefined,
|
@@ -2559,6 +5752,258 @@ exports.Asset = {
|
|
2559
5752
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
|
2560
5753
|
set: item.alpacaAccount.volumeThreshold
|
2561
5754
|
} : undefined,
|
5755
|
+
user: item.alpacaAccount.user ? {
|
5756
|
+
upsert: {
|
5757
|
+
where: {
|
5758
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
5759
|
+
equals: item.alpacaAccount.user.id
|
5760
|
+
} : undefined,
|
5761
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
5762
|
+
equals: item.alpacaAccount.user.name
|
5763
|
+
} : undefined,
|
5764
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
5765
|
+
equals: item.alpacaAccount.user.email
|
5766
|
+
} : undefined,
|
5767
|
+
},
|
5768
|
+
update: {
|
5769
|
+
id: item.alpacaAccount.user.id !== undefined ? {
|
5770
|
+
set: item.alpacaAccount.user.id
|
5771
|
+
} : undefined,
|
5772
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
5773
|
+
set: item.alpacaAccount.user.name
|
5774
|
+
} : undefined,
|
5775
|
+
email: item.alpacaAccount.user.email !== undefined ? {
|
5776
|
+
set: item.alpacaAccount.user.email
|
5777
|
+
} : undefined,
|
5778
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
|
5779
|
+
set: item.alpacaAccount.user.emailVerified
|
5780
|
+
} : undefined,
|
5781
|
+
image: item.alpacaAccount.user.image !== undefined ? {
|
5782
|
+
set: item.alpacaAccount.user.image
|
5783
|
+
} : undefined,
|
5784
|
+
role: item.alpacaAccount.user.role !== undefined ? {
|
5785
|
+
set: item.alpacaAccount.user.role
|
5786
|
+
} : undefined,
|
5787
|
+
bio: item.alpacaAccount.user.bio !== undefined ? {
|
5788
|
+
set: item.alpacaAccount.user.bio
|
5789
|
+
} : undefined,
|
5790
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
|
5791
|
+
set: item.alpacaAccount.user.jobTitle
|
5792
|
+
} : undefined,
|
5793
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
|
5794
|
+
set: item.alpacaAccount.user.currentAccount
|
5795
|
+
} : undefined,
|
5796
|
+
plan: item.alpacaAccount.user.plan !== undefined ? {
|
5797
|
+
set: item.alpacaAccount.user.plan
|
5798
|
+
} : undefined,
|
5799
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
5800
|
+
set: item.alpacaAccount.user.openaiAPIKey
|
5801
|
+
} : undefined,
|
5802
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? {
|
5803
|
+
set: item.alpacaAccount.user.openaiModel
|
5804
|
+
} : undefined,
|
5805
|
+
},
|
5806
|
+
create: {
|
5807
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
5808
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
5809
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
5810
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
5811
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
5812
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
5813
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
5814
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
5815
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
5816
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
5817
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
5818
|
+
},
|
5819
|
+
}
|
5820
|
+
} : undefined,
|
5821
|
+
trades: item.alpacaAccount.trades ? {
|
5822
|
+
upsert: item.alpacaAccount.trades.map((item) => ({
|
5823
|
+
where: {
|
5824
|
+
id: item.id !== undefined ? item.id : undefined,
|
5825
|
+
},
|
5826
|
+
update: {
|
5827
|
+
id: item.id !== undefined ? {
|
5828
|
+
set: item.id
|
5829
|
+
} : undefined,
|
5830
|
+
qty: item.qty !== undefined ? {
|
5831
|
+
set: item.qty
|
5832
|
+
} : undefined,
|
5833
|
+
price: item.price !== undefined ? {
|
5834
|
+
set: item.price
|
5835
|
+
} : undefined,
|
5836
|
+
total: item.total !== undefined ? {
|
5837
|
+
set: item.total
|
5838
|
+
} : undefined,
|
5839
|
+
optionType: item.optionType !== undefined ? {
|
5840
|
+
set: item.optionType
|
5841
|
+
} : undefined,
|
5842
|
+
signal: item.signal !== undefined ? {
|
5843
|
+
set: item.signal
|
5844
|
+
} : undefined,
|
5845
|
+
strategy: item.strategy !== undefined ? {
|
5846
|
+
set: item.strategy
|
5847
|
+
} : undefined,
|
5848
|
+
analysis: item.analysis !== undefined ? {
|
5849
|
+
set: item.analysis
|
5850
|
+
} : undefined,
|
5851
|
+
summary: item.summary !== undefined ? {
|
5852
|
+
set: item.summary
|
5853
|
+
} : undefined,
|
5854
|
+
confidence: item.confidence !== undefined ? {
|
5855
|
+
set: item.confidence
|
5856
|
+
} : undefined,
|
5857
|
+
timestamp: item.timestamp !== undefined ? {
|
5858
|
+
set: item.timestamp
|
5859
|
+
} : undefined,
|
5860
|
+
status: item.status !== undefined ? {
|
5861
|
+
set: item.status
|
5862
|
+
} : undefined,
|
5863
|
+
},
|
5864
|
+
create: {
|
5865
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5866
|
+
price: item.price !== undefined ? item.price : undefined,
|
5867
|
+
total: item.total !== undefined ? item.total : undefined,
|
5868
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
5869
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
5870
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
5871
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
5872
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
5873
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
5874
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
5875
|
+
status: item.status !== undefined ? item.status : undefined,
|
5876
|
+
},
|
5877
|
+
}))
|
5878
|
+
} : undefined,
|
5879
|
+
orders: item.alpacaAccount.orders ? {
|
5880
|
+
upsert: item.alpacaAccount.orders.map((item) => ({
|
5881
|
+
where: {
|
5882
|
+
id: item.id !== undefined ? item.id : undefined,
|
5883
|
+
},
|
5884
|
+
update: {
|
5885
|
+
id: item.id !== undefined ? {
|
5886
|
+
set: item.id
|
5887
|
+
} : undefined,
|
5888
|
+
clientOrderId: item.clientOrderId !== undefined ? {
|
5889
|
+
set: item.clientOrderId
|
5890
|
+
} : undefined,
|
5891
|
+
qty: item.qty !== undefined ? {
|
5892
|
+
set: item.qty
|
5893
|
+
} : undefined,
|
5894
|
+
notional: item.notional !== undefined ? {
|
5895
|
+
set: item.notional
|
5896
|
+
} : undefined,
|
5897
|
+
side: item.side !== undefined ? {
|
5898
|
+
set: item.side
|
5899
|
+
} : undefined,
|
5900
|
+
type: item.type !== undefined ? {
|
5901
|
+
set: item.type
|
5902
|
+
} : undefined,
|
5903
|
+
orderClass: item.orderClass !== undefined ? {
|
5904
|
+
set: item.orderClass
|
5905
|
+
} : undefined,
|
5906
|
+
timeInForce: item.timeInForce !== undefined ? {
|
5907
|
+
set: item.timeInForce
|
5908
|
+
} : undefined,
|
5909
|
+
limitPrice: item.limitPrice !== undefined ? {
|
5910
|
+
set: item.limitPrice
|
5911
|
+
} : undefined,
|
5912
|
+
stopPrice: item.stopPrice !== undefined ? {
|
5913
|
+
set: item.stopPrice
|
5914
|
+
} : undefined,
|
5915
|
+
trailPrice: item.trailPrice !== undefined ? {
|
5916
|
+
set: item.trailPrice
|
5917
|
+
} : undefined,
|
5918
|
+
trailPercent: item.trailPercent !== undefined ? {
|
5919
|
+
set: item.trailPercent
|
5920
|
+
} : undefined,
|
5921
|
+
extendedHours: item.extendedHours !== undefined ? {
|
5922
|
+
set: item.extendedHours
|
5923
|
+
} : undefined,
|
5924
|
+
status: item.status !== undefined ? {
|
5925
|
+
set: item.status
|
5926
|
+
} : undefined,
|
5927
|
+
submittedAt: item.submittedAt !== undefined ? {
|
5928
|
+
set: item.submittedAt
|
5929
|
+
} : undefined,
|
5930
|
+
filledAt: item.filledAt !== undefined ? {
|
5931
|
+
set: item.filledAt
|
5932
|
+
} : undefined,
|
5933
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? {
|
5934
|
+
set: item.filledAvgPrice
|
5935
|
+
} : undefined,
|
5936
|
+
fee: item.fee !== undefined ? {
|
5937
|
+
set: item.fee
|
5938
|
+
} : undefined,
|
5939
|
+
strikePrice: item.strikePrice !== undefined ? {
|
5940
|
+
set: item.strikePrice
|
5941
|
+
} : undefined,
|
5942
|
+
expirationDate: item.expirationDate !== undefined ? {
|
5943
|
+
set: item.expirationDate
|
5944
|
+
} : undefined,
|
5945
|
+
optionType: item.optionType !== undefined ? {
|
5946
|
+
set: item.optionType
|
5947
|
+
} : undefined,
|
5948
|
+
stopLossId: item.stopLossId !== undefined ? {
|
5949
|
+
set: item.stopLossId
|
5950
|
+
} : undefined,
|
5951
|
+
takeProfitId: item.takeProfitId !== undefined ? {
|
5952
|
+
set: item.takeProfitId
|
5953
|
+
} : undefined,
|
5954
|
+
},
|
5955
|
+
create: {
|
5956
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
5957
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
5958
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
5959
|
+
side: item.side !== undefined ? item.side : undefined,
|
5960
|
+
type: item.type !== undefined ? item.type : undefined,
|
5961
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
5962
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
5963
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
5964
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
5965
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
5966
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
5967
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
5968
|
+
status: item.status !== undefined ? item.status : undefined,
|
5969
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
5970
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
5971
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
5972
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
5973
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
5974
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
5975
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
5976
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
5977
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
5978
|
+
},
|
5979
|
+
}))
|
5980
|
+
} : undefined,
|
5981
|
+
alerts: item.alpacaAccount.alerts ? {
|
5982
|
+
upsert: item.alpacaAccount.alerts.map((item) => ({
|
5983
|
+
where: {
|
5984
|
+
id: item.id !== undefined ? item.id : undefined,
|
5985
|
+
},
|
5986
|
+
update: {
|
5987
|
+
id: item.id !== undefined ? {
|
5988
|
+
set: item.id
|
5989
|
+
} : undefined,
|
5990
|
+
message: item.message !== undefined ? {
|
5991
|
+
set: item.message
|
5992
|
+
} : undefined,
|
5993
|
+
type: item.type !== undefined ? {
|
5994
|
+
set: item.type
|
5995
|
+
} : undefined,
|
5996
|
+
isRead: item.isRead !== undefined ? {
|
5997
|
+
set: item.isRead
|
5998
|
+
} : undefined,
|
5999
|
+
},
|
6000
|
+
create: {
|
6001
|
+
message: item.message !== undefined ? item.message : undefined,
|
6002
|
+
type: item.type !== undefined ? item.type : undefined,
|
6003
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
6004
|
+
},
|
6005
|
+
}))
|
6006
|
+
} : undefined,
|
2562
6007
|
},
|
2563
6008
|
create: {
|
2564
6009
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -2570,6 +6015,113 @@ exports.Asset = {
|
|
2570
6015
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
2571
6016
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
2572
6017
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
6018
|
+
user: item.alpacaAccount.user ?
|
6019
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
6020
|
+
? { connect: {
|
6021
|
+
id: item.alpacaAccount.user.id
|
6022
|
+
}
|
6023
|
+
}
|
6024
|
+
: { connectOrCreate: {
|
6025
|
+
where: {
|
6026
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
6027
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
6028
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
6029
|
+
equals: item.alpacaAccount.user.name
|
6030
|
+
} : undefined,
|
6031
|
+
},
|
6032
|
+
create: {
|
6033
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
6034
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
6035
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
6036
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
6037
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
6038
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
6039
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
6040
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
6041
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
6042
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
6043
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
6044
|
+
},
|
6045
|
+
}
|
6046
|
+
} : undefined,
|
6047
|
+
trades: item.alpacaAccount.trades ?
|
6048
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
6049
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
6050
|
+
id: item.id
|
6051
|
+
}))
|
6052
|
+
}
|
6053
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
6054
|
+
where: {
|
6055
|
+
id: item.id !== undefined ? item.id : undefined,
|
6056
|
+
},
|
6057
|
+
create: {
|
6058
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
6059
|
+
price: item.price !== undefined ? item.price : undefined,
|
6060
|
+
total: item.total !== undefined ? item.total : undefined,
|
6061
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
6062
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
6063
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
6064
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
6065
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
6066
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
6067
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
6068
|
+
status: item.status !== undefined ? item.status : undefined,
|
6069
|
+
},
|
6070
|
+
}))
|
6071
|
+
} : undefined,
|
6072
|
+
orders: item.alpacaAccount.orders ?
|
6073
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
6074
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
6075
|
+
id: item.id
|
6076
|
+
}))
|
6077
|
+
}
|
6078
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
6079
|
+
where: {
|
6080
|
+
id: item.id !== undefined ? item.id : undefined,
|
6081
|
+
},
|
6082
|
+
create: {
|
6083
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
6084
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
6085
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
6086
|
+
side: item.side !== undefined ? item.side : undefined,
|
6087
|
+
type: item.type !== undefined ? item.type : undefined,
|
6088
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
6089
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
6090
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
6091
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
6092
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
6093
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
6094
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
6095
|
+
status: item.status !== undefined ? item.status : undefined,
|
6096
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
6097
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
6098
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
6099
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
6100
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
6101
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
6102
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
6103
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
6104
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
6105
|
+
},
|
6106
|
+
}))
|
6107
|
+
} : undefined,
|
6108
|
+
alerts: item.alpacaAccount.alerts ?
|
6109
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
6110
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
6111
|
+
id: item.id
|
6112
|
+
}))
|
6113
|
+
}
|
6114
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
6115
|
+
where: {
|
6116
|
+
id: item.id !== undefined ? item.id : undefined,
|
6117
|
+
},
|
6118
|
+
create: {
|
6119
|
+
message: item.message !== undefined ? item.message : undefined,
|
6120
|
+
type: item.type !== undefined ? item.type : undefined,
|
6121
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
6122
|
+
},
|
6123
|
+
}))
|
6124
|
+
} : undefined,
|
2573
6125
|
},
|
2574
6126
|
}
|
2575
6127
|
} : undefined,
|
@@ -2608,6 +6160,113 @@ exports.Asset = {
|
|
2608
6160
|
maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
|
2609
6161
|
minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
|
2610
6162
|
volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
|
6163
|
+
user: item.alpacaAccount.user ?
|
6164
|
+
typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
|
6165
|
+
? { connect: {
|
6166
|
+
id: item.alpacaAccount.user.id
|
6167
|
+
}
|
6168
|
+
}
|
6169
|
+
: { connectOrCreate: {
|
6170
|
+
where: {
|
6171
|
+
id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
|
6172
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
6173
|
+
name: item.alpacaAccount.user.name !== undefined ? {
|
6174
|
+
equals: item.alpacaAccount.user.name
|
6175
|
+
} : undefined,
|
6176
|
+
},
|
6177
|
+
create: {
|
6178
|
+
name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
|
6179
|
+
email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
|
6180
|
+
emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
|
6181
|
+
image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
|
6182
|
+
role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
|
6183
|
+
bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
|
6184
|
+
jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
|
6185
|
+
currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
|
6186
|
+
plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
|
6187
|
+
openaiAPIKey: item.alpacaAccount.user.openaiAPIKey !== undefined ? item.alpacaAccount.user.openaiAPIKey : undefined,
|
6188
|
+
openaiModel: item.alpacaAccount.user.openaiModel !== undefined ? item.alpacaAccount.user.openaiModel : undefined,
|
6189
|
+
},
|
6190
|
+
}
|
6191
|
+
} : undefined,
|
6192
|
+
trades: item.alpacaAccount.trades ?
|
6193
|
+
Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
6194
|
+
connect: item.alpacaAccount.trades.map((item) => ({
|
6195
|
+
id: item.id
|
6196
|
+
}))
|
6197
|
+
}
|
6198
|
+
: { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
|
6199
|
+
where: {
|
6200
|
+
id: item.id !== undefined ? item.id : undefined,
|
6201
|
+
},
|
6202
|
+
create: {
|
6203
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
6204
|
+
price: item.price !== undefined ? item.price : undefined,
|
6205
|
+
total: item.total !== undefined ? item.total : undefined,
|
6206
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
6207
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
6208
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
6209
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
6210
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
6211
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
6212
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
6213
|
+
status: item.status !== undefined ? item.status : undefined,
|
6214
|
+
},
|
6215
|
+
}))
|
6216
|
+
} : undefined,
|
6217
|
+
orders: item.alpacaAccount.orders ?
|
6218
|
+
Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
6219
|
+
connect: item.alpacaAccount.orders.map((item) => ({
|
6220
|
+
id: item.id
|
6221
|
+
}))
|
6222
|
+
}
|
6223
|
+
: { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
|
6224
|
+
where: {
|
6225
|
+
id: item.id !== undefined ? item.id : undefined,
|
6226
|
+
},
|
6227
|
+
create: {
|
6228
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
6229
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
6230
|
+
notional: item.notional !== undefined ? item.notional : undefined,
|
6231
|
+
side: item.side !== undefined ? item.side : undefined,
|
6232
|
+
type: item.type !== undefined ? item.type : undefined,
|
6233
|
+
orderClass: item.orderClass !== undefined ? item.orderClass : undefined,
|
6234
|
+
timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
|
6235
|
+
limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
|
6236
|
+
stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
|
6237
|
+
trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
|
6238
|
+
trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
|
6239
|
+
extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
|
6240
|
+
status: item.status !== undefined ? item.status : undefined,
|
6241
|
+
submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
|
6242
|
+
filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
|
6243
|
+
filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
|
6244
|
+
fee: item.fee !== undefined ? item.fee : undefined,
|
6245
|
+
strikePrice: item.strikePrice !== undefined ? item.strikePrice : undefined,
|
6246
|
+
expirationDate: item.expirationDate !== undefined ? item.expirationDate : undefined,
|
6247
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
6248
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
6249
|
+
takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
|
6250
|
+
},
|
6251
|
+
}))
|
6252
|
+
} : undefined,
|
6253
|
+
alerts: item.alpacaAccount.alerts ?
|
6254
|
+
Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
6255
|
+
connect: item.alpacaAccount.alerts.map((item) => ({
|
6256
|
+
id: item.id
|
6257
|
+
}))
|
6258
|
+
}
|
6259
|
+
: { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
|
6260
|
+
where: {
|
6261
|
+
id: item.id !== undefined ? item.id : undefined,
|
6262
|
+
},
|
6263
|
+
create: {
|
6264
|
+
message: item.message !== undefined ? item.message : undefined,
|
6265
|
+
type: item.type !== undefined ? item.type : undefined,
|
6266
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
6267
|
+
},
|
6268
|
+
}))
|
6269
|
+
} : undefined,
|
2611
6270
|
},
|
2612
6271
|
}
|
2613
6272
|
} : undefined,
|