adaptic-backend 1.0.159 → 1.0.161

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.
Files changed (65) hide show
  1. package/Account.cjs +285 -8
  2. package/Action.cjs +615 -4
  3. package/Alert.cjs +338 -4
  4. package/AlpacaAccount.cjs +771 -4
  5. package/Asset.cjs +642 -0
  6. package/Authenticator.cjs +288 -4
  7. package/Customer.cjs +273 -10
  8. package/NewsArticle.cjs +165 -0
  9. package/NewsArticleAssetSentiment.cjs +256 -8
  10. package/Order.cjs +510 -10
  11. package/Position.cjs +546 -8
  12. package/Session.cjs +288 -4
  13. package/StopLoss.cjs +348 -1
  14. package/TakeProfit.cjs +348 -1
  15. package/Trade.cjs +607 -8
  16. package/User.cjs +261 -0
  17. package/package.json +1 -1
  18. package/server/Account.d.ts.map +1 -1
  19. package/server/Account.js.map +1 -1
  20. package/server/Account.mjs +285 -8
  21. package/server/Action.d.ts.map +1 -1
  22. package/server/Action.js.map +1 -1
  23. package/server/Action.mjs +615 -4
  24. package/server/Alert.d.ts.map +1 -1
  25. package/server/Alert.js.map +1 -1
  26. package/server/Alert.mjs +338 -4
  27. package/server/AlpacaAccount.d.ts.map +1 -1
  28. package/server/AlpacaAccount.js.map +1 -1
  29. package/server/AlpacaAccount.mjs +771 -4
  30. package/server/Asset.d.ts.map +1 -1
  31. package/server/Asset.js.map +1 -1
  32. package/server/Asset.mjs +642 -0
  33. package/server/Authenticator.d.ts.map +1 -1
  34. package/server/Authenticator.js.map +1 -1
  35. package/server/Authenticator.mjs +288 -4
  36. package/server/Customer.d.ts.map +1 -1
  37. package/server/Customer.js.map +1 -1
  38. package/server/Customer.mjs +273 -10
  39. package/server/NewsArticle.d.ts.map +1 -1
  40. package/server/NewsArticle.js.map +1 -1
  41. package/server/NewsArticle.mjs +165 -0
  42. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  43. package/server/NewsArticleAssetSentiment.js.map +1 -1
  44. package/server/NewsArticleAssetSentiment.mjs +256 -8
  45. package/server/Order.d.ts.map +1 -1
  46. package/server/Order.js.map +1 -1
  47. package/server/Order.mjs +510 -10
  48. package/server/Position.d.ts.map +1 -1
  49. package/server/Position.js.map +1 -1
  50. package/server/Position.mjs +546 -8
  51. package/server/Session.d.ts.map +1 -1
  52. package/server/Session.js.map +1 -1
  53. package/server/Session.mjs +288 -4
  54. package/server/StopLoss.d.ts.map +1 -1
  55. package/server/StopLoss.js.map +1 -1
  56. package/server/StopLoss.mjs +348 -1
  57. package/server/TakeProfit.d.ts.map +1 -1
  58. package/server/TakeProfit.js.map +1 -1
  59. package/server/TakeProfit.mjs +348 -1
  60. package/server/Trade.d.ts.map +1 -1
  61. package/server/Trade.js.map +1 -1
  62. package/server/Trade.mjs +607 -8
  63. package/server/User.d.ts.map +1 -1
  64. package/server/User.js.map +1 -1
  65. package/server/User.mjs +261 -0
package/server/Trade.mjs CHANGED
@@ -294,6 +294,9 @@ export const Trade = {
294
294
  : { connectOrCreate: {
295
295
  where: {
296
296
  id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
297
+ userId: props.alpacaAccount.userId !== undefined ? {
298
+ equals: props.alpacaAccount.userId
299
+ } : undefined,
297
300
  },
298
301
  create: {
299
302
  type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
@@ -340,9 +343,17 @@ export const Trade = {
340
343
  : { connectOrCreate: {
341
344
  where: {
342
345
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
346
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
347
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
348
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
349
+ equals: props.alpacaAccount.user.customer.authUserId
350
+ } : undefined,
343
351
  name: props.alpacaAccount.user.customer.name !== undefined ? {
344
352
  equals: props.alpacaAccount.user.customer.name
345
353
  } : undefined,
354
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
355
+ equals: props.alpacaAccount.user.customer.stripePriceId
356
+ } : undefined,
346
357
  },
347
358
  create: {
348
359
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -364,6 +375,12 @@ export const Trade = {
364
375
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
365
376
  where: {
366
377
  id: item.id !== undefined ? item.id : undefined,
378
+ userId: item.userId !== undefined ? {
379
+ equals: item.userId
380
+ } : undefined,
381
+ providerAccountId: item.providerAccountId !== undefined ? {
382
+ equals: item.providerAccountId
383
+ } : undefined,
367
384
  },
368
385
  create: {
369
386
  type: item.type !== undefined ? item.type : undefined,
@@ -388,6 +405,9 @@ export const Trade = {
388
405
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
389
406
  where: {
390
407
  id: item.id !== undefined ? item.id : undefined,
408
+ userId: item.userId !== undefined ? {
409
+ equals: item.userId
410
+ } : undefined,
391
411
  },
392
412
  create: {
393
413
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -404,6 +424,9 @@ export const Trade = {
404
424
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
405
425
  where: {
406
426
  id: item.id !== undefined ? item.id : undefined,
427
+ userId: item.userId !== undefined ? {
428
+ equals: item.userId
429
+ } : undefined,
407
430
  },
408
431
  create: {
409
432
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -424,6 +447,15 @@ export const Trade = {
424
447
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
425
448
  where: {
426
449
  id: item.id !== undefined ? item.id : undefined,
450
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
451
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
452
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
453
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
454
+ equals: item.alpacaAccountId
455
+ } : undefined,
456
+ assetId: item.assetId !== undefined ? {
457
+ equals: item.assetId
458
+ } : undefined,
427
459
  },
428
460
  create: {
429
461
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -457,6 +489,7 @@ export const Trade = {
457
489
  : { connectOrCreate: {
458
490
  where: {
459
491
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
492
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
460
493
  },
461
494
  create: {
462
495
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -473,6 +506,7 @@ export const Trade = {
473
506
  : { connectOrCreate: {
474
507
  where: {
475
508
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
509
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
476
510
  },
477
511
  create: {
478
512
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -489,6 +523,9 @@ export const Trade = {
489
523
  : { connectOrCreate: {
490
524
  where: {
491
525
  id: item.action.id !== undefined ? item.action.id : undefined,
526
+ tradeId: item.action.tradeId !== undefined ? {
527
+ equals: item.action.tradeId
528
+ } : undefined,
492
529
  },
493
530
  create: {
494
531
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -582,6 +619,12 @@ export const Trade = {
582
619
  : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
583
620
  where: {
584
621
  id: item.id !== undefined ? item.id : undefined,
622
+ assetId: item.assetId !== undefined ? {
623
+ equals: item.assetId
624
+ } : undefined,
625
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
626
+ equals: item.alpacaAccountId
627
+ } : undefined,
585
628
  },
586
629
  create: {
587
630
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -680,6 +723,9 @@ export const Trade = {
680
723
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
681
724
  where: {
682
725
  id: item.id !== undefined ? item.id : undefined,
726
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
727
+ equals: item.alpacaAccountId
728
+ } : undefined,
683
729
  },
684
730
  create: {
685
731
  message: item.message !== undefined ? item.message : undefined,
@@ -768,6 +814,15 @@ export const Trade = {
768
814
  : { connectOrCreate: props.asset.orders.map((item) => ({
769
815
  where: {
770
816
  id: item.id !== undefined ? item.id : undefined,
817
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
818
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
819
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
820
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
821
+ equals: item.alpacaAccountId
822
+ } : undefined,
823
+ assetId: item.assetId !== undefined ? {
824
+ equals: item.assetId
825
+ } : undefined,
771
826
  },
772
827
  create: {
773
828
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -801,6 +856,7 @@ export const Trade = {
801
856
  : { connectOrCreate: {
802
857
  where: {
803
858
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
859
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
804
860
  },
805
861
  create: {
806
862
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -817,6 +873,7 @@ export const Trade = {
817
873
  : { connectOrCreate: {
818
874
  where: {
819
875
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
876
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
820
877
  },
821
878
  create: {
822
879
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -833,6 +890,9 @@ export const Trade = {
833
890
  : { connectOrCreate: {
834
891
  where: {
835
892
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
893
+ userId: item.alpacaAccount.userId !== undefined ? {
894
+ equals: item.alpacaAccount.userId
895
+ } : undefined,
836
896
  },
837
897
  create: {
838
898
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -856,6 +916,9 @@ export const Trade = {
856
916
  : { connectOrCreate: {
857
917
  where: {
858
918
  id: item.action.id !== undefined ? item.action.id : undefined,
919
+ tradeId: item.action.tradeId !== undefined ? {
920
+ equals: item.action.tradeId
921
+ } : undefined,
859
922
  },
860
923
  create: {
861
924
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -878,6 +941,12 @@ export const Trade = {
878
941
  : { connectOrCreate: props.asset.positions.map((item) => ({
879
942
  where: {
880
943
  id: item.id !== undefined ? item.id : undefined,
944
+ assetId: item.assetId !== undefined ? {
945
+ equals: item.assetId
946
+ } : undefined,
947
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
948
+ equals: item.alpacaAccountId
949
+ } : undefined,
881
950
  },
882
951
  create: {
883
952
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -902,6 +971,9 @@ export const Trade = {
902
971
  : { connectOrCreate: {
903
972
  where: {
904
973
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
974
+ userId: item.alpacaAccount.userId !== undefined ? {
975
+ equals: item.alpacaAccount.userId
976
+ } : undefined,
905
977
  },
906
978
  create: {
907
979
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -929,6 +1001,12 @@ export const Trade = {
929
1001
  where: {
930
1002
  id: item.id !== undefined ? item.id : undefined,
931
1003
  url: item.url !== undefined ? item.url : undefined,
1004
+ assetId: item.assetId !== undefined ? {
1005
+ equals: item.assetId
1006
+ } : undefined,
1007
+ newsArticleId: item.newsArticleId !== undefined ? {
1008
+ equals: item.newsArticleId
1009
+ } : undefined,
932
1010
  },
933
1011
  create: {
934
1012
  url: item.url !== undefined ? item.url : undefined,
@@ -981,6 +1059,9 @@ export const Trade = {
981
1059
  : { connectOrCreate: props.actions.map((item) => ({
982
1060
  where: {
983
1061
  id: item.id !== undefined ? item.id : undefined,
1062
+ tradeId: item.tradeId !== undefined ? {
1063
+ equals: item.tradeId
1064
+ } : undefined,
984
1065
  },
985
1066
  create: {
986
1067
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -997,6 +1078,15 @@ export const Trade = {
997
1078
  : { connectOrCreate: {
998
1079
  where: {
999
1080
  id: item.order.id !== undefined ? item.order.id : undefined,
1081
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
1082
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
1083
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
1084
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
1085
+ equals: item.order.alpacaAccountId
1086
+ } : undefined,
1087
+ assetId: item.order.assetId !== undefined ? {
1088
+ equals: item.order.assetId
1089
+ } : undefined,
1000
1090
  },
1001
1091
  create: {
1002
1092
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -1030,6 +1120,7 @@ export const Trade = {
1030
1120
  : { connectOrCreate: {
1031
1121
  where: {
1032
1122
  id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
1123
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
1033
1124
  },
1034
1125
  create: {
1035
1126
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -1046,6 +1137,7 @@ export const Trade = {
1046
1137
  : { connectOrCreate: {
1047
1138
  where: {
1048
1139
  id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
1140
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
1049
1141
  },
1050
1142
  create: {
1051
1143
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -1062,6 +1154,9 @@ export const Trade = {
1062
1154
  : { connectOrCreate: {
1063
1155
  where: {
1064
1156
  id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
1157
+ userId: item.order.alpacaAccount.userId !== undefined ? {
1158
+ equals: item.order.alpacaAccount.userId
1159
+ } : undefined,
1065
1160
  },
1066
1161
  create: {
1067
1162
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -1235,8 +1330,12 @@ export const Trade = {
1235
1330
  const variables = {
1236
1331
  where: {
1237
1332
  id: props.id !== undefined ? props.id : undefined,
1238
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
1239
- assetId: props.assetId !== undefined ? props.assetId : undefined,
1333
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
1334
+ equals: props.alpacaAccountId
1335
+ } : undefined,
1336
+ assetId: props.assetId !== undefined ? {
1337
+ equals: props.assetId
1338
+ } : undefined,
1240
1339
  qty: props.qty !== undefined ? props.qty : undefined,
1241
1340
  price: props.price !== undefined ? props.price : undefined,
1242
1341
  total: props.total !== undefined ? props.total : undefined,
@@ -1300,6 +1399,9 @@ export const Trade = {
1300
1399
  id: props.alpacaAccount.id !== undefined ? {
1301
1400
  equals: props.alpacaAccount.id
1302
1401
  } : undefined,
1402
+ userId: props.alpacaAccount.userId !== undefined ? {
1403
+ equals: props.alpacaAccount.userId
1404
+ } : undefined,
1303
1405
  },
1304
1406
  update: {
1305
1407
  id: props.alpacaAccount.id !== undefined ? {
@@ -1388,9 +1490,21 @@ export const Trade = {
1388
1490
  id: props.alpacaAccount.user.customer.id !== undefined ? {
1389
1491
  equals: props.alpacaAccount.user.customer.id
1390
1492
  } : undefined,
1493
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
1494
+ equals: props.alpacaAccount.user.customer.authUserId
1495
+ } : undefined,
1391
1496
  name: props.alpacaAccount.user.customer.name !== undefined ? {
1392
1497
  equals: props.alpacaAccount.user.customer.name
1393
1498
  } : undefined,
1499
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
1500
+ equals: props.alpacaAccount.user.customer.stripeCustomerId
1501
+ } : undefined,
1502
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
1503
+ equals: props.alpacaAccount.user.customer.stripeSubscriptionId
1504
+ } : undefined,
1505
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
1506
+ equals: props.alpacaAccount.user.customer.stripePriceId
1507
+ } : undefined,
1394
1508
  },
1395
1509
  update: {
1396
1510
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -1430,6 +1544,12 @@ export const Trade = {
1430
1544
  upsert: props.alpacaAccount.user.accounts.map((item) => ({
1431
1545
  where: {
1432
1546
  id: item.id !== undefined ? item.id : undefined,
1547
+ userId: item.userId !== undefined ? {
1548
+ equals: item.userId
1549
+ } : undefined,
1550
+ providerAccountId: item.providerAccountId !== undefined ? {
1551
+ equals: item.providerAccountId
1552
+ } : undefined,
1433
1553
  },
1434
1554
  update: {
1435
1555
  id: item.id !== undefined ? {
@@ -1484,6 +1604,9 @@ export const Trade = {
1484
1604
  upsert: props.alpacaAccount.user.sessions.map((item) => ({
1485
1605
  where: {
1486
1606
  id: item.id !== undefined ? item.id : undefined,
1607
+ userId: item.userId !== undefined ? {
1608
+ equals: item.userId
1609
+ } : undefined,
1487
1610
  },
1488
1611
  update: {
1489
1612
  id: item.id !== undefined ? {
@@ -1506,6 +1629,9 @@ export const Trade = {
1506
1629
  upsert: props.alpacaAccount.user.authenticators.map((item) => ({
1507
1630
  where: {
1508
1631
  id: item.id !== undefined ? item.id : undefined,
1632
+ userId: item.userId !== undefined ? {
1633
+ equals: item.userId
1634
+ } : undefined,
1509
1635
  },
1510
1636
  update: {
1511
1637
  id: item.id !== undefined ? {
@@ -1550,9 +1676,17 @@ export const Trade = {
1550
1676
  : { connectOrCreate: {
1551
1677
  where: {
1552
1678
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
1679
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
1680
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
1681
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
1682
+ equals: props.alpacaAccount.user.customer.authUserId
1683
+ } : undefined,
1553
1684
  name: props.alpacaAccount.user.customer.name !== undefined ? {
1554
1685
  equals: props.alpacaAccount.user.customer.name
1555
1686
  } : undefined,
1687
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
1688
+ equals: props.alpacaAccount.user.customer.stripePriceId
1689
+ } : undefined,
1556
1690
  },
1557
1691
  create: {
1558
1692
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -1574,6 +1708,12 @@ export const Trade = {
1574
1708
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
1575
1709
  where: {
1576
1710
  id: item.id !== undefined ? item.id : undefined,
1711
+ userId: item.userId !== undefined ? {
1712
+ equals: item.userId
1713
+ } : undefined,
1714
+ providerAccountId: item.providerAccountId !== undefined ? {
1715
+ equals: item.providerAccountId
1716
+ } : undefined,
1577
1717
  },
1578
1718
  create: {
1579
1719
  type: item.type !== undefined ? item.type : undefined,
@@ -1598,6 +1738,9 @@ export const Trade = {
1598
1738
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
1599
1739
  where: {
1600
1740
  id: item.id !== undefined ? item.id : undefined,
1741
+ userId: item.userId !== undefined ? {
1742
+ equals: item.userId
1743
+ } : undefined,
1601
1744
  },
1602
1745
  create: {
1603
1746
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -1614,6 +1757,9 @@ export const Trade = {
1614
1757
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
1615
1758
  where: {
1616
1759
  id: item.id !== undefined ? item.id : undefined,
1760
+ userId: item.userId !== undefined ? {
1761
+ equals: item.userId
1762
+ } : undefined,
1617
1763
  },
1618
1764
  create: {
1619
1765
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -1629,6 +1775,15 @@ export const Trade = {
1629
1775
  upsert: props.alpacaAccount.orders.map((item) => ({
1630
1776
  where: {
1631
1777
  id: item.id !== undefined ? item.id : undefined,
1778
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1779
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1780
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1781
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1782
+ equals: item.alpacaAccountId
1783
+ } : undefined,
1784
+ assetId: item.assetId !== undefined ? {
1785
+ equals: item.assetId
1786
+ } : undefined,
1632
1787
  },
1633
1788
  update: {
1634
1789
  id: item.id !== undefined ? {
@@ -1706,6 +1861,9 @@ export const Trade = {
1706
1861
  id: item.stopLoss.id !== undefined ? {
1707
1862
  equals: item.stopLoss.id
1708
1863
  } : undefined,
1864
+ orderId: item.stopLoss.orderId !== undefined ? {
1865
+ equals: item.stopLoss.orderId
1866
+ } : undefined,
1709
1867
  },
1710
1868
  update: {
1711
1869
  id: item.stopLoss.id !== undefined ? {
@@ -1730,6 +1888,9 @@ export const Trade = {
1730
1888
  id: item.takeProfit.id !== undefined ? {
1731
1889
  equals: item.takeProfit.id
1732
1890
  } : undefined,
1891
+ orderId: item.takeProfit.orderId !== undefined ? {
1892
+ equals: item.takeProfit.orderId
1893
+ } : undefined,
1733
1894
  },
1734
1895
  update: {
1735
1896
  id: item.takeProfit.id !== undefined ? {
@@ -1754,6 +1915,9 @@ export const Trade = {
1754
1915
  id: item.action.id !== undefined ? {
1755
1916
  equals: item.action.id
1756
1917
  } : undefined,
1918
+ tradeId: item.action.tradeId !== undefined ? {
1919
+ equals: item.action.tradeId
1920
+ } : undefined,
1757
1921
  },
1758
1922
  update: {
1759
1923
  id: item.action.id !== undefined ? {
@@ -2059,6 +2223,7 @@ export const Trade = {
2059
2223
  : { connectOrCreate: {
2060
2224
  where: {
2061
2225
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2226
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2062
2227
  },
2063
2228
  create: {
2064
2229
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2075,6 +2240,7 @@ export const Trade = {
2075
2240
  : { connectOrCreate: {
2076
2241
  where: {
2077
2242
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2243
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2078
2244
  },
2079
2245
  create: {
2080
2246
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2091,6 +2257,9 @@ export const Trade = {
2091
2257
  : { connectOrCreate: {
2092
2258
  where: {
2093
2259
  id: item.action.id !== undefined ? item.action.id : undefined,
2260
+ tradeId: item.action.tradeId !== undefined ? {
2261
+ equals: item.action.tradeId
2262
+ } : undefined,
2094
2263
  },
2095
2264
  create: {
2096
2265
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2179,6 +2348,12 @@ export const Trade = {
2179
2348
  upsert: props.alpacaAccount.positions.map((item) => ({
2180
2349
  where: {
2181
2350
  id: item.id !== undefined ? item.id : undefined,
2351
+ assetId: item.assetId !== undefined ? {
2352
+ equals: item.assetId
2353
+ } : undefined,
2354
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2355
+ equals: item.alpacaAccountId
2356
+ } : undefined,
2182
2357
  },
2183
2358
  update: {
2184
2359
  id: item.id !== undefined ? {
@@ -2558,6 +2733,9 @@ export const Trade = {
2558
2733
  upsert: props.alpacaAccount.alerts.map((item) => ({
2559
2734
  where: {
2560
2735
  id: item.id !== undefined ? item.id : undefined,
2736
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2737
+ equals: item.alpacaAccountId
2738
+ } : undefined,
2561
2739
  },
2562
2740
  update: {
2563
2741
  id: item.id !== undefined ? {
@@ -2626,9 +2804,17 @@ export const Trade = {
2626
2804
  : { connectOrCreate: {
2627
2805
  where: {
2628
2806
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
2807
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2808
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2809
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2810
+ equals: props.alpacaAccount.user.customer.authUserId
2811
+ } : undefined,
2629
2812
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2630
2813
  equals: props.alpacaAccount.user.customer.name
2631
2814
  } : undefined,
2815
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2816
+ equals: props.alpacaAccount.user.customer.stripePriceId
2817
+ } : undefined,
2632
2818
  },
2633
2819
  create: {
2634
2820
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -2650,6 +2836,12 @@ export const Trade = {
2650
2836
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
2651
2837
  where: {
2652
2838
  id: item.id !== undefined ? item.id : undefined,
2839
+ userId: item.userId !== undefined ? {
2840
+ equals: item.userId
2841
+ } : undefined,
2842
+ providerAccountId: item.providerAccountId !== undefined ? {
2843
+ equals: item.providerAccountId
2844
+ } : undefined,
2653
2845
  },
2654
2846
  create: {
2655
2847
  type: item.type !== undefined ? item.type : undefined,
@@ -2674,6 +2866,9 @@ export const Trade = {
2674
2866
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
2675
2867
  where: {
2676
2868
  id: item.id !== undefined ? item.id : undefined,
2869
+ userId: item.userId !== undefined ? {
2870
+ equals: item.userId
2871
+ } : undefined,
2677
2872
  },
2678
2873
  create: {
2679
2874
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -2690,6 +2885,9 @@ export const Trade = {
2690
2885
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
2691
2886
  where: {
2692
2887
  id: item.id !== undefined ? item.id : undefined,
2888
+ userId: item.userId !== undefined ? {
2889
+ equals: item.userId
2890
+ } : undefined,
2693
2891
  },
2694
2892
  create: {
2695
2893
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -2710,6 +2908,15 @@ export const Trade = {
2710
2908
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
2711
2909
  where: {
2712
2910
  id: item.id !== undefined ? item.id : undefined,
2911
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2912
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2913
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2914
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2915
+ equals: item.alpacaAccountId
2916
+ } : undefined,
2917
+ assetId: item.assetId !== undefined ? {
2918
+ equals: item.assetId
2919
+ } : undefined,
2713
2920
  },
2714
2921
  create: {
2715
2922
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2743,6 +2950,7 @@ export const Trade = {
2743
2950
  : { connectOrCreate: {
2744
2951
  where: {
2745
2952
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2953
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2746
2954
  },
2747
2955
  create: {
2748
2956
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2759,6 +2967,7 @@ export const Trade = {
2759
2967
  : { connectOrCreate: {
2760
2968
  where: {
2761
2969
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2970
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2762
2971
  },
2763
2972
  create: {
2764
2973
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2775,6 +2984,9 @@ export const Trade = {
2775
2984
  : { connectOrCreate: {
2776
2985
  where: {
2777
2986
  id: item.action.id !== undefined ? item.action.id : undefined,
2987
+ tradeId: item.action.tradeId !== undefined ? {
2988
+ equals: item.action.tradeId
2989
+ } : undefined,
2778
2990
  },
2779
2991
  create: {
2780
2992
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2868,6 +3080,12 @@ export const Trade = {
2868
3080
  : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
2869
3081
  where: {
2870
3082
  id: item.id !== undefined ? item.id : undefined,
3083
+ assetId: item.assetId !== undefined ? {
3084
+ equals: item.assetId
3085
+ } : undefined,
3086
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3087
+ equals: item.alpacaAccountId
3088
+ } : undefined,
2871
3089
  },
2872
3090
  create: {
2873
3091
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -2966,6 +3184,9 @@ export const Trade = {
2966
3184
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
2967
3185
  where: {
2968
3186
  id: item.id !== undefined ? item.id : undefined,
3187
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3188
+ equals: item.alpacaAccountId
3189
+ } : undefined,
2969
3190
  },
2970
3191
  create: {
2971
3192
  message: item.message !== undefined ? item.message : undefined,
@@ -3163,6 +3384,15 @@ export const Trade = {
3163
3384
  upsert: props.asset.orders.map((item) => ({
3164
3385
  where: {
3165
3386
  id: item.id !== undefined ? item.id : undefined,
3387
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3388
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3389
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3390
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3391
+ equals: item.alpacaAccountId
3392
+ } : undefined,
3393
+ assetId: item.assetId !== undefined ? {
3394
+ equals: item.assetId
3395
+ } : undefined,
3166
3396
  },
3167
3397
  update: {
3168
3398
  id: item.id !== undefined ? {
@@ -3240,6 +3470,9 @@ export const Trade = {
3240
3470
  id: item.stopLoss.id !== undefined ? {
3241
3471
  equals: item.stopLoss.id
3242
3472
  } : undefined,
3473
+ orderId: item.stopLoss.orderId !== undefined ? {
3474
+ equals: item.stopLoss.orderId
3475
+ } : undefined,
3243
3476
  },
3244
3477
  update: {
3245
3478
  id: item.stopLoss.id !== undefined ? {
@@ -3264,6 +3497,9 @@ export const Trade = {
3264
3497
  id: item.takeProfit.id !== undefined ? {
3265
3498
  equals: item.takeProfit.id
3266
3499
  } : undefined,
3500
+ orderId: item.takeProfit.orderId !== undefined ? {
3501
+ equals: item.takeProfit.orderId
3502
+ } : undefined,
3267
3503
  },
3268
3504
  update: {
3269
3505
  id: item.takeProfit.id !== undefined ? {
@@ -3288,6 +3524,9 @@ export const Trade = {
3288
3524
  id: item.alpacaAccount.id !== undefined ? {
3289
3525
  equals: item.alpacaAccount.id
3290
3526
  } : undefined,
3527
+ userId: item.alpacaAccount.userId !== undefined ? {
3528
+ equals: item.alpacaAccount.userId
3529
+ } : undefined,
3291
3530
  },
3292
3531
  update: {
3293
3532
  id: item.alpacaAccount.id !== undefined ? {
@@ -3340,6 +3579,9 @@ export const Trade = {
3340
3579
  id: item.action.id !== undefined ? {
3341
3580
  equals: item.action.id
3342
3581
  } : undefined,
3582
+ tradeId: item.action.tradeId !== undefined ? {
3583
+ equals: item.action.tradeId
3584
+ } : undefined,
3343
3585
  },
3344
3586
  update: {
3345
3587
  id: item.action.id !== undefined ? {
@@ -3403,6 +3645,7 @@ export const Trade = {
3403
3645
  : { connectOrCreate: {
3404
3646
  where: {
3405
3647
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3648
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3406
3649
  },
3407
3650
  create: {
3408
3651
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3419,6 +3662,7 @@ export const Trade = {
3419
3662
  : { connectOrCreate: {
3420
3663
  where: {
3421
3664
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3665
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3422
3666
  },
3423
3667
  create: {
3424
3668
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3435,6 +3679,9 @@ export const Trade = {
3435
3679
  : { connectOrCreate: {
3436
3680
  where: {
3437
3681
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3682
+ userId: item.alpacaAccount.userId !== undefined ? {
3683
+ equals: item.alpacaAccount.userId
3684
+ } : undefined,
3438
3685
  },
3439
3686
  create: {
3440
3687
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3458,6 +3705,9 @@ export const Trade = {
3458
3705
  : { connectOrCreate: {
3459
3706
  where: {
3460
3707
  id: item.action.id !== undefined ? item.action.id : undefined,
3708
+ tradeId: item.action.tradeId !== undefined ? {
3709
+ equals: item.action.tradeId
3710
+ } : undefined,
3461
3711
  },
3462
3712
  create: {
3463
3713
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3475,6 +3725,12 @@ export const Trade = {
3475
3725
  upsert: props.asset.positions.map((item) => ({
3476
3726
  where: {
3477
3727
  id: item.id !== undefined ? item.id : undefined,
3728
+ assetId: item.assetId !== undefined ? {
3729
+ equals: item.assetId
3730
+ } : undefined,
3731
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3732
+ equals: item.alpacaAccountId
3733
+ } : undefined,
3478
3734
  },
3479
3735
  update: {
3480
3736
  id: item.id !== undefined ? {
@@ -3525,6 +3781,9 @@ export const Trade = {
3525
3781
  id: item.alpacaAccount.id !== undefined ? {
3526
3782
  equals: item.alpacaAccount.id
3527
3783
  } : undefined,
3784
+ userId: item.alpacaAccount.userId !== undefined ? {
3785
+ equals: item.alpacaAccount.userId
3786
+ } : undefined,
3528
3787
  },
3529
3788
  update: {
3530
3789
  id: item.alpacaAccount.id !== undefined ? {
@@ -3595,6 +3854,9 @@ export const Trade = {
3595
3854
  : { connectOrCreate: {
3596
3855
  where: {
3597
3856
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3857
+ userId: item.alpacaAccount.userId !== undefined ? {
3858
+ equals: item.alpacaAccount.userId
3859
+ } : undefined,
3598
3860
  },
3599
3861
  create: {
3600
3862
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3617,6 +3879,12 @@ export const Trade = {
3617
3879
  where: {
3618
3880
  id: item.id !== undefined ? item.id : undefined,
3619
3881
  url: item.url !== undefined ? item.url : undefined,
3882
+ assetId: item.assetId !== undefined ? {
3883
+ equals: item.assetId
3884
+ } : undefined,
3885
+ newsArticleId: item.newsArticleId !== undefined ? {
3886
+ equals: item.newsArticleId
3887
+ } : undefined,
3620
3888
  },
3621
3889
  update: {
3622
3890
  id: item.id !== undefined ? {
@@ -3814,6 +4082,15 @@ export const Trade = {
3814
4082
  : { connectOrCreate: props.asset.orders.map((item) => ({
3815
4083
  where: {
3816
4084
  id: item.id !== undefined ? item.id : undefined,
4085
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4086
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4087
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4088
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4089
+ equals: item.alpacaAccountId
4090
+ } : undefined,
4091
+ assetId: item.assetId !== undefined ? {
4092
+ equals: item.assetId
4093
+ } : undefined,
3817
4094
  },
3818
4095
  create: {
3819
4096
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3847,6 +4124,7 @@ export const Trade = {
3847
4124
  : { connectOrCreate: {
3848
4125
  where: {
3849
4126
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4127
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3850
4128
  },
3851
4129
  create: {
3852
4130
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3863,6 +4141,7 @@ export const Trade = {
3863
4141
  : { connectOrCreate: {
3864
4142
  where: {
3865
4143
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
4144
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3866
4145
  },
3867
4146
  create: {
3868
4147
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3879,6 +4158,9 @@ export const Trade = {
3879
4158
  : { connectOrCreate: {
3880
4159
  where: {
3881
4160
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4161
+ userId: item.alpacaAccount.userId !== undefined ? {
4162
+ equals: item.alpacaAccount.userId
4163
+ } : undefined,
3882
4164
  },
3883
4165
  create: {
3884
4166
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3902,6 +4184,9 @@ export const Trade = {
3902
4184
  : { connectOrCreate: {
3903
4185
  where: {
3904
4186
  id: item.action.id !== undefined ? item.action.id : undefined,
4187
+ tradeId: item.action.tradeId !== undefined ? {
4188
+ equals: item.action.tradeId
4189
+ } : undefined,
3905
4190
  },
3906
4191
  create: {
3907
4192
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3924,6 +4209,12 @@ export const Trade = {
3924
4209
  : { connectOrCreate: props.asset.positions.map((item) => ({
3925
4210
  where: {
3926
4211
  id: item.id !== undefined ? item.id : undefined,
4212
+ assetId: item.assetId !== undefined ? {
4213
+ equals: item.assetId
4214
+ } : undefined,
4215
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4216
+ equals: item.alpacaAccountId
4217
+ } : undefined,
3927
4218
  },
3928
4219
  create: {
3929
4220
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -3948,6 +4239,9 @@ export const Trade = {
3948
4239
  : { connectOrCreate: {
3949
4240
  where: {
3950
4241
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4242
+ userId: item.alpacaAccount.userId !== undefined ? {
4243
+ equals: item.alpacaAccount.userId
4244
+ } : undefined,
3951
4245
  },
3952
4246
  create: {
3953
4247
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3975,6 +4269,12 @@ export const Trade = {
3975
4269
  where: {
3976
4270
  id: item.id !== undefined ? item.id : undefined,
3977
4271
  url: item.url !== undefined ? item.url : undefined,
4272
+ assetId: item.assetId !== undefined ? {
4273
+ equals: item.assetId
4274
+ } : undefined,
4275
+ newsArticleId: item.newsArticleId !== undefined ? {
4276
+ equals: item.newsArticleId
4277
+ } : undefined,
3978
4278
  },
3979
4279
  create: {
3980
4280
  url: item.url !== undefined ? item.url : undefined,
@@ -4022,6 +4322,9 @@ export const Trade = {
4022
4322
  upsert: props.actions.map((item) => ({
4023
4323
  where: {
4024
4324
  id: item.id !== undefined ? item.id : undefined,
4325
+ tradeId: item.tradeId !== undefined ? {
4326
+ equals: item.tradeId
4327
+ } : undefined,
4025
4328
  },
4026
4329
  update: {
4027
4330
  id: item.id !== undefined ? {
@@ -4048,6 +4351,18 @@ export const Trade = {
4048
4351
  id: item.order.id !== undefined ? {
4049
4352
  equals: item.order.id
4050
4353
  } : undefined,
4354
+ clientOrderId: item.order.clientOrderId !== undefined ? {
4355
+ equals: item.order.clientOrderId
4356
+ } : undefined,
4357
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
4358
+ equals: item.order.alpacaAccountId
4359
+ } : undefined,
4360
+ assetId: item.order.assetId !== undefined ? {
4361
+ equals: item.order.assetId
4362
+ } : undefined,
4363
+ actionId: item.order.actionId !== undefined ? {
4364
+ equals: item.order.actionId
4365
+ } : undefined,
4051
4366
  },
4052
4367
  update: {
4053
4368
  id: item.order.id !== undefined ? {
@@ -4125,6 +4440,9 @@ export const Trade = {
4125
4440
  id: item.order.stopLoss.id !== undefined ? {
4126
4441
  equals: item.order.stopLoss.id
4127
4442
  } : undefined,
4443
+ orderId: item.order.stopLoss.orderId !== undefined ? {
4444
+ equals: item.order.stopLoss.orderId
4445
+ } : undefined,
4128
4446
  },
4129
4447
  update: {
4130
4448
  id: item.order.stopLoss.id !== undefined ? {
@@ -4149,6 +4467,9 @@ export const Trade = {
4149
4467
  id: item.order.takeProfit.id !== undefined ? {
4150
4468
  equals: item.order.takeProfit.id
4151
4469
  } : undefined,
4470
+ orderId: item.order.takeProfit.orderId !== undefined ? {
4471
+ equals: item.order.takeProfit.orderId
4472
+ } : undefined,
4152
4473
  },
4153
4474
  update: {
4154
4475
  id: item.order.takeProfit.id !== undefined ? {
@@ -4173,6 +4494,9 @@ export const Trade = {
4173
4494
  id: item.order.alpacaAccount.id !== undefined ? {
4174
4495
  equals: item.order.alpacaAccount.id
4175
4496
  } : undefined,
4497
+ userId: item.order.alpacaAccount.userId !== undefined ? {
4498
+ equals: item.order.alpacaAccount.userId
4499
+ } : undefined,
4176
4500
  },
4177
4501
  update: {
4178
4502
  id: item.order.alpacaAccount.id !== undefined ? {
@@ -4494,6 +4818,7 @@ export const Trade = {
4494
4818
  : { connectOrCreate: {
4495
4819
  where: {
4496
4820
  id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
4821
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
4497
4822
  },
4498
4823
  create: {
4499
4824
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -4510,6 +4835,7 @@ export const Trade = {
4510
4835
  : { connectOrCreate: {
4511
4836
  where: {
4512
4837
  id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
4838
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
4513
4839
  },
4514
4840
  create: {
4515
4841
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -4526,6 +4852,9 @@ export const Trade = {
4526
4852
  : { connectOrCreate: {
4527
4853
  where: {
4528
4854
  id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
4855
+ userId: item.order.alpacaAccount.userId !== undefined ? {
4856
+ equals: item.order.alpacaAccount.userId
4857
+ } : undefined,
4529
4858
  },
4530
4859
  create: {
4531
4860
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -4630,6 +4959,15 @@ export const Trade = {
4630
4959
  : { connectOrCreate: {
4631
4960
  where: {
4632
4961
  id: item.order.id !== undefined ? item.order.id : undefined,
4962
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
4963
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
4964
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
4965
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
4966
+ equals: item.order.alpacaAccountId
4967
+ } : undefined,
4968
+ assetId: item.order.assetId !== undefined ? {
4969
+ equals: item.order.assetId
4970
+ } : undefined,
4633
4971
  },
4634
4972
  create: {
4635
4973
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -4663,6 +5001,7 @@ export const Trade = {
4663
5001
  : { connectOrCreate: {
4664
5002
  where: {
4665
5003
  id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
5004
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
4666
5005
  },
4667
5006
  create: {
4668
5007
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -4679,6 +5018,7 @@ export const Trade = {
4679
5018
  : { connectOrCreate: {
4680
5019
  where: {
4681
5020
  id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
5021
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
4682
5022
  },
4683
5023
  create: {
4684
5024
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -4695,6 +5035,9 @@ export const Trade = {
4695
5035
  : { connectOrCreate: {
4696
5036
  where: {
4697
5037
  id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
5038
+ userId: item.order.alpacaAccount.userId !== undefined ? {
5039
+ equals: item.order.alpacaAccount.userId
5040
+ } : undefined,
4698
5041
  },
4699
5042
  create: {
4700
5043
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -4821,8 +5164,12 @@ export const Trade = {
4821
5164
  const variables = props.map(prop => ({
4822
5165
  where: {
4823
5166
  id: prop.id !== undefined ? prop.id : undefined,
4824
- alpacaAccountId: prop.alpacaAccountId !== undefined ? prop.alpacaAccountId : undefined,
4825
- assetId: prop.assetId !== undefined ? prop.assetId : undefined,
5167
+ alpacaAccountId: prop.alpacaAccountId !== undefined ? {
5168
+ equals: prop.alpacaAccountId
5169
+ } : undefined,
5170
+ assetId: prop.assetId !== undefined ? {
5171
+ equals: prop.assetId
5172
+ } : undefined,
4826
5173
  qty: prop.qty !== undefined ? prop.qty : undefined,
4827
5174
  price: prop.price !== undefined ? prop.price : undefined,
4828
5175
  total: prop.total !== undefined ? prop.total : undefined,
@@ -4886,6 +5233,9 @@ export const Trade = {
4886
5233
  id: prop.alpacaAccount.id !== undefined ? {
4887
5234
  equals: prop.alpacaAccount.id
4888
5235
  } : undefined,
5236
+ userId: prop.alpacaAccount.userId !== undefined ? {
5237
+ equals: prop.alpacaAccount.userId
5238
+ } : undefined,
4889
5239
  },
4890
5240
  update: {
4891
5241
  id: prop.alpacaAccount.id !== undefined ? {
@@ -4974,9 +5324,21 @@ export const Trade = {
4974
5324
  id: prop.alpacaAccount.user.customer.id !== undefined ? {
4975
5325
  equals: prop.alpacaAccount.user.customer.id
4976
5326
  } : undefined,
5327
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5328
+ equals: prop.alpacaAccount.user.customer.authUserId
5329
+ } : undefined,
4977
5330
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
4978
5331
  equals: prop.alpacaAccount.user.customer.name
4979
5332
  } : undefined,
5333
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
5334
+ equals: prop.alpacaAccount.user.customer.stripeCustomerId
5335
+ } : undefined,
5336
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
5337
+ equals: prop.alpacaAccount.user.customer.stripeSubscriptionId
5338
+ } : undefined,
5339
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5340
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5341
+ } : undefined,
4980
5342
  },
4981
5343
  update: {
4982
5344
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -5016,6 +5378,12 @@ export const Trade = {
5016
5378
  upsert: prop.alpacaAccount.user.accounts.map((item) => ({
5017
5379
  where: {
5018
5380
  id: item.id !== undefined ? item.id : undefined,
5381
+ userId: item.userId !== undefined ? {
5382
+ equals: item.userId
5383
+ } : undefined,
5384
+ providerAccountId: item.providerAccountId !== undefined ? {
5385
+ equals: item.providerAccountId
5386
+ } : undefined,
5019
5387
  },
5020
5388
  update: {
5021
5389
  id: item.id !== undefined ? {
@@ -5070,6 +5438,9 @@ export const Trade = {
5070
5438
  upsert: prop.alpacaAccount.user.sessions.map((item) => ({
5071
5439
  where: {
5072
5440
  id: item.id !== undefined ? item.id : undefined,
5441
+ userId: item.userId !== undefined ? {
5442
+ equals: item.userId
5443
+ } : undefined,
5073
5444
  },
5074
5445
  update: {
5075
5446
  id: item.id !== undefined ? {
@@ -5092,6 +5463,9 @@ export const Trade = {
5092
5463
  upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
5093
5464
  where: {
5094
5465
  id: item.id !== undefined ? item.id : undefined,
5466
+ userId: item.userId !== undefined ? {
5467
+ equals: item.userId
5468
+ } : undefined,
5095
5469
  },
5096
5470
  update: {
5097
5471
  id: item.id !== undefined ? {
@@ -5136,9 +5510,17 @@ export const Trade = {
5136
5510
  : { connectOrCreate: {
5137
5511
  where: {
5138
5512
  id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
5513
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
5514
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
5515
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5516
+ equals: prop.alpacaAccount.user.customer.authUserId
5517
+ } : undefined,
5139
5518
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5140
5519
  equals: prop.alpacaAccount.user.customer.name
5141
5520
  } : undefined,
5521
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5522
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5523
+ } : undefined,
5142
5524
  },
5143
5525
  create: {
5144
5526
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -5160,6 +5542,12 @@ export const Trade = {
5160
5542
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
5161
5543
  where: {
5162
5544
  id: item.id !== undefined ? item.id : undefined,
5545
+ userId: item.userId !== undefined ? {
5546
+ equals: item.userId
5547
+ } : undefined,
5548
+ providerAccountId: item.providerAccountId !== undefined ? {
5549
+ equals: item.providerAccountId
5550
+ } : undefined,
5163
5551
  },
5164
5552
  create: {
5165
5553
  type: item.type !== undefined ? item.type : undefined,
@@ -5184,6 +5572,9 @@ export const Trade = {
5184
5572
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
5185
5573
  where: {
5186
5574
  id: item.id !== undefined ? item.id : undefined,
5575
+ userId: item.userId !== undefined ? {
5576
+ equals: item.userId
5577
+ } : undefined,
5187
5578
  },
5188
5579
  create: {
5189
5580
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -5200,6 +5591,9 @@ export const Trade = {
5200
5591
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
5201
5592
  where: {
5202
5593
  id: item.id !== undefined ? item.id : undefined,
5594
+ userId: item.userId !== undefined ? {
5595
+ equals: item.userId
5596
+ } : undefined,
5203
5597
  },
5204
5598
  create: {
5205
5599
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -5215,6 +5609,15 @@ export const Trade = {
5215
5609
  upsert: prop.alpacaAccount.orders.map((item) => ({
5216
5610
  where: {
5217
5611
  id: item.id !== undefined ? item.id : undefined,
5612
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5613
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5614
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5615
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5616
+ equals: item.alpacaAccountId
5617
+ } : undefined,
5618
+ assetId: item.assetId !== undefined ? {
5619
+ equals: item.assetId
5620
+ } : undefined,
5218
5621
  },
5219
5622
  update: {
5220
5623
  id: item.id !== undefined ? {
@@ -5292,6 +5695,9 @@ export const Trade = {
5292
5695
  id: item.stopLoss.id !== undefined ? {
5293
5696
  equals: item.stopLoss.id
5294
5697
  } : undefined,
5698
+ orderId: item.stopLoss.orderId !== undefined ? {
5699
+ equals: item.stopLoss.orderId
5700
+ } : undefined,
5295
5701
  },
5296
5702
  update: {
5297
5703
  id: item.stopLoss.id !== undefined ? {
@@ -5316,6 +5722,9 @@ export const Trade = {
5316
5722
  id: item.takeProfit.id !== undefined ? {
5317
5723
  equals: item.takeProfit.id
5318
5724
  } : undefined,
5725
+ orderId: item.takeProfit.orderId !== undefined ? {
5726
+ equals: item.takeProfit.orderId
5727
+ } : undefined,
5319
5728
  },
5320
5729
  update: {
5321
5730
  id: item.takeProfit.id !== undefined ? {
@@ -5340,6 +5749,9 @@ export const Trade = {
5340
5749
  id: item.action.id !== undefined ? {
5341
5750
  equals: item.action.id
5342
5751
  } : undefined,
5752
+ tradeId: item.action.tradeId !== undefined ? {
5753
+ equals: item.action.tradeId
5754
+ } : undefined,
5343
5755
  },
5344
5756
  update: {
5345
5757
  id: item.action.id !== undefined ? {
@@ -5645,6 +6057,7 @@ export const Trade = {
5645
6057
  : { connectOrCreate: {
5646
6058
  where: {
5647
6059
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
6060
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
5648
6061
  },
5649
6062
  create: {
5650
6063
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -5661,6 +6074,7 @@ export const Trade = {
5661
6074
  : { connectOrCreate: {
5662
6075
  where: {
5663
6076
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
6077
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
5664
6078
  },
5665
6079
  create: {
5666
6080
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -5677,6 +6091,9 @@ export const Trade = {
5677
6091
  : { connectOrCreate: {
5678
6092
  where: {
5679
6093
  id: item.action.id !== undefined ? item.action.id : undefined,
6094
+ tradeId: item.action.tradeId !== undefined ? {
6095
+ equals: item.action.tradeId
6096
+ } : undefined,
5680
6097
  },
5681
6098
  create: {
5682
6099
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -5765,6 +6182,12 @@ export const Trade = {
5765
6182
  upsert: prop.alpacaAccount.positions.map((item) => ({
5766
6183
  where: {
5767
6184
  id: item.id !== undefined ? item.id : undefined,
6185
+ assetId: item.assetId !== undefined ? {
6186
+ equals: item.assetId
6187
+ } : undefined,
6188
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6189
+ equals: item.alpacaAccountId
6190
+ } : undefined,
5768
6191
  },
5769
6192
  update: {
5770
6193
  id: item.id !== undefined ? {
@@ -6144,6 +6567,9 @@ export const Trade = {
6144
6567
  upsert: prop.alpacaAccount.alerts.map((item) => ({
6145
6568
  where: {
6146
6569
  id: item.id !== undefined ? item.id : undefined,
6570
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6571
+ equals: item.alpacaAccountId
6572
+ } : undefined,
6147
6573
  },
6148
6574
  update: {
6149
6575
  id: item.id !== undefined ? {
@@ -6212,9 +6638,17 @@ export const Trade = {
6212
6638
  : { connectOrCreate: {
6213
6639
  where: {
6214
6640
  id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
6641
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
6642
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
6643
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
6644
+ equals: prop.alpacaAccount.user.customer.authUserId
6645
+ } : undefined,
6215
6646
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
6216
6647
  equals: prop.alpacaAccount.user.customer.name
6217
6648
  } : undefined,
6649
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
6650
+ equals: prop.alpacaAccount.user.customer.stripePriceId
6651
+ } : undefined,
6218
6652
  },
6219
6653
  create: {
6220
6654
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -6236,6 +6670,12 @@ export const Trade = {
6236
6670
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
6237
6671
  where: {
6238
6672
  id: item.id !== undefined ? item.id : undefined,
6673
+ userId: item.userId !== undefined ? {
6674
+ equals: item.userId
6675
+ } : undefined,
6676
+ providerAccountId: item.providerAccountId !== undefined ? {
6677
+ equals: item.providerAccountId
6678
+ } : undefined,
6239
6679
  },
6240
6680
  create: {
6241
6681
  type: item.type !== undefined ? item.type : undefined,
@@ -6260,6 +6700,9 @@ export const Trade = {
6260
6700
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
6261
6701
  where: {
6262
6702
  id: item.id !== undefined ? item.id : undefined,
6703
+ userId: item.userId !== undefined ? {
6704
+ equals: item.userId
6705
+ } : undefined,
6263
6706
  },
6264
6707
  create: {
6265
6708
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -6276,6 +6719,9 @@ export const Trade = {
6276
6719
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
6277
6720
  where: {
6278
6721
  id: item.id !== undefined ? item.id : undefined,
6722
+ userId: item.userId !== undefined ? {
6723
+ equals: item.userId
6724
+ } : undefined,
6279
6725
  },
6280
6726
  create: {
6281
6727
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -6296,6 +6742,15 @@ export const Trade = {
6296
6742
  : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
6297
6743
  where: {
6298
6744
  id: item.id !== undefined ? item.id : undefined,
6745
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6746
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6747
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6748
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6749
+ equals: item.alpacaAccountId
6750
+ } : undefined,
6751
+ assetId: item.assetId !== undefined ? {
6752
+ equals: item.assetId
6753
+ } : undefined,
6299
6754
  },
6300
6755
  create: {
6301
6756
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6329,6 +6784,7 @@ export const Trade = {
6329
6784
  : { connectOrCreate: {
6330
6785
  where: {
6331
6786
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
6787
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6332
6788
  },
6333
6789
  create: {
6334
6790
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6345,6 +6801,7 @@ export const Trade = {
6345
6801
  : { connectOrCreate: {
6346
6802
  where: {
6347
6803
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
6804
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6348
6805
  },
6349
6806
  create: {
6350
6807
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6361,6 +6818,9 @@ export const Trade = {
6361
6818
  : { connectOrCreate: {
6362
6819
  where: {
6363
6820
  id: item.action.id !== undefined ? item.action.id : undefined,
6821
+ tradeId: item.action.tradeId !== undefined ? {
6822
+ equals: item.action.tradeId
6823
+ } : undefined,
6364
6824
  },
6365
6825
  create: {
6366
6826
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6454,6 +6914,12 @@ export const Trade = {
6454
6914
  : { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
6455
6915
  where: {
6456
6916
  id: item.id !== undefined ? item.id : undefined,
6917
+ assetId: item.assetId !== undefined ? {
6918
+ equals: item.assetId
6919
+ } : undefined,
6920
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6921
+ equals: item.alpacaAccountId
6922
+ } : undefined,
6457
6923
  },
6458
6924
  create: {
6459
6925
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -6552,6 +7018,9 @@ export const Trade = {
6552
7018
  : { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
6553
7019
  where: {
6554
7020
  id: item.id !== undefined ? item.id : undefined,
7021
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7022
+ equals: item.alpacaAccountId
7023
+ } : undefined,
6555
7024
  },
6556
7025
  create: {
6557
7026
  message: item.message !== undefined ? item.message : undefined,
@@ -6749,6 +7218,15 @@ export const Trade = {
6749
7218
  upsert: prop.asset.orders.map((item) => ({
6750
7219
  where: {
6751
7220
  id: item.id !== undefined ? item.id : undefined,
7221
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7222
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7223
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7224
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7225
+ equals: item.alpacaAccountId
7226
+ } : undefined,
7227
+ assetId: item.assetId !== undefined ? {
7228
+ equals: item.assetId
7229
+ } : undefined,
6752
7230
  },
6753
7231
  update: {
6754
7232
  id: item.id !== undefined ? {
@@ -6826,6 +7304,9 @@ export const Trade = {
6826
7304
  id: item.stopLoss.id !== undefined ? {
6827
7305
  equals: item.stopLoss.id
6828
7306
  } : undefined,
7307
+ orderId: item.stopLoss.orderId !== undefined ? {
7308
+ equals: item.stopLoss.orderId
7309
+ } : undefined,
6829
7310
  },
6830
7311
  update: {
6831
7312
  id: item.stopLoss.id !== undefined ? {
@@ -6850,6 +7331,9 @@ export const Trade = {
6850
7331
  id: item.takeProfit.id !== undefined ? {
6851
7332
  equals: item.takeProfit.id
6852
7333
  } : undefined,
7334
+ orderId: item.takeProfit.orderId !== undefined ? {
7335
+ equals: item.takeProfit.orderId
7336
+ } : undefined,
6853
7337
  },
6854
7338
  update: {
6855
7339
  id: item.takeProfit.id !== undefined ? {
@@ -6874,6 +7358,9 @@ export const Trade = {
6874
7358
  id: item.alpacaAccount.id !== undefined ? {
6875
7359
  equals: item.alpacaAccount.id
6876
7360
  } : undefined,
7361
+ userId: item.alpacaAccount.userId !== undefined ? {
7362
+ equals: item.alpacaAccount.userId
7363
+ } : undefined,
6877
7364
  },
6878
7365
  update: {
6879
7366
  id: item.alpacaAccount.id !== undefined ? {
@@ -6926,6 +7413,9 @@ export const Trade = {
6926
7413
  id: item.action.id !== undefined ? {
6927
7414
  equals: item.action.id
6928
7415
  } : undefined,
7416
+ tradeId: item.action.tradeId !== undefined ? {
7417
+ equals: item.action.tradeId
7418
+ } : undefined,
6929
7419
  },
6930
7420
  update: {
6931
7421
  id: item.action.id !== undefined ? {
@@ -6989,6 +7479,7 @@ export const Trade = {
6989
7479
  : { connectOrCreate: {
6990
7480
  where: {
6991
7481
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7482
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6992
7483
  },
6993
7484
  create: {
6994
7485
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -7005,6 +7496,7 @@ export const Trade = {
7005
7496
  : { connectOrCreate: {
7006
7497
  where: {
7007
7498
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7499
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
7008
7500
  },
7009
7501
  create: {
7010
7502
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -7021,6 +7513,9 @@ export const Trade = {
7021
7513
  : { connectOrCreate: {
7022
7514
  where: {
7023
7515
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
7516
+ userId: item.alpacaAccount.userId !== undefined ? {
7517
+ equals: item.alpacaAccount.userId
7518
+ } : undefined,
7024
7519
  },
7025
7520
  create: {
7026
7521
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7044,6 +7539,9 @@ export const Trade = {
7044
7539
  : { connectOrCreate: {
7045
7540
  where: {
7046
7541
  id: item.action.id !== undefined ? item.action.id : undefined,
7542
+ tradeId: item.action.tradeId !== undefined ? {
7543
+ equals: item.action.tradeId
7544
+ } : undefined,
7047
7545
  },
7048
7546
  create: {
7049
7547
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -7061,6 +7559,12 @@ export const Trade = {
7061
7559
  upsert: prop.asset.positions.map((item) => ({
7062
7560
  where: {
7063
7561
  id: item.id !== undefined ? item.id : undefined,
7562
+ assetId: item.assetId !== undefined ? {
7563
+ equals: item.assetId
7564
+ } : undefined,
7565
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7566
+ equals: item.alpacaAccountId
7567
+ } : undefined,
7064
7568
  },
7065
7569
  update: {
7066
7570
  id: item.id !== undefined ? {
@@ -7111,6 +7615,9 @@ export const Trade = {
7111
7615
  id: item.alpacaAccount.id !== undefined ? {
7112
7616
  equals: item.alpacaAccount.id
7113
7617
  } : undefined,
7618
+ userId: item.alpacaAccount.userId !== undefined ? {
7619
+ equals: item.alpacaAccount.userId
7620
+ } : undefined,
7114
7621
  },
7115
7622
  update: {
7116
7623
  id: item.alpacaAccount.id !== undefined ? {
@@ -7181,6 +7688,9 @@ export const Trade = {
7181
7688
  : { connectOrCreate: {
7182
7689
  where: {
7183
7690
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
7691
+ userId: item.alpacaAccount.userId !== undefined ? {
7692
+ equals: item.alpacaAccount.userId
7693
+ } : undefined,
7184
7694
  },
7185
7695
  create: {
7186
7696
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7203,6 +7713,12 @@ export const Trade = {
7203
7713
  where: {
7204
7714
  id: item.id !== undefined ? item.id : undefined,
7205
7715
  url: item.url !== undefined ? item.url : undefined,
7716
+ assetId: item.assetId !== undefined ? {
7717
+ equals: item.assetId
7718
+ } : undefined,
7719
+ newsArticleId: item.newsArticleId !== undefined ? {
7720
+ equals: item.newsArticleId
7721
+ } : undefined,
7206
7722
  },
7207
7723
  update: {
7208
7724
  id: item.id !== undefined ? {
@@ -7400,6 +7916,15 @@ export const Trade = {
7400
7916
  : { connectOrCreate: prop.asset.orders.map((item) => ({
7401
7917
  where: {
7402
7918
  id: item.id !== undefined ? item.id : undefined,
7919
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7920
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7921
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7922
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7923
+ equals: item.alpacaAccountId
7924
+ } : undefined,
7925
+ assetId: item.assetId !== undefined ? {
7926
+ equals: item.assetId
7927
+ } : undefined,
7403
7928
  },
7404
7929
  create: {
7405
7930
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -7433,6 +7958,7 @@ export const Trade = {
7433
7958
  : { connectOrCreate: {
7434
7959
  where: {
7435
7960
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7961
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
7436
7962
  },
7437
7963
  create: {
7438
7964
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -7449,6 +7975,7 @@ export const Trade = {
7449
7975
  : { connectOrCreate: {
7450
7976
  where: {
7451
7977
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7978
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
7452
7979
  },
7453
7980
  create: {
7454
7981
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -7465,6 +7992,9 @@ export const Trade = {
7465
7992
  : { connectOrCreate: {
7466
7993
  where: {
7467
7994
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
7995
+ userId: item.alpacaAccount.userId !== undefined ? {
7996
+ equals: item.alpacaAccount.userId
7997
+ } : undefined,
7468
7998
  },
7469
7999
  create: {
7470
8000
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7488,6 +8018,9 @@ export const Trade = {
7488
8018
  : { connectOrCreate: {
7489
8019
  where: {
7490
8020
  id: item.action.id !== undefined ? item.action.id : undefined,
8021
+ tradeId: item.action.tradeId !== undefined ? {
8022
+ equals: item.action.tradeId
8023
+ } : undefined,
7491
8024
  },
7492
8025
  create: {
7493
8026
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -7510,6 +8043,12 @@ export const Trade = {
7510
8043
  : { connectOrCreate: prop.asset.positions.map((item) => ({
7511
8044
  where: {
7512
8045
  id: item.id !== undefined ? item.id : undefined,
8046
+ assetId: item.assetId !== undefined ? {
8047
+ equals: item.assetId
8048
+ } : undefined,
8049
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
8050
+ equals: item.alpacaAccountId
8051
+ } : undefined,
7513
8052
  },
7514
8053
  create: {
7515
8054
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -7534,6 +8073,9 @@ export const Trade = {
7534
8073
  : { connectOrCreate: {
7535
8074
  where: {
7536
8075
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
8076
+ userId: item.alpacaAccount.userId !== undefined ? {
8077
+ equals: item.alpacaAccount.userId
8078
+ } : undefined,
7537
8079
  },
7538
8080
  create: {
7539
8081
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -7561,6 +8103,12 @@ export const Trade = {
7561
8103
  where: {
7562
8104
  id: item.id !== undefined ? item.id : undefined,
7563
8105
  url: item.url !== undefined ? item.url : undefined,
8106
+ assetId: item.assetId !== undefined ? {
8107
+ equals: item.assetId
8108
+ } : undefined,
8109
+ newsArticleId: item.newsArticleId !== undefined ? {
8110
+ equals: item.newsArticleId
8111
+ } : undefined,
7564
8112
  },
7565
8113
  create: {
7566
8114
  url: item.url !== undefined ? item.url : undefined,
@@ -7608,6 +8156,9 @@ export const Trade = {
7608
8156
  upsert: prop.actions.map((item) => ({
7609
8157
  where: {
7610
8158
  id: item.id !== undefined ? item.id : undefined,
8159
+ tradeId: item.tradeId !== undefined ? {
8160
+ equals: item.tradeId
8161
+ } : undefined,
7611
8162
  },
7612
8163
  update: {
7613
8164
  id: item.id !== undefined ? {
@@ -7634,6 +8185,18 @@ export const Trade = {
7634
8185
  id: item.order.id !== undefined ? {
7635
8186
  equals: item.order.id
7636
8187
  } : undefined,
8188
+ clientOrderId: item.order.clientOrderId !== undefined ? {
8189
+ equals: item.order.clientOrderId
8190
+ } : undefined,
8191
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
8192
+ equals: item.order.alpacaAccountId
8193
+ } : undefined,
8194
+ assetId: item.order.assetId !== undefined ? {
8195
+ equals: item.order.assetId
8196
+ } : undefined,
8197
+ actionId: item.order.actionId !== undefined ? {
8198
+ equals: item.order.actionId
8199
+ } : undefined,
7637
8200
  },
7638
8201
  update: {
7639
8202
  id: item.order.id !== undefined ? {
@@ -7711,6 +8274,9 @@ export const Trade = {
7711
8274
  id: item.order.stopLoss.id !== undefined ? {
7712
8275
  equals: item.order.stopLoss.id
7713
8276
  } : undefined,
8277
+ orderId: item.order.stopLoss.orderId !== undefined ? {
8278
+ equals: item.order.stopLoss.orderId
8279
+ } : undefined,
7714
8280
  },
7715
8281
  update: {
7716
8282
  id: item.order.stopLoss.id !== undefined ? {
@@ -7735,6 +8301,9 @@ export const Trade = {
7735
8301
  id: item.order.takeProfit.id !== undefined ? {
7736
8302
  equals: item.order.takeProfit.id
7737
8303
  } : undefined,
8304
+ orderId: item.order.takeProfit.orderId !== undefined ? {
8305
+ equals: item.order.takeProfit.orderId
8306
+ } : undefined,
7738
8307
  },
7739
8308
  update: {
7740
8309
  id: item.order.takeProfit.id !== undefined ? {
@@ -7759,6 +8328,9 @@ export const Trade = {
7759
8328
  id: item.order.alpacaAccount.id !== undefined ? {
7760
8329
  equals: item.order.alpacaAccount.id
7761
8330
  } : undefined,
8331
+ userId: item.order.alpacaAccount.userId !== undefined ? {
8332
+ equals: item.order.alpacaAccount.userId
8333
+ } : undefined,
7762
8334
  },
7763
8335
  update: {
7764
8336
  id: item.order.alpacaAccount.id !== undefined ? {
@@ -8080,6 +8652,7 @@ export const Trade = {
8080
8652
  : { connectOrCreate: {
8081
8653
  where: {
8082
8654
  id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
8655
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
8083
8656
  },
8084
8657
  create: {
8085
8658
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -8096,6 +8669,7 @@ export const Trade = {
8096
8669
  : { connectOrCreate: {
8097
8670
  where: {
8098
8671
  id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
8672
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
8099
8673
  },
8100
8674
  create: {
8101
8675
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -8112,6 +8686,9 @@ export const Trade = {
8112
8686
  : { connectOrCreate: {
8113
8687
  where: {
8114
8688
  id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
8689
+ userId: item.order.alpacaAccount.userId !== undefined ? {
8690
+ equals: item.order.alpacaAccount.userId
8691
+ } : undefined,
8115
8692
  },
8116
8693
  create: {
8117
8694
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -8216,6 +8793,15 @@ export const Trade = {
8216
8793
  : { connectOrCreate: {
8217
8794
  where: {
8218
8795
  id: item.order.id !== undefined ? item.order.id : undefined,
8796
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
8797
+ actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
8798
+ stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
8799
+ alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
8800
+ equals: item.order.alpacaAccountId
8801
+ } : undefined,
8802
+ assetId: item.order.assetId !== undefined ? {
8803
+ equals: item.order.assetId
8804
+ } : undefined,
8219
8805
  },
8220
8806
  create: {
8221
8807
  clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
@@ -8249,6 +8835,7 @@ export const Trade = {
8249
8835
  : { connectOrCreate: {
8250
8836
  where: {
8251
8837
  id: item.order.stopLoss.id !== undefined ? item.order.stopLoss.id : undefined,
8838
+ orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
8252
8839
  },
8253
8840
  create: {
8254
8841
  stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
@@ -8265,6 +8852,7 @@ export const Trade = {
8265
8852
  : { connectOrCreate: {
8266
8853
  where: {
8267
8854
  id: item.order.takeProfit.id !== undefined ? item.order.takeProfit.id : undefined,
8855
+ orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
8268
8856
  },
8269
8857
  create: {
8270
8858
  limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
@@ -8281,6 +8869,9 @@ export const Trade = {
8281
8869
  : { connectOrCreate: {
8282
8870
  where: {
8283
8871
  id: item.order.alpacaAccount.id !== undefined ? item.order.alpacaAccount.id : undefined,
8872
+ userId: item.order.alpacaAccount.userId !== undefined ? {
8873
+ equals: item.order.alpacaAccount.userId
8874
+ } : undefined,
8284
8875
  },
8285
8876
  create: {
8286
8877
  type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
@@ -8442,8 +9033,12 @@ export const Trade = {
8442
9033
  const variables = {
8443
9034
  where: {
8444
9035
  id: props.id !== undefined ? props.id : undefined,
8445
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
8446
- assetId: props.assetId !== undefined ? props.assetId : undefined,
9036
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
9037
+ equals: props.alpacaAccountId
9038
+ } : undefined,
9039
+ assetId: props.assetId !== undefined ? {
9040
+ equals: props.assetId
9041
+ } : undefined,
8447
9042
  qty: props.qty !== undefined ? props.qty : undefined,
8448
9043
  price: props.price !== undefined ? props.price : undefined,
8449
9044
  total: props.total !== undefined ? props.total : undefined,
@@ -8522,8 +9117,12 @@ export const Trade = {
8522
9117
  id: props.id !== undefined ? {
8523
9118
  equals: props.id
8524
9119
  } : undefined,
8525
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
8526
- assetId: props.assetId !== undefined ? props.assetId : undefined,
9120
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
9121
+ equals: props.alpacaAccountId
9122
+ } : undefined,
9123
+ assetId: props.assetId !== undefined ? {
9124
+ equals: props.assetId
9125
+ } : undefined,
8527
9126
  qty: props.qty !== undefined ? props.qty : undefined,
8528
9127
  price: props.price !== undefined ? props.price : undefined,
8529
9128
  total: props.total !== undefined ? props.total : undefined,