adaptic-backend 1.0.151 → 1.0.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/Account.cjs +1029 -0
  2. package/Action.cjs +3460 -0
  3. package/Alert.cjs +3800 -0
  4. package/AlpacaAccount.cjs +2888 -0
  5. package/Asset.cjs +3659 -0
  6. package/Authenticator.cjs +1029 -0
  7. package/Customer.cjs +1029 -0
  8. package/NewsArticle.cjs +892 -0
  9. package/NewsArticleAssetSentiment.cjs +1243 -0
  10. package/Order.cjs +4500 -0
  11. package/Position.cjs +4288 -0
  12. package/Session.cjs +1029 -0
  13. package/StopLoss.cjs +1832 -0
  14. package/TakeProfit.cjs +1832 -0
  15. package/Trade.cjs +5276 -0
  16. package/User.cjs +3103 -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 +1029 -0
  21. package/server/Action.d.ts.map +1 -1
  22. package/server/Action.js.map +1 -1
  23. package/server/Action.mjs +3460 -0
  24. package/server/Alert.d.ts.map +1 -1
  25. package/server/Alert.js.map +1 -1
  26. package/server/Alert.mjs +3800 -0
  27. package/server/AlpacaAccount.d.ts.map +1 -1
  28. package/server/AlpacaAccount.js.map +1 -1
  29. package/server/AlpacaAccount.mjs +2888 -0
  30. package/server/Asset.d.ts.map +1 -1
  31. package/server/Asset.js.map +1 -1
  32. package/server/Asset.mjs +3659 -0
  33. package/server/Authenticator.d.ts.map +1 -1
  34. package/server/Authenticator.js.map +1 -1
  35. package/server/Authenticator.mjs +1029 -0
  36. package/server/Customer.d.ts.map +1 -1
  37. package/server/Customer.js.map +1 -1
  38. package/server/Customer.mjs +1029 -0
  39. package/server/NewsArticle.d.ts.map +1 -1
  40. package/server/NewsArticle.js.map +1 -1
  41. package/server/NewsArticle.mjs +892 -0
  42. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  43. package/server/NewsArticleAssetSentiment.js.map +1 -1
  44. package/server/NewsArticleAssetSentiment.mjs +1243 -0
  45. package/server/Order.d.ts.map +1 -1
  46. package/server/Order.js.map +1 -1
  47. package/server/Order.mjs +4500 -0
  48. package/server/Position.d.ts.map +1 -1
  49. package/server/Position.js.map +1 -1
  50. package/server/Position.mjs +4288 -0
  51. package/server/Session.d.ts.map +1 -1
  52. package/server/Session.js.map +1 -1
  53. package/server/Session.mjs +1029 -0
  54. package/server/StopLoss.d.ts.map +1 -1
  55. package/server/StopLoss.js.map +1 -1
  56. package/server/StopLoss.mjs +1832 -0
  57. package/server/TakeProfit.d.ts.map +1 -1
  58. package/server/TakeProfit.js.map +1 -1
  59. package/server/TakeProfit.mjs +1832 -0
  60. package/server/Trade.d.ts.map +1 -1
  61. package/server/Trade.js.map +1 -1
  62. package/server/Trade.mjs +5276 -0
  63. package/server/User.d.ts.map +1 -1
  64. package/server/User.js.map +1 -1
  65. package/server/User.mjs +3103 -0
@@ -238,6 +238,48 @@ exports.NewsArticleAssetSentiment = {
238
238
  confidence: item.confidence !== undefined ? item.confidence : undefined,
239
239
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
240
240
  status: item.status !== undefined ? item.status : undefined,
241
+ alpacaAccount: item.alpacaAccount ?
242
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
243
+ ? { connect: {
244
+ id: item.alpacaAccount.id
245
+ }
246
+ }
247
+ : { connectOrCreate: {
248
+ where: {
249
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
250
+ },
251
+ create: {
252
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
253
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
254
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
255
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
256
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
257
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
258
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
259
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
260
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
261
+ },
262
+ }
263
+ } : undefined,
264
+ actions: item.actions ?
265
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
266
+ connect: item.actions.map((item) => ({
267
+ id: item.id
268
+ }))
269
+ }
270
+ : { connectOrCreate: item.actions.map((item) => ({
271
+ where: {
272
+ id: item.id !== undefined ? item.id : undefined,
273
+ },
274
+ create: {
275
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
276
+ type: item.type !== undefined ? item.type : undefined,
277
+ note: item.note !== undefined ? item.note : undefined,
278
+ status: item.status !== undefined ? item.status : undefined,
279
+ fee: item.fee !== undefined ? item.fee : undefined,
280
+ },
281
+ }))
282
+ } : undefined,
241
283
  },
242
284
  }))
243
285
  } : undefined,
@@ -274,6 +316,80 @@ exports.NewsArticleAssetSentiment = {
274
316
  optionType: item.optionType !== undefined ? item.optionType : undefined,
275
317
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
276
318
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
319
+ stopLoss: item.stopLoss ?
320
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
321
+ ? { connect: {
322
+ id: item.stopLoss.id
323
+ }
324
+ }
325
+ : { connectOrCreate: {
326
+ where: {
327
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
328
+ },
329
+ create: {
330
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
331
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
332
+ },
333
+ }
334
+ } : undefined,
335
+ takeProfit: item.takeProfit ?
336
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
337
+ ? { connect: {
338
+ id: item.takeProfit.id
339
+ }
340
+ }
341
+ : { connectOrCreate: {
342
+ where: {
343
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
344
+ },
345
+ create: {
346
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
347
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
348
+ },
349
+ }
350
+ } : undefined,
351
+ alpacaAccount: item.alpacaAccount ?
352
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
353
+ ? { connect: {
354
+ id: item.alpacaAccount.id
355
+ }
356
+ }
357
+ : { connectOrCreate: {
358
+ where: {
359
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
360
+ },
361
+ create: {
362
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
363
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
364
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
365
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
366
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
367
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
368
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
369
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
370
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
371
+ },
372
+ }
373
+ } : undefined,
374
+ action: item.action ?
375
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
376
+ ? { connect: {
377
+ id: item.action.id
378
+ }
379
+ }
380
+ : { connectOrCreate: {
381
+ where: {
382
+ id: item.action.id !== undefined ? item.action.id : undefined,
383
+ },
384
+ create: {
385
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
386
+ type: item.action.type !== undefined ? item.action.type : undefined,
387
+ note: item.action.note !== undefined ? item.action.note : undefined,
388
+ status: item.action.status !== undefined ? item.action.status : undefined,
389
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
390
+ },
391
+ }
392
+ } : undefined,
277
393
  },
278
394
  }))
279
395
  } : undefined,
@@ -301,6 +417,29 @@ exports.NewsArticleAssetSentiment = {
301
417
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
302
418
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
303
419
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
420
+ alpacaAccount: item.alpacaAccount ?
421
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
422
+ ? { connect: {
423
+ id: item.alpacaAccount.id
424
+ }
425
+ }
426
+ : { connectOrCreate: {
427
+ where: {
428
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
429
+ },
430
+ create: {
431
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
432
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
433
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
434
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
435
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
436
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
437
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
438
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
439
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
440
+ },
441
+ }
442
+ } : undefined,
304
443
  },
305
444
  }))
306
445
  } : undefined,
@@ -703,6 +842,92 @@ exports.NewsArticleAssetSentiment = {
703
842
  status: item.status !== undefined ? {
704
843
  set: item.status
705
844
  } : undefined,
845
+ alpacaAccount: item.alpacaAccount ? {
846
+ upsert: {
847
+ where: {
848
+ id: item.alpacaAccount.id !== undefined ? {
849
+ equals: item.alpacaAccount.id
850
+ } : undefined,
851
+ },
852
+ update: {
853
+ id: item.alpacaAccount.id !== undefined ? {
854
+ set: item.alpacaAccount.id
855
+ } : undefined,
856
+ type: item.alpacaAccount.type !== undefined ? {
857
+ set: item.alpacaAccount.type
858
+ } : undefined,
859
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
860
+ set: item.alpacaAccount.APIKey
861
+ } : undefined,
862
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
863
+ set: item.alpacaAccount.APISecret
864
+ } : undefined,
865
+ configuration: item.alpacaAccount.configuration !== undefined ? {
866
+ set: item.alpacaAccount.configuration
867
+ } : undefined,
868
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
869
+ set: item.alpacaAccount.marketOpen
870
+ } : undefined,
871
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
872
+ set: item.alpacaAccount.minOrderSize
873
+ } : undefined,
874
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
875
+ set: item.alpacaAccount.maxOrderSize
876
+ } : undefined,
877
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
878
+ set: item.alpacaAccount.minPercentageChange
879
+ } : undefined,
880
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
881
+ set: item.alpacaAccount.volumeThreshold
882
+ } : undefined,
883
+ },
884
+ create: {
885
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
886
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
887
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
888
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
889
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
890
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
891
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
892
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
893
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
894
+ },
895
+ }
896
+ } : undefined,
897
+ actions: item.actions ? {
898
+ upsert: item.actions.map((item) => ({
899
+ where: {
900
+ id: item.id !== undefined ? item.id : undefined,
901
+ },
902
+ update: {
903
+ id: item.id !== undefined ? {
904
+ set: item.id
905
+ } : undefined,
906
+ sequence: item.sequence !== undefined ? {
907
+ set: item.sequence
908
+ } : undefined,
909
+ type: item.type !== undefined ? {
910
+ set: item.type
911
+ } : undefined,
912
+ note: item.note !== undefined ? {
913
+ set: item.note
914
+ } : undefined,
915
+ status: item.status !== undefined ? {
916
+ set: item.status
917
+ } : undefined,
918
+ fee: item.fee !== undefined ? {
919
+ set: item.fee
920
+ } : undefined,
921
+ },
922
+ create: {
923
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
924
+ type: item.type !== undefined ? item.type : undefined,
925
+ note: item.note !== undefined ? item.note : undefined,
926
+ status: item.status !== undefined ? item.status : undefined,
927
+ fee: item.fee !== undefined ? item.fee : undefined,
928
+ },
929
+ }))
930
+ } : undefined,
706
931
  },
707
932
  create: {
708
933
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -716,6 +941,48 @@ exports.NewsArticleAssetSentiment = {
716
941
  confidence: item.confidence !== undefined ? item.confidence : undefined,
717
942
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
718
943
  status: item.status !== undefined ? item.status : undefined,
944
+ alpacaAccount: item.alpacaAccount ?
945
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
946
+ ? { connect: {
947
+ id: item.alpacaAccount.id
948
+ }
949
+ }
950
+ : { connectOrCreate: {
951
+ where: {
952
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
953
+ },
954
+ create: {
955
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
956
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
957
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
958
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
959
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
960
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
961
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
962
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
963
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
964
+ },
965
+ }
966
+ } : undefined,
967
+ actions: item.actions ?
968
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
969
+ connect: item.actions.map((item) => ({
970
+ id: item.id
971
+ }))
972
+ }
973
+ : { connectOrCreate: item.actions.map((item) => ({
974
+ where: {
975
+ id: item.id !== undefined ? item.id : undefined,
976
+ },
977
+ create: {
978
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
979
+ type: item.type !== undefined ? item.type : undefined,
980
+ note: item.note !== undefined ? item.note : undefined,
981
+ status: item.status !== undefined ? item.status : undefined,
982
+ fee: item.fee !== undefined ? item.fee : undefined,
983
+ },
984
+ }))
985
+ } : undefined,
719
986
  },
720
987
  }))
721
988
  } : undefined,
@@ -794,6 +1061,142 @@ exports.NewsArticleAssetSentiment = {
794
1061
  takeProfitId: item.takeProfitId !== undefined ? {
795
1062
  set: item.takeProfitId
796
1063
  } : undefined,
1064
+ stopLoss: item.stopLoss ? {
1065
+ upsert: {
1066
+ where: {
1067
+ id: item.stopLoss.id !== undefined ? {
1068
+ equals: item.stopLoss.id
1069
+ } : undefined,
1070
+ },
1071
+ update: {
1072
+ id: item.stopLoss.id !== undefined ? {
1073
+ set: item.stopLoss.id
1074
+ } : undefined,
1075
+ stopPrice: item.stopLoss.stopPrice !== undefined ? {
1076
+ set: item.stopLoss.stopPrice
1077
+ } : undefined,
1078
+ limitPrice: item.stopLoss.limitPrice !== undefined ? {
1079
+ set: item.stopLoss.limitPrice
1080
+ } : undefined,
1081
+ },
1082
+ create: {
1083
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
1084
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
1085
+ },
1086
+ }
1087
+ } : undefined,
1088
+ takeProfit: item.takeProfit ? {
1089
+ upsert: {
1090
+ where: {
1091
+ id: item.takeProfit.id !== undefined ? {
1092
+ equals: item.takeProfit.id
1093
+ } : undefined,
1094
+ },
1095
+ update: {
1096
+ id: item.takeProfit.id !== undefined ? {
1097
+ set: item.takeProfit.id
1098
+ } : undefined,
1099
+ limitPrice: item.takeProfit.limitPrice !== undefined ? {
1100
+ set: item.takeProfit.limitPrice
1101
+ } : undefined,
1102
+ stopPrice: item.takeProfit.stopPrice !== undefined ? {
1103
+ set: item.takeProfit.stopPrice
1104
+ } : undefined,
1105
+ },
1106
+ create: {
1107
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
1108
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
1109
+ },
1110
+ }
1111
+ } : undefined,
1112
+ alpacaAccount: item.alpacaAccount ? {
1113
+ upsert: {
1114
+ where: {
1115
+ id: item.alpacaAccount.id !== undefined ? {
1116
+ equals: item.alpacaAccount.id
1117
+ } : undefined,
1118
+ },
1119
+ update: {
1120
+ id: item.alpacaAccount.id !== undefined ? {
1121
+ set: item.alpacaAccount.id
1122
+ } : undefined,
1123
+ type: item.alpacaAccount.type !== undefined ? {
1124
+ set: item.alpacaAccount.type
1125
+ } : undefined,
1126
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1127
+ set: item.alpacaAccount.APIKey
1128
+ } : undefined,
1129
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1130
+ set: item.alpacaAccount.APISecret
1131
+ } : undefined,
1132
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1133
+ set: item.alpacaAccount.configuration
1134
+ } : undefined,
1135
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1136
+ set: item.alpacaAccount.marketOpen
1137
+ } : undefined,
1138
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
1139
+ set: item.alpacaAccount.minOrderSize
1140
+ } : undefined,
1141
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
1142
+ set: item.alpacaAccount.maxOrderSize
1143
+ } : undefined,
1144
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
1145
+ set: item.alpacaAccount.minPercentageChange
1146
+ } : undefined,
1147
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
1148
+ set: item.alpacaAccount.volumeThreshold
1149
+ } : undefined,
1150
+ },
1151
+ create: {
1152
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1153
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1154
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1155
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1156
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1157
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1158
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1159
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1160
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1161
+ },
1162
+ }
1163
+ } : undefined,
1164
+ action: item.action ? {
1165
+ upsert: {
1166
+ where: {
1167
+ id: item.action.id !== undefined ? {
1168
+ equals: item.action.id
1169
+ } : undefined,
1170
+ },
1171
+ update: {
1172
+ id: item.action.id !== undefined ? {
1173
+ set: item.action.id
1174
+ } : undefined,
1175
+ sequence: item.action.sequence !== undefined ? {
1176
+ set: item.action.sequence
1177
+ } : undefined,
1178
+ type: item.action.type !== undefined ? {
1179
+ set: item.action.type
1180
+ } : undefined,
1181
+ note: item.action.note !== undefined ? {
1182
+ set: item.action.note
1183
+ } : undefined,
1184
+ status: item.action.status !== undefined ? {
1185
+ set: item.action.status
1186
+ } : undefined,
1187
+ fee: item.action.fee !== undefined ? {
1188
+ set: item.action.fee
1189
+ } : undefined,
1190
+ },
1191
+ create: {
1192
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1193
+ type: item.action.type !== undefined ? item.action.type : undefined,
1194
+ note: item.action.note !== undefined ? item.action.note : undefined,
1195
+ status: item.action.status !== undefined ? item.action.status : undefined,
1196
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1197
+ },
1198
+ }
1199
+ } : undefined,
797
1200
  },
798
1201
  create: {
799
1202
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -818,6 +1221,80 @@ exports.NewsArticleAssetSentiment = {
818
1221
  optionType: item.optionType !== undefined ? item.optionType : undefined,
819
1222
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
820
1223
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
1224
+ stopLoss: item.stopLoss ?
1225
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
1226
+ ? { connect: {
1227
+ id: item.stopLoss.id
1228
+ }
1229
+ }
1230
+ : { connectOrCreate: {
1231
+ where: {
1232
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1233
+ },
1234
+ create: {
1235
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
1236
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
1237
+ },
1238
+ }
1239
+ } : undefined,
1240
+ takeProfit: item.takeProfit ?
1241
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
1242
+ ? { connect: {
1243
+ id: item.takeProfit.id
1244
+ }
1245
+ }
1246
+ : { connectOrCreate: {
1247
+ where: {
1248
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1249
+ },
1250
+ create: {
1251
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
1252
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
1253
+ },
1254
+ }
1255
+ } : undefined,
1256
+ alpacaAccount: item.alpacaAccount ?
1257
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1258
+ ? { connect: {
1259
+ id: item.alpacaAccount.id
1260
+ }
1261
+ }
1262
+ : { connectOrCreate: {
1263
+ where: {
1264
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1265
+ },
1266
+ create: {
1267
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1268
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1269
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1270
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1271
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1272
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1273
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1274
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1275
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1276
+ },
1277
+ }
1278
+ } : undefined,
1279
+ action: item.action ?
1280
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1281
+ ? { connect: {
1282
+ id: item.action.id
1283
+ }
1284
+ }
1285
+ : { connectOrCreate: {
1286
+ where: {
1287
+ id: item.action.id !== undefined ? item.action.id : undefined,
1288
+ },
1289
+ create: {
1290
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1291
+ type: item.action.type !== undefined ? item.action.type : undefined,
1292
+ note: item.action.note !== undefined ? item.action.note : undefined,
1293
+ status: item.action.status !== undefined ? item.action.status : undefined,
1294
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1295
+ },
1296
+ }
1297
+ } : undefined,
821
1298
  },
822
1299
  }))
823
1300
  } : undefined,
@@ -869,6 +1346,58 @@ exports.NewsArticleAssetSentiment = {
869
1346
  assetMarginable: item.assetMarginable !== undefined ? {
870
1347
  set: item.assetMarginable
871
1348
  } : undefined,
1349
+ alpacaAccount: item.alpacaAccount ? {
1350
+ upsert: {
1351
+ where: {
1352
+ id: item.alpacaAccount.id !== undefined ? {
1353
+ equals: item.alpacaAccount.id
1354
+ } : undefined,
1355
+ },
1356
+ update: {
1357
+ id: item.alpacaAccount.id !== undefined ? {
1358
+ set: item.alpacaAccount.id
1359
+ } : undefined,
1360
+ type: item.alpacaAccount.type !== undefined ? {
1361
+ set: item.alpacaAccount.type
1362
+ } : undefined,
1363
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1364
+ set: item.alpacaAccount.APIKey
1365
+ } : undefined,
1366
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1367
+ set: item.alpacaAccount.APISecret
1368
+ } : undefined,
1369
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1370
+ set: item.alpacaAccount.configuration
1371
+ } : undefined,
1372
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1373
+ set: item.alpacaAccount.marketOpen
1374
+ } : undefined,
1375
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
1376
+ set: item.alpacaAccount.minOrderSize
1377
+ } : undefined,
1378
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
1379
+ set: item.alpacaAccount.maxOrderSize
1380
+ } : undefined,
1381
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
1382
+ set: item.alpacaAccount.minPercentageChange
1383
+ } : undefined,
1384
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
1385
+ set: item.alpacaAccount.volumeThreshold
1386
+ } : undefined,
1387
+ },
1388
+ create: {
1389
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1390
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1391
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1392
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1393
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1394
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1395
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1396
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1397
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1398
+ },
1399
+ }
1400
+ } : undefined,
872
1401
  },
873
1402
  create: {
874
1403
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -884,6 +1413,29 @@ exports.NewsArticleAssetSentiment = {
884
1413
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
885
1414
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
886
1415
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1416
+ alpacaAccount: item.alpacaAccount ?
1417
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1418
+ ? { connect: {
1419
+ id: item.alpacaAccount.id
1420
+ }
1421
+ }
1422
+ : { connectOrCreate: {
1423
+ where: {
1424
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1425
+ },
1426
+ create: {
1427
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1428
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1429
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1430
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1431
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1432
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1433
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1434
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1435
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1436
+ },
1437
+ }
1438
+ } : undefined,
887
1439
  },
888
1440
  }))
889
1441
  } : undefined,
@@ -966,6 +1518,48 @@ exports.NewsArticleAssetSentiment = {
966
1518
  confidence: item.confidence !== undefined ? item.confidence : undefined,
967
1519
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
968
1520
  status: item.status !== undefined ? item.status : undefined,
1521
+ alpacaAccount: item.alpacaAccount ?
1522
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1523
+ ? { connect: {
1524
+ id: item.alpacaAccount.id
1525
+ }
1526
+ }
1527
+ : { connectOrCreate: {
1528
+ where: {
1529
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1530
+ },
1531
+ create: {
1532
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1533
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1534
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1535
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1536
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1537
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1538
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1539
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1540
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1541
+ },
1542
+ }
1543
+ } : undefined,
1544
+ actions: item.actions ?
1545
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1546
+ connect: item.actions.map((item) => ({
1547
+ id: item.id
1548
+ }))
1549
+ }
1550
+ : { connectOrCreate: item.actions.map((item) => ({
1551
+ where: {
1552
+ id: item.id !== undefined ? item.id : undefined,
1553
+ },
1554
+ create: {
1555
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1556
+ type: item.type !== undefined ? item.type : undefined,
1557
+ note: item.note !== undefined ? item.note : undefined,
1558
+ status: item.status !== undefined ? item.status : undefined,
1559
+ fee: item.fee !== undefined ? item.fee : undefined,
1560
+ },
1561
+ }))
1562
+ } : undefined,
969
1563
  },
970
1564
  }))
971
1565
  } : undefined,
@@ -1002,6 +1596,80 @@ exports.NewsArticleAssetSentiment = {
1002
1596
  optionType: item.optionType !== undefined ? item.optionType : undefined,
1003
1597
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1004
1598
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
1599
+ stopLoss: item.stopLoss ?
1600
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
1601
+ ? { connect: {
1602
+ id: item.stopLoss.id
1603
+ }
1604
+ }
1605
+ : { connectOrCreate: {
1606
+ where: {
1607
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1608
+ },
1609
+ create: {
1610
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
1611
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
1612
+ },
1613
+ }
1614
+ } : undefined,
1615
+ takeProfit: item.takeProfit ?
1616
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
1617
+ ? { connect: {
1618
+ id: item.takeProfit.id
1619
+ }
1620
+ }
1621
+ : { connectOrCreate: {
1622
+ where: {
1623
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1624
+ },
1625
+ create: {
1626
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
1627
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
1628
+ },
1629
+ }
1630
+ } : undefined,
1631
+ alpacaAccount: item.alpacaAccount ?
1632
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1633
+ ? { connect: {
1634
+ id: item.alpacaAccount.id
1635
+ }
1636
+ }
1637
+ : { connectOrCreate: {
1638
+ where: {
1639
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1640
+ },
1641
+ create: {
1642
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1643
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1644
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1645
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1646
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1647
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1648
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1649
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1650
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1651
+ },
1652
+ }
1653
+ } : undefined,
1654
+ action: item.action ?
1655
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1656
+ ? { connect: {
1657
+ id: item.action.id
1658
+ }
1659
+ }
1660
+ : { connectOrCreate: {
1661
+ where: {
1662
+ id: item.action.id !== undefined ? item.action.id : undefined,
1663
+ },
1664
+ create: {
1665
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1666
+ type: item.action.type !== undefined ? item.action.type : undefined,
1667
+ note: item.action.note !== undefined ? item.action.note : undefined,
1668
+ status: item.action.status !== undefined ? item.action.status : undefined,
1669
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1670
+ },
1671
+ }
1672
+ } : undefined,
1005
1673
  },
1006
1674
  }))
1007
1675
  } : undefined,
@@ -1029,6 +1697,29 @@ exports.NewsArticleAssetSentiment = {
1029
1697
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1030
1698
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1031
1699
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1700
+ alpacaAccount: item.alpacaAccount ?
1701
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1702
+ ? { connect: {
1703
+ id: item.alpacaAccount.id
1704
+ }
1705
+ }
1706
+ : { connectOrCreate: {
1707
+ where: {
1708
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1709
+ },
1710
+ create: {
1711
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1712
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1713
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1714
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1715
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1716
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1717
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1718
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1719
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1720
+ },
1721
+ }
1722
+ } : undefined,
1032
1723
  },
1033
1724
  }))
1034
1725
  } : undefined,
@@ -1391,6 +2082,92 @@ exports.NewsArticleAssetSentiment = {
1391
2082
  status: item.status !== undefined ? {
1392
2083
  set: item.status
1393
2084
  } : undefined,
2085
+ alpacaAccount: item.alpacaAccount ? {
2086
+ upsert: {
2087
+ where: {
2088
+ id: item.alpacaAccount.id !== undefined ? {
2089
+ equals: item.alpacaAccount.id
2090
+ } : undefined,
2091
+ },
2092
+ update: {
2093
+ id: item.alpacaAccount.id !== undefined ? {
2094
+ set: item.alpacaAccount.id
2095
+ } : undefined,
2096
+ type: item.alpacaAccount.type !== undefined ? {
2097
+ set: item.alpacaAccount.type
2098
+ } : undefined,
2099
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2100
+ set: item.alpacaAccount.APIKey
2101
+ } : undefined,
2102
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2103
+ set: item.alpacaAccount.APISecret
2104
+ } : undefined,
2105
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2106
+ set: item.alpacaAccount.configuration
2107
+ } : undefined,
2108
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2109
+ set: item.alpacaAccount.marketOpen
2110
+ } : undefined,
2111
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
2112
+ set: item.alpacaAccount.minOrderSize
2113
+ } : undefined,
2114
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
2115
+ set: item.alpacaAccount.maxOrderSize
2116
+ } : undefined,
2117
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
2118
+ set: item.alpacaAccount.minPercentageChange
2119
+ } : undefined,
2120
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
2121
+ set: item.alpacaAccount.volumeThreshold
2122
+ } : undefined,
2123
+ },
2124
+ create: {
2125
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2126
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2127
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2128
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2129
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2130
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2131
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2132
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2133
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2134
+ },
2135
+ }
2136
+ } : undefined,
2137
+ actions: item.actions ? {
2138
+ upsert: item.actions.map((item) => ({
2139
+ where: {
2140
+ id: item.id !== undefined ? item.id : undefined,
2141
+ },
2142
+ update: {
2143
+ id: item.id !== undefined ? {
2144
+ set: item.id
2145
+ } : undefined,
2146
+ sequence: item.sequence !== undefined ? {
2147
+ set: item.sequence
2148
+ } : undefined,
2149
+ type: item.type !== undefined ? {
2150
+ set: item.type
2151
+ } : undefined,
2152
+ note: item.note !== undefined ? {
2153
+ set: item.note
2154
+ } : undefined,
2155
+ status: item.status !== undefined ? {
2156
+ set: item.status
2157
+ } : undefined,
2158
+ fee: item.fee !== undefined ? {
2159
+ set: item.fee
2160
+ } : undefined,
2161
+ },
2162
+ create: {
2163
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2164
+ type: item.type !== undefined ? item.type : undefined,
2165
+ note: item.note !== undefined ? item.note : undefined,
2166
+ status: item.status !== undefined ? item.status : undefined,
2167
+ fee: item.fee !== undefined ? item.fee : undefined,
2168
+ },
2169
+ }))
2170
+ } : undefined,
1394
2171
  },
1395
2172
  create: {
1396
2173
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1404,6 +2181,48 @@ exports.NewsArticleAssetSentiment = {
1404
2181
  confidence: item.confidence !== undefined ? item.confidence : undefined,
1405
2182
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1406
2183
  status: item.status !== undefined ? item.status : undefined,
2184
+ alpacaAccount: item.alpacaAccount ?
2185
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2186
+ ? { connect: {
2187
+ id: item.alpacaAccount.id
2188
+ }
2189
+ }
2190
+ : { connectOrCreate: {
2191
+ where: {
2192
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2193
+ },
2194
+ create: {
2195
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2196
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2197
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2198
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2199
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2200
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2201
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2202
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2203
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2204
+ },
2205
+ }
2206
+ } : undefined,
2207
+ actions: item.actions ?
2208
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2209
+ connect: item.actions.map((item) => ({
2210
+ id: item.id
2211
+ }))
2212
+ }
2213
+ : { connectOrCreate: item.actions.map((item) => ({
2214
+ where: {
2215
+ id: item.id !== undefined ? item.id : undefined,
2216
+ },
2217
+ create: {
2218
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2219
+ type: item.type !== undefined ? item.type : undefined,
2220
+ note: item.note !== undefined ? item.note : undefined,
2221
+ status: item.status !== undefined ? item.status : undefined,
2222
+ fee: item.fee !== undefined ? item.fee : undefined,
2223
+ },
2224
+ }))
2225
+ } : undefined,
1407
2226
  },
1408
2227
  }))
1409
2228
  } : undefined,
@@ -1482,6 +2301,142 @@ exports.NewsArticleAssetSentiment = {
1482
2301
  takeProfitId: item.takeProfitId !== undefined ? {
1483
2302
  set: item.takeProfitId
1484
2303
  } : undefined,
2304
+ stopLoss: item.stopLoss ? {
2305
+ upsert: {
2306
+ where: {
2307
+ id: item.stopLoss.id !== undefined ? {
2308
+ equals: item.stopLoss.id
2309
+ } : undefined,
2310
+ },
2311
+ update: {
2312
+ id: item.stopLoss.id !== undefined ? {
2313
+ set: item.stopLoss.id
2314
+ } : undefined,
2315
+ stopPrice: item.stopLoss.stopPrice !== undefined ? {
2316
+ set: item.stopLoss.stopPrice
2317
+ } : undefined,
2318
+ limitPrice: item.stopLoss.limitPrice !== undefined ? {
2319
+ set: item.stopLoss.limitPrice
2320
+ } : undefined,
2321
+ },
2322
+ create: {
2323
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
2324
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
2325
+ },
2326
+ }
2327
+ } : undefined,
2328
+ takeProfit: item.takeProfit ? {
2329
+ upsert: {
2330
+ where: {
2331
+ id: item.takeProfit.id !== undefined ? {
2332
+ equals: item.takeProfit.id
2333
+ } : undefined,
2334
+ },
2335
+ update: {
2336
+ id: item.takeProfit.id !== undefined ? {
2337
+ set: item.takeProfit.id
2338
+ } : undefined,
2339
+ limitPrice: item.takeProfit.limitPrice !== undefined ? {
2340
+ set: item.takeProfit.limitPrice
2341
+ } : undefined,
2342
+ stopPrice: item.takeProfit.stopPrice !== undefined ? {
2343
+ set: item.takeProfit.stopPrice
2344
+ } : undefined,
2345
+ },
2346
+ create: {
2347
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
2348
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
2349
+ },
2350
+ }
2351
+ } : undefined,
2352
+ alpacaAccount: item.alpacaAccount ? {
2353
+ upsert: {
2354
+ where: {
2355
+ id: item.alpacaAccount.id !== undefined ? {
2356
+ equals: item.alpacaAccount.id
2357
+ } : undefined,
2358
+ },
2359
+ update: {
2360
+ id: item.alpacaAccount.id !== undefined ? {
2361
+ set: item.alpacaAccount.id
2362
+ } : undefined,
2363
+ type: item.alpacaAccount.type !== undefined ? {
2364
+ set: item.alpacaAccount.type
2365
+ } : undefined,
2366
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2367
+ set: item.alpacaAccount.APIKey
2368
+ } : undefined,
2369
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2370
+ set: item.alpacaAccount.APISecret
2371
+ } : undefined,
2372
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2373
+ set: item.alpacaAccount.configuration
2374
+ } : undefined,
2375
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2376
+ set: item.alpacaAccount.marketOpen
2377
+ } : undefined,
2378
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
2379
+ set: item.alpacaAccount.minOrderSize
2380
+ } : undefined,
2381
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
2382
+ set: item.alpacaAccount.maxOrderSize
2383
+ } : undefined,
2384
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
2385
+ set: item.alpacaAccount.minPercentageChange
2386
+ } : undefined,
2387
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
2388
+ set: item.alpacaAccount.volumeThreshold
2389
+ } : undefined,
2390
+ },
2391
+ create: {
2392
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2393
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2394
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2395
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2396
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2397
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2398
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2399
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2400
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2401
+ },
2402
+ }
2403
+ } : undefined,
2404
+ action: item.action ? {
2405
+ upsert: {
2406
+ where: {
2407
+ id: item.action.id !== undefined ? {
2408
+ equals: item.action.id
2409
+ } : undefined,
2410
+ },
2411
+ update: {
2412
+ id: item.action.id !== undefined ? {
2413
+ set: item.action.id
2414
+ } : undefined,
2415
+ sequence: item.action.sequence !== undefined ? {
2416
+ set: item.action.sequence
2417
+ } : undefined,
2418
+ type: item.action.type !== undefined ? {
2419
+ set: item.action.type
2420
+ } : undefined,
2421
+ note: item.action.note !== undefined ? {
2422
+ set: item.action.note
2423
+ } : undefined,
2424
+ status: item.action.status !== undefined ? {
2425
+ set: item.action.status
2426
+ } : undefined,
2427
+ fee: item.action.fee !== undefined ? {
2428
+ set: item.action.fee
2429
+ } : undefined,
2430
+ },
2431
+ create: {
2432
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2433
+ type: item.action.type !== undefined ? item.action.type : undefined,
2434
+ note: item.action.note !== undefined ? item.action.note : undefined,
2435
+ status: item.action.status !== undefined ? item.action.status : undefined,
2436
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2437
+ },
2438
+ }
2439
+ } : undefined,
1485
2440
  },
1486
2441
  create: {
1487
2442
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -1506,6 +2461,80 @@ exports.NewsArticleAssetSentiment = {
1506
2461
  optionType: item.optionType !== undefined ? item.optionType : undefined,
1507
2462
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1508
2463
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
2464
+ stopLoss: item.stopLoss ?
2465
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
2466
+ ? { connect: {
2467
+ id: item.stopLoss.id
2468
+ }
2469
+ }
2470
+ : { connectOrCreate: {
2471
+ where: {
2472
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2473
+ },
2474
+ create: {
2475
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
2476
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
2477
+ },
2478
+ }
2479
+ } : undefined,
2480
+ takeProfit: item.takeProfit ?
2481
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
2482
+ ? { connect: {
2483
+ id: item.takeProfit.id
2484
+ }
2485
+ }
2486
+ : { connectOrCreate: {
2487
+ where: {
2488
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2489
+ },
2490
+ create: {
2491
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
2492
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
2493
+ },
2494
+ }
2495
+ } : undefined,
2496
+ alpacaAccount: item.alpacaAccount ?
2497
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2498
+ ? { connect: {
2499
+ id: item.alpacaAccount.id
2500
+ }
2501
+ }
2502
+ : { connectOrCreate: {
2503
+ where: {
2504
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2505
+ },
2506
+ create: {
2507
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2508
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2509
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2510
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2511
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2512
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2513
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2514
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2515
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2516
+ },
2517
+ }
2518
+ } : undefined,
2519
+ action: item.action ?
2520
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2521
+ ? { connect: {
2522
+ id: item.action.id
2523
+ }
2524
+ }
2525
+ : { connectOrCreate: {
2526
+ where: {
2527
+ id: item.action.id !== undefined ? item.action.id : undefined,
2528
+ },
2529
+ create: {
2530
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2531
+ type: item.action.type !== undefined ? item.action.type : undefined,
2532
+ note: item.action.note !== undefined ? item.action.note : undefined,
2533
+ status: item.action.status !== undefined ? item.action.status : undefined,
2534
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2535
+ },
2536
+ }
2537
+ } : undefined,
1509
2538
  },
1510
2539
  }))
1511
2540
  } : undefined,
@@ -1557,6 +2586,58 @@ exports.NewsArticleAssetSentiment = {
1557
2586
  assetMarginable: item.assetMarginable !== undefined ? {
1558
2587
  set: item.assetMarginable
1559
2588
  } : undefined,
2589
+ alpacaAccount: item.alpacaAccount ? {
2590
+ upsert: {
2591
+ where: {
2592
+ id: item.alpacaAccount.id !== undefined ? {
2593
+ equals: item.alpacaAccount.id
2594
+ } : undefined,
2595
+ },
2596
+ update: {
2597
+ id: item.alpacaAccount.id !== undefined ? {
2598
+ set: item.alpacaAccount.id
2599
+ } : undefined,
2600
+ type: item.alpacaAccount.type !== undefined ? {
2601
+ set: item.alpacaAccount.type
2602
+ } : undefined,
2603
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2604
+ set: item.alpacaAccount.APIKey
2605
+ } : undefined,
2606
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2607
+ set: item.alpacaAccount.APISecret
2608
+ } : undefined,
2609
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2610
+ set: item.alpacaAccount.configuration
2611
+ } : undefined,
2612
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2613
+ set: item.alpacaAccount.marketOpen
2614
+ } : undefined,
2615
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
2616
+ set: item.alpacaAccount.minOrderSize
2617
+ } : undefined,
2618
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
2619
+ set: item.alpacaAccount.maxOrderSize
2620
+ } : undefined,
2621
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
2622
+ set: item.alpacaAccount.minPercentageChange
2623
+ } : undefined,
2624
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
2625
+ set: item.alpacaAccount.volumeThreshold
2626
+ } : undefined,
2627
+ },
2628
+ create: {
2629
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2630
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2631
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2632
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2633
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2634
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2635
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2636
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2637
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2638
+ },
2639
+ }
2640
+ } : undefined,
1560
2641
  },
1561
2642
  create: {
1562
2643
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -1572,6 +2653,29 @@ exports.NewsArticleAssetSentiment = {
1572
2653
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1573
2654
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1574
2655
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2656
+ alpacaAccount: item.alpacaAccount ?
2657
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2658
+ ? { connect: {
2659
+ id: item.alpacaAccount.id
2660
+ }
2661
+ }
2662
+ : { connectOrCreate: {
2663
+ where: {
2664
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2665
+ },
2666
+ create: {
2667
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2668
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2669
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2670
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2671
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2672
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2673
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2674
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2675
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2676
+ },
2677
+ }
2678
+ } : undefined,
1575
2679
  },
1576
2680
  }))
1577
2681
  } : undefined,
@@ -1654,6 +2758,48 @@ exports.NewsArticleAssetSentiment = {
1654
2758
  confidence: item.confidence !== undefined ? item.confidence : undefined,
1655
2759
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1656
2760
  status: item.status !== undefined ? item.status : undefined,
2761
+ alpacaAccount: item.alpacaAccount ?
2762
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2763
+ ? { connect: {
2764
+ id: item.alpacaAccount.id
2765
+ }
2766
+ }
2767
+ : { connectOrCreate: {
2768
+ where: {
2769
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2770
+ },
2771
+ create: {
2772
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2773
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2774
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2775
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2776
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2777
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2778
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2779
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2780
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2781
+ },
2782
+ }
2783
+ } : undefined,
2784
+ actions: item.actions ?
2785
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2786
+ connect: item.actions.map((item) => ({
2787
+ id: item.id
2788
+ }))
2789
+ }
2790
+ : { connectOrCreate: item.actions.map((item) => ({
2791
+ where: {
2792
+ id: item.id !== undefined ? item.id : undefined,
2793
+ },
2794
+ create: {
2795
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2796
+ type: item.type !== undefined ? item.type : undefined,
2797
+ note: item.note !== undefined ? item.note : undefined,
2798
+ status: item.status !== undefined ? item.status : undefined,
2799
+ fee: item.fee !== undefined ? item.fee : undefined,
2800
+ },
2801
+ }))
2802
+ } : undefined,
1657
2803
  },
1658
2804
  }))
1659
2805
  } : undefined,
@@ -1690,6 +2836,80 @@ exports.NewsArticleAssetSentiment = {
1690
2836
  optionType: item.optionType !== undefined ? item.optionType : undefined,
1691
2837
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1692
2838
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
2839
+ stopLoss: item.stopLoss ?
2840
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
2841
+ ? { connect: {
2842
+ id: item.stopLoss.id
2843
+ }
2844
+ }
2845
+ : { connectOrCreate: {
2846
+ where: {
2847
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2848
+ },
2849
+ create: {
2850
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
2851
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
2852
+ },
2853
+ }
2854
+ } : undefined,
2855
+ takeProfit: item.takeProfit ?
2856
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
2857
+ ? { connect: {
2858
+ id: item.takeProfit.id
2859
+ }
2860
+ }
2861
+ : { connectOrCreate: {
2862
+ where: {
2863
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2864
+ },
2865
+ create: {
2866
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
2867
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
2868
+ },
2869
+ }
2870
+ } : undefined,
2871
+ alpacaAccount: item.alpacaAccount ?
2872
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2873
+ ? { connect: {
2874
+ id: item.alpacaAccount.id
2875
+ }
2876
+ }
2877
+ : { connectOrCreate: {
2878
+ where: {
2879
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2880
+ },
2881
+ create: {
2882
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2883
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2884
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2885
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2886
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2887
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2888
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2889
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2890
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2891
+ },
2892
+ }
2893
+ } : undefined,
2894
+ action: item.action ?
2895
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2896
+ ? { connect: {
2897
+ id: item.action.id
2898
+ }
2899
+ }
2900
+ : { connectOrCreate: {
2901
+ where: {
2902
+ id: item.action.id !== undefined ? item.action.id : undefined,
2903
+ },
2904
+ create: {
2905
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2906
+ type: item.action.type !== undefined ? item.action.type : undefined,
2907
+ note: item.action.note !== undefined ? item.action.note : undefined,
2908
+ status: item.action.status !== undefined ? item.action.status : undefined,
2909
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2910
+ },
2911
+ }
2912
+ } : undefined,
1693
2913
  },
1694
2914
  }))
1695
2915
  } : undefined,
@@ -1717,6 +2937,29 @@ exports.NewsArticleAssetSentiment = {
1717
2937
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1718
2938
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1719
2939
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2940
+ alpacaAccount: item.alpacaAccount ?
2941
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2942
+ ? { connect: {
2943
+ id: item.alpacaAccount.id
2944
+ }
2945
+ }
2946
+ : { connectOrCreate: {
2947
+ where: {
2948
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2949
+ },
2950
+ create: {
2951
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2952
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2953
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2954
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2955
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2956
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2957
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2958
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2959
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2960
+ },
2961
+ }
2962
+ } : undefined,
1720
2963
  },
1721
2964
  }))
1722
2965
  } : undefined,