adaptic-backend 1.0.150 → 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 (73) hide show
  1. package/Account.cjs +1081 -156
  2. package/Action.cjs +3484 -72
  3. package/Alert.cjs +3824 -72
  4. package/AlpacaAccount.cjs +2936 -144
  5. package/Asset.cjs +3891 -696
  6. package/Authenticator.cjs +1057 -84
  7. package/Customer.cjs +1069 -120
  8. package/EconomicEvent.cjs +28 -84
  9. package/NewsArticle.cjs +956 -192
  10. package/NewsArticleAssetSentiment.cjs +1271 -84
  11. package/Order.cjs +4567 -201
  12. package/Position.cjs +4348 -180
  13. package/Session.cjs +1053 -72
  14. package/StopLoss.cjs +1848 -48
  15. package/TakeProfit.cjs +1848 -48
  16. package/Trade.cjs +5340 -192
  17. package/User.cjs +3159 -168
  18. package/VerificationToken.cjs +16 -48
  19. package/package.json +1 -1
  20. package/server/Account.d.ts.map +1 -1
  21. package/server/Account.js.map +1 -1
  22. package/server/Account.mjs +1081 -156
  23. package/server/Action.d.ts.map +1 -1
  24. package/server/Action.js.map +1 -1
  25. package/server/Action.mjs +3484 -72
  26. package/server/Alert.d.ts.map +1 -1
  27. package/server/Alert.js.map +1 -1
  28. package/server/Alert.mjs +3824 -72
  29. package/server/AlpacaAccount.d.ts.map +1 -1
  30. package/server/AlpacaAccount.js.map +1 -1
  31. package/server/AlpacaAccount.mjs +2936 -144
  32. package/server/Asset.d.ts.map +1 -1
  33. package/server/Asset.js.map +1 -1
  34. package/server/Asset.mjs +3891 -696
  35. package/server/Authenticator.d.ts.map +1 -1
  36. package/server/Authenticator.js.map +1 -1
  37. package/server/Authenticator.mjs +1057 -84
  38. package/server/Customer.d.ts.map +1 -1
  39. package/server/Customer.js.map +1 -1
  40. package/server/Customer.mjs +1069 -120
  41. package/server/EconomicEvent.d.ts.map +1 -1
  42. package/server/EconomicEvent.js.map +1 -1
  43. package/server/EconomicEvent.mjs +28 -84
  44. package/server/NewsArticle.d.ts.map +1 -1
  45. package/server/NewsArticle.js.map +1 -1
  46. package/server/NewsArticle.mjs +956 -192
  47. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  48. package/server/NewsArticleAssetSentiment.js.map +1 -1
  49. package/server/NewsArticleAssetSentiment.mjs +1271 -84
  50. package/server/Order.d.ts.map +1 -1
  51. package/server/Order.js.map +1 -1
  52. package/server/Order.mjs +4567 -201
  53. package/server/Position.d.ts.map +1 -1
  54. package/server/Position.js.map +1 -1
  55. package/server/Position.mjs +4348 -180
  56. package/server/Session.d.ts.map +1 -1
  57. package/server/Session.js.map +1 -1
  58. package/server/Session.mjs +1053 -72
  59. package/server/StopLoss.d.ts.map +1 -1
  60. package/server/StopLoss.js.map +1 -1
  61. package/server/StopLoss.mjs +1848 -48
  62. package/server/TakeProfit.d.ts.map +1 -1
  63. package/server/TakeProfit.js.map +1 -1
  64. package/server/TakeProfit.mjs +1848 -48
  65. package/server/Trade.d.ts.map +1 -1
  66. package/server/Trade.js.map +1 -1
  67. package/server/Trade.mjs +5340 -192
  68. package/server/User.d.ts.map +1 -1
  69. package/server/User.js.map +1 -1
  70. package/server/User.mjs +3159 -168
  71. package/server/VerificationToken.d.ts.map +1 -1
  72. package/server/VerificationToken.js.map +1 -1
  73. package/server/VerificationToken.mjs +16 -48
@@ -236,6 +236,48 @@ export const NewsArticleAssetSentiment = {
236
236
  confidence: item.confidence !== undefined ? item.confidence : undefined,
237
237
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
238
238
  status: item.status !== undefined ? item.status : undefined,
239
+ alpacaAccount: item.alpacaAccount ?
240
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
241
+ ? { connect: {
242
+ id: item.alpacaAccount.id
243
+ }
244
+ }
245
+ : { connectOrCreate: {
246
+ where: {
247
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
248
+ },
249
+ create: {
250
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
251
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
252
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
253
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
254
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
255
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
256
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
257
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
258
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
259
+ },
260
+ }
261
+ } : undefined,
262
+ actions: item.actions ?
263
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
264
+ connect: item.actions.map((item) => ({
265
+ id: item.id
266
+ }))
267
+ }
268
+ : { connectOrCreate: item.actions.map((item) => ({
269
+ where: {
270
+ id: item.id !== undefined ? item.id : undefined,
271
+ },
272
+ create: {
273
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
274
+ type: item.type !== undefined ? item.type : undefined,
275
+ note: item.note !== undefined ? item.note : undefined,
276
+ status: item.status !== undefined ? item.status : undefined,
277
+ fee: item.fee !== undefined ? item.fee : undefined,
278
+ },
279
+ }))
280
+ } : undefined,
239
281
  },
240
282
  }))
241
283
  } : undefined,
@@ -272,6 +314,80 @@ export const NewsArticleAssetSentiment = {
272
314
  optionType: item.optionType !== undefined ? item.optionType : undefined,
273
315
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
274
316
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
317
+ stopLoss: item.stopLoss ?
318
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
319
+ ? { connect: {
320
+ id: item.stopLoss.id
321
+ }
322
+ }
323
+ : { connectOrCreate: {
324
+ where: {
325
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
326
+ },
327
+ create: {
328
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
329
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
330
+ },
331
+ }
332
+ } : undefined,
333
+ takeProfit: item.takeProfit ?
334
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
335
+ ? { connect: {
336
+ id: item.takeProfit.id
337
+ }
338
+ }
339
+ : { connectOrCreate: {
340
+ where: {
341
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
342
+ },
343
+ create: {
344
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
345
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
346
+ },
347
+ }
348
+ } : undefined,
349
+ alpacaAccount: item.alpacaAccount ?
350
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
351
+ ? { connect: {
352
+ id: item.alpacaAccount.id
353
+ }
354
+ }
355
+ : { connectOrCreate: {
356
+ where: {
357
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
358
+ },
359
+ create: {
360
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
361
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
362
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
363
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
364
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
365
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
366
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
367
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
368
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
369
+ },
370
+ }
371
+ } : undefined,
372
+ action: item.action ?
373
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
374
+ ? { connect: {
375
+ id: item.action.id
376
+ }
377
+ }
378
+ : { connectOrCreate: {
379
+ where: {
380
+ id: item.action.id !== undefined ? item.action.id : undefined,
381
+ },
382
+ create: {
383
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
384
+ type: item.action.type !== undefined ? item.action.type : undefined,
385
+ note: item.action.note !== undefined ? item.action.note : undefined,
386
+ status: item.action.status !== undefined ? item.action.status : undefined,
387
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
388
+ },
389
+ }
390
+ } : undefined,
275
391
  },
276
392
  }))
277
393
  } : undefined,
@@ -299,6 +415,29 @@ export const NewsArticleAssetSentiment = {
299
415
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
300
416
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
301
417
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
418
+ alpacaAccount: item.alpacaAccount ?
419
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
420
+ ? { connect: {
421
+ id: item.alpacaAccount.id
422
+ }
423
+ }
424
+ : { connectOrCreate: {
425
+ where: {
426
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
427
+ },
428
+ create: {
429
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
430
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
431
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
432
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
433
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
434
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
435
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
436
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
437
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
438
+ },
439
+ }
440
+ } : undefined,
302
441
  },
303
442
  }))
304
443
  } : undefined,
@@ -379,27 +518,13 @@ export const NewsArticleAssetSentiment = {
379
518
  }`;
380
519
  const variables = {
381
520
  where: {
382
- id: props.id !== undefined ? {
383
- equals: props.id
384
- } : undefined,
385
- url: props.url !== undefined ? {
386
- equals: props.url
387
- } : undefined,
388
- assetId: props.assetId !== undefined ? {
389
- equals: props.assetId
390
- } : undefined,
391
- newsArticleId: props.newsArticleId !== undefined ? {
392
- equals: props.newsArticleId
393
- } : undefined,
394
- relevancyScore: props.relevancyScore !== undefined ? {
395
- equals: props.relevancyScore
396
- } : undefined,
397
- sentimentScore: props.sentimentScore !== undefined ? {
398
- equals: props.sentimentScore
399
- } : undefined,
400
- sentimentLabel: props.sentimentLabel !== undefined ? {
401
- equals: props.sentimentLabel
402
- } : undefined,
521
+ id: props.id !== undefined ? props.id : undefined,
522
+ url: props.url !== undefined ? props.url : undefined,
523
+ assetId: props.assetId !== undefined ? props.assetId : undefined,
524
+ newsArticleId: props.newsArticleId !== undefined ? props.newsArticleId : undefined,
525
+ relevancyScore: props.relevancyScore !== undefined ? props.relevancyScore : undefined,
526
+ sentimentScore: props.sentimentScore !== undefined ? props.sentimentScore : undefined,
527
+ sentimentLabel: props.sentimentLabel !== undefined ? props.sentimentLabel : undefined,
403
528
  },
404
529
  data: {
405
530
  id: props.id !== undefined ? {
@@ -715,6 +840,92 @@ export const NewsArticleAssetSentiment = {
715
840
  status: item.status !== undefined ? {
716
841
  set: item.status
717
842
  } : undefined,
843
+ alpacaAccount: item.alpacaAccount ? {
844
+ upsert: {
845
+ where: {
846
+ id: item.alpacaAccount.id !== undefined ? {
847
+ equals: item.alpacaAccount.id
848
+ } : undefined,
849
+ },
850
+ update: {
851
+ id: item.alpacaAccount.id !== undefined ? {
852
+ set: item.alpacaAccount.id
853
+ } : undefined,
854
+ type: item.alpacaAccount.type !== undefined ? {
855
+ set: item.alpacaAccount.type
856
+ } : undefined,
857
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
858
+ set: item.alpacaAccount.APIKey
859
+ } : undefined,
860
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
861
+ set: item.alpacaAccount.APISecret
862
+ } : undefined,
863
+ configuration: item.alpacaAccount.configuration !== undefined ? {
864
+ set: item.alpacaAccount.configuration
865
+ } : undefined,
866
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
867
+ set: item.alpacaAccount.marketOpen
868
+ } : undefined,
869
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
870
+ set: item.alpacaAccount.minOrderSize
871
+ } : undefined,
872
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
873
+ set: item.alpacaAccount.maxOrderSize
874
+ } : undefined,
875
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
876
+ set: item.alpacaAccount.minPercentageChange
877
+ } : undefined,
878
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
879
+ set: item.alpacaAccount.volumeThreshold
880
+ } : undefined,
881
+ },
882
+ create: {
883
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
884
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
885
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
886
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
887
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
888
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
889
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
890
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
891
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
892
+ },
893
+ }
894
+ } : undefined,
895
+ actions: item.actions ? {
896
+ upsert: item.actions.map((item) => ({
897
+ where: {
898
+ id: item.id !== undefined ? item.id : undefined,
899
+ },
900
+ update: {
901
+ id: item.id !== undefined ? {
902
+ set: item.id
903
+ } : undefined,
904
+ sequence: item.sequence !== undefined ? {
905
+ set: item.sequence
906
+ } : undefined,
907
+ type: item.type !== undefined ? {
908
+ set: item.type
909
+ } : undefined,
910
+ note: item.note !== undefined ? {
911
+ set: item.note
912
+ } : undefined,
913
+ status: item.status !== undefined ? {
914
+ set: item.status
915
+ } : undefined,
916
+ fee: item.fee !== undefined ? {
917
+ set: item.fee
918
+ } : undefined,
919
+ },
920
+ create: {
921
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
922
+ type: item.type !== undefined ? item.type : undefined,
923
+ note: item.note !== undefined ? item.note : undefined,
924
+ status: item.status !== undefined ? item.status : undefined,
925
+ fee: item.fee !== undefined ? item.fee : undefined,
926
+ },
927
+ }))
928
+ } : undefined,
718
929
  },
719
930
  create: {
720
931
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -728,6 +939,48 @@ export const NewsArticleAssetSentiment = {
728
939
  confidence: item.confidence !== undefined ? item.confidence : undefined,
729
940
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
730
941
  status: item.status !== undefined ? item.status : undefined,
942
+ alpacaAccount: item.alpacaAccount ?
943
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
944
+ ? { connect: {
945
+ id: item.alpacaAccount.id
946
+ }
947
+ }
948
+ : { connectOrCreate: {
949
+ where: {
950
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
951
+ },
952
+ create: {
953
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
954
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
955
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
956
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
957
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
958
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
959
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
960
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
961
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
962
+ },
963
+ }
964
+ } : undefined,
965
+ actions: item.actions ?
966
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
967
+ connect: item.actions.map((item) => ({
968
+ id: item.id
969
+ }))
970
+ }
971
+ : { connectOrCreate: item.actions.map((item) => ({
972
+ where: {
973
+ id: item.id !== undefined ? item.id : undefined,
974
+ },
975
+ create: {
976
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
977
+ type: item.type !== undefined ? item.type : undefined,
978
+ note: item.note !== undefined ? item.note : undefined,
979
+ status: item.status !== undefined ? item.status : undefined,
980
+ fee: item.fee !== undefined ? item.fee : undefined,
981
+ },
982
+ }))
983
+ } : undefined,
731
984
  },
732
985
  }))
733
986
  } : undefined,
@@ -806,6 +1059,142 @@ export const NewsArticleAssetSentiment = {
806
1059
  takeProfitId: item.takeProfitId !== undefined ? {
807
1060
  set: item.takeProfitId
808
1061
  } : undefined,
1062
+ stopLoss: item.stopLoss ? {
1063
+ upsert: {
1064
+ where: {
1065
+ id: item.stopLoss.id !== undefined ? {
1066
+ equals: item.stopLoss.id
1067
+ } : undefined,
1068
+ },
1069
+ update: {
1070
+ id: item.stopLoss.id !== undefined ? {
1071
+ set: item.stopLoss.id
1072
+ } : undefined,
1073
+ stopPrice: item.stopLoss.stopPrice !== undefined ? {
1074
+ set: item.stopLoss.stopPrice
1075
+ } : undefined,
1076
+ limitPrice: item.stopLoss.limitPrice !== undefined ? {
1077
+ set: item.stopLoss.limitPrice
1078
+ } : undefined,
1079
+ },
1080
+ create: {
1081
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
1082
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
1083
+ },
1084
+ }
1085
+ } : undefined,
1086
+ takeProfit: item.takeProfit ? {
1087
+ upsert: {
1088
+ where: {
1089
+ id: item.takeProfit.id !== undefined ? {
1090
+ equals: item.takeProfit.id
1091
+ } : undefined,
1092
+ },
1093
+ update: {
1094
+ id: item.takeProfit.id !== undefined ? {
1095
+ set: item.takeProfit.id
1096
+ } : undefined,
1097
+ limitPrice: item.takeProfit.limitPrice !== undefined ? {
1098
+ set: item.takeProfit.limitPrice
1099
+ } : undefined,
1100
+ stopPrice: item.takeProfit.stopPrice !== undefined ? {
1101
+ set: item.takeProfit.stopPrice
1102
+ } : undefined,
1103
+ },
1104
+ create: {
1105
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
1106
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
1107
+ },
1108
+ }
1109
+ } : undefined,
1110
+ alpacaAccount: item.alpacaAccount ? {
1111
+ upsert: {
1112
+ where: {
1113
+ id: item.alpacaAccount.id !== undefined ? {
1114
+ equals: item.alpacaAccount.id
1115
+ } : undefined,
1116
+ },
1117
+ update: {
1118
+ id: item.alpacaAccount.id !== undefined ? {
1119
+ set: item.alpacaAccount.id
1120
+ } : undefined,
1121
+ type: item.alpacaAccount.type !== undefined ? {
1122
+ set: item.alpacaAccount.type
1123
+ } : undefined,
1124
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1125
+ set: item.alpacaAccount.APIKey
1126
+ } : undefined,
1127
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1128
+ set: item.alpacaAccount.APISecret
1129
+ } : undefined,
1130
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1131
+ set: item.alpacaAccount.configuration
1132
+ } : undefined,
1133
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1134
+ set: item.alpacaAccount.marketOpen
1135
+ } : undefined,
1136
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
1137
+ set: item.alpacaAccount.minOrderSize
1138
+ } : undefined,
1139
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
1140
+ set: item.alpacaAccount.maxOrderSize
1141
+ } : undefined,
1142
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
1143
+ set: item.alpacaAccount.minPercentageChange
1144
+ } : undefined,
1145
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
1146
+ set: item.alpacaAccount.volumeThreshold
1147
+ } : undefined,
1148
+ },
1149
+ create: {
1150
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1151
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1152
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1153
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1154
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1155
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1156
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1157
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1158
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1159
+ },
1160
+ }
1161
+ } : undefined,
1162
+ action: item.action ? {
1163
+ upsert: {
1164
+ where: {
1165
+ id: item.action.id !== undefined ? {
1166
+ equals: item.action.id
1167
+ } : undefined,
1168
+ },
1169
+ update: {
1170
+ id: item.action.id !== undefined ? {
1171
+ set: item.action.id
1172
+ } : undefined,
1173
+ sequence: item.action.sequence !== undefined ? {
1174
+ set: item.action.sequence
1175
+ } : undefined,
1176
+ type: item.action.type !== undefined ? {
1177
+ set: item.action.type
1178
+ } : undefined,
1179
+ note: item.action.note !== undefined ? {
1180
+ set: item.action.note
1181
+ } : undefined,
1182
+ status: item.action.status !== undefined ? {
1183
+ set: item.action.status
1184
+ } : undefined,
1185
+ fee: item.action.fee !== undefined ? {
1186
+ set: item.action.fee
1187
+ } : undefined,
1188
+ },
1189
+ create: {
1190
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1191
+ type: item.action.type !== undefined ? item.action.type : undefined,
1192
+ note: item.action.note !== undefined ? item.action.note : undefined,
1193
+ status: item.action.status !== undefined ? item.action.status : undefined,
1194
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1195
+ },
1196
+ }
1197
+ } : undefined,
809
1198
  },
810
1199
  create: {
811
1200
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -830,6 +1219,80 @@ export const NewsArticleAssetSentiment = {
830
1219
  optionType: item.optionType !== undefined ? item.optionType : undefined,
831
1220
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
832
1221
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
1222
+ stopLoss: item.stopLoss ?
1223
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
1224
+ ? { connect: {
1225
+ id: item.stopLoss.id
1226
+ }
1227
+ }
1228
+ : { connectOrCreate: {
1229
+ where: {
1230
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1231
+ },
1232
+ create: {
1233
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
1234
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
1235
+ },
1236
+ }
1237
+ } : undefined,
1238
+ takeProfit: item.takeProfit ?
1239
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
1240
+ ? { connect: {
1241
+ id: item.takeProfit.id
1242
+ }
1243
+ }
1244
+ : { connectOrCreate: {
1245
+ where: {
1246
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1247
+ },
1248
+ create: {
1249
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
1250
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
1251
+ },
1252
+ }
1253
+ } : undefined,
1254
+ alpacaAccount: item.alpacaAccount ?
1255
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1256
+ ? { connect: {
1257
+ id: item.alpacaAccount.id
1258
+ }
1259
+ }
1260
+ : { connectOrCreate: {
1261
+ where: {
1262
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1263
+ },
1264
+ create: {
1265
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1266
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1267
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1268
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1269
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1270
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1271
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1272
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1273
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1274
+ },
1275
+ }
1276
+ } : undefined,
1277
+ action: item.action ?
1278
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1279
+ ? { connect: {
1280
+ id: item.action.id
1281
+ }
1282
+ }
1283
+ : { connectOrCreate: {
1284
+ where: {
1285
+ id: item.action.id !== undefined ? item.action.id : undefined,
1286
+ },
1287
+ create: {
1288
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1289
+ type: item.action.type !== undefined ? item.action.type : undefined,
1290
+ note: item.action.note !== undefined ? item.action.note : undefined,
1291
+ status: item.action.status !== undefined ? item.action.status : undefined,
1292
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1293
+ },
1294
+ }
1295
+ } : undefined,
833
1296
  },
834
1297
  }))
835
1298
  } : undefined,
@@ -881,6 +1344,58 @@ export const NewsArticleAssetSentiment = {
881
1344
  assetMarginable: item.assetMarginable !== undefined ? {
882
1345
  set: item.assetMarginable
883
1346
  } : undefined,
1347
+ alpacaAccount: item.alpacaAccount ? {
1348
+ upsert: {
1349
+ where: {
1350
+ id: item.alpacaAccount.id !== undefined ? {
1351
+ equals: item.alpacaAccount.id
1352
+ } : undefined,
1353
+ },
1354
+ update: {
1355
+ id: item.alpacaAccount.id !== undefined ? {
1356
+ set: item.alpacaAccount.id
1357
+ } : undefined,
1358
+ type: item.alpacaAccount.type !== undefined ? {
1359
+ set: item.alpacaAccount.type
1360
+ } : undefined,
1361
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1362
+ set: item.alpacaAccount.APIKey
1363
+ } : undefined,
1364
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1365
+ set: item.alpacaAccount.APISecret
1366
+ } : undefined,
1367
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1368
+ set: item.alpacaAccount.configuration
1369
+ } : undefined,
1370
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1371
+ set: item.alpacaAccount.marketOpen
1372
+ } : undefined,
1373
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
1374
+ set: item.alpacaAccount.minOrderSize
1375
+ } : undefined,
1376
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
1377
+ set: item.alpacaAccount.maxOrderSize
1378
+ } : undefined,
1379
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
1380
+ set: item.alpacaAccount.minPercentageChange
1381
+ } : undefined,
1382
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
1383
+ set: item.alpacaAccount.volumeThreshold
1384
+ } : undefined,
1385
+ },
1386
+ create: {
1387
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1388
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1389
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1390
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1391
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1392
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1393
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1394
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1395
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1396
+ },
1397
+ }
1398
+ } : undefined,
884
1399
  },
885
1400
  create: {
886
1401
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -896,6 +1411,29 @@ export const NewsArticleAssetSentiment = {
896
1411
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
897
1412
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
898
1413
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1414
+ alpacaAccount: item.alpacaAccount ?
1415
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1416
+ ? { connect: {
1417
+ id: item.alpacaAccount.id
1418
+ }
1419
+ }
1420
+ : { connectOrCreate: {
1421
+ where: {
1422
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1423
+ },
1424
+ create: {
1425
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1426
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1427
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1428
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1429
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1430
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1431
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1432
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1433
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1434
+ },
1435
+ }
1436
+ } : undefined,
899
1437
  },
900
1438
  }))
901
1439
  } : undefined,
@@ -978,6 +1516,48 @@ export const NewsArticleAssetSentiment = {
978
1516
  confidence: item.confidence !== undefined ? item.confidence : undefined,
979
1517
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
980
1518
  status: item.status !== undefined ? item.status : undefined,
1519
+ alpacaAccount: item.alpacaAccount ?
1520
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1521
+ ? { connect: {
1522
+ id: item.alpacaAccount.id
1523
+ }
1524
+ }
1525
+ : { connectOrCreate: {
1526
+ where: {
1527
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1528
+ },
1529
+ create: {
1530
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1531
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1532
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1533
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1534
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1535
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1536
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1537
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1538
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1539
+ },
1540
+ }
1541
+ } : undefined,
1542
+ actions: item.actions ?
1543
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1544
+ connect: item.actions.map((item) => ({
1545
+ id: item.id
1546
+ }))
1547
+ }
1548
+ : { connectOrCreate: item.actions.map((item) => ({
1549
+ where: {
1550
+ id: item.id !== undefined ? item.id : undefined,
1551
+ },
1552
+ create: {
1553
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1554
+ type: item.type !== undefined ? item.type : undefined,
1555
+ note: item.note !== undefined ? item.note : undefined,
1556
+ status: item.status !== undefined ? item.status : undefined,
1557
+ fee: item.fee !== undefined ? item.fee : undefined,
1558
+ },
1559
+ }))
1560
+ } : undefined,
981
1561
  },
982
1562
  }))
983
1563
  } : undefined,
@@ -1014,6 +1594,80 @@ export const NewsArticleAssetSentiment = {
1014
1594
  optionType: item.optionType !== undefined ? item.optionType : undefined,
1015
1595
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1016
1596
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
1597
+ stopLoss: item.stopLoss ?
1598
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
1599
+ ? { connect: {
1600
+ id: item.stopLoss.id
1601
+ }
1602
+ }
1603
+ : { connectOrCreate: {
1604
+ where: {
1605
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1606
+ },
1607
+ create: {
1608
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
1609
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
1610
+ },
1611
+ }
1612
+ } : undefined,
1613
+ takeProfit: item.takeProfit ?
1614
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
1615
+ ? { connect: {
1616
+ id: item.takeProfit.id
1617
+ }
1618
+ }
1619
+ : { connectOrCreate: {
1620
+ where: {
1621
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1622
+ },
1623
+ create: {
1624
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
1625
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
1626
+ },
1627
+ }
1628
+ } : undefined,
1629
+ alpacaAccount: item.alpacaAccount ?
1630
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1631
+ ? { connect: {
1632
+ id: item.alpacaAccount.id
1633
+ }
1634
+ }
1635
+ : { connectOrCreate: {
1636
+ where: {
1637
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1638
+ },
1639
+ create: {
1640
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1641
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1642
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1643
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1644
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1645
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1646
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1647
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1648
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1649
+ },
1650
+ }
1651
+ } : undefined,
1652
+ action: item.action ?
1653
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1654
+ ? { connect: {
1655
+ id: item.action.id
1656
+ }
1657
+ }
1658
+ : { connectOrCreate: {
1659
+ where: {
1660
+ id: item.action.id !== undefined ? item.action.id : undefined,
1661
+ },
1662
+ create: {
1663
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1664
+ type: item.action.type !== undefined ? item.action.type : undefined,
1665
+ note: item.action.note !== undefined ? item.action.note : undefined,
1666
+ status: item.action.status !== undefined ? item.action.status : undefined,
1667
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1668
+ },
1669
+ }
1670
+ } : undefined,
1017
1671
  },
1018
1672
  }))
1019
1673
  } : undefined,
@@ -1041,6 +1695,29 @@ export const NewsArticleAssetSentiment = {
1041
1695
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1042
1696
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1043
1697
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1698
+ alpacaAccount: item.alpacaAccount ?
1699
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1700
+ ? { connect: {
1701
+ id: item.alpacaAccount.id
1702
+ }
1703
+ }
1704
+ : { connectOrCreate: {
1705
+ where: {
1706
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1707
+ },
1708
+ create: {
1709
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1710
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1711
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1712
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1713
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1714
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
1715
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
1716
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
1717
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
1718
+ },
1719
+ }
1720
+ } : undefined,
1044
1721
  },
1045
1722
  }))
1046
1723
  } : undefined,
@@ -1081,27 +1758,13 @@ export const NewsArticleAssetSentiment = {
1081
1758
  }`;
1082
1759
  const variables = props.map(prop => ({
1083
1760
  where: {
1084
- id: prop.id !== undefined ? {
1085
- equals: prop.id
1086
- } : undefined,
1087
- url: prop.url !== undefined ? {
1088
- equals: prop.url
1089
- } : undefined,
1090
- assetId: prop.assetId !== undefined ? {
1091
- equals: prop.assetId
1092
- } : undefined,
1093
- newsArticleId: prop.newsArticleId !== undefined ? {
1094
- equals: prop.newsArticleId
1095
- } : undefined,
1096
- relevancyScore: prop.relevancyScore !== undefined ? {
1097
- equals: prop.relevancyScore
1098
- } : undefined,
1099
- sentimentScore: prop.sentimentScore !== undefined ? {
1100
- equals: prop.sentimentScore
1101
- } : undefined,
1102
- sentimentLabel: prop.sentimentLabel !== undefined ? {
1103
- equals: prop.sentimentLabel
1104
- } : undefined,
1761
+ id: prop.id !== undefined ? prop.id : undefined,
1762
+ url: prop.url !== undefined ? prop.url : undefined,
1763
+ assetId: prop.assetId !== undefined ? prop.assetId : undefined,
1764
+ newsArticleId: prop.newsArticleId !== undefined ? prop.newsArticleId : undefined,
1765
+ relevancyScore: prop.relevancyScore !== undefined ? prop.relevancyScore : undefined,
1766
+ sentimentScore: prop.sentimentScore !== undefined ? prop.sentimentScore : undefined,
1767
+ sentimentLabel: prop.sentimentLabel !== undefined ? prop.sentimentLabel : undefined,
1105
1768
  },
1106
1769
  data: {
1107
1770
  id: prop.id !== undefined ? {
@@ -1417,6 +2080,92 @@ export const NewsArticleAssetSentiment = {
1417
2080
  status: item.status !== undefined ? {
1418
2081
  set: item.status
1419
2082
  } : undefined,
2083
+ alpacaAccount: item.alpacaAccount ? {
2084
+ upsert: {
2085
+ where: {
2086
+ id: item.alpacaAccount.id !== undefined ? {
2087
+ equals: item.alpacaAccount.id
2088
+ } : undefined,
2089
+ },
2090
+ update: {
2091
+ id: item.alpacaAccount.id !== undefined ? {
2092
+ set: item.alpacaAccount.id
2093
+ } : undefined,
2094
+ type: item.alpacaAccount.type !== undefined ? {
2095
+ set: item.alpacaAccount.type
2096
+ } : undefined,
2097
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2098
+ set: item.alpacaAccount.APIKey
2099
+ } : undefined,
2100
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2101
+ set: item.alpacaAccount.APISecret
2102
+ } : undefined,
2103
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2104
+ set: item.alpacaAccount.configuration
2105
+ } : undefined,
2106
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2107
+ set: item.alpacaAccount.marketOpen
2108
+ } : undefined,
2109
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
2110
+ set: item.alpacaAccount.minOrderSize
2111
+ } : undefined,
2112
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
2113
+ set: item.alpacaAccount.maxOrderSize
2114
+ } : undefined,
2115
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
2116
+ set: item.alpacaAccount.minPercentageChange
2117
+ } : undefined,
2118
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
2119
+ set: item.alpacaAccount.volumeThreshold
2120
+ } : undefined,
2121
+ },
2122
+ create: {
2123
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2124
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2125
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2126
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2127
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2128
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2129
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2130
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2131
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2132
+ },
2133
+ }
2134
+ } : undefined,
2135
+ actions: item.actions ? {
2136
+ upsert: item.actions.map((item) => ({
2137
+ where: {
2138
+ id: item.id !== undefined ? item.id : undefined,
2139
+ },
2140
+ update: {
2141
+ id: item.id !== undefined ? {
2142
+ set: item.id
2143
+ } : undefined,
2144
+ sequence: item.sequence !== undefined ? {
2145
+ set: item.sequence
2146
+ } : undefined,
2147
+ type: item.type !== undefined ? {
2148
+ set: item.type
2149
+ } : undefined,
2150
+ note: item.note !== undefined ? {
2151
+ set: item.note
2152
+ } : undefined,
2153
+ status: item.status !== undefined ? {
2154
+ set: item.status
2155
+ } : undefined,
2156
+ fee: item.fee !== undefined ? {
2157
+ set: item.fee
2158
+ } : undefined,
2159
+ },
2160
+ create: {
2161
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2162
+ type: item.type !== undefined ? item.type : undefined,
2163
+ note: item.note !== undefined ? item.note : undefined,
2164
+ status: item.status !== undefined ? item.status : undefined,
2165
+ fee: item.fee !== undefined ? item.fee : undefined,
2166
+ },
2167
+ }))
2168
+ } : undefined,
1420
2169
  },
1421
2170
  create: {
1422
2171
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1430,6 +2179,48 @@ export const NewsArticleAssetSentiment = {
1430
2179
  confidence: item.confidence !== undefined ? item.confidence : undefined,
1431
2180
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1432
2181
  status: item.status !== undefined ? item.status : undefined,
2182
+ alpacaAccount: item.alpacaAccount ?
2183
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2184
+ ? { connect: {
2185
+ id: item.alpacaAccount.id
2186
+ }
2187
+ }
2188
+ : { connectOrCreate: {
2189
+ where: {
2190
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2191
+ },
2192
+ create: {
2193
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2194
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2195
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2196
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2197
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2198
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2199
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2200
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2201
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2202
+ },
2203
+ }
2204
+ } : undefined,
2205
+ actions: item.actions ?
2206
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2207
+ connect: item.actions.map((item) => ({
2208
+ id: item.id
2209
+ }))
2210
+ }
2211
+ : { connectOrCreate: item.actions.map((item) => ({
2212
+ where: {
2213
+ id: item.id !== undefined ? item.id : undefined,
2214
+ },
2215
+ create: {
2216
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2217
+ type: item.type !== undefined ? item.type : undefined,
2218
+ note: item.note !== undefined ? item.note : undefined,
2219
+ status: item.status !== undefined ? item.status : undefined,
2220
+ fee: item.fee !== undefined ? item.fee : undefined,
2221
+ },
2222
+ }))
2223
+ } : undefined,
1433
2224
  },
1434
2225
  }))
1435
2226
  } : undefined,
@@ -1508,6 +2299,142 @@ export const NewsArticleAssetSentiment = {
1508
2299
  takeProfitId: item.takeProfitId !== undefined ? {
1509
2300
  set: item.takeProfitId
1510
2301
  } : undefined,
2302
+ stopLoss: item.stopLoss ? {
2303
+ upsert: {
2304
+ where: {
2305
+ id: item.stopLoss.id !== undefined ? {
2306
+ equals: item.stopLoss.id
2307
+ } : undefined,
2308
+ },
2309
+ update: {
2310
+ id: item.stopLoss.id !== undefined ? {
2311
+ set: item.stopLoss.id
2312
+ } : undefined,
2313
+ stopPrice: item.stopLoss.stopPrice !== undefined ? {
2314
+ set: item.stopLoss.stopPrice
2315
+ } : undefined,
2316
+ limitPrice: item.stopLoss.limitPrice !== undefined ? {
2317
+ set: item.stopLoss.limitPrice
2318
+ } : undefined,
2319
+ },
2320
+ create: {
2321
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
2322
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
2323
+ },
2324
+ }
2325
+ } : undefined,
2326
+ takeProfit: item.takeProfit ? {
2327
+ upsert: {
2328
+ where: {
2329
+ id: item.takeProfit.id !== undefined ? {
2330
+ equals: item.takeProfit.id
2331
+ } : undefined,
2332
+ },
2333
+ update: {
2334
+ id: item.takeProfit.id !== undefined ? {
2335
+ set: item.takeProfit.id
2336
+ } : undefined,
2337
+ limitPrice: item.takeProfit.limitPrice !== undefined ? {
2338
+ set: item.takeProfit.limitPrice
2339
+ } : undefined,
2340
+ stopPrice: item.takeProfit.stopPrice !== undefined ? {
2341
+ set: item.takeProfit.stopPrice
2342
+ } : undefined,
2343
+ },
2344
+ create: {
2345
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
2346
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
2347
+ },
2348
+ }
2349
+ } : undefined,
2350
+ alpacaAccount: item.alpacaAccount ? {
2351
+ upsert: {
2352
+ where: {
2353
+ id: item.alpacaAccount.id !== undefined ? {
2354
+ equals: item.alpacaAccount.id
2355
+ } : undefined,
2356
+ },
2357
+ update: {
2358
+ id: item.alpacaAccount.id !== undefined ? {
2359
+ set: item.alpacaAccount.id
2360
+ } : undefined,
2361
+ type: item.alpacaAccount.type !== undefined ? {
2362
+ set: item.alpacaAccount.type
2363
+ } : undefined,
2364
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2365
+ set: item.alpacaAccount.APIKey
2366
+ } : undefined,
2367
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2368
+ set: item.alpacaAccount.APISecret
2369
+ } : undefined,
2370
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2371
+ set: item.alpacaAccount.configuration
2372
+ } : undefined,
2373
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2374
+ set: item.alpacaAccount.marketOpen
2375
+ } : undefined,
2376
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
2377
+ set: item.alpacaAccount.minOrderSize
2378
+ } : undefined,
2379
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
2380
+ set: item.alpacaAccount.maxOrderSize
2381
+ } : undefined,
2382
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
2383
+ set: item.alpacaAccount.minPercentageChange
2384
+ } : undefined,
2385
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
2386
+ set: item.alpacaAccount.volumeThreshold
2387
+ } : undefined,
2388
+ },
2389
+ create: {
2390
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2391
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2392
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2393
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2394
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2395
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2396
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2397
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2398
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2399
+ },
2400
+ }
2401
+ } : undefined,
2402
+ action: item.action ? {
2403
+ upsert: {
2404
+ where: {
2405
+ id: item.action.id !== undefined ? {
2406
+ equals: item.action.id
2407
+ } : undefined,
2408
+ },
2409
+ update: {
2410
+ id: item.action.id !== undefined ? {
2411
+ set: item.action.id
2412
+ } : undefined,
2413
+ sequence: item.action.sequence !== undefined ? {
2414
+ set: item.action.sequence
2415
+ } : undefined,
2416
+ type: item.action.type !== undefined ? {
2417
+ set: item.action.type
2418
+ } : undefined,
2419
+ note: item.action.note !== undefined ? {
2420
+ set: item.action.note
2421
+ } : undefined,
2422
+ status: item.action.status !== undefined ? {
2423
+ set: item.action.status
2424
+ } : undefined,
2425
+ fee: item.action.fee !== undefined ? {
2426
+ set: item.action.fee
2427
+ } : undefined,
2428
+ },
2429
+ create: {
2430
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2431
+ type: item.action.type !== undefined ? item.action.type : undefined,
2432
+ note: item.action.note !== undefined ? item.action.note : undefined,
2433
+ status: item.action.status !== undefined ? item.action.status : undefined,
2434
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2435
+ },
2436
+ }
2437
+ } : undefined,
1511
2438
  },
1512
2439
  create: {
1513
2440
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -1532,6 +2459,80 @@ export const NewsArticleAssetSentiment = {
1532
2459
  optionType: item.optionType !== undefined ? item.optionType : undefined,
1533
2460
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1534
2461
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
2462
+ stopLoss: item.stopLoss ?
2463
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
2464
+ ? { connect: {
2465
+ id: item.stopLoss.id
2466
+ }
2467
+ }
2468
+ : { connectOrCreate: {
2469
+ where: {
2470
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2471
+ },
2472
+ create: {
2473
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
2474
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
2475
+ },
2476
+ }
2477
+ } : undefined,
2478
+ takeProfit: item.takeProfit ?
2479
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
2480
+ ? { connect: {
2481
+ id: item.takeProfit.id
2482
+ }
2483
+ }
2484
+ : { connectOrCreate: {
2485
+ where: {
2486
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2487
+ },
2488
+ create: {
2489
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
2490
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
2491
+ },
2492
+ }
2493
+ } : undefined,
2494
+ alpacaAccount: item.alpacaAccount ?
2495
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2496
+ ? { connect: {
2497
+ id: item.alpacaAccount.id
2498
+ }
2499
+ }
2500
+ : { connectOrCreate: {
2501
+ where: {
2502
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2503
+ },
2504
+ create: {
2505
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2506
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2507
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2508
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2509
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2510
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2511
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2512
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2513
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2514
+ },
2515
+ }
2516
+ } : undefined,
2517
+ action: item.action ?
2518
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2519
+ ? { connect: {
2520
+ id: item.action.id
2521
+ }
2522
+ }
2523
+ : { connectOrCreate: {
2524
+ where: {
2525
+ id: item.action.id !== undefined ? item.action.id : undefined,
2526
+ },
2527
+ create: {
2528
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2529
+ type: item.action.type !== undefined ? item.action.type : undefined,
2530
+ note: item.action.note !== undefined ? item.action.note : undefined,
2531
+ status: item.action.status !== undefined ? item.action.status : undefined,
2532
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2533
+ },
2534
+ }
2535
+ } : undefined,
1535
2536
  },
1536
2537
  }))
1537
2538
  } : undefined,
@@ -1583,6 +2584,58 @@ export const NewsArticleAssetSentiment = {
1583
2584
  assetMarginable: item.assetMarginable !== undefined ? {
1584
2585
  set: item.assetMarginable
1585
2586
  } : undefined,
2587
+ alpacaAccount: item.alpacaAccount ? {
2588
+ upsert: {
2589
+ where: {
2590
+ id: item.alpacaAccount.id !== undefined ? {
2591
+ equals: item.alpacaAccount.id
2592
+ } : undefined,
2593
+ },
2594
+ update: {
2595
+ id: item.alpacaAccount.id !== undefined ? {
2596
+ set: item.alpacaAccount.id
2597
+ } : undefined,
2598
+ type: item.alpacaAccount.type !== undefined ? {
2599
+ set: item.alpacaAccount.type
2600
+ } : undefined,
2601
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2602
+ set: item.alpacaAccount.APIKey
2603
+ } : undefined,
2604
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2605
+ set: item.alpacaAccount.APISecret
2606
+ } : undefined,
2607
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2608
+ set: item.alpacaAccount.configuration
2609
+ } : undefined,
2610
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2611
+ set: item.alpacaAccount.marketOpen
2612
+ } : undefined,
2613
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? {
2614
+ set: item.alpacaAccount.minOrderSize
2615
+ } : undefined,
2616
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? {
2617
+ set: item.alpacaAccount.maxOrderSize
2618
+ } : undefined,
2619
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? {
2620
+ set: item.alpacaAccount.minPercentageChange
2621
+ } : undefined,
2622
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? {
2623
+ set: item.alpacaAccount.volumeThreshold
2624
+ } : undefined,
2625
+ },
2626
+ create: {
2627
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2628
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2629
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2630
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2631
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2632
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2633
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2634
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2635
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2636
+ },
2637
+ }
2638
+ } : undefined,
1586
2639
  },
1587
2640
  create: {
1588
2641
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -1598,6 +2651,29 @@ export const NewsArticleAssetSentiment = {
1598
2651
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1599
2652
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1600
2653
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2654
+ alpacaAccount: item.alpacaAccount ?
2655
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2656
+ ? { connect: {
2657
+ id: item.alpacaAccount.id
2658
+ }
2659
+ }
2660
+ : { connectOrCreate: {
2661
+ where: {
2662
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2663
+ },
2664
+ create: {
2665
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2666
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2667
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2668
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2669
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2670
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2671
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2672
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2673
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2674
+ },
2675
+ }
2676
+ } : undefined,
1601
2677
  },
1602
2678
  }))
1603
2679
  } : undefined,
@@ -1680,6 +2756,48 @@ export const NewsArticleAssetSentiment = {
1680
2756
  confidence: item.confidence !== undefined ? item.confidence : undefined,
1681
2757
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1682
2758
  status: item.status !== undefined ? item.status : undefined,
2759
+ alpacaAccount: item.alpacaAccount ?
2760
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2761
+ ? { connect: {
2762
+ id: item.alpacaAccount.id
2763
+ }
2764
+ }
2765
+ : { connectOrCreate: {
2766
+ where: {
2767
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2768
+ },
2769
+ create: {
2770
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2771
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2772
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2773
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2774
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2775
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2776
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2777
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2778
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2779
+ },
2780
+ }
2781
+ } : undefined,
2782
+ actions: item.actions ?
2783
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2784
+ connect: item.actions.map((item) => ({
2785
+ id: item.id
2786
+ }))
2787
+ }
2788
+ : { connectOrCreate: item.actions.map((item) => ({
2789
+ where: {
2790
+ id: item.id !== undefined ? item.id : undefined,
2791
+ },
2792
+ create: {
2793
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2794
+ type: item.type !== undefined ? item.type : undefined,
2795
+ note: item.note !== undefined ? item.note : undefined,
2796
+ status: item.status !== undefined ? item.status : undefined,
2797
+ fee: item.fee !== undefined ? item.fee : undefined,
2798
+ },
2799
+ }))
2800
+ } : undefined,
1683
2801
  },
1684
2802
  }))
1685
2803
  } : undefined,
@@ -1716,6 +2834,80 @@ export const NewsArticleAssetSentiment = {
1716
2834
  optionType: item.optionType !== undefined ? item.optionType : undefined,
1717
2835
  stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1718
2836
  takeProfitId: item.takeProfitId !== undefined ? item.takeProfitId : undefined,
2837
+ stopLoss: item.stopLoss ?
2838
+ typeof item.stopLoss === 'object' && Object.keys(item.stopLoss).length === 1 && Object.keys(item.stopLoss)[0] === 'id'
2839
+ ? { connect: {
2840
+ id: item.stopLoss.id
2841
+ }
2842
+ }
2843
+ : { connectOrCreate: {
2844
+ where: {
2845
+ id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2846
+ },
2847
+ create: {
2848
+ stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
2849
+ limitPrice: item.stopLoss.limitPrice !== undefined ? item.stopLoss.limitPrice : undefined,
2850
+ },
2851
+ }
2852
+ } : undefined,
2853
+ takeProfit: item.takeProfit ?
2854
+ typeof item.takeProfit === 'object' && Object.keys(item.takeProfit).length === 1 && Object.keys(item.takeProfit)[0] === 'id'
2855
+ ? { connect: {
2856
+ id: item.takeProfit.id
2857
+ }
2858
+ }
2859
+ : { connectOrCreate: {
2860
+ where: {
2861
+ id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2862
+ },
2863
+ create: {
2864
+ limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
2865
+ stopPrice: item.takeProfit.stopPrice !== undefined ? item.takeProfit.stopPrice : undefined,
2866
+ },
2867
+ }
2868
+ } : undefined,
2869
+ alpacaAccount: item.alpacaAccount ?
2870
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2871
+ ? { connect: {
2872
+ id: item.alpacaAccount.id
2873
+ }
2874
+ }
2875
+ : { connectOrCreate: {
2876
+ where: {
2877
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2878
+ },
2879
+ create: {
2880
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2881
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2882
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2883
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2884
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2885
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2886
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2887
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2888
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2889
+ },
2890
+ }
2891
+ } : undefined,
2892
+ action: item.action ?
2893
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2894
+ ? { connect: {
2895
+ id: item.action.id
2896
+ }
2897
+ }
2898
+ : { connectOrCreate: {
2899
+ where: {
2900
+ id: item.action.id !== undefined ? item.action.id : undefined,
2901
+ },
2902
+ create: {
2903
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2904
+ type: item.action.type !== undefined ? item.action.type : undefined,
2905
+ note: item.action.note !== undefined ? item.action.note : undefined,
2906
+ status: item.action.status !== undefined ? item.action.status : undefined,
2907
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2908
+ },
2909
+ }
2910
+ } : undefined,
1719
2911
  },
1720
2912
  }))
1721
2913
  } : undefined,
@@ -1743,6 +2935,29 @@ export const NewsArticleAssetSentiment = {
1743
2935
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1744
2936
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1745
2937
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2938
+ alpacaAccount: item.alpacaAccount ?
2939
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2940
+ ? { connect: {
2941
+ id: item.alpacaAccount.id
2942
+ }
2943
+ }
2944
+ : { connectOrCreate: {
2945
+ where: {
2946
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2947
+ },
2948
+ create: {
2949
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2950
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2951
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2952
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2953
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2954
+ minOrderSize: item.alpacaAccount.minOrderSize !== undefined ? item.alpacaAccount.minOrderSize : undefined,
2955
+ maxOrderSize: item.alpacaAccount.maxOrderSize !== undefined ? item.alpacaAccount.maxOrderSize : undefined,
2956
+ minPercentageChange: item.alpacaAccount.minPercentageChange !== undefined ? item.alpacaAccount.minPercentageChange : undefined,
2957
+ volumeThreshold: item.alpacaAccount.volumeThreshold !== undefined ? item.alpacaAccount.volumeThreshold : undefined,
2958
+ },
2959
+ }
2960
+ } : undefined,
1746
2961
  },
1747
2962
  }))
1748
2963
  } : undefined,
@@ -1818,27 +3033,13 @@ export const NewsArticleAssetSentiment = {
1818
3033
  }`;
1819
3034
  const variables = {
1820
3035
  where: {
1821
- id: props.id !== undefined ? {
1822
- equals: props.id
1823
- } : undefined,
1824
- url: props.url !== undefined ? {
1825
- equals: props.url
1826
- } : undefined,
1827
- assetId: props.assetId !== undefined ? {
1828
- equals: props.assetId
1829
- } : undefined,
1830
- newsArticleId: props.newsArticleId !== undefined ? {
1831
- equals: props.newsArticleId
1832
- } : undefined,
1833
- relevancyScore: props.relevancyScore !== undefined ? {
1834
- equals: props.relevancyScore
1835
- } : undefined,
1836
- sentimentScore: props.sentimentScore !== undefined ? {
1837
- equals: props.sentimentScore
1838
- } : undefined,
1839
- sentimentLabel: props.sentimentLabel !== undefined ? {
1840
- equals: props.sentimentLabel
1841
- } : undefined,
3036
+ id: props.id !== undefined ? props.id : undefined,
3037
+ url: props.url !== undefined ? props.url : undefined,
3038
+ assetId: props.assetId !== undefined ? props.assetId : undefined,
3039
+ newsArticleId: props.newsArticleId !== undefined ? props.newsArticleId : undefined,
3040
+ relevancyScore: props.relevancyScore !== undefined ? props.relevancyScore : undefined,
3041
+ sentimentScore: props.sentimentScore !== undefined ? props.sentimentScore : undefined,
3042
+ sentimentLabel: props.sentimentLabel !== undefined ? props.sentimentLabel : undefined,
1842
3043
  },
1843
3044
  };
1844
3045
  const filteredVariables = removeUndefinedProps(variables);
@@ -1901,27 +3102,13 @@ export const NewsArticleAssetSentiment = {
1901
3102
  }`;
1902
3103
  const variables = {
1903
3104
  where: {
1904
- id: props.id !== undefined ? {
1905
- equals: props.id
1906
- } : undefined,
1907
- assetId: props.assetId !== undefined ? {
1908
- equals: props.assetId
1909
- } : undefined,
1910
- newsArticleId: props.newsArticleId !== undefined ? {
1911
- equals: props.newsArticleId
1912
- } : undefined,
1913
- url: props.url !== undefined ? {
1914
- equals: props.url
1915
- } : undefined,
1916
- relevancyScore: props.relevancyScore !== undefined ? {
1917
- equals: props.relevancyScore
1918
- } : undefined,
1919
- sentimentScore: props.sentimentScore !== undefined ? {
1920
- equals: props.sentimentScore
1921
- } : undefined,
1922
- sentimentLabel: props.sentimentLabel !== undefined ? {
1923
- equals: props.sentimentLabel
1924
- } : undefined,
3105
+ id: props.id !== undefined ? props.id : undefined,
3106
+ assetId: props.assetId !== undefined ? props.assetId : undefined,
3107
+ newsArticleId: props.newsArticleId !== undefined ? props.newsArticleId : undefined,
3108
+ url: props.url !== undefined ? props.url : undefined,
3109
+ relevancyScore: props.relevancyScore !== undefined ? props.relevancyScore : undefined,
3110
+ sentimentScore: props.sentimentScore !== undefined ? props.sentimentScore : undefined,
3111
+ sentimentLabel: props.sentimentLabel !== undefined ? props.sentimentLabel : undefined,
1925
3112
  },
1926
3113
  };
1927
3114
  const filteredVariables = removeUndefinedProps(variables);