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
@@ -225,6 +225,12 @@ exports.NewsArticleAssetSentiment = {
225
225
  : { connectOrCreate: props.asset.trades.map((item) => ({
226
226
  where: {
227
227
  id: item.id !== undefined ? item.id : undefined,
228
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
229
+ equals: item.alpacaAccountId
230
+ } : undefined,
231
+ assetId: item.assetId !== undefined ? {
232
+ equals: item.assetId
233
+ } : undefined,
228
234
  },
229
235
  create: {
230
236
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -247,6 +253,9 @@ exports.NewsArticleAssetSentiment = {
247
253
  : { connectOrCreate: {
248
254
  where: {
249
255
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
256
+ userId: item.alpacaAccount.userId !== undefined ? {
257
+ equals: item.alpacaAccount.userId
258
+ } : undefined,
250
259
  },
251
260
  create: {
252
261
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -270,6 +279,9 @@ exports.NewsArticleAssetSentiment = {
270
279
  : { connectOrCreate: item.actions.map((item) => ({
271
280
  where: {
272
281
  id: item.id !== undefined ? item.id : undefined,
282
+ tradeId: item.tradeId !== undefined ? {
283
+ equals: item.tradeId
284
+ } : undefined,
273
285
  },
274
286
  create: {
275
287
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -292,6 +304,15 @@ exports.NewsArticleAssetSentiment = {
292
304
  : { connectOrCreate: props.asset.orders.map((item) => ({
293
305
  where: {
294
306
  id: item.id !== undefined ? item.id : undefined,
307
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
308
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
309
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
310
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
311
+ equals: item.alpacaAccountId
312
+ } : undefined,
313
+ assetId: item.assetId !== undefined ? {
314
+ equals: item.assetId
315
+ } : undefined,
295
316
  },
296
317
  create: {
297
318
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -325,6 +346,7 @@ exports.NewsArticleAssetSentiment = {
325
346
  : { connectOrCreate: {
326
347
  where: {
327
348
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
349
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
328
350
  },
329
351
  create: {
330
352
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -341,6 +363,7 @@ exports.NewsArticleAssetSentiment = {
341
363
  : { connectOrCreate: {
342
364
  where: {
343
365
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
366
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
344
367
  },
345
368
  create: {
346
369
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -357,6 +380,9 @@ exports.NewsArticleAssetSentiment = {
357
380
  : { connectOrCreate: {
358
381
  where: {
359
382
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
383
+ userId: item.alpacaAccount.userId !== undefined ? {
384
+ equals: item.alpacaAccount.userId
385
+ } : undefined,
360
386
  },
361
387
  create: {
362
388
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -380,6 +406,9 @@ exports.NewsArticleAssetSentiment = {
380
406
  : { connectOrCreate: {
381
407
  where: {
382
408
  id: item.action.id !== undefined ? item.action.id : undefined,
409
+ tradeId: item.action.tradeId !== undefined ? {
410
+ equals: item.action.tradeId
411
+ } : undefined,
383
412
  },
384
413
  create: {
385
414
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -402,6 +431,12 @@ exports.NewsArticleAssetSentiment = {
402
431
  : { connectOrCreate: props.asset.positions.map((item) => ({
403
432
  where: {
404
433
  id: item.id !== undefined ? item.id : undefined,
434
+ assetId: item.assetId !== undefined ? {
435
+ equals: item.assetId
436
+ } : undefined,
437
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
438
+ equals: item.alpacaAccountId
439
+ } : undefined,
405
440
  },
406
441
  create: {
407
442
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -426,6 +461,9 @@ exports.NewsArticleAssetSentiment = {
426
461
  : { connectOrCreate: {
427
462
  where: {
428
463
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
464
+ userId: item.alpacaAccount.userId !== undefined ? {
465
+ equals: item.alpacaAccount.userId
466
+ } : undefined,
429
467
  },
430
468
  create: {
431
469
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -522,8 +560,12 @@ exports.NewsArticleAssetSentiment = {
522
560
  where: {
523
561
  id: props.id !== undefined ? props.id : undefined,
524
562
  url: props.url !== undefined ? props.url : undefined,
525
- assetId: props.assetId !== undefined ? props.assetId : undefined,
526
- newsArticleId: props.newsArticleId !== undefined ? props.newsArticleId : undefined,
563
+ assetId: props.assetId !== undefined ? {
564
+ equals: props.assetId
565
+ } : undefined,
566
+ newsArticleId: props.newsArticleId !== undefined ? {
567
+ equals: props.newsArticleId
568
+ } : undefined,
527
569
  relevancyScore: props.relevancyScore !== undefined ? props.relevancyScore : undefined,
528
570
  sentimentScore: props.sentimentScore !== undefined ? props.sentimentScore : undefined,
529
571
  sentimentLabel: props.sentimentLabel !== undefined ? props.sentimentLabel : undefined,
@@ -804,6 +846,12 @@ exports.NewsArticleAssetSentiment = {
804
846
  upsert: props.asset.trades.map((item) => ({
805
847
  where: {
806
848
  id: item.id !== undefined ? item.id : undefined,
849
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
850
+ equals: item.alpacaAccountId
851
+ } : undefined,
852
+ assetId: item.assetId !== undefined ? {
853
+ equals: item.assetId
854
+ } : undefined,
807
855
  },
808
856
  update: {
809
857
  id: item.id !== undefined ? {
@@ -848,6 +896,9 @@ exports.NewsArticleAssetSentiment = {
848
896
  id: item.alpacaAccount.id !== undefined ? {
849
897
  equals: item.alpacaAccount.id
850
898
  } : undefined,
899
+ userId: item.alpacaAccount.userId !== undefined ? {
900
+ equals: item.alpacaAccount.userId
901
+ } : undefined,
851
902
  },
852
903
  update: {
853
904
  id: item.alpacaAccount.id !== undefined ? {
@@ -898,6 +949,9 @@ exports.NewsArticleAssetSentiment = {
898
949
  upsert: item.actions.map((item) => ({
899
950
  where: {
900
951
  id: item.id !== undefined ? item.id : undefined,
952
+ tradeId: item.tradeId !== undefined ? {
953
+ equals: item.tradeId
954
+ } : undefined,
901
955
  },
902
956
  update: {
903
957
  id: item.id !== undefined ? {
@@ -950,6 +1004,9 @@ exports.NewsArticleAssetSentiment = {
950
1004
  : { connectOrCreate: {
951
1005
  where: {
952
1006
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1007
+ userId: item.alpacaAccount.userId !== undefined ? {
1008
+ equals: item.alpacaAccount.userId
1009
+ } : undefined,
953
1010
  },
954
1011
  create: {
955
1012
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -973,6 +1030,9 @@ exports.NewsArticleAssetSentiment = {
973
1030
  : { connectOrCreate: item.actions.map((item) => ({
974
1031
  where: {
975
1032
  id: item.id !== undefined ? item.id : undefined,
1033
+ tradeId: item.tradeId !== undefined ? {
1034
+ equals: item.tradeId
1035
+ } : undefined,
976
1036
  },
977
1037
  create: {
978
1038
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -990,6 +1050,15 @@ exports.NewsArticleAssetSentiment = {
990
1050
  upsert: props.asset.orders.map((item) => ({
991
1051
  where: {
992
1052
  id: item.id !== undefined ? item.id : undefined,
1053
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1054
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1055
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1056
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1057
+ equals: item.alpacaAccountId
1058
+ } : undefined,
1059
+ assetId: item.assetId !== undefined ? {
1060
+ equals: item.assetId
1061
+ } : undefined,
993
1062
  },
994
1063
  update: {
995
1064
  id: item.id !== undefined ? {
@@ -1067,6 +1136,9 @@ exports.NewsArticleAssetSentiment = {
1067
1136
  id: item.stopLoss.id !== undefined ? {
1068
1137
  equals: item.stopLoss.id
1069
1138
  } : undefined,
1139
+ orderId: item.stopLoss.orderId !== undefined ? {
1140
+ equals: item.stopLoss.orderId
1141
+ } : undefined,
1070
1142
  },
1071
1143
  update: {
1072
1144
  id: item.stopLoss.id !== undefined ? {
@@ -1091,6 +1163,9 @@ exports.NewsArticleAssetSentiment = {
1091
1163
  id: item.takeProfit.id !== undefined ? {
1092
1164
  equals: item.takeProfit.id
1093
1165
  } : undefined,
1166
+ orderId: item.takeProfit.orderId !== undefined ? {
1167
+ equals: item.takeProfit.orderId
1168
+ } : undefined,
1094
1169
  },
1095
1170
  update: {
1096
1171
  id: item.takeProfit.id !== undefined ? {
@@ -1115,6 +1190,9 @@ exports.NewsArticleAssetSentiment = {
1115
1190
  id: item.alpacaAccount.id !== undefined ? {
1116
1191
  equals: item.alpacaAccount.id
1117
1192
  } : undefined,
1193
+ userId: item.alpacaAccount.userId !== undefined ? {
1194
+ equals: item.alpacaAccount.userId
1195
+ } : undefined,
1118
1196
  },
1119
1197
  update: {
1120
1198
  id: item.alpacaAccount.id !== undefined ? {
@@ -1167,6 +1245,9 @@ exports.NewsArticleAssetSentiment = {
1167
1245
  id: item.action.id !== undefined ? {
1168
1246
  equals: item.action.id
1169
1247
  } : undefined,
1248
+ tradeId: item.action.tradeId !== undefined ? {
1249
+ equals: item.action.tradeId
1250
+ } : undefined,
1170
1251
  },
1171
1252
  update: {
1172
1253
  id: item.action.id !== undefined ? {
@@ -1230,6 +1311,7 @@ exports.NewsArticleAssetSentiment = {
1230
1311
  : { connectOrCreate: {
1231
1312
  where: {
1232
1313
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1314
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
1233
1315
  },
1234
1316
  create: {
1235
1317
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -1246,6 +1328,7 @@ exports.NewsArticleAssetSentiment = {
1246
1328
  : { connectOrCreate: {
1247
1329
  where: {
1248
1330
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1331
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
1249
1332
  },
1250
1333
  create: {
1251
1334
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -1262,6 +1345,9 @@ exports.NewsArticleAssetSentiment = {
1262
1345
  : { connectOrCreate: {
1263
1346
  where: {
1264
1347
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1348
+ userId: item.alpacaAccount.userId !== undefined ? {
1349
+ equals: item.alpacaAccount.userId
1350
+ } : undefined,
1265
1351
  },
1266
1352
  create: {
1267
1353
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1285,6 +1371,9 @@ exports.NewsArticleAssetSentiment = {
1285
1371
  : { connectOrCreate: {
1286
1372
  where: {
1287
1373
  id: item.action.id !== undefined ? item.action.id : undefined,
1374
+ tradeId: item.action.tradeId !== undefined ? {
1375
+ equals: item.action.tradeId
1376
+ } : undefined,
1288
1377
  },
1289
1378
  create: {
1290
1379
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -1302,6 +1391,12 @@ exports.NewsArticleAssetSentiment = {
1302
1391
  upsert: props.asset.positions.map((item) => ({
1303
1392
  where: {
1304
1393
  id: item.id !== undefined ? item.id : undefined,
1394
+ assetId: item.assetId !== undefined ? {
1395
+ equals: item.assetId
1396
+ } : undefined,
1397
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1398
+ equals: item.alpacaAccountId
1399
+ } : undefined,
1305
1400
  },
1306
1401
  update: {
1307
1402
  id: item.id !== undefined ? {
@@ -1352,6 +1447,9 @@ exports.NewsArticleAssetSentiment = {
1352
1447
  id: item.alpacaAccount.id !== undefined ? {
1353
1448
  equals: item.alpacaAccount.id
1354
1449
  } : undefined,
1450
+ userId: item.alpacaAccount.userId !== undefined ? {
1451
+ equals: item.alpacaAccount.userId
1452
+ } : undefined,
1355
1453
  },
1356
1454
  update: {
1357
1455
  id: item.alpacaAccount.id !== undefined ? {
@@ -1422,6 +1520,9 @@ exports.NewsArticleAssetSentiment = {
1422
1520
  : { connectOrCreate: {
1423
1521
  where: {
1424
1522
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1523
+ userId: item.alpacaAccount.userId !== undefined ? {
1524
+ equals: item.alpacaAccount.userId
1525
+ } : undefined,
1425
1526
  },
1426
1527
  create: {
1427
1528
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1505,6 +1606,12 @@ exports.NewsArticleAssetSentiment = {
1505
1606
  : { connectOrCreate: props.asset.trades.map((item) => ({
1506
1607
  where: {
1507
1608
  id: item.id !== undefined ? item.id : undefined,
1609
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1610
+ equals: item.alpacaAccountId
1611
+ } : undefined,
1612
+ assetId: item.assetId !== undefined ? {
1613
+ equals: item.assetId
1614
+ } : undefined,
1508
1615
  },
1509
1616
  create: {
1510
1617
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1527,6 +1634,9 @@ exports.NewsArticleAssetSentiment = {
1527
1634
  : { connectOrCreate: {
1528
1635
  where: {
1529
1636
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1637
+ userId: item.alpacaAccount.userId !== undefined ? {
1638
+ equals: item.alpacaAccount.userId
1639
+ } : undefined,
1530
1640
  },
1531
1641
  create: {
1532
1642
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1550,6 +1660,9 @@ exports.NewsArticleAssetSentiment = {
1550
1660
  : { connectOrCreate: item.actions.map((item) => ({
1551
1661
  where: {
1552
1662
  id: item.id !== undefined ? item.id : undefined,
1663
+ tradeId: item.tradeId !== undefined ? {
1664
+ equals: item.tradeId
1665
+ } : undefined,
1553
1666
  },
1554
1667
  create: {
1555
1668
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1572,6 +1685,15 @@ exports.NewsArticleAssetSentiment = {
1572
1685
  : { connectOrCreate: props.asset.orders.map((item) => ({
1573
1686
  where: {
1574
1687
  id: item.id !== undefined ? item.id : undefined,
1688
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1689
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1690
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1691
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1692
+ equals: item.alpacaAccountId
1693
+ } : undefined,
1694
+ assetId: item.assetId !== undefined ? {
1695
+ equals: item.assetId
1696
+ } : undefined,
1575
1697
  },
1576
1698
  create: {
1577
1699
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -1605,6 +1727,7 @@ exports.NewsArticleAssetSentiment = {
1605
1727
  : { connectOrCreate: {
1606
1728
  where: {
1607
1729
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1730
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
1608
1731
  },
1609
1732
  create: {
1610
1733
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -1621,6 +1744,7 @@ exports.NewsArticleAssetSentiment = {
1621
1744
  : { connectOrCreate: {
1622
1745
  where: {
1623
1746
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1747
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
1624
1748
  },
1625
1749
  create: {
1626
1750
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -1637,6 +1761,9 @@ exports.NewsArticleAssetSentiment = {
1637
1761
  : { connectOrCreate: {
1638
1762
  where: {
1639
1763
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1764
+ userId: item.alpacaAccount.userId !== undefined ? {
1765
+ equals: item.alpacaAccount.userId
1766
+ } : undefined,
1640
1767
  },
1641
1768
  create: {
1642
1769
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1660,6 +1787,9 @@ exports.NewsArticleAssetSentiment = {
1660
1787
  : { connectOrCreate: {
1661
1788
  where: {
1662
1789
  id: item.action.id !== undefined ? item.action.id : undefined,
1790
+ tradeId: item.action.tradeId !== undefined ? {
1791
+ equals: item.action.tradeId
1792
+ } : undefined,
1663
1793
  },
1664
1794
  create: {
1665
1795
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -1682,6 +1812,12 @@ exports.NewsArticleAssetSentiment = {
1682
1812
  : { connectOrCreate: props.asset.positions.map((item) => ({
1683
1813
  where: {
1684
1814
  id: item.id !== undefined ? item.id : undefined,
1815
+ assetId: item.assetId !== undefined ? {
1816
+ equals: item.assetId
1817
+ } : undefined,
1818
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1819
+ equals: item.alpacaAccountId
1820
+ } : undefined,
1685
1821
  },
1686
1822
  create: {
1687
1823
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -1706,6 +1842,9 @@ exports.NewsArticleAssetSentiment = {
1706
1842
  : { connectOrCreate: {
1707
1843
  where: {
1708
1844
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1845
+ userId: item.alpacaAccount.userId !== undefined ? {
1846
+ equals: item.alpacaAccount.userId
1847
+ } : undefined,
1709
1848
  },
1710
1849
  create: {
1711
1850
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1762,8 +1901,12 @@ exports.NewsArticleAssetSentiment = {
1762
1901
  where: {
1763
1902
  id: prop.id !== undefined ? prop.id : undefined,
1764
1903
  url: prop.url !== undefined ? prop.url : undefined,
1765
- assetId: prop.assetId !== undefined ? prop.assetId : undefined,
1766
- newsArticleId: prop.newsArticleId !== undefined ? prop.newsArticleId : undefined,
1904
+ assetId: prop.assetId !== undefined ? {
1905
+ equals: prop.assetId
1906
+ } : undefined,
1907
+ newsArticleId: prop.newsArticleId !== undefined ? {
1908
+ equals: prop.newsArticleId
1909
+ } : undefined,
1767
1910
  relevancyScore: prop.relevancyScore !== undefined ? prop.relevancyScore : undefined,
1768
1911
  sentimentScore: prop.sentimentScore !== undefined ? prop.sentimentScore : undefined,
1769
1912
  sentimentLabel: prop.sentimentLabel !== undefined ? prop.sentimentLabel : undefined,
@@ -2044,6 +2187,12 @@ exports.NewsArticleAssetSentiment = {
2044
2187
  upsert: prop.asset.trades.map((item) => ({
2045
2188
  where: {
2046
2189
  id: item.id !== undefined ? item.id : undefined,
2190
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2191
+ equals: item.alpacaAccountId
2192
+ } : undefined,
2193
+ assetId: item.assetId !== undefined ? {
2194
+ equals: item.assetId
2195
+ } : undefined,
2047
2196
  },
2048
2197
  update: {
2049
2198
  id: item.id !== undefined ? {
@@ -2088,6 +2237,9 @@ exports.NewsArticleAssetSentiment = {
2088
2237
  id: item.alpacaAccount.id !== undefined ? {
2089
2238
  equals: item.alpacaAccount.id
2090
2239
  } : undefined,
2240
+ userId: item.alpacaAccount.userId !== undefined ? {
2241
+ equals: item.alpacaAccount.userId
2242
+ } : undefined,
2091
2243
  },
2092
2244
  update: {
2093
2245
  id: item.alpacaAccount.id !== undefined ? {
@@ -2138,6 +2290,9 @@ exports.NewsArticleAssetSentiment = {
2138
2290
  upsert: item.actions.map((item) => ({
2139
2291
  where: {
2140
2292
  id: item.id !== undefined ? item.id : undefined,
2293
+ tradeId: item.tradeId !== undefined ? {
2294
+ equals: item.tradeId
2295
+ } : undefined,
2141
2296
  },
2142
2297
  update: {
2143
2298
  id: item.id !== undefined ? {
@@ -2190,6 +2345,9 @@ exports.NewsArticleAssetSentiment = {
2190
2345
  : { connectOrCreate: {
2191
2346
  where: {
2192
2347
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2348
+ userId: item.alpacaAccount.userId !== undefined ? {
2349
+ equals: item.alpacaAccount.userId
2350
+ } : undefined,
2193
2351
  },
2194
2352
  create: {
2195
2353
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2213,6 +2371,9 @@ exports.NewsArticleAssetSentiment = {
2213
2371
  : { connectOrCreate: item.actions.map((item) => ({
2214
2372
  where: {
2215
2373
  id: item.id !== undefined ? item.id : undefined,
2374
+ tradeId: item.tradeId !== undefined ? {
2375
+ equals: item.tradeId
2376
+ } : undefined,
2216
2377
  },
2217
2378
  create: {
2218
2379
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2230,6 +2391,15 @@ exports.NewsArticleAssetSentiment = {
2230
2391
  upsert: prop.asset.orders.map((item) => ({
2231
2392
  where: {
2232
2393
  id: item.id !== undefined ? item.id : undefined,
2394
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2395
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2396
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2397
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2398
+ equals: item.alpacaAccountId
2399
+ } : undefined,
2400
+ assetId: item.assetId !== undefined ? {
2401
+ equals: item.assetId
2402
+ } : undefined,
2233
2403
  },
2234
2404
  update: {
2235
2405
  id: item.id !== undefined ? {
@@ -2307,6 +2477,9 @@ exports.NewsArticleAssetSentiment = {
2307
2477
  id: item.stopLoss.id !== undefined ? {
2308
2478
  equals: item.stopLoss.id
2309
2479
  } : undefined,
2480
+ orderId: item.stopLoss.orderId !== undefined ? {
2481
+ equals: item.stopLoss.orderId
2482
+ } : undefined,
2310
2483
  },
2311
2484
  update: {
2312
2485
  id: item.stopLoss.id !== undefined ? {
@@ -2331,6 +2504,9 @@ exports.NewsArticleAssetSentiment = {
2331
2504
  id: item.takeProfit.id !== undefined ? {
2332
2505
  equals: item.takeProfit.id
2333
2506
  } : undefined,
2507
+ orderId: item.takeProfit.orderId !== undefined ? {
2508
+ equals: item.takeProfit.orderId
2509
+ } : undefined,
2334
2510
  },
2335
2511
  update: {
2336
2512
  id: item.takeProfit.id !== undefined ? {
@@ -2355,6 +2531,9 @@ exports.NewsArticleAssetSentiment = {
2355
2531
  id: item.alpacaAccount.id !== undefined ? {
2356
2532
  equals: item.alpacaAccount.id
2357
2533
  } : undefined,
2534
+ userId: item.alpacaAccount.userId !== undefined ? {
2535
+ equals: item.alpacaAccount.userId
2536
+ } : undefined,
2358
2537
  },
2359
2538
  update: {
2360
2539
  id: item.alpacaAccount.id !== undefined ? {
@@ -2407,6 +2586,9 @@ exports.NewsArticleAssetSentiment = {
2407
2586
  id: item.action.id !== undefined ? {
2408
2587
  equals: item.action.id
2409
2588
  } : undefined,
2589
+ tradeId: item.action.tradeId !== undefined ? {
2590
+ equals: item.action.tradeId
2591
+ } : undefined,
2410
2592
  },
2411
2593
  update: {
2412
2594
  id: item.action.id !== undefined ? {
@@ -2470,6 +2652,7 @@ exports.NewsArticleAssetSentiment = {
2470
2652
  : { connectOrCreate: {
2471
2653
  where: {
2472
2654
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2655
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2473
2656
  },
2474
2657
  create: {
2475
2658
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2486,6 +2669,7 @@ exports.NewsArticleAssetSentiment = {
2486
2669
  : { connectOrCreate: {
2487
2670
  where: {
2488
2671
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2672
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2489
2673
  },
2490
2674
  create: {
2491
2675
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2502,6 +2686,9 @@ exports.NewsArticleAssetSentiment = {
2502
2686
  : { connectOrCreate: {
2503
2687
  where: {
2504
2688
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2689
+ userId: item.alpacaAccount.userId !== undefined ? {
2690
+ equals: item.alpacaAccount.userId
2691
+ } : undefined,
2505
2692
  },
2506
2693
  create: {
2507
2694
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2525,6 +2712,9 @@ exports.NewsArticleAssetSentiment = {
2525
2712
  : { connectOrCreate: {
2526
2713
  where: {
2527
2714
  id: item.action.id !== undefined ? item.action.id : undefined,
2715
+ tradeId: item.action.tradeId !== undefined ? {
2716
+ equals: item.action.tradeId
2717
+ } : undefined,
2528
2718
  },
2529
2719
  create: {
2530
2720
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2542,6 +2732,12 @@ exports.NewsArticleAssetSentiment = {
2542
2732
  upsert: prop.asset.positions.map((item) => ({
2543
2733
  where: {
2544
2734
  id: item.id !== undefined ? item.id : undefined,
2735
+ assetId: item.assetId !== undefined ? {
2736
+ equals: item.assetId
2737
+ } : undefined,
2738
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2739
+ equals: item.alpacaAccountId
2740
+ } : undefined,
2545
2741
  },
2546
2742
  update: {
2547
2743
  id: item.id !== undefined ? {
@@ -2592,6 +2788,9 @@ exports.NewsArticleAssetSentiment = {
2592
2788
  id: item.alpacaAccount.id !== undefined ? {
2593
2789
  equals: item.alpacaAccount.id
2594
2790
  } : undefined,
2791
+ userId: item.alpacaAccount.userId !== undefined ? {
2792
+ equals: item.alpacaAccount.userId
2793
+ } : undefined,
2595
2794
  },
2596
2795
  update: {
2597
2796
  id: item.alpacaAccount.id !== undefined ? {
@@ -2662,6 +2861,9 @@ exports.NewsArticleAssetSentiment = {
2662
2861
  : { connectOrCreate: {
2663
2862
  where: {
2664
2863
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2864
+ userId: item.alpacaAccount.userId !== undefined ? {
2865
+ equals: item.alpacaAccount.userId
2866
+ } : undefined,
2665
2867
  },
2666
2868
  create: {
2667
2869
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2745,6 +2947,12 @@ exports.NewsArticleAssetSentiment = {
2745
2947
  : { connectOrCreate: prop.asset.trades.map((item) => ({
2746
2948
  where: {
2747
2949
  id: item.id !== undefined ? item.id : undefined,
2950
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2951
+ equals: item.alpacaAccountId
2952
+ } : undefined,
2953
+ assetId: item.assetId !== undefined ? {
2954
+ equals: item.assetId
2955
+ } : undefined,
2748
2956
  },
2749
2957
  create: {
2750
2958
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -2767,6 +2975,9 @@ exports.NewsArticleAssetSentiment = {
2767
2975
  : { connectOrCreate: {
2768
2976
  where: {
2769
2977
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2978
+ userId: item.alpacaAccount.userId !== undefined ? {
2979
+ equals: item.alpacaAccount.userId
2980
+ } : undefined,
2770
2981
  },
2771
2982
  create: {
2772
2983
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2790,6 +3001,9 @@ exports.NewsArticleAssetSentiment = {
2790
3001
  : { connectOrCreate: item.actions.map((item) => ({
2791
3002
  where: {
2792
3003
  id: item.id !== undefined ? item.id : undefined,
3004
+ tradeId: item.tradeId !== undefined ? {
3005
+ equals: item.tradeId
3006
+ } : undefined,
2793
3007
  },
2794
3008
  create: {
2795
3009
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2812,6 +3026,15 @@ exports.NewsArticleAssetSentiment = {
2812
3026
  : { connectOrCreate: prop.asset.orders.map((item) => ({
2813
3027
  where: {
2814
3028
  id: item.id !== undefined ? item.id : undefined,
3029
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3030
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3031
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3032
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3033
+ equals: item.alpacaAccountId
3034
+ } : undefined,
3035
+ assetId: item.assetId !== undefined ? {
3036
+ equals: item.assetId
3037
+ } : undefined,
2815
3038
  },
2816
3039
  create: {
2817
3040
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2845,6 +3068,7 @@ exports.NewsArticleAssetSentiment = {
2845
3068
  : { connectOrCreate: {
2846
3069
  where: {
2847
3070
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3071
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2848
3072
  },
2849
3073
  create: {
2850
3074
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2861,6 +3085,7 @@ exports.NewsArticleAssetSentiment = {
2861
3085
  : { connectOrCreate: {
2862
3086
  where: {
2863
3087
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3088
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2864
3089
  },
2865
3090
  create: {
2866
3091
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2877,6 +3102,9 @@ exports.NewsArticleAssetSentiment = {
2877
3102
  : { connectOrCreate: {
2878
3103
  where: {
2879
3104
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3105
+ userId: item.alpacaAccount.userId !== undefined ? {
3106
+ equals: item.alpacaAccount.userId
3107
+ } : undefined,
2880
3108
  },
2881
3109
  create: {
2882
3110
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2900,6 +3128,9 @@ exports.NewsArticleAssetSentiment = {
2900
3128
  : { connectOrCreate: {
2901
3129
  where: {
2902
3130
  id: item.action.id !== undefined ? item.action.id : undefined,
3131
+ tradeId: item.action.tradeId !== undefined ? {
3132
+ equals: item.action.tradeId
3133
+ } : undefined,
2903
3134
  },
2904
3135
  create: {
2905
3136
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2922,6 +3153,12 @@ exports.NewsArticleAssetSentiment = {
2922
3153
  : { connectOrCreate: prop.asset.positions.map((item) => ({
2923
3154
  where: {
2924
3155
  id: item.id !== undefined ? item.id : undefined,
3156
+ assetId: item.assetId !== undefined ? {
3157
+ equals: item.assetId
3158
+ } : undefined,
3159
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3160
+ equals: item.alpacaAccountId
3161
+ } : undefined,
2925
3162
  },
2926
3163
  create: {
2927
3164
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -2946,6 +3183,9 @@ exports.NewsArticleAssetSentiment = {
2946
3183
  : { connectOrCreate: {
2947
3184
  where: {
2948
3185
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
3186
+ userId: item.alpacaAccount.userId !== undefined ? {
3187
+ equals: item.alpacaAccount.userId
3188
+ } : undefined,
2949
3189
  },
2950
3190
  create: {
2951
3191
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -3038,8 +3278,12 @@ exports.NewsArticleAssetSentiment = {
3038
3278
  where: {
3039
3279
  id: props.id !== undefined ? props.id : undefined,
3040
3280
  url: props.url !== undefined ? props.url : undefined,
3041
- assetId: props.assetId !== undefined ? props.assetId : undefined,
3042
- newsArticleId: props.newsArticleId !== undefined ? props.newsArticleId : undefined,
3281
+ assetId: props.assetId !== undefined ? {
3282
+ equals: props.assetId
3283
+ } : undefined,
3284
+ newsArticleId: props.newsArticleId !== undefined ? {
3285
+ equals: props.newsArticleId
3286
+ } : undefined,
3043
3287
  relevancyScore: props.relevancyScore !== undefined ? props.relevancyScore : undefined,
3044
3288
  sentimentScore: props.sentimentScore !== undefined ? props.sentimentScore : undefined,
3045
3289
  sentimentLabel: props.sentimentLabel !== undefined ? props.sentimentLabel : undefined,
@@ -3109,8 +3353,12 @@ exports.NewsArticleAssetSentiment = {
3109
3353
  id: props.id !== undefined ? {
3110
3354
  equals: props.id
3111
3355
  } : undefined,
3112
- assetId: props.assetId !== undefined ? props.assetId : undefined,
3113
- newsArticleId: props.newsArticleId !== undefined ? props.newsArticleId : undefined,
3356
+ assetId: props.assetId !== undefined ? {
3357
+ equals: props.assetId
3358
+ } : undefined,
3359
+ newsArticleId: props.newsArticleId !== undefined ? {
3360
+ equals: props.newsArticleId
3361
+ } : undefined,
3114
3362
  url: props.url !== undefined ? {
3115
3363
  equals: props.url
3116
3364
  } : undefined,