adaptic-backend 1.0.159 → 1.0.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Account.cjs +435 -58
- package/Action.cjs +966 -121
- package/Alert.cjs +593 -89
- package/AlpacaAccount.cjs +1161 -134
- package/Asset.cjs +1029 -129
- package/Authenticator.cjs +438 -54
- package/Customer.cjs +435 -64
- package/EconomicEvent.cjs +9 -3
- package/NewsArticle.cjs +255 -30
- package/NewsArticleAssetSentiment.cjs +427 -65
- package/Order.cjs +867 -129
- package/Position.cjs +945 -141
- package/Session.cjs +438 -54
- package/StopLoss.cjs +552 -69
- package/TakeProfit.cjs +552 -69
- package/Trade.cjs +1042 -153
- package/User.cjs +480 -73
- package/VerificationToken.cjs +9 -3
- package/package.json +1 -1
- package/server/Account.d.ts.map +1 -1
- package/server/Account.js.map +1 -1
- package/server/Account.mjs +435 -58
- package/server/Action.d.ts.map +1 -1
- package/server/Action.js.map +1 -1
- package/server/Action.mjs +966 -121
- package/server/Alert.d.ts.map +1 -1
- package/server/Alert.js.map +1 -1
- package/server/Alert.mjs +593 -89
- package/server/AlpacaAccount.d.ts.map +1 -1
- package/server/AlpacaAccount.js.map +1 -1
- package/server/AlpacaAccount.mjs +1161 -134
- package/server/Asset.d.ts.map +1 -1
- package/server/Asset.js.map +1 -1
- package/server/Asset.mjs +1029 -129
- package/server/Authenticator.d.ts.map +1 -1
- package/server/Authenticator.js.map +1 -1
- package/server/Authenticator.mjs +438 -54
- package/server/Customer.d.ts.map +1 -1
- package/server/Customer.js.map +1 -1
- package/server/Customer.mjs +435 -64
- package/server/EconomicEvent.d.ts.map +1 -1
- package/server/EconomicEvent.js.map +1 -1
- package/server/EconomicEvent.mjs +9 -3
- package/server/NewsArticle.d.ts.map +1 -1
- package/server/NewsArticle.js.map +1 -1
- package/server/NewsArticle.mjs +255 -30
- package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
- package/server/NewsArticleAssetSentiment.js.map +1 -1
- package/server/NewsArticleAssetSentiment.mjs +427 -65
- package/server/Order.d.ts.map +1 -1
- package/server/Order.js.map +1 -1
- package/server/Order.mjs +867 -129
- package/server/Position.d.ts.map +1 -1
- package/server/Position.js.map +1 -1
- package/server/Position.mjs +945 -141
- package/server/Session.d.ts.map +1 -1
- package/server/Session.js.map +1 -1
- package/server/Session.mjs +438 -54
- package/server/StopLoss.d.ts.map +1 -1
- package/server/StopLoss.js.map +1 -1
- package/server/StopLoss.mjs +552 -69
- package/server/TakeProfit.d.ts.map +1 -1
- package/server/TakeProfit.js.map +1 -1
- package/server/TakeProfit.mjs +552 -69
- package/server/Trade.d.ts.map +1 -1
- package/server/Trade.js.map +1 -1
- package/server/Trade.mjs +1042 -153
- package/server/User.d.ts.map +1 -1
- package/server/User.js.map +1 -1
- package/server/User.mjs +480 -73
- package/server/VerificationToken.d.ts.map +1 -1
- package/server/VerificationToken.js.map +1 -1
- package/server/VerificationToken.mjs +9 -3
package/Trade.cjs
CHANGED
@@ -295,7 +295,12 @@ exports.Trade = {
|
|
295
295
|
}
|
296
296
|
: { connectOrCreate: {
|
297
297
|
where: {
|
298
|
-
id: props.alpacaAccount.id !== undefined ?
|
298
|
+
id: props.alpacaAccount.id !== undefined ? {
|
299
|
+
equals: props.alpacaAccount.id
|
300
|
+
} : undefined,
|
301
|
+
userId: props.alpacaAccount.userId !== undefined ? {
|
302
|
+
equals: props.alpacaAccount.userId
|
303
|
+
} : undefined,
|
299
304
|
},
|
300
305
|
create: {
|
301
306
|
type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
|
@@ -315,7 +320,9 @@ exports.Trade = {
|
|
315
320
|
}
|
316
321
|
: { connectOrCreate: {
|
317
322
|
where: {
|
318
|
-
id: props.alpacaAccount.user.id !== undefined ?
|
323
|
+
id: props.alpacaAccount.user.id !== undefined ? {
|
324
|
+
equals: props.alpacaAccount.user.id
|
325
|
+
} : undefined,
|
319
326
|
email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
|
320
327
|
name: props.alpacaAccount.user.name !== undefined ? {
|
321
328
|
equals: props.alpacaAccount.user.name
|
@@ -341,10 +348,20 @@ exports.Trade = {
|
|
341
348
|
}
|
342
349
|
: { connectOrCreate: {
|
343
350
|
where: {
|
344
|
-
id: props.alpacaAccount.user.customer.id !== undefined ?
|
351
|
+
id: props.alpacaAccount.user.customer.id !== undefined ? {
|
352
|
+
equals: props.alpacaAccount.user.customer.id
|
353
|
+
} : undefined,
|
354
|
+
stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
|
355
|
+
stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
|
356
|
+
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
|
357
|
+
equals: props.alpacaAccount.user.customer.authUserId
|
358
|
+
} : undefined,
|
345
359
|
name: props.alpacaAccount.user.customer.name !== undefined ? {
|
346
360
|
equals: props.alpacaAccount.user.customer.name
|
347
361
|
} : undefined,
|
362
|
+
stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
363
|
+
equals: props.alpacaAccount.user.customer.stripePriceId
|
364
|
+
} : undefined,
|
348
365
|
},
|
349
366
|
create: {
|
350
367
|
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
|
@@ -365,7 +382,15 @@ exports.Trade = {
|
|
365
382
|
}
|
366
383
|
: { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
|
367
384
|
where: {
|
368
|
-
id: item.id !== undefined ?
|
385
|
+
id: item.id !== undefined ? {
|
386
|
+
equals: item.id
|
387
|
+
} : undefined,
|
388
|
+
userId: item.userId !== undefined ? {
|
389
|
+
equals: item.userId
|
390
|
+
} : undefined,
|
391
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
392
|
+
equals: item.providerAccountId
|
393
|
+
} : undefined,
|
369
394
|
},
|
370
395
|
create: {
|
371
396
|
type: item.type !== undefined ? item.type : undefined,
|
@@ -389,7 +414,12 @@ exports.Trade = {
|
|
389
414
|
}
|
390
415
|
: { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
|
391
416
|
where: {
|
392
|
-
id: item.id !== undefined ?
|
417
|
+
id: item.id !== undefined ? {
|
418
|
+
equals: item.id
|
419
|
+
} : undefined,
|
420
|
+
userId: item.userId !== undefined ? {
|
421
|
+
equals: item.userId
|
422
|
+
} : undefined,
|
393
423
|
},
|
394
424
|
create: {
|
395
425
|
sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
|
@@ -405,7 +435,12 @@ exports.Trade = {
|
|
405
435
|
}
|
406
436
|
: { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
|
407
437
|
where: {
|
408
|
-
id: item.id !== undefined ?
|
438
|
+
id: item.id !== undefined ? {
|
439
|
+
equals: item.id
|
440
|
+
} : undefined,
|
441
|
+
userId: item.userId !== undefined ? {
|
442
|
+
equals: item.userId
|
443
|
+
} : undefined,
|
409
444
|
},
|
410
445
|
create: {
|
411
446
|
credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
|
@@ -425,7 +460,18 @@ exports.Trade = {
|
|
425
460
|
}
|
426
461
|
: { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
|
427
462
|
where: {
|
428
|
-
id: item.id !== undefined ?
|
463
|
+
id: item.id !== undefined ? {
|
464
|
+
equals: item.id
|
465
|
+
} : undefined,
|
466
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
467
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
468
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
469
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
470
|
+
equals: item.alpacaAccountId
|
471
|
+
} : undefined,
|
472
|
+
assetId: item.assetId !== undefined ? {
|
473
|
+
equals: item.assetId
|
474
|
+
} : undefined,
|
429
475
|
},
|
430
476
|
create: {
|
431
477
|
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
@@ -458,7 +504,10 @@ exports.Trade = {
|
|
458
504
|
}
|
459
505
|
: { connectOrCreate: {
|
460
506
|
where: {
|
461
|
-
id: item.stopLoss.id !== undefined ?
|
507
|
+
id: item.stopLoss.id !== undefined ? {
|
508
|
+
equals: item.stopLoss.id
|
509
|
+
} : undefined,
|
510
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
462
511
|
},
|
463
512
|
create: {
|
464
513
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -474,7 +523,10 @@ exports.Trade = {
|
|
474
523
|
}
|
475
524
|
: { connectOrCreate: {
|
476
525
|
where: {
|
477
|
-
id: item.takeProfit.id !== undefined ?
|
526
|
+
id: item.takeProfit.id !== undefined ? {
|
527
|
+
equals: item.takeProfit.id
|
528
|
+
} : undefined,
|
529
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
478
530
|
},
|
479
531
|
create: {
|
480
532
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -490,7 +542,12 @@ exports.Trade = {
|
|
490
542
|
}
|
491
543
|
: { connectOrCreate: {
|
492
544
|
where: {
|
493
|
-
id: item.action.id !== undefined ?
|
545
|
+
id: item.action.id !== undefined ? {
|
546
|
+
equals: item.action.id
|
547
|
+
} : undefined,
|
548
|
+
tradeId: item.action.tradeId !== undefined ? {
|
549
|
+
equals: item.action.tradeId
|
550
|
+
} : undefined,
|
494
551
|
},
|
495
552
|
create: {
|
496
553
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -509,7 +566,9 @@ exports.Trade = {
|
|
509
566
|
}
|
510
567
|
: { connectOrCreate: {
|
511
568
|
where: {
|
512
|
-
id: item.asset.id !== undefined ?
|
569
|
+
id: item.asset.id !== undefined ? {
|
570
|
+
equals: item.asset.id
|
571
|
+
} : undefined,
|
513
572
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
514
573
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
515
574
|
},
|
@@ -583,7 +642,15 @@ exports.Trade = {
|
|
583
642
|
}
|
584
643
|
: { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
|
585
644
|
where: {
|
586
|
-
id: item.id !== undefined ?
|
645
|
+
id: item.id !== undefined ? {
|
646
|
+
equals: item.id
|
647
|
+
} : undefined,
|
648
|
+
assetId: item.assetId !== undefined ? {
|
649
|
+
equals: item.assetId
|
650
|
+
} : undefined,
|
651
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
652
|
+
equals: item.alpacaAccountId
|
653
|
+
} : undefined,
|
587
654
|
},
|
588
655
|
create: {
|
589
656
|
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
@@ -607,7 +674,9 @@ exports.Trade = {
|
|
607
674
|
}
|
608
675
|
: { connectOrCreate: {
|
609
676
|
where: {
|
610
|
-
id: item.asset.id !== undefined ?
|
677
|
+
id: item.asset.id !== undefined ? {
|
678
|
+
equals: item.asset.id
|
679
|
+
} : undefined,
|
611
680
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
612
681
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
613
682
|
},
|
@@ -681,7 +750,12 @@ exports.Trade = {
|
|
681
750
|
}
|
682
751
|
: { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
|
683
752
|
where: {
|
684
|
-
id: item.id !== undefined ?
|
753
|
+
id: item.id !== undefined ? {
|
754
|
+
equals: item.id
|
755
|
+
} : undefined,
|
756
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
757
|
+
equals: item.alpacaAccountId
|
758
|
+
} : undefined,
|
685
759
|
},
|
686
760
|
create: {
|
687
761
|
message: item.message !== undefined ? item.message : undefined,
|
@@ -701,7 +775,9 @@ exports.Trade = {
|
|
701
775
|
}
|
702
776
|
: { connectOrCreate: {
|
703
777
|
where: {
|
704
|
-
id: props.asset.id !== undefined ?
|
778
|
+
id: props.asset.id !== undefined ? {
|
779
|
+
equals: props.asset.id
|
780
|
+
} : undefined,
|
705
781
|
symbol: props.asset.symbol !== undefined ? props.asset.symbol : undefined,
|
706
782
|
name: props.asset.name !== undefined ? props.asset.name : undefined,
|
707
783
|
},
|
@@ -769,7 +845,18 @@ exports.Trade = {
|
|
769
845
|
}
|
770
846
|
: { connectOrCreate: props.asset.orders.map((item) => ({
|
771
847
|
where: {
|
772
|
-
id: item.id !== undefined ?
|
848
|
+
id: item.id !== undefined ? {
|
849
|
+
equals: item.id
|
850
|
+
} : undefined,
|
851
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
852
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
853
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
854
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
855
|
+
equals: item.alpacaAccountId
|
856
|
+
} : undefined,
|
857
|
+
assetId: item.assetId !== undefined ? {
|
858
|
+
equals: item.assetId
|
859
|
+
} : undefined,
|
773
860
|
},
|
774
861
|
create: {
|
775
862
|
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
@@ -802,7 +889,10 @@ exports.Trade = {
|
|
802
889
|
}
|
803
890
|
: { connectOrCreate: {
|
804
891
|
where: {
|
805
|
-
id: item.stopLoss.id !== undefined ?
|
892
|
+
id: item.stopLoss.id !== undefined ? {
|
893
|
+
equals: item.stopLoss.id
|
894
|
+
} : undefined,
|
895
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
806
896
|
},
|
807
897
|
create: {
|
808
898
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -818,7 +908,10 @@ exports.Trade = {
|
|
818
908
|
}
|
819
909
|
: { connectOrCreate: {
|
820
910
|
where: {
|
821
|
-
id: item.takeProfit.id !== undefined ?
|
911
|
+
id: item.takeProfit.id !== undefined ? {
|
912
|
+
equals: item.takeProfit.id
|
913
|
+
} : undefined,
|
914
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
822
915
|
},
|
823
916
|
create: {
|
824
917
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -834,7 +927,12 @@ exports.Trade = {
|
|
834
927
|
}
|
835
928
|
: { connectOrCreate: {
|
836
929
|
where: {
|
837
|
-
id: item.alpacaAccount.id !== undefined ?
|
930
|
+
id: item.alpacaAccount.id !== undefined ? {
|
931
|
+
equals: item.alpacaAccount.id
|
932
|
+
} : undefined,
|
933
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
934
|
+
equals: item.alpacaAccount.userId
|
935
|
+
} : undefined,
|
838
936
|
},
|
839
937
|
create: {
|
840
938
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -857,7 +955,12 @@ exports.Trade = {
|
|
857
955
|
}
|
858
956
|
: { connectOrCreate: {
|
859
957
|
where: {
|
860
|
-
id: item.action.id !== undefined ?
|
958
|
+
id: item.action.id !== undefined ? {
|
959
|
+
equals: item.action.id
|
960
|
+
} : undefined,
|
961
|
+
tradeId: item.action.tradeId !== undefined ? {
|
962
|
+
equals: item.action.tradeId
|
963
|
+
} : undefined,
|
861
964
|
},
|
862
965
|
create: {
|
863
966
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -879,7 +982,15 @@ exports.Trade = {
|
|
879
982
|
}
|
880
983
|
: { connectOrCreate: props.asset.positions.map((item) => ({
|
881
984
|
where: {
|
882
|
-
id: item.id !== undefined ?
|
985
|
+
id: item.id !== undefined ? {
|
986
|
+
equals: item.id
|
987
|
+
} : undefined,
|
988
|
+
assetId: item.assetId !== undefined ? {
|
989
|
+
equals: item.assetId
|
990
|
+
} : undefined,
|
991
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
992
|
+
equals: item.alpacaAccountId
|
993
|
+
} : undefined,
|
883
994
|
},
|
884
995
|
create: {
|
885
996
|
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
@@ -903,7 +1014,12 @@ exports.Trade = {
|
|
903
1014
|
}
|
904
1015
|
: { connectOrCreate: {
|
905
1016
|
where: {
|
906
|
-
id: item.alpacaAccount.id !== undefined ?
|
1017
|
+
id: item.alpacaAccount.id !== undefined ? {
|
1018
|
+
equals: item.alpacaAccount.id
|
1019
|
+
} : undefined,
|
1020
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
1021
|
+
equals: item.alpacaAccount.userId
|
1022
|
+
} : undefined,
|
907
1023
|
},
|
908
1024
|
create: {
|
909
1025
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -929,8 +1045,16 @@ exports.Trade = {
|
|
929
1045
|
}
|
930
1046
|
: { connectOrCreate: props.asset.newsMentions.map((item) => ({
|
931
1047
|
where: {
|
932
|
-
id: item.id !== undefined ?
|
1048
|
+
id: item.id !== undefined ? {
|
1049
|
+
equals: item.id
|
1050
|
+
} : undefined,
|
933
1051
|
url: item.url !== undefined ? item.url : undefined,
|
1052
|
+
assetId: item.assetId !== undefined ? {
|
1053
|
+
equals: item.assetId
|
1054
|
+
} : undefined,
|
1055
|
+
newsArticleId: item.newsArticleId !== undefined ? {
|
1056
|
+
equals: item.newsArticleId
|
1057
|
+
} : undefined,
|
934
1058
|
},
|
935
1059
|
create: {
|
936
1060
|
url: item.url !== undefined ? item.url : undefined,
|
@@ -945,7 +1069,9 @@ exports.Trade = {
|
|
945
1069
|
}
|
946
1070
|
: { connectOrCreate: {
|
947
1071
|
where: {
|
948
|
-
id: item.news.id !== undefined ?
|
1072
|
+
id: item.news.id !== undefined ? {
|
1073
|
+
equals: item.news.id
|
1074
|
+
} : undefined,
|
949
1075
|
url: item.news.url !== undefined ? item.news.url : undefined,
|
950
1076
|
title: item.news.title !== undefined ? {
|
951
1077
|
equals: item.news.title
|
@@ -982,7 +1108,12 @@ exports.Trade = {
|
|
982
1108
|
}
|
983
1109
|
: { connectOrCreate: props.actions.map((item) => ({
|
984
1110
|
where: {
|
985
|
-
id: item.id !== undefined ?
|
1111
|
+
id: item.id !== undefined ? {
|
1112
|
+
equals: item.id
|
1113
|
+
} : undefined,
|
1114
|
+
tradeId: item.tradeId !== undefined ? {
|
1115
|
+
equals: item.tradeId
|
1116
|
+
} : undefined,
|
986
1117
|
},
|
987
1118
|
create: {
|
988
1119
|
sequence: item.sequence !== undefined ? item.sequence : undefined,
|
@@ -998,7 +1129,18 @@ exports.Trade = {
|
|
998
1129
|
}
|
999
1130
|
: { connectOrCreate: {
|
1000
1131
|
where: {
|
1001
|
-
id: item.order.id !== undefined ?
|
1132
|
+
id: item.order.id !== undefined ? {
|
1133
|
+
equals: item.order.id
|
1134
|
+
} : undefined,
|
1135
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
1136
|
+
actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
|
1137
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
1138
|
+
alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
|
1139
|
+
equals: item.order.alpacaAccountId
|
1140
|
+
} : undefined,
|
1141
|
+
assetId: item.order.assetId !== undefined ? {
|
1142
|
+
equals: item.order.assetId
|
1143
|
+
} : undefined,
|
1002
1144
|
},
|
1003
1145
|
create: {
|
1004
1146
|
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
@@ -1031,7 +1173,10 @@ exports.Trade = {
|
|
1031
1173
|
}
|
1032
1174
|
: { connectOrCreate: {
|
1033
1175
|
where: {
|
1034
|
-
id: item.order.stopLoss.id !== undefined ?
|
1176
|
+
id: item.order.stopLoss.id !== undefined ? {
|
1177
|
+
equals: item.order.stopLoss.id
|
1178
|
+
} : undefined,
|
1179
|
+
orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
|
1035
1180
|
},
|
1036
1181
|
create: {
|
1037
1182
|
stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
|
@@ -1047,7 +1192,10 @@ exports.Trade = {
|
|
1047
1192
|
}
|
1048
1193
|
: { connectOrCreate: {
|
1049
1194
|
where: {
|
1050
|
-
id: item.order.takeProfit.id !== undefined ?
|
1195
|
+
id: item.order.takeProfit.id !== undefined ? {
|
1196
|
+
equals: item.order.takeProfit.id
|
1197
|
+
} : undefined,
|
1198
|
+
orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
|
1051
1199
|
},
|
1052
1200
|
create: {
|
1053
1201
|
limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
|
@@ -1063,7 +1211,12 @@ exports.Trade = {
|
|
1063
1211
|
}
|
1064
1212
|
: { connectOrCreate: {
|
1065
1213
|
where: {
|
1066
|
-
id: item.order.alpacaAccount.id !== undefined ?
|
1214
|
+
id: item.order.alpacaAccount.id !== undefined ? {
|
1215
|
+
equals: item.order.alpacaAccount.id
|
1216
|
+
} : undefined,
|
1217
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
1218
|
+
equals: item.order.alpacaAccount.userId
|
1219
|
+
} : undefined,
|
1067
1220
|
},
|
1068
1221
|
create: {
|
1069
1222
|
type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
|
@@ -1086,7 +1239,9 @@ exports.Trade = {
|
|
1086
1239
|
}
|
1087
1240
|
: { connectOrCreate: {
|
1088
1241
|
where: {
|
1089
|
-
id: item.order.asset.id !== undefined ?
|
1242
|
+
id: item.order.asset.id !== undefined ? {
|
1243
|
+
equals: item.order.asset.id
|
1244
|
+
} : undefined,
|
1090
1245
|
symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
|
1091
1246
|
name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
|
1092
1247
|
},
|
@@ -1236,9 +1391,15 @@ exports.Trade = {
|
|
1236
1391
|
}`;
|
1237
1392
|
const variables = {
|
1238
1393
|
where: {
|
1239
|
-
id: props.id !== undefined ?
|
1240
|
-
|
1241
|
-
|
1394
|
+
id: props.id !== undefined ? {
|
1395
|
+
equals: props.id
|
1396
|
+
} : undefined,
|
1397
|
+
alpacaAccountId: props.alpacaAccountId !== undefined ? {
|
1398
|
+
equals: props.alpacaAccountId
|
1399
|
+
} : undefined,
|
1400
|
+
assetId: props.assetId !== undefined ? {
|
1401
|
+
equals: props.assetId
|
1402
|
+
} : undefined,
|
1242
1403
|
qty: props.qty !== undefined ? props.qty : undefined,
|
1243
1404
|
price: props.price !== undefined ? props.price : undefined,
|
1244
1405
|
total: props.total !== undefined ? props.total : undefined,
|
@@ -1302,6 +1463,9 @@ exports.Trade = {
|
|
1302
1463
|
id: props.alpacaAccount.id !== undefined ? {
|
1303
1464
|
equals: props.alpacaAccount.id
|
1304
1465
|
} : undefined,
|
1466
|
+
userId: props.alpacaAccount.userId !== undefined ? {
|
1467
|
+
equals: props.alpacaAccount.userId
|
1468
|
+
} : undefined,
|
1305
1469
|
},
|
1306
1470
|
update: {
|
1307
1471
|
id: props.alpacaAccount.id !== undefined ? {
|
@@ -1390,9 +1554,21 @@ exports.Trade = {
|
|
1390
1554
|
id: props.alpacaAccount.user.customer.id !== undefined ? {
|
1391
1555
|
equals: props.alpacaAccount.user.customer.id
|
1392
1556
|
} : undefined,
|
1557
|
+
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
|
1558
|
+
equals: props.alpacaAccount.user.customer.authUserId
|
1559
|
+
} : undefined,
|
1393
1560
|
name: props.alpacaAccount.user.customer.name !== undefined ? {
|
1394
1561
|
equals: props.alpacaAccount.user.customer.name
|
1395
1562
|
} : undefined,
|
1563
|
+
stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
|
1564
|
+
equals: props.alpacaAccount.user.customer.stripeCustomerId
|
1565
|
+
} : undefined,
|
1566
|
+
stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
|
1567
|
+
equals: props.alpacaAccount.user.customer.stripeSubscriptionId
|
1568
|
+
} : undefined,
|
1569
|
+
stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
1570
|
+
equals: props.alpacaAccount.user.customer.stripePriceId
|
1571
|
+
} : undefined,
|
1396
1572
|
},
|
1397
1573
|
update: {
|
1398
1574
|
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
|
@@ -1431,7 +1607,15 @@ exports.Trade = {
|
|
1431
1607
|
accounts: props.alpacaAccount.user.accounts ? {
|
1432
1608
|
upsert: props.alpacaAccount.user.accounts.map((item) => ({
|
1433
1609
|
where: {
|
1434
|
-
id: item.id !== undefined ?
|
1610
|
+
id: item.id !== undefined ? {
|
1611
|
+
equals: item.id
|
1612
|
+
} : undefined,
|
1613
|
+
userId: item.userId !== undefined ? {
|
1614
|
+
equals: item.userId
|
1615
|
+
} : undefined,
|
1616
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
1617
|
+
equals: item.providerAccountId
|
1618
|
+
} : undefined,
|
1435
1619
|
},
|
1436
1620
|
update: {
|
1437
1621
|
id: item.id !== undefined ? {
|
@@ -1485,7 +1669,12 @@ exports.Trade = {
|
|
1485
1669
|
sessions: props.alpacaAccount.user.sessions ? {
|
1486
1670
|
upsert: props.alpacaAccount.user.sessions.map((item) => ({
|
1487
1671
|
where: {
|
1488
|
-
id: item.id !== undefined ?
|
1672
|
+
id: item.id !== undefined ? {
|
1673
|
+
equals: item.id
|
1674
|
+
} : undefined,
|
1675
|
+
userId: item.userId !== undefined ? {
|
1676
|
+
equals: item.userId
|
1677
|
+
} : undefined,
|
1489
1678
|
},
|
1490
1679
|
update: {
|
1491
1680
|
id: item.id !== undefined ? {
|
@@ -1507,7 +1696,12 @@ exports.Trade = {
|
|
1507
1696
|
authenticators: props.alpacaAccount.user.authenticators ? {
|
1508
1697
|
upsert: props.alpacaAccount.user.authenticators.map((item) => ({
|
1509
1698
|
where: {
|
1510
|
-
id: item.id !== undefined ?
|
1699
|
+
id: item.id !== undefined ? {
|
1700
|
+
equals: item.id
|
1701
|
+
} : undefined,
|
1702
|
+
userId: item.userId !== undefined ? {
|
1703
|
+
equals: item.userId
|
1704
|
+
} : undefined,
|
1511
1705
|
},
|
1512
1706
|
update: {
|
1513
1707
|
id: item.id !== undefined ? {
|
@@ -1551,10 +1745,20 @@ exports.Trade = {
|
|
1551
1745
|
}
|
1552
1746
|
: { connectOrCreate: {
|
1553
1747
|
where: {
|
1554
|
-
id: props.alpacaAccount.user.customer.id !== undefined ?
|
1748
|
+
id: props.alpacaAccount.user.customer.id !== undefined ? {
|
1749
|
+
equals: props.alpacaAccount.user.customer.id
|
1750
|
+
} : undefined,
|
1751
|
+
stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
|
1752
|
+
stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
|
1753
|
+
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
|
1754
|
+
equals: props.alpacaAccount.user.customer.authUserId
|
1755
|
+
} : undefined,
|
1555
1756
|
name: props.alpacaAccount.user.customer.name !== undefined ? {
|
1556
1757
|
equals: props.alpacaAccount.user.customer.name
|
1557
1758
|
} : undefined,
|
1759
|
+
stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
1760
|
+
equals: props.alpacaAccount.user.customer.stripePriceId
|
1761
|
+
} : undefined,
|
1558
1762
|
},
|
1559
1763
|
create: {
|
1560
1764
|
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
|
@@ -1575,7 +1779,15 @@ exports.Trade = {
|
|
1575
1779
|
}
|
1576
1780
|
: { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
|
1577
1781
|
where: {
|
1578
|
-
id: item.id !== undefined ?
|
1782
|
+
id: item.id !== undefined ? {
|
1783
|
+
equals: item.id
|
1784
|
+
} : undefined,
|
1785
|
+
userId: item.userId !== undefined ? {
|
1786
|
+
equals: item.userId
|
1787
|
+
} : undefined,
|
1788
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
1789
|
+
equals: item.providerAccountId
|
1790
|
+
} : undefined,
|
1579
1791
|
},
|
1580
1792
|
create: {
|
1581
1793
|
type: item.type !== undefined ? item.type : undefined,
|
@@ -1599,7 +1811,12 @@ exports.Trade = {
|
|
1599
1811
|
}
|
1600
1812
|
: { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
|
1601
1813
|
where: {
|
1602
|
-
id: item.id !== undefined ?
|
1814
|
+
id: item.id !== undefined ? {
|
1815
|
+
equals: item.id
|
1816
|
+
} : undefined,
|
1817
|
+
userId: item.userId !== undefined ? {
|
1818
|
+
equals: item.userId
|
1819
|
+
} : undefined,
|
1603
1820
|
},
|
1604
1821
|
create: {
|
1605
1822
|
sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
|
@@ -1615,7 +1832,12 @@ exports.Trade = {
|
|
1615
1832
|
}
|
1616
1833
|
: { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
|
1617
1834
|
where: {
|
1618
|
-
id: item.id !== undefined ?
|
1835
|
+
id: item.id !== undefined ? {
|
1836
|
+
equals: item.id
|
1837
|
+
} : undefined,
|
1838
|
+
userId: item.userId !== undefined ? {
|
1839
|
+
equals: item.userId
|
1840
|
+
} : undefined,
|
1619
1841
|
},
|
1620
1842
|
create: {
|
1621
1843
|
credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
|
@@ -1630,7 +1852,18 @@ exports.Trade = {
|
|
1630
1852
|
orders: props.alpacaAccount.orders ? {
|
1631
1853
|
upsert: props.alpacaAccount.orders.map((item) => ({
|
1632
1854
|
where: {
|
1633
|
-
id: item.id !== undefined ?
|
1855
|
+
id: item.id !== undefined ? {
|
1856
|
+
equals: item.id
|
1857
|
+
} : undefined,
|
1858
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
1859
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
1860
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
1861
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
1862
|
+
equals: item.alpacaAccountId
|
1863
|
+
} : undefined,
|
1864
|
+
assetId: item.assetId !== undefined ? {
|
1865
|
+
equals: item.assetId
|
1866
|
+
} : undefined,
|
1634
1867
|
},
|
1635
1868
|
update: {
|
1636
1869
|
id: item.id !== undefined ? {
|
@@ -1708,6 +1941,9 @@ exports.Trade = {
|
|
1708
1941
|
id: item.stopLoss.id !== undefined ? {
|
1709
1942
|
equals: item.stopLoss.id
|
1710
1943
|
} : undefined,
|
1944
|
+
orderId: item.stopLoss.orderId !== undefined ? {
|
1945
|
+
equals: item.stopLoss.orderId
|
1946
|
+
} : undefined,
|
1711
1947
|
},
|
1712
1948
|
update: {
|
1713
1949
|
id: item.stopLoss.id !== undefined ? {
|
@@ -1732,6 +1968,9 @@ exports.Trade = {
|
|
1732
1968
|
id: item.takeProfit.id !== undefined ? {
|
1733
1969
|
equals: item.takeProfit.id
|
1734
1970
|
} : undefined,
|
1971
|
+
orderId: item.takeProfit.orderId !== undefined ? {
|
1972
|
+
equals: item.takeProfit.orderId
|
1973
|
+
} : undefined,
|
1735
1974
|
},
|
1736
1975
|
update: {
|
1737
1976
|
id: item.takeProfit.id !== undefined ? {
|
@@ -1756,6 +1995,9 @@ exports.Trade = {
|
|
1756
1995
|
id: item.action.id !== undefined ? {
|
1757
1996
|
equals: item.action.id
|
1758
1997
|
} : undefined,
|
1998
|
+
tradeId: item.action.tradeId !== undefined ? {
|
1999
|
+
equals: item.action.tradeId
|
2000
|
+
} : undefined,
|
1759
2001
|
},
|
1760
2002
|
update: {
|
1761
2003
|
id: item.action.id !== undefined ? {
|
@@ -2060,7 +2302,10 @@ exports.Trade = {
|
|
2060
2302
|
}
|
2061
2303
|
: { connectOrCreate: {
|
2062
2304
|
where: {
|
2063
|
-
id: item.stopLoss.id !== undefined ?
|
2305
|
+
id: item.stopLoss.id !== undefined ? {
|
2306
|
+
equals: item.stopLoss.id
|
2307
|
+
} : undefined,
|
2308
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
2064
2309
|
},
|
2065
2310
|
create: {
|
2066
2311
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -2076,7 +2321,10 @@ exports.Trade = {
|
|
2076
2321
|
}
|
2077
2322
|
: { connectOrCreate: {
|
2078
2323
|
where: {
|
2079
|
-
id: item.takeProfit.id !== undefined ?
|
2324
|
+
id: item.takeProfit.id !== undefined ? {
|
2325
|
+
equals: item.takeProfit.id
|
2326
|
+
} : undefined,
|
2327
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
2080
2328
|
},
|
2081
2329
|
create: {
|
2082
2330
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -2092,7 +2340,12 @@ exports.Trade = {
|
|
2092
2340
|
}
|
2093
2341
|
: { connectOrCreate: {
|
2094
2342
|
where: {
|
2095
|
-
id: item.action.id !== undefined ?
|
2343
|
+
id: item.action.id !== undefined ? {
|
2344
|
+
equals: item.action.id
|
2345
|
+
} : undefined,
|
2346
|
+
tradeId: item.action.tradeId !== undefined ? {
|
2347
|
+
equals: item.action.tradeId
|
2348
|
+
} : undefined,
|
2096
2349
|
},
|
2097
2350
|
create: {
|
2098
2351
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -2111,7 +2364,9 @@ exports.Trade = {
|
|
2111
2364
|
}
|
2112
2365
|
: { connectOrCreate: {
|
2113
2366
|
where: {
|
2114
|
-
id: item.asset.id !== undefined ?
|
2367
|
+
id: item.asset.id !== undefined ? {
|
2368
|
+
equals: item.asset.id
|
2369
|
+
} : undefined,
|
2115
2370
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
2116
2371
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
2117
2372
|
},
|
@@ -2180,7 +2435,15 @@ exports.Trade = {
|
|
2180
2435
|
positions: props.alpacaAccount.positions ? {
|
2181
2436
|
upsert: props.alpacaAccount.positions.map((item) => ({
|
2182
2437
|
where: {
|
2183
|
-
id: item.id !== undefined ?
|
2438
|
+
id: item.id !== undefined ? {
|
2439
|
+
equals: item.id
|
2440
|
+
} : undefined,
|
2441
|
+
assetId: item.assetId !== undefined ? {
|
2442
|
+
equals: item.assetId
|
2443
|
+
} : undefined,
|
2444
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
2445
|
+
equals: item.alpacaAccountId
|
2446
|
+
} : undefined,
|
2184
2447
|
},
|
2185
2448
|
update: {
|
2186
2449
|
id: item.id !== undefined ? {
|
@@ -2490,7 +2753,9 @@ exports.Trade = {
|
|
2490
2753
|
}
|
2491
2754
|
: { connectOrCreate: {
|
2492
2755
|
where: {
|
2493
|
-
id: item.asset.id !== undefined ?
|
2756
|
+
id: item.asset.id !== undefined ? {
|
2757
|
+
equals: item.asset.id
|
2758
|
+
} : undefined,
|
2494
2759
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
2495
2760
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
2496
2761
|
},
|
@@ -2559,7 +2824,12 @@ exports.Trade = {
|
|
2559
2824
|
alerts: props.alpacaAccount.alerts ? {
|
2560
2825
|
upsert: props.alpacaAccount.alerts.map((item) => ({
|
2561
2826
|
where: {
|
2562
|
-
id: item.id !== undefined ?
|
2827
|
+
id: item.id !== undefined ? {
|
2828
|
+
equals: item.id
|
2829
|
+
} : undefined,
|
2830
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
2831
|
+
equals: item.alpacaAccountId
|
2832
|
+
} : undefined,
|
2563
2833
|
},
|
2564
2834
|
update: {
|
2565
2835
|
id: item.id !== undefined ? {
|
@@ -2601,7 +2871,9 @@ exports.Trade = {
|
|
2601
2871
|
}
|
2602
2872
|
: { connectOrCreate: {
|
2603
2873
|
where: {
|
2604
|
-
id: props.alpacaAccount.user.id !== undefined ?
|
2874
|
+
id: props.alpacaAccount.user.id !== undefined ? {
|
2875
|
+
equals: props.alpacaAccount.user.id
|
2876
|
+
} : undefined,
|
2605
2877
|
email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
|
2606
2878
|
name: props.alpacaAccount.user.name !== undefined ? {
|
2607
2879
|
equals: props.alpacaAccount.user.name
|
@@ -2627,10 +2899,20 @@ exports.Trade = {
|
|
2627
2899
|
}
|
2628
2900
|
: { connectOrCreate: {
|
2629
2901
|
where: {
|
2630
|
-
id: props.alpacaAccount.user.customer.id !== undefined ?
|
2902
|
+
id: props.alpacaAccount.user.customer.id !== undefined ? {
|
2903
|
+
equals: props.alpacaAccount.user.customer.id
|
2904
|
+
} : undefined,
|
2905
|
+
stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
|
2906
|
+
stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
|
2907
|
+
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
|
2908
|
+
equals: props.alpacaAccount.user.customer.authUserId
|
2909
|
+
} : undefined,
|
2631
2910
|
name: props.alpacaAccount.user.customer.name !== undefined ? {
|
2632
2911
|
equals: props.alpacaAccount.user.customer.name
|
2633
2912
|
} : undefined,
|
2913
|
+
stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
2914
|
+
equals: props.alpacaAccount.user.customer.stripePriceId
|
2915
|
+
} : undefined,
|
2634
2916
|
},
|
2635
2917
|
create: {
|
2636
2918
|
authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
|
@@ -2651,7 +2933,15 @@ exports.Trade = {
|
|
2651
2933
|
}
|
2652
2934
|
: { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
|
2653
2935
|
where: {
|
2654
|
-
id: item.id !== undefined ?
|
2936
|
+
id: item.id !== undefined ? {
|
2937
|
+
equals: item.id
|
2938
|
+
} : undefined,
|
2939
|
+
userId: item.userId !== undefined ? {
|
2940
|
+
equals: item.userId
|
2941
|
+
} : undefined,
|
2942
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
2943
|
+
equals: item.providerAccountId
|
2944
|
+
} : undefined,
|
2655
2945
|
},
|
2656
2946
|
create: {
|
2657
2947
|
type: item.type !== undefined ? item.type : undefined,
|
@@ -2675,7 +2965,12 @@ exports.Trade = {
|
|
2675
2965
|
}
|
2676
2966
|
: { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
|
2677
2967
|
where: {
|
2678
|
-
id: item.id !== undefined ?
|
2968
|
+
id: item.id !== undefined ? {
|
2969
|
+
equals: item.id
|
2970
|
+
} : undefined,
|
2971
|
+
userId: item.userId !== undefined ? {
|
2972
|
+
equals: item.userId
|
2973
|
+
} : undefined,
|
2679
2974
|
},
|
2680
2975
|
create: {
|
2681
2976
|
sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
|
@@ -2691,7 +2986,12 @@ exports.Trade = {
|
|
2691
2986
|
}
|
2692
2987
|
: { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
|
2693
2988
|
where: {
|
2694
|
-
id: item.id !== undefined ?
|
2989
|
+
id: item.id !== undefined ? {
|
2990
|
+
equals: item.id
|
2991
|
+
} : undefined,
|
2992
|
+
userId: item.userId !== undefined ? {
|
2993
|
+
equals: item.userId
|
2994
|
+
} : undefined,
|
2695
2995
|
},
|
2696
2996
|
create: {
|
2697
2997
|
credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
|
@@ -2711,7 +3011,18 @@ exports.Trade = {
|
|
2711
3011
|
}
|
2712
3012
|
: { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
|
2713
3013
|
where: {
|
2714
|
-
id: item.id !== undefined ?
|
3014
|
+
id: item.id !== undefined ? {
|
3015
|
+
equals: item.id
|
3016
|
+
} : undefined,
|
3017
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
3018
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
3019
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
3020
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
3021
|
+
equals: item.alpacaAccountId
|
3022
|
+
} : undefined,
|
3023
|
+
assetId: item.assetId !== undefined ? {
|
3024
|
+
equals: item.assetId
|
3025
|
+
} : undefined,
|
2715
3026
|
},
|
2716
3027
|
create: {
|
2717
3028
|
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
@@ -2744,7 +3055,10 @@ exports.Trade = {
|
|
2744
3055
|
}
|
2745
3056
|
: { connectOrCreate: {
|
2746
3057
|
where: {
|
2747
|
-
id: item.stopLoss.id !== undefined ?
|
3058
|
+
id: item.stopLoss.id !== undefined ? {
|
3059
|
+
equals: item.stopLoss.id
|
3060
|
+
} : undefined,
|
3061
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
2748
3062
|
},
|
2749
3063
|
create: {
|
2750
3064
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -2760,7 +3074,10 @@ exports.Trade = {
|
|
2760
3074
|
}
|
2761
3075
|
: { connectOrCreate: {
|
2762
3076
|
where: {
|
2763
|
-
id: item.takeProfit.id !== undefined ?
|
3077
|
+
id: item.takeProfit.id !== undefined ? {
|
3078
|
+
equals: item.takeProfit.id
|
3079
|
+
} : undefined,
|
3080
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
2764
3081
|
},
|
2765
3082
|
create: {
|
2766
3083
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -2776,7 +3093,12 @@ exports.Trade = {
|
|
2776
3093
|
}
|
2777
3094
|
: { connectOrCreate: {
|
2778
3095
|
where: {
|
2779
|
-
id: item.action.id !== undefined ?
|
3096
|
+
id: item.action.id !== undefined ? {
|
3097
|
+
equals: item.action.id
|
3098
|
+
} : undefined,
|
3099
|
+
tradeId: item.action.tradeId !== undefined ? {
|
3100
|
+
equals: item.action.tradeId
|
3101
|
+
} : undefined,
|
2780
3102
|
},
|
2781
3103
|
create: {
|
2782
3104
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -2795,7 +3117,9 @@ exports.Trade = {
|
|
2795
3117
|
}
|
2796
3118
|
: { connectOrCreate: {
|
2797
3119
|
where: {
|
2798
|
-
id: item.asset.id !== undefined ?
|
3120
|
+
id: item.asset.id !== undefined ? {
|
3121
|
+
equals: item.asset.id
|
3122
|
+
} : undefined,
|
2799
3123
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
2800
3124
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
2801
3125
|
},
|
@@ -2869,7 +3193,15 @@ exports.Trade = {
|
|
2869
3193
|
}
|
2870
3194
|
: { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
|
2871
3195
|
where: {
|
2872
|
-
id: item.id !== undefined ?
|
3196
|
+
id: item.id !== undefined ? {
|
3197
|
+
equals: item.id
|
3198
|
+
} : undefined,
|
3199
|
+
assetId: item.assetId !== undefined ? {
|
3200
|
+
equals: item.assetId
|
3201
|
+
} : undefined,
|
3202
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
3203
|
+
equals: item.alpacaAccountId
|
3204
|
+
} : undefined,
|
2873
3205
|
},
|
2874
3206
|
create: {
|
2875
3207
|
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
@@ -2893,7 +3225,9 @@ exports.Trade = {
|
|
2893
3225
|
}
|
2894
3226
|
: { connectOrCreate: {
|
2895
3227
|
where: {
|
2896
|
-
id: item.asset.id !== undefined ?
|
3228
|
+
id: item.asset.id !== undefined ? {
|
3229
|
+
equals: item.asset.id
|
3230
|
+
} : undefined,
|
2897
3231
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
2898
3232
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
2899
3233
|
},
|
@@ -2967,7 +3301,12 @@ exports.Trade = {
|
|
2967
3301
|
}
|
2968
3302
|
: { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
|
2969
3303
|
where: {
|
2970
|
-
id: item.id !== undefined ?
|
3304
|
+
id: item.id !== undefined ? {
|
3305
|
+
equals: item.id
|
3306
|
+
} : undefined,
|
3307
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
3308
|
+
equals: item.alpacaAccountId
|
3309
|
+
} : undefined,
|
2971
3310
|
},
|
2972
3311
|
create: {
|
2973
3312
|
message: item.message !== undefined ? item.message : undefined,
|
@@ -3164,7 +3503,18 @@ exports.Trade = {
|
|
3164
3503
|
orders: props.asset.orders ? {
|
3165
3504
|
upsert: props.asset.orders.map((item) => ({
|
3166
3505
|
where: {
|
3167
|
-
id: item.id !== undefined ?
|
3506
|
+
id: item.id !== undefined ? {
|
3507
|
+
equals: item.id
|
3508
|
+
} : undefined,
|
3509
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
3510
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
3511
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
3512
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
3513
|
+
equals: item.alpacaAccountId
|
3514
|
+
} : undefined,
|
3515
|
+
assetId: item.assetId !== undefined ? {
|
3516
|
+
equals: item.assetId
|
3517
|
+
} : undefined,
|
3168
3518
|
},
|
3169
3519
|
update: {
|
3170
3520
|
id: item.id !== undefined ? {
|
@@ -3242,6 +3592,9 @@ exports.Trade = {
|
|
3242
3592
|
id: item.stopLoss.id !== undefined ? {
|
3243
3593
|
equals: item.stopLoss.id
|
3244
3594
|
} : undefined,
|
3595
|
+
orderId: item.stopLoss.orderId !== undefined ? {
|
3596
|
+
equals: item.stopLoss.orderId
|
3597
|
+
} : undefined,
|
3245
3598
|
},
|
3246
3599
|
update: {
|
3247
3600
|
id: item.stopLoss.id !== undefined ? {
|
@@ -3266,6 +3619,9 @@ exports.Trade = {
|
|
3266
3619
|
id: item.takeProfit.id !== undefined ? {
|
3267
3620
|
equals: item.takeProfit.id
|
3268
3621
|
} : undefined,
|
3622
|
+
orderId: item.takeProfit.orderId !== undefined ? {
|
3623
|
+
equals: item.takeProfit.orderId
|
3624
|
+
} : undefined,
|
3269
3625
|
},
|
3270
3626
|
update: {
|
3271
3627
|
id: item.takeProfit.id !== undefined ? {
|
@@ -3290,6 +3646,9 @@ exports.Trade = {
|
|
3290
3646
|
id: item.alpacaAccount.id !== undefined ? {
|
3291
3647
|
equals: item.alpacaAccount.id
|
3292
3648
|
} : undefined,
|
3649
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
3650
|
+
equals: item.alpacaAccount.userId
|
3651
|
+
} : undefined,
|
3293
3652
|
},
|
3294
3653
|
update: {
|
3295
3654
|
id: item.alpacaAccount.id !== undefined ? {
|
@@ -3342,6 +3701,9 @@ exports.Trade = {
|
|
3342
3701
|
id: item.action.id !== undefined ? {
|
3343
3702
|
equals: item.action.id
|
3344
3703
|
} : undefined,
|
3704
|
+
tradeId: item.action.tradeId !== undefined ? {
|
3705
|
+
equals: item.action.tradeId
|
3706
|
+
} : undefined,
|
3345
3707
|
},
|
3346
3708
|
update: {
|
3347
3709
|
id: item.action.id !== undefined ? {
|
@@ -3404,7 +3766,10 @@ exports.Trade = {
|
|
3404
3766
|
}
|
3405
3767
|
: { connectOrCreate: {
|
3406
3768
|
where: {
|
3407
|
-
id: item.stopLoss.id !== undefined ?
|
3769
|
+
id: item.stopLoss.id !== undefined ? {
|
3770
|
+
equals: item.stopLoss.id
|
3771
|
+
} : undefined,
|
3772
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
3408
3773
|
},
|
3409
3774
|
create: {
|
3410
3775
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -3420,7 +3785,10 @@ exports.Trade = {
|
|
3420
3785
|
}
|
3421
3786
|
: { connectOrCreate: {
|
3422
3787
|
where: {
|
3423
|
-
id: item.takeProfit.id !== undefined ?
|
3788
|
+
id: item.takeProfit.id !== undefined ? {
|
3789
|
+
equals: item.takeProfit.id
|
3790
|
+
} : undefined,
|
3791
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
3424
3792
|
},
|
3425
3793
|
create: {
|
3426
3794
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -3436,7 +3804,12 @@ exports.Trade = {
|
|
3436
3804
|
}
|
3437
3805
|
: { connectOrCreate: {
|
3438
3806
|
where: {
|
3439
|
-
id: item.alpacaAccount.id !== undefined ?
|
3807
|
+
id: item.alpacaAccount.id !== undefined ? {
|
3808
|
+
equals: item.alpacaAccount.id
|
3809
|
+
} : undefined,
|
3810
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
3811
|
+
equals: item.alpacaAccount.userId
|
3812
|
+
} : undefined,
|
3440
3813
|
},
|
3441
3814
|
create: {
|
3442
3815
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -3459,7 +3832,12 @@ exports.Trade = {
|
|
3459
3832
|
}
|
3460
3833
|
: { connectOrCreate: {
|
3461
3834
|
where: {
|
3462
|
-
id: item.action.id !== undefined ?
|
3835
|
+
id: item.action.id !== undefined ? {
|
3836
|
+
equals: item.action.id
|
3837
|
+
} : undefined,
|
3838
|
+
tradeId: item.action.tradeId !== undefined ? {
|
3839
|
+
equals: item.action.tradeId
|
3840
|
+
} : undefined,
|
3463
3841
|
},
|
3464
3842
|
create: {
|
3465
3843
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -3476,7 +3854,15 @@ exports.Trade = {
|
|
3476
3854
|
positions: props.asset.positions ? {
|
3477
3855
|
upsert: props.asset.positions.map((item) => ({
|
3478
3856
|
where: {
|
3479
|
-
id: item.id !== undefined ?
|
3857
|
+
id: item.id !== undefined ? {
|
3858
|
+
equals: item.id
|
3859
|
+
} : undefined,
|
3860
|
+
assetId: item.assetId !== undefined ? {
|
3861
|
+
equals: item.assetId
|
3862
|
+
} : undefined,
|
3863
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
3864
|
+
equals: item.alpacaAccountId
|
3865
|
+
} : undefined,
|
3480
3866
|
},
|
3481
3867
|
update: {
|
3482
3868
|
id: item.id !== undefined ? {
|
@@ -3527,6 +3913,9 @@ exports.Trade = {
|
|
3527
3913
|
id: item.alpacaAccount.id !== undefined ? {
|
3528
3914
|
equals: item.alpacaAccount.id
|
3529
3915
|
} : undefined,
|
3916
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
3917
|
+
equals: item.alpacaAccount.userId
|
3918
|
+
} : undefined,
|
3530
3919
|
},
|
3531
3920
|
update: {
|
3532
3921
|
id: item.alpacaAccount.id !== undefined ? {
|
@@ -3596,7 +3985,12 @@ exports.Trade = {
|
|
3596
3985
|
}
|
3597
3986
|
: { connectOrCreate: {
|
3598
3987
|
where: {
|
3599
|
-
id: item.alpacaAccount.id !== undefined ?
|
3988
|
+
id: item.alpacaAccount.id !== undefined ? {
|
3989
|
+
equals: item.alpacaAccount.id
|
3990
|
+
} : undefined,
|
3991
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
3992
|
+
equals: item.alpacaAccount.userId
|
3993
|
+
} : undefined,
|
3600
3994
|
},
|
3601
3995
|
create: {
|
3602
3996
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -3617,8 +4011,16 @@ exports.Trade = {
|
|
3617
4011
|
newsMentions: props.asset.newsMentions ? {
|
3618
4012
|
upsert: props.asset.newsMentions.map((item) => ({
|
3619
4013
|
where: {
|
3620
|
-
id: item.id !== undefined ?
|
4014
|
+
id: item.id !== undefined ? {
|
4015
|
+
equals: item.id
|
4016
|
+
} : undefined,
|
3621
4017
|
url: item.url !== undefined ? item.url : undefined,
|
4018
|
+
assetId: item.assetId !== undefined ? {
|
4019
|
+
equals: item.assetId
|
4020
|
+
} : undefined,
|
4021
|
+
newsArticleId: item.newsArticleId !== undefined ? {
|
4022
|
+
equals: item.newsArticleId
|
4023
|
+
} : undefined,
|
3622
4024
|
},
|
3623
4025
|
update: {
|
3624
4026
|
id: item.id !== undefined ? {
|
@@ -3724,7 +4126,9 @@ exports.Trade = {
|
|
3724
4126
|
}
|
3725
4127
|
: { connectOrCreate: {
|
3726
4128
|
where: {
|
3727
|
-
id: item.news.id !== undefined ?
|
4129
|
+
id: item.news.id !== undefined ? {
|
4130
|
+
equals: item.news.id
|
4131
|
+
} : undefined,
|
3728
4132
|
url: item.news.url !== undefined ? item.news.url : undefined,
|
3729
4133
|
title: item.news.title !== undefined ? {
|
3730
4134
|
equals: item.news.title
|
@@ -3815,7 +4219,18 @@ exports.Trade = {
|
|
3815
4219
|
}
|
3816
4220
|
: { connectOrCreate: props.asset.orders.map((item) => ({
|
3817
4221
|
where: {
|
3818
|
-
id: item.id !== undefined ?
|
4222
|
+
id: item.id !== undefined ? {
|
4223
|
+
equals: item.id
|
4224
|
+
} : undefined,
|
4225
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
4226
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
4227
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
4228
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
4229
|
+
equals: item.alpacaAccountId
|
4230
|
+
} : undefined,
|
4231
|
+
assetId: item.assetId !== undefined ? {
|
4232
|
+
equals: item.assetId
|
4233
|
+
} : undefined,
|
3819
4234
|
},
|
3820
4235
|
create: {
|
3821
4236
|
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
@@ -3848,7 +4263,10 @@ exports.Trade = {
|
|
3848
4263
|
}
|
3849
4264
|
: { connectOrCreate: {
|
3850
4265
|
where: {
|
3851
|
-
id: item.stopLoss.id !== undefined ?
|
4266
|
+
id: item.stopLoss.id !== undefined ? {
|
4267
|
+
equals: item.stopLoss.id
|
4268
|
+
} : undefined,
|
4269
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
3852
4270
|
},
|
3853
4271
|
create: {
|
3854
4272
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -3864,7 +4282,10 @@ exports.Trade = {
|
|
3864
4282
|
}
|
3865
4283
|
: { connectOrCreate: {
|
3866
4284
|
where: {
|
3867
|
-
id: item.takeProfit.id !== undefined ?
|
4285
|
+
id: item.takeProfit.id !== undefined ? {
|
4286
|
+
equals: item.takeProfit.id
|
4287
|
+
} : undefined,
|
4288
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
3868
4289
|
},
|
3869
4290
|
create: {
|
3870
4291
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -3880,7 +4301,12 @@ exports.Trade = {
|
|
3880
4301
|
}
|
3881
4302
|
: { connectOrCreate: {
|
3882
4303
|
where: {
|
3883
|
-
id: item.alpacaAccount.id !== undefined ?
|
4304
|
+
id: item.alpacaAccount.id !== undefined ? {
|
4305
|
+
equals: item.alpacaAccount.id
|
4306
|
+
} : undefined,
|
4307
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
4308
|
+
equals: item.alpacaAccount.userId
|
4309
|
+
} : undefined,
|
3884
4310
|
},
|
3885
4311
|
create: {
|
3886
4312
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -3903,7 +4329,12 @@ exports.Trade = {
|
|
3903
4329
|
}
|
3904
4330
|
: { connectOrCreate: {
|
3905
4331
|
where: {
|
3906
|
-
id: item.action.id !== undefined ?
|
4332
|
+
id: item.action.id !== undefined ? {
|
4333
|
+
equals: item.action.id
|
4334
|
+
} : undefined,
|
4335
|
+
tradeId: item.action.tradeId !== undefined ? {
|
4336
|
+
equals: item.action.tradeId
|
4337
|
+
} : undefined,
|
3907
4338
|
},
|
3908
4339
|
create: {
|
3909
4340
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -3925,7 +4356,15 @@ exports.Trade = {
|
|
3925
4356
|
}
|
3926
4357
|
: { connectOrCreate: props.asset.positions.map((item) => ({
|
3927
4358
|
where: {
|
3928
|
-
id: item.id !== undefined ?
|
4359
|
+
id: item.id !== undefined ? {
|
4360
|
+
equals: item.id
|
4361
|
+
} : undefined,
|
4362
|
+
assetId: item.assetId !== undefined ? {
|
4363
|
+
equals: item.assetId
|
4364
|
+
} : undefined,
|
4365
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
4366
|
+
equals: item.alpacaAccountId
|
4367
|
+
} : undefined,
|
3929
4368
|
},
|
3930
4369
|
create: {
|
3931
4370
|
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
@@ -3949,7 +4388,12 @@ exports.Trade = {
|
|
3949
4388
|
}
|
3950
4389
|
: { connectOrCreate: {
|
3951
4390
|
where: {
|
3952
|
-
id: item.alpacaAccount.id !== undefined ?
|
4391
|
+
id: item.alpacaAccount.id !== undefined ? {
|
4392
|
+
equals: item.alpacaAccount.id
|
4393
|
+
} : undefined,
|
4394
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
4395
|
+
equals: item.alpacaAccount.userId
|
4396
|
+
} : undefined,
|
3953
4397
|
},
|
3954
4398
|
create: {
|
3955
4399
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -3975,8 +4419,16 @@ exports.Trade = {
|
|
3975
4419
|
}
|
3976
4420
|
: { connectOrCreate: props.asset.newsMentions.map((item) => ({
|
3977
4421
|
where: {
|
3978
|
-
id: item.id !== undefined ?
|
4422
|
+
id: item.id !== undefined ? {
|
4423
|
+
equals: item.id
|
4424
|
+
} : undefined,
|
3979
4425
|
url: item.url !== undefined ? item.url : undefined,
|
4426
|
+
assetId: item.assetId !== undefined ? {
|
4427
|
+
equals: item.assetId
|
4428
|
+
} : undefined,
|
4429
|
+
newsArticleId: item.newsArticleId !== undefined ? {
|
4430
|
+
equals: item.newsArticleId
|
4431
|
+
} : undefined,
|
3980
4432
|
},
|
3981
4433
|
create: {
|
3982
4434
|
url: item.url !== undefined ? item.url : undefined,
|
@@ -3991,7 +4443,9 @@ exports.Trade = {
|
|
3991
4443
|
}
|
3992
4444
|
: { connectOrCreate: {
|
3993
4445
|
where: {
|
3994
|
-
id: item.news.id !== undefined ?
|
4446
|
+
id: item.news.id !== undefined ? {
|
4447
|
+
equals: item.news.id
|
4448
|
+
} : undefined,
|
3995
4449
|
url: item.news.url !== undefined ? item.news.url : undefined,
|
3996
4450
|
title: item.news.title !== undefined ? {
|
3997
4451
|
equals: item.news.title
|
@@ -4023,7 +4477,12 @@ exports.Trade = {
|
|
4023
4477
|
actions: props.actions ? {
|
4024
4478
|
upsert: props.actions.map((item) => ({
|
4025
4479
|
where: {
|
4026
|
-
id: item.id !== undefined ?
|
4480
|
+
id: item.id !== undefined ? {
|
4481
|
+
equals: item.id
|
4482
|
+
} : undefined,
|
4483
|
+
tradeId: item.tradeId !== undefined ? {
|
4484
|
+
equals: item.tradeId
|
4485
|
+
} : undefined,
|
4027
4486
|
},
|
4028
4487
|
update: {
|
4029
4488
|
id: item.id !== undefined ? {
|
@@ -4050,6 +4509,18 @@ exports.Trade = {
|
|
4050
4509
|
id: item.order.id !== undefined ? {
|
4051
4510
|
equals: item.order.id
|
4052
4511
|
} : undefined,
|
4512
|
+
clientOrderId: item.order.clientOrderId !== undefined ? {
|
4513
|
+
equals: item.order.clientOrderId
|
4514
|
+
} : undefined,
|
4515
|
+
alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
|
4516
|
+
equals: item.order.alpacaAccountId
|
4517
|
+
} : undefined,
|
4518
|
+
assetId: item.order.assetId !== undefined ? {
|
4519
|
+
equals: item.order.assetId
|
4520
|
+
} : undefined,
|
4521
|
+
actionId: item.order.actionId !== undefined ? {
|
4522
|
+
equals: item.order.actionId
|
4523
|
+
} : undefined,
|
4053
4524
|
},
|
4054
4525
|
update: {
|
4055
4526
|
id: item.order.id !== undefined ? {
|
@@ -4127,6 +4598,9 @@ exports.Trade = {
|
|
4127
4598
|
id: item.order.stopLoss.id !== undefined ? {
|
4128
4599
|
equals: item.order.stopLoss.id
|
4129
4600
|
} : undefined,
|
4601
|
+
orderId: item.order.stopLoss.orderId !== undefined ? {
|
4602
|
+
equals: item.order.stopLoss.orderId
|
4603
|
+
} : undefined,
|
4130
4604
|
},
|
4131
4605
|
update: {
|
4132
4606
|
id: item.order.stopLoss.id !== undefined ? {
|
@@ -4151,6 +4625,9 @@ exports.Trade = {
|
|
4151
4625
|
id: item.order.takeProfit.id !== undefined ? {
|
4152
4626
|
equals: item.order.takeProfit.id
|
4153
4627
|
} : undefined,
|
4628
|
+
orderId: item.order.takeProfit.orderId !== undefined ? {
|
4629
|
+
equals: item.order.takeProfit.orderId
|
4630
|
+
} : undefined,
|
4154
4631
|
},
|
4155
4632
|
update: {
|
4156
4633
|
id: item.order.takeProfit.id !== undefined ? {
|
@@ -4175,6 +4652,9 @@ exports.Trade = {
|
|
4175
4652
|
id: item.order.alpacaAccount.id !== undefined ? {
|
4176
4653
|
equals: item.order.alpacaAccount.id
|
4177
4654
|
} : undefined,
|
4655
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
4656
|
+
equals: item.order.alpacaAccount.userId
|
4657
|
+
} : undefined,
|
4178
4658
|
},
|
4179
4659
|
update: {
|
4180
4660
|
id: item.order.alpacaAccount.id !== undefined ? {
|
@@ -4495,7 +4975,10 @@ exports.Trade = {
|
|
4495
4975
|
}
|
4496
4976
|
: { connectOrCreate: {
|
4497
4977
|
where: {
|
4498
|
-
id: item.order.stopLoss.id !== undefined ?
|
4978
|
+
id: item.order.stopLoss.id !== undefined ? {
|
4979
|
+
equals: item.order.stopLoss.id
|
4980
|
+
} : undefined,
|
4981
|
+
orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
|
4499
4982
|
},
|
4500
4983
|
create: {
|
4501
4984
|
stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
|
@@ -4511,7 +4994,10 @@ exports.Trade = {
|
|
4511
4994
|
}
|
4512
4995
|
: { connectOrCreate: {
|
4513
4996
|
where: {
|
4514
|
-
id: item.order.takeProfit.id !== undefined ?
|
4997
|
+
id: item.order.takeProfit.id !== undefined ? {
|
4998
|
+
equals: item.order.takeProfit.id
|
4999
|
+
} : undefined,
|
5000
|
+
orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
|
4515
5001
|
},
|
4516
5002
|
create: {
|
4517
5003
|
limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
|
@@ -4527,7 +5013,12 @@ exports.Trade = {
|
|
4527
5013
|
}
|
4528
5014
|
: { connectOrCreate: {
|
4529
5015
|
where: {
|
4530
|
-
id: item.order.alpacaAccount.id !== undefined ?
|
5016
|
+
id: item.order.alpacaAccount.id !== undefined ? {
|
5017
|
+
equals: item.order.alpacaAccount.id
|
5018
|
+
} : undefined,
|
5019
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
5020
|
+
equals: item.order.alpacaAccount.userId
|
5021
|
+
} : undefined,
|
4531
5022
|
},
|
4532
5023
|
create: {
|
4533
5024
|
type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
|
@@ -4550,7 +5041,9 @@ exports.Trade = {
|
|
4550
5041
|
}
|
4551
5042
|
: { connectOrCreate: {
|
4552
5043
|
where: {
|
4553
|
-
id: item.order.asset.id !== undefined ?
|
5044
|
+
id: item.order.asset.id !== undefined ? {
|
5045
|
+
equals: item.order.asset.id
|
5046
|
+
} : undefined,
|
4554
5047
|
symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
|
4555
5048
|
name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
|
4556
5049
|
},
|
@@ -4631,7 +5124,18 @@ exports.Trade = {
|
|
4631
5124
|
}
|
4632
5125
|
: { connectOrCreate: {
|
4633
5126
|
where: {
|
4634
|
-
id: item.order.id !== undefined ?
|
5127
|
+
id: item.order.id !== undefined ? {
|
5128
|
+
equals: item.order.id
|
5129
|
+
} : undefined,
|
5130
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
5131
|
+
actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
|
5132
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
5133
|
+
alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
|
5134
|
+
equals: item.order.alpacaAccountId
|
5135
|
+
} : undefined,
|
5136
|
+
assetId: item.order.assetId !== undefined ? {
|
5137
|
+
equals: item.order.assetId
|
5138
|
+
} : undefined,
|
4635
5139
|
},
|
4636
5140
|
create: {
|
4637
5141
|
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
@@ -4664,7 +5168,10 @@ exports.Trade = {
|
|
4664
5168
|
}
|
4665
5169
|
: { connectOrCreate: {
|
4666
5170
|
where: {
|
4667
|
-
id: item.order.stopLoss.id !== undefined ?
|
5171
|
+
id: item.order.stopLoss.id !== undefined ? {
|
5172
|
+
equals: item.order.stopLoss.id
|
5173
|
+
} : undefined,
|
5174
|
+
orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
|
4668
5175
|
},
|
4669
5176
|
create: {
|
4670
5177
|
stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
|
@@ -4680,7 +5187,10 @@ exports.Trade = {
|
|
4680
5187
|
}
|
4681
5188
|
: { connectOrCreate: {
|
4682
5189
|
where: {
|
4683
|
-
id: item.order.takeProfit.id !== undefined ?
|
5190
|
+
id: item.order.takeProfit.id !== undefined ? {
|
5191
|
+
equals: item.order.takeProfit.id
|
5192
|
+
} : undefined,
|
5193
|
+
orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
|
4684
5194
|
},
|
4685
5195
|
create: {
|
4686
5196
|
limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
|
@@ -4696,7 +5206,12 @@ exports.Trade = {
|
|
4696
5206
|
}
|
4697
5207
|
: { connectOrCreate: {
|
4698
5208
|
where: {
|
4699
|
-
id: item.order.alpacaAccount.id !== undefined ?
|
5209
|
+
id: item.order.alpacaAccount.id !== undefined ? {
|
5210
|
+
equals: item.order.alpacaAccount.id
|
5211
|
+
} : undefined,
|
5212
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
5213
|
+
equals: item.order.alpacaAccount.userId
|
5214
|
+
} : undefined,
|
4700
5215
|
},
|
4701
5216
|
create: {
|
4702
5217
|
type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
|
@@ -4719,7 +5234,9 @@ exports.Trade = {
|
|
4719
5234
|
}
|
4720
5235
|
: { connectOrCreate: {
|
4721
5236
|
where: {
|
4722
|
-
id: item.order.asset.id !== undefined ?
|
5237
|
+
id: item.order.asset.id !== undefined ? {
|
5238
|
+
equals: item.order.asset.id
|
5239
|
+
} : undefined,
|
4723
5240
|
symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
|
4724
5241
|
name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
|
4725
5242
|
},
|
@@ -4822,9 +5339,15 @@ exports.Trade = {
|
|
4822
5339
|
}`;
|
4823
5340
|
const variables = props.map(prop => ({
|
4824
5341
|
where: {
|
4825
|
-
id: prop.id !== undefined ?
|
4826
|
-
|
4827
|
-
|
5342
|
+
id: prop.id !== undefined ? {
|
5343
|
+
equals: prop.id
|
5344
|
+
} : undefined,
|
5345
|
+
alpacaAccountId: prop.alpacaAccountId !== undefined ? {
|
5346
|
+
equals: prop.alpacaAccountId
|
5347
|
+
} : undefined,
|
5348
|
+
assetId: prop.assetId !== undefined ? {
|
5349
|
+
equals: prop.assetId
|
5350
|
+
} : undefined,
|
4828
5351
|
qty: prop.qty !== undefined ? prop.qty : undefined,
|
4829
5352
|
price: prop.price !== undefined ? prop.price : undefined,
|
4830
5353
|
total: prop.total !== undefined ? prop.total : undefined,
|
@@ -4888,6 +5411,9 @@ exports.Trade = {
|
|
4888
5411
|
id: prop.alpacaAccount.id !== undefined ? {
|
4889
5412
|
equals: prop.alpacaAccount.id
|
4890
5413
|
} : undefined,
|
5414
|
+
userId: prop.alpacaAccount.userId !== undefined ? {
|
5415
|
+
equals: prop.alpacaAccount.userId
|
5416
|
+
} : undefined,
|
4891
5417
|
},
|
4892
5418
|
update: {
|
4893
5419
|
id: prop.alpacaAccount.id !== undefined ? {
|
@@ -4976,9 +5502,21 @@ exports.Trade = {
|
|
4976
5502
|
id: prop.alpacaAccount.user.customer.id !== undefined ? {
|
4977
5503
|
equals: prop.alpacaAccount.user.customer.id
|
4978
5504
|
} : undefined,
|
5505
|
+
authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
|
5506
|
+
equals: prop.alpacaAccount.user.customer.authUserId
|
5507
|
+
} : undefined,
|
4979
5508
|
name: prop.alpacaAccount.user.customer.name !== undefined ? {
|
4980
5509
|
equals: prop.alpacaAccount.user.customer.name
|
4981
5510
|
} : undefined,
|
5511
|
+
stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
|
5512
|
+
equals: prop.alpacaAccount.user.customer.stripeCustomerId
|
5513
|
+
} : undefined,
|
5514
|
+
stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
|
5515
|
+
equals: prop.alpacaAccount.user.customer.stripeSubscriptionId
|
5516
|
+
} : undefined,
|
5517
|
+
stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
5518
|
+
equals: prop.alpacaAccount.user.customer.stripePriceId
|
5519
|
+
} : undefined,
|
4982
5520
|
},
|
4983
5521
|
update: {
|
4984
5522
|
authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
|
@@ -5017,7 +5555,15 @@ exports.Trade = {
|
|
5017
5555
|
accounts: prop.alpacaAccount.user.accounts ? {
|
5018
5556
|
upsert: prop.alpacaAccount.user.accounts.map((item) => ({
|
5019
5557
|
where: {
|
5020
|
-
id: item.id !== undefined ?
|
5558
|
+
id: item.id !== undefined ? {
|
5559
|
+
equals: item.id
|
5560
|
+
} : undefined,
|
5561
|
+
userId: item.userId !== undefined ? {
|
5562
|
+
equals: item.userId
|
5563
|
+
} : undefined,
|
5564
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
5565
|
+
equals: item.providerAccountId
|
5566
|
+
} : undefined,
|
5021
5567
|
},
|
5022
5568
|
update: {
|
5023
5569
|
id: item.id !== undefined ? {
|
@@ -5071,7 +5617,12 @@ exports.Trade = {
|
|
5071
5617
|
sessions: prop.alpacaAccount.user.sessions ? {
|
5072
5618
|
upsert: prop.alpacaAccount.user.sessions.map((item) => ({
|
5073
5619
|
where: {
|
5074
|
-
id: item.id !== undefined ?
|
5620
|
+
id: item.id !== undefined ? {
|
5621
|
+
equals: item.id
|
5622
|
+
} : undefined,
|
5623
|
+
userId: item.userId !== undefined ? {
|
5624
|
+
equals: item.userId
|
5625
|
+
} : undefined,
|
5075
5626
|
},
|
5076
5627
|
update: {
|
5077
5628
|
id: item.id !== undefined ? {
|
@@ -5093,7 +5644,12 @@ exports.Trade = {
|
|
5093
5644
|
authenticators: prop.alpacaAccount.user.authenticators ? {
|
5094
5645
|
upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
|
5095
5646
|
where: {
|
5096
|
-
id: item.id !== undefined ?
|
5647
|
+
id: item.id !== undefined ? {
|
5648
|
+
equals: item.id
|
5649
|
+
} : undefined,
|
5650
|
+
userId: item.userId !== undefined ? {
|
5651
|
+
equals: item.userId
|
5652
|
+
} : undefined,
|
5097
5653
|
},
|
5098
5654
|
update: {
|
5099
5655
|
id: item.id !== undefined ? {
|
@@ -5137,10 +5693,20 @@ exports.Trade = {
|
|
5137
5693
|
}
|
5138
5694
|
: { connectOrCreate: {
|
5139
5695
|
where: {
|
5140
|
-
id: prop.alpacaAccount.user.customer.id !== undefined ?
|
5696
|
+
id: prop.alpacaAccount.user.customer.id !== undefined ? {
|
5697
|
+
equals: prop.alpacaAccount.user.customer.id
|
5698
|
+
} : undefined,
|
5699
|
+
stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
|
5700
|
+
stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
|
5701
|
+
authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
|
5702
|
+
equals: prop.alpacaAccount.user.customer.authUserId
|
5703
|
+
} : undefined,
|
5141
5704
|
name: prop.alpacaAccount.user.customer.name !== undefined ? {
|
5142
5705
|
equals: prop.alpacaAccount.user.customer.name
|
5143
5706
|
} : undefined,
|
5707
|
+
stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
5708
|
+
equals: prop.alpacaAccount.user.customer.stripePriceId
|
5709
|
+
} : undefined,
|
5144
5710
|
},
|
5145
5711
|
create: {
|
5146
5712
|
authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
|
@@ -5161,7 +5727,15 @@ exports.Trade = {
|
|
5161
5727
|
}
|
5162
5728
|
: { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
|
5163
5729
|
where: {
|
5164
|
-
id: item.id !== undefined ?
|
5730
|
+
id: item.id !== undefined ? {
|
5731
|
+
equals: item.id
|
5732
|
+
} : undefined,
|
5733
|
+
userId: item.userId !== undefined ? {
|
5734
|
+
equals: item.userId
|
5735
|
+
} : undefined,
|
5736
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
5737
|
+
equals: item.providerAccountId
|
5738
|
+
} : undefined,
|
5165
5739
|
},
|
5166
5740
|
create: {
|
5167
5741
|
type: item.type !== undefined ? item.type : undefined,
|
@@ -5185,7 +5759,12 @@ exports.Trade = {
|
|
5185
5759
|
}
|
5186
5760
|
: { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
|
5187
5761
|
where: {
|
5188
|
-
id: item.id !== undefined ?
|
5762
|
+
id: item.id !== undefined ? {
|
5763
|
+
equals: item.id
|
5764
|
+
} : undefined,
|
5765
|
+
userId: item.userId !== undefined ? {
|
5766
|
+
equals: item.userId
|
5767
|
+
} : undefined,
|
5189
5768
|
},
|
5190
5769
|
create: {
|
5191
5770
|
sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
|
@@ -5201,7 +5780,12 @@ exports.Trade = {
|
|
5201
5780
|
}
|
5202
5781
|
: { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
|
5203
5782
|
where: {
|
5204
|
-
id: item.id !== undefined ?
|
5783
|
+
id: item.id !== undefined ? {
|
5784
|
+
equals: item.id
|
5785
|
+
} : undefined,
|
5786
|
+
userId: item.userId !== undefined ? {
|
5787
|
+
equals: item.userId
|
5788
|
+
} : undefined,
|
5205
5789
|
},
|
5206
5790
|
create: {
|
5207
5791
|
credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
|
@@ -5216,7 +5800,18 @@ exports.Trade = {
|
|
5216
5800
|
orders: prop.alpacaAccount.orders ? {
|
5217
5801
|
upsert: prop.alpacaAccount.orders.map((item) => ({
|
5218
5802
|
where: {
|
5219
|
-
id: item.id !== undefined ?
|
5803
|
+
id: item.id !== undefined ? {
|
5804
|
+
equals: item.id
|
5805
|
+
} : undefined,
|
5806
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
5807
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
5808
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
5809
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
5810
|
+
equals: item.alpacaAccountId
|
5811
|
+
} : undefined,
|
5812
|
+
assetId: item.assetId !== undefined ? {
|
5813
|
+
equals: item.assetId
|
5814
|
+
} : undefined,
|
5220
5815
|
},
|
5221
5816
|
update: {
|
5222
5817
|
id: item.id !== undefined ? {
|
@@ -5294,6 +5889,9 @@ exports.Trade = {
|
|
5294
5889
|
id: item.stopLoss.id !== undefined ? {
|
5295
5890
|
equals: item.stopLoss.id
|
5296
5891
|
} : undefined,
|
5892
|
+
orderId: item.stopLoss.orderId !== undefined ? {
|
5893
|
+
equals: item.stopLoss.orderId
|
5894
|
+
} : undefined,
|
5297
5895
|
},
|
5298
5896
|
update: {
|
5299
5897
|
id: item.stopLoss.id !== undefined ? {
|
@@ -5318,6 +5916,9 @@ exports.Trade = {
|
|
5318
5916
|
id: item.takeProfit.id !== undefined ? {
|
5319
5917
|
equals: item.takeProfit.id
|
5320
5918
|
} : undefined,
|
5919
|
+
orderId: item.takeProfit.orderId !== undefined ? {
|
5920
|
+
equals: item.takeProfit.orderId
|
5921
|
+
} : undefined,
|
5321
5922
|
},
|
5322
5923
|
update: {
|
5323
5924
|
id: item.takeProfit.id !== undefined ? {
|
@@ -5342,6 +5943,9 @@ exports.Trade = {
|
|
5342
5943
|
id: item.action.id !== undefined ? {
|
5343
5944
|
equals: item.action.id
|
5344
5945
|
} : undefined,
|
5946
|
+
tradeId: item.action.tradeId !== undefined ? {
|
5947
|
+
equals: item.action.tradeId
|
5948
|
+
} : undefined,
|
5345
5949
|
},
|
5346
5950
|
update: {
|
5347
5951
|
id: item.action.id !== undefined ? {
|
@@ -5646,7 +6250,10 @@ exports.Trade = {
|
|
5646
6250
|
}
|
5647
6251
|
: { connectOrCreate: {
|
5648
6252
|
where: {
|
5649
|
-
id: item.stopLoss.id !== undefined ?
|
6253
|
+
id: item.stopLoss.id !== undefined ? {
|
6254
|
+
equals: item.stopLoss.id
|
6255
|
+
} : undefined,
|
6256
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
5650
6257
|
},
|
5651
6258
|
create: {
|
5652
6259
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -5662,7 +6269,10 @@ exports.Trade = {
|
|
5662
6269
|
}
|
5663
6270
|
: { connectOrCreate: {
|
5664
6271
|
where: {
|
5665
|
-
id: item.takeProfit.id !== undefined ?
|
6272
|
+
id: item.takeProfit.id !== undefined ? {
|
6273
|
+
equals: item.takeProfit.id
|
6274
|
+
} : undefined,
|
6275
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
5666
6276
|
},
|
5667
6277
|
create: {
|
5668
6278
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -5678,7 +6288,12 @@ exports.Trade = {
|
|
5678
6288
|
}
|
5679
6289
|
: { connectOrCreate: {
|
5680
6290
|
where: {
|
5681
|
-
id: item.action.id !== undefined ?
|
6291
|
+
id: item.action.id !== undefined ? {
|
6292
|
+
equals: item.action.id
|
6293
|
+
} : undefined,
|
6294
|
+
tradeId: item.action.tradeId !== undefined ? {
|
6295
|
+
equals: item.action.tradeId
|
6296
|
+
} : undefined,
|
5682
6297
|
},
|
5683
6298
|
create: {
|
5684
6299
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -5697,7 +6312,9 @@ exports.Trade = {
|
|
5697
6312
|
}
|
5698
6313
|
: { connectOrCreate: {
|
5699
6314
|
where: {
|
5700
|
-
id: item.asset.id !== undefined ?
|
6315
|
+
id: item.asset.id !== undefined ? {
|
6316
|
+
equals: item.asset.id
|
6317
|
+
} : undefined,
|
5701
6318
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
5702
6319
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
5703
6320
|
},
|
@@ -5766,7 +6383,15 @@ exports.Trade = {
|
|
5766
6383
|
positions: prop.alpacaAccount.positions ? {
|
5767
6384
|
upsert: prop.alpacaAccount.positions.map((item) => ({
|
5768
6385
|
where: {
|
5769
|
-
id: item.id !== undefined ?
|
6386
|
+
id: item.id !== undefined ? {
|
6387
|
+
equals: item.id
|
6388
|
+
} : undefined,
|
6389
|
+
assetId: item.assetId !== undefined ? {
|
6390
|
+
equals: item.assetId
|
6391
|
+
} : undefined,
|
6392
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
6393
|
+
equals: item.alpacaAccountId
|
6394
|
+
} : undefined,
|
5770
6395
|
},
|
5771
6396
|
update: {
|
5772
6397
|
id: item.id !== undefined ? {
|
@@ -6076,7 +6701,9 @@ exports.Trade = {
|
|
6076
6701
|
}
|
6077
6702
|
: { connectOrCreate: {
|
6078
6703
|
where: {
|
6079
|
-
id: item.asset.id !== undefined ?
|
6704
|
+
id: item.asset.id !== undefined ? {
|
6705
|
+
equals: item.asset.id
|
6706
|
+
} : undefined,
|
6080
6707
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
6081
6708
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
6082
6709
|
},
|
@@ -6145,7 +6772,12 @@ exports.Trade = {
|
|
6145
6772
|
alerts: prop.alpacaAccount.alerts ? {
|
6146
6773
|
upsert: prop.alpacaAccount.alerts.map((item) => ({
|
6147
6774
|
where: {
|
6148
|
-
id: item.id !== undefined ?
|
6775
|
+
id: item.id !== undefined ? {
|
6776
|
+
equals: item.id
|
6777
|
+
} : undefined,
|
6778
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
6779
|
+
equals: item.alpacaAccountId
|
6780
|
+
} : undefined,
|
6149
6781
|
},
|
6150
6782
|
update: {
|
6151
6783
|
id: item.id !== undefined ? {
|
@@ -6187,7 +6819,9 @@ exports.Trade = {
|
|
6187
6819
|
}
|
6188
6820
|
: { connectOrCreate: {
|
6189
6821
|
where: {
|
6190
|
-
id: prop.alpacaAccount.user.id !== undefined ?
|
6822
|
+
id: prop.alpacaAccount.user.id !== undefined ? {
|
6823
|
+
equals: prop.alpacaAccount.user.id
|
6824
|
+
} : undefined,
|
6191
6825
|
email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
|
6192
6826
|
name: prop.alpacaAccount.user.name !== undefined ? {
|
6193
6827
|
equals: prop.alpacaAccount.user.name
|
@@ -6213,10 +6847,20 @@ exports.Trade = {
|
|
6213
6847
|
}
|
6214
6848
|
: { connectOrCreate: {
|
6215
6849
|
where: {
|
6216
|
-
id: prop.alpacaAccount.user.customer.id !== undefined ?
|
6850
|
+
id: prop.alpacaAccount.user.customer.id !== undefined ? {
|
6851
|
+
equals: prop.alpacaAccount.user.customer.id
|
6852
|
+
} : undefined,
|
6853
|
+
stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
|
6854
|
+
stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
|
6855
|
+
authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
|
6856
|
+
equals: prop.alpacaAccount.user.customer.authUserId
|
6857
|
+
} : undefined,
|
6217
6858
|
name: prop.alpacaAccount.user.customer.name !== undefined ? {
|
6218
6859
|
equals: prop.alpacaAccount.user.customer.name
|
6219
6860
|
} : undefined,
|
6861
|
+
stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
|
6862
|
+
equals: prop.alpacaAccount.user.customer.stripePriceId
|
6863
|
+
} : undefined,
|
6220
6864
|
},
|
6221
6865
|
create: {
|
6222
6866
|
authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
|
@@ -6237,7 +6881,15 @@ exports.Trade = {
|
|
6237
6881
|
}
|
6238
6882
|
: { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
|
6239
6883
|
where: {
|
6240
|
-
id: item.id !== undefined ?
|
6884
|
+
id: item.id !== undefined ? {
|
6885
|
+
equals: item.id
|
6886
|
+
} : undefined,
|
6887
|
+
userId: item.userId !== undefined ? {
|
6888
|
+
equals: item.userId
|
6889
|
+
} : undefined,
|
6890
|
+
providerAccountId: item.providerAccountId !== undefined ? {
|
6891
|
+
equals: item.providerAccountId
|
6892
|
+
} : undefined,
|
6241
6893
|
},
|
6242
6894
|
create: {
|
6243
6895
|
type: item.type !== undefined ? item.type : undefined,
|
@@ -6261,7 +6913,12 @@ exports.Trade = {
|
|
6261
6913
|
}
|
6262
6914
|
: { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
|
6263
6915
|
where: {
|
6264
|
-
id: item.id !== undefined ?
|
6916
|
+
id: item.id !== undefined ? {
|
6917
|
+
equals: item.id
|
6918
|
+
} : undefined,
|
6919
|
+
userId: item.userId !== undefined ? {
|
6920
|
+
equals: item.userId
|
6921
|
+
} : undefined,
|
6265
6922
|
},
|
6266
6923
|
create: {
|
6267
6924
|
sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
|
@@ -6277,7 +6934,12 @@ exports.Trade = {
|
|
6277
6934
|
}
|
6278
6935
|
: { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
|
6279
6936
|
where: {
|
6280
|
-
id: item.id !== undefined ?
|
6937
|
+
id: item.id !== undefined ? {
|
6938
|
+
equals: item.id
|
6939
|
+
} : undefined,
|
6940
|
+
userId: item.userId !== undefined ? {
|
6941
|
+
equals: item.userId
|
6942
|
+
} : undefined,
|
6281
6943
|
},
|
6282
6944
|
create: {
|
6283
6945
|
credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
|
@@ -6297,7 +6959,18 @@ exports.Trade = {
|
|
6297
6959
|
}
|
6298
6960
|
: { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
|
6299
6961
|
where: {
|
6300
|
-
id: item.id !== undefined ?
|
6962
|
+
id: item.id !== undefined ? {
|
6963
|
+
equals: item.id
|
6964
|
+
} : undefined,
|
6965
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
6966
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
6967
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
6968
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
6969
|
+
equals: item.alpacaAccountId
|
6970
|
+
} : undefined,
|
6971
|
+
assetId: item.assetId !== undefined ? {
|
6972
|
+
equals: item.assetId
|
6973
|
+
} : undefined,
|
6301
6974
|
},
|
6302
6975
|
create: {
|
6303
6976
|
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
@@ -6330,7 +7003,10 @@ exports.Trade = {
|
|
6330
7003
|
}
|
6331
7004
|
: { connectOrCreate: {
|
6332
7005
|
where: {
|
6333
|
-
id: item.stopLoss.id !== undefined ?
|
7006
|
+
id: item.stopLoss.id !== undefined ? {
|
7007
|
+
equals: item.stopLoss.id
|
7008
|
+
} : undefined,
|
7009
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
6334
7010
|
},
|
6335
7011
|
create: {
|
6336
7012
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -6346,7 +7022,10 @@ exports.Trade = {
|
|
6346
7022
|
}
|
6347
7023
|
: { connectOrCreate: {
|
6348
7024
|
where: {
|
6349
|
-
id: item.takeProfit.id !== undefined ?
|
7025
|
+
id: item.takeProfit.id !== undefined ? {
|
7026
|
+
equals: item.takeProfit.id
|
7027
|
+
} : undefined,
|
7028
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
6350
7029
|
},
|
6351
7030
|
create: {
|
6352
7031
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -6362,7 +7041,12 @@ exports.Trade = {
|
|
6362
7041
|
}
|
6363
7042
|
: { connectOrCreate: {
|
6364
7043
|
where: {
|
6365
|
-
id: item.action.id !== undefined ?
|
7044
|
+
id: item.action.id !== undefined ? {
|
7045
|
+
equals: item.action.id
|
7046
|
+
} : undefined,
|
7047
|
+
tradeId: item.action.tradeId !== undefined ? {
|
7048
|
+
equals: item.action.tradeId
|
7049
|
+
} : undefined,
|
6366
7050
|
},
|
6367
7051
|
create: {
|
6368
7052
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -6381,7 +7065,9 @@ exports.Trade = {
|
|
6381
7065
|
}
|
6382
7066
|
: { connectOrCreate: {
|
6383
7067
|
where: {
|
6384
|
-
id: item.asset.id !== undefined ?
|
7068
|
+
id: item.asset.id !== undefined ? {
|
7069
|
+
equals: item.asset.id
|
7070
|
+
} : undefined,
|
6385
7071
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
6386
7072
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
6387
7073
|
},
|
@@ -6455,7 +7141,15 @@ exports.Trade = {
|
|
6455
7141
|
}
|
6456
7142
|
: { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
|
6457
7143
|
where: {
|
6458
|
-
id: item.id !== undefined ?
|
7144
|
+
id: item.id !== undefined ? {
|
7145
|
+
equals: item.id
|
7146
|
+
} : undefined,
|
7147
|
+
assetId: item.assetId !== undefined ? {
|
7148
|
+
equals: item.assetId
|
7149
|
+
} : undefined,
|
7150
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
7151
|
+
equals: item.alpacaAccountId
|
7152
|
+
} : undefined,
|
6459
7153
|
},
|
6460
7154
|
create: {
|
6461
7155
|
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
@@ -6479,7 +7173,9 @@ exports.Trade = {
|
|
6479
7173
|
}
|
6480
7174
|
: { connectOrCreate: {
|
6481
7175
|
where: {
|
6482
|
-
id: item.asset.id !== undefined ?
|
7176
|
+
id: item.asset.id !== undefined ? {
|
7177
|
+
equals: item.asset.id
|
7178
|
+
} : undefined,
|
6483
7179
|
symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
|
6484
7180
|
name: item.asset.name !== undefined ? item.asset.name : undefined,
|
6485
7181
|
},
|
@@ -6553,7 +7249,12 @@ exports.Trade = {
|
|
6553
7249
|
}
|
6554
7250
|
: { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
|
6555
7251
|
where: {
|
6556
|
-
id: item.id !== undefined ?
|
7252
|
+
id: item.id !== undefined ? {
|
7253
|
+
equals: item.id
|
7254
|
+
} : undefined,
|
7255
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
7256
|
+
equals: item.alpacaAccountId
|
7257
|
+
} : undefined,
|
6557
7258
|
},
|
6558
7259
|
create: {
|
6559
7260
|
message: item.message !== undefined ? item.message : undefined,
|
@@ -6750,7 +7451,18 @@ exports.Trade = {
|
|
6750
7451
|
orders: prop.asset.orders ? {
|
6751
7452
|
upsert: prop.asset.orders.map((item) => ({
|
6752
7453
|
where: {
|
6753
|
-
id: item.id !== undefined ?
|
7454
|
+
id: item.id !== undefined ? {
|
7455
|
+
equals: item.id
|
7456
|
+
} : undefined,
|
7457
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
7458
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
7459
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
7460
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
7461
|
+
equals: item.alpacaAccountId
|
7462
|
+
} : undefined,
|
7463
|
+
assetId: item.assetId !== undefined ? {
|
7464
|
+
equals: item.assetId
|
7465
|
+
} : undefined,
|
6754
7466
|
},
|
6755
7467
|
update: {
|
6756
7468
|
id: item.id !== undefined ? {
|
@@ -6828,6 +7540,9 @@ exports.Trade = {
|
|
6828
7540
|
id: item.stopLoss.id !== undefined ? {
|
6829
7541
|
equals: item.stopLoss.id
|
6830
7542
|
} : undefined,
|
7543
|
+
orderId: item.stopLoss.orderId !== undefined ? {
|
7544
|
+
equals: item.stopLoss.orderId
|
7545
|
+
} : undefined,
|
6831
7546
|
},
|
6832
7547
|
update: {
|
6833
7548
|
id: item.stopLoss.id !== undefined ? {
|
@@ -6852,6 +7567,9 @@ exports.Trade = {
|
|
6852
7567
|
id: item.takeProfit.id !== undefined ? {
|
6853
7568
|
equals: item.takeProfit.id
|
6854
7569
|
} : undefined,
|
7570
|
+
orderId: item.takeProfit.orderId !== undefined ? {
|
7571
|
+
equals: item.takeProfit.orderId
|
7572
|
+
} : undefined,
|
6855
7573
|
},
|
6856
7574
|
update: {
|
6857
7575
|
id: item.takeProfit.id !== undefined ? {
|
@@ -6876,6 +7594,9 @@ exports.Trade = {
|
|
6876
7594
|
id: item.alpacaAccount.id !== undefined ? {
|
6877
7595
|
equals: item.alpacaAccount.id
|
6878
7596
|
} : undefined,
|
7597
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
7598
|
+
equals: item.alpacaAccount.userId
|
7599
|
+
} : undefined,
|
6879
7600
|
},
|
6880
7601
|
update: {
|
6881
7602
|
id: item.alpacaAccount.id !== undefined ? {
|
@@ -6928,6 +7649,9 @@ exports.Trade = {
|
|
6928
7649
|
id: item.action.id !== undefined ? {
|
6929
7650
|
equals: item.action.id
|
6930
7651
|
} : undefined,
|
7652
|
+
tradeId: item.action.tradeId !== undefined ? {
|
7653
|
+
equals: item.action.tradeId
|
7654
|
+
} : undefined,
|
6931
7655
|
},
|
6932
7656
|
update: {
|
6933
7657
|
id: item.action.id !== undefined ? {
|
@@ -6990,7 +7714,10 @@ exports.Trade = {
|
|
6990
7714
|
}
|
6991
7715
|
: { connectOrCreate: {
|
6992
7716
|
where: {
|
6993
|
-
id: item.stopLoss.id !== undefined ?
|
7717
|
+
id: item.stopLoss.id !== undefined ? {
|
7718
|
+
equals: item.stopLoss.id
|
7719
|
+
} : undefined,
|
7720
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
6994
7721
|
},
|
6995
7722
|
create: {
|
6996
7723
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -7006,7 +7733,10 @@ exports.Trade = {
|
|
7006
7733
|
}
|
7007
7734
|
: { connectOrCreate: {
|
7008
7735
|
where: {
|
7009
|
-
id: item.takeProfit.id !== undefined ?
|
7736
|
+
id: item.takeProfit.id !== undefined ? {
|
7737
|
+
equals: item.takeProfit.id
|
7738
|
+
} : undefined,
|
7739
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
7010
7740
|
},
|
7011
7741
|
create: {
|
7012
7742
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -7022,7 +7752,12 @@ exports.Trade = {
|
|
7022
7752
|
}
|
7023
7753
|
: { connectOrCreate: {
|
7024
7754
|
where: {
|
7025
|
-
id: item.alpacaAccount.id !== undefined ?
|
7755
|
+
id: item.alpacaAccount.id !== undefined ? {
|
7756
|
+
equals: item.alpacaAccount.id
|
7757
|
+
} : undefined,
|
7758
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
7759
|
+
equals: item.alpacaAccount.userId
|
7760
|
+
} : undefined,
|
7026
7761
|
},
|
7027
7762
|
create: {
|
7028
7763
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -7045,7 +7780,12 @@ exports.Trade = {
|
|
7045
7780
|
}
|
7046
7781
|
: { connectOrCreate: {
|
7047
7782
|
where: {
|
7048
|
-
id: item.action.id !== undefined ?
|
7783
|
+
id: item.action.id !== undefined ? {
|
7784
|
+
equals: item.action.id
|
7785
|
+
} : undefined,
|
7786
|
+
tradeId: item.action.tradeId !== undefined ? {
|
7787
|
+
equals: item.action.tradeId
|
7788
|
+
} : undefined,
|
7049
7789
|
},
|
7050
7790
|
create: {
|
7051
7791
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -7062,7 +7802,15 @@ exports.Trade = {
|
|
7062
7802
|
positions: prop.asset.positions ? {
|
7063
7803
|
upsert: prop.asset.positions.map((item) => ({
|
7064
7804
|
where: {
|
7065
|
-
id: item.id !== undefined ?
|
7805
|
+
id: item.id !== undefined ? {
|
7806
|
+
equals: item.id
|
7807
|
+
} : undefined,
|
7808
|
+
assetId: item.assetId !== undefined ? {
|
7809
|
+
equals: item.assetId
|
7810
|
+
} : undefined,
|
7811
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
7812
|
+
equals: item.alpacaAccountId
|
7813
|
+
} : undefined,
|
7066
7814
|
},
|
7067
7815
|
update: {
|
7068
7816
|
id: item.id !== undefined ? {
|
@@ -7113,6 +7861,9 @@ exports.Trade = {
|
|
7113
7861
|
id: item.alpacaAccount.id !== undefined ? {
|
7114
7862
|
equals: item.alpacaAccount.id
|
7115
7863
|
} : undefined,
|
7864
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
7865
|
+
equals: item.alpacaAccount.userId
|
7866
|
+
} : undefined,
|
7116
7867
|
},
|
7117
7868
|
update: {
|
7118
7869
|
id: item.alpacaAccount.id !== undefined ? {
|
@@ -7182,7 +7933,12 @@ exports.Trade = {
|
|
7182
7933
|
}
|
7183
7934
|
: { connectOrCreate: {
|
7184
7935
|
where: {
|
7185
|
-
id: item.alpacaAccount.id !== undefined ?
|
7936
|
+
id: item.alpacaAccount.id !== undefined ? {
|
7937
|
+
equals: item.alpacaAccount.id
|
7938
|
+
} : undefined,
|
7939
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
7940
|
+
equals: item.alpacaAccount.userId
|
7941
|
+
} : undefined,
|
7186
7942
|
},
|
7187
7943
|
create: {
|
7188
7944
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -7203,8 +7959,16 @@ exports.Trade = {
|
|
7203
7959
|
newsMentions: prop.asset.newsMentions ? {
|
7204
7960
|
upsert: prop.asset.newsMentions.map((item) => ({
|
7205
7961
|
where: {
|
7206
|
-
id: item.id !== undefined ?
|
7962
|
+
id: item.id !== undefined ? {
|
7963
|
+
equals: item.id
|
7964
|
+
} : undefined,
|
7207
7965
|
url: item.url !== undefined ? item.url : undefined,
|
7966
|
+
assetId: item.assetId !== undefined ? {
|
7967
|
+
equals: item.assetId
|
7968
|
+
} : undefined,
|
7969
|
+
newsArticleId: item.newsArticleId !== undefined ? {
|
7970
|
+
equals: item.newsArticleId
|
7971
|
+
} : undefined,
|
7208
7972
|
},
|
7209
7973
|
update: {
|
7210
7974
|
id: item.id !== undefined ? {
|
@@ -7310,7 +8074,9 @@ exports.Trade = {
|
|
7310
8074
|
}
|
7311
8075
|
: { connectOrCreate: {
|
7312
8076
|
where: {
|
7313
|
-
id: item.news.id !== undefined ?
|
8077
|
+
id: item.news.id !== undefined ? {
|
8078
|
+
equals: item.news.id
|
8079
|
+
} : undefined,
|
7314
8080
|
url: item.news.url !== undefined ? item.news.url : undefined,
|
7315
8081
|
title: item.news.title !== undefined ? {
|
7316
8082
|
equals: item.news.title
|
@@ -7401,7 +8167,18 @@ exports.Trade = {
|
|
7401
8167
|
}
|
7402
8168
|
: { connectOrCreate: prop.asset.orders.map((item) => ({
|
7403
8169
|
where: {
|
7404
|
-
id: item.id !== undefined ?
|
8170
|
+
id: item.id !== undefined ? {
|
8171
|
+
equals: item.id
|
8172
|
+
} : undefined,
|
8173
|
+
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
8174
|
+
actionId: item.actionId !== undefined ? item.actionId : undefined,
|
8175
|
+
stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
|
8176
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
8177
|
+
equals: item.alpacaAccountId
|
8178
|
+
} : undefined,
|
8179
|
+
assetId: item.assetId !== undefined ? {
|
8180
|
+
equals: item.assetId
|
8181
|
+
} : undefined,
|
7405
8182
|
},
|
7406
8183
|
create: {
|
7407
8184
|
clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
|
@@ -7434,7 +8211,10 @@ exports.Trade = {
|
|
7434
8211
|
}
|
7435
8212
|
: { connectOrCreate: {
|
7436
8213
|
where: {
|
7437
|
-
id: item.stopLoss.id !== undefined ?
|
8214
|
+
id: item.stopLoss.id !== undefined ? {
|
8215
|
+
equals: item.stopLoss.id
|
8216
|
+
} : undefined,
|
8217
|
+
orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
|
7438
8218
|
},
|
7439
8219
|
create: {
|
7440
8220
|
stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
|
@@ -7450,7 +8230,10 @@ exports.Trade = {
|
|
7450
8230
|
}
|
7451
8231
|
: { connectOrCreate: {
|
7452
8232
|
where: {
|
7453
|
-
id: item.takeProfit.id !== undefined ?
|
8233
|
+
id: item.takeProfit.id !== undefined ? {
|
8234
|
+
equals: item.takeProfit.id
|
8235
|
+
} : undefined,
|
8236
|
+
orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
|
7454
8237
|
},
|
7455
8238
|
create: {
|
7456
8239
|
limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
|
@@ -7466,7 +8249,12 @@ exports.Trade = {
|
|
7466
8249
|
}
|
7467
8250
|
: { connectOrCreate: {
|
7468
8251
|
where: {
|
7469
|
-
id: item.alpacaAccount.id !== undefined ?
|
8252
|
+
id: item.alpacaAccount.id !== undefined ? {
|
8253
|
+
equals: item.alpacaAccount.id
|
8254
|
+
} : undefined,
|
8255
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
8256
|
+
equals: item.alpacaAccount.userId
|
8257
|
+
} : undefined,
|
7470
8258
|
},
|
7471
8259
|
create: {
|
7472
8260
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -7489,7 +8277,12 @@ exports.Trade = {
|
|
7489
8277
|
}
|
7490
8278
|
: { connectOrCreate: {
|
7491
8279
|
where: {
|
7492
|
-
id: item.action.id !== undefined ?
|
8280
|
+
id: item.action.id !== undefined ? {
|
8281
|
+
equals: item.action.id
|
8282
|
+
} : undefined,
|
8283
|
+
tradeId: item.action.tradeId !== undefined ? {
|
8284
|
+
equals: item.action.tradeId
|
8285
|
+
} : undefined,
|
7493
8286
|
},
|
7494
8287
|
create: {
|
7495
8288
|
sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
|
@@ -7511,7 +8304,15 @@ exports.Trade = {
|
|
7511
8304
|
}
|
7512
8305
|
: { connectOrCreate: prop.asset.positions.map((item) => ({
|
7513
8306
|
where: {
|
7514
|
-
id: item.id !== undefined ?
|
8307
|
+
id: item.id !== undefined ? {
|
8308
|
+
equals: item.id
|
8309
|
+
} : undefined,
|
8310
|
+
assetId: item.assetId !== undefined ? {
|
8311
|
+
equals: item.assetId
|
8312
|
+
} : undefined,
|
8313
|
+
alpacaAccountId: item.alpacaAccountId !== undefined ? {
|
8314
|
+
equals: item.alpacaAccountId
|
8315
|
+
} : undefined,
|
7515
8316
|
},
|
7516
8317
|
create: {
|
7517
8318
|
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
@@ -7535,7 +8336,12 @@ exports.Trade = {
|
|
7535
8336
|
}
|
7536
8337
|
: { connectOrCreate: {
|
7537
8338
|
where: {
|
7538
|
-
id: item.alpacaAccount.id !== undefined ?
|
8339
|
+
id: item.alpacaAccount.id !== undefined ? {
|
8340
|
+
equals: item.alpacaAccount.id
|
8341
|
+
} : undefined,
|
8342
|
+
userId: item.alpacaAccount.userId !== undefined ? {
|
8343
|
+
equals: item.alpacaAccount.userId
|
8344
|
+
} : undefined,
|
7539
8345
|
},
|
7540
8346
|
create: {
|
7541
8347
|
type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
|
@@ -7561,8 +8367,16 @@ exports.Trade = {
|
|
7561
8367
|
}
|
7562
8368
|
: { connectOrCreate: prop.asset.newsMentions.map((item) => ({
|
7563
8369
|
where: {
|
7564
|
-
id: item.id !== undefined ?
|
8370
|
+
id: item.id !== undefined ? {
|
8371
|
+
equals: item.id
|
8372
|
+
} : undefined,
|
7565
8373
|
url: item.url !== undefined ? item.url : undefined,
|
8374
|
+
assetId: item.assetId !== undefined ? {
|
8375
|
+
equals: item.assetId
|
8376
|
+
} : undefined,
|
8377
|
+
newsArticleId: item.newsArticleId !== undefined ? {
|
8378
|
+
equals: item.newsArticleId
|
8379
|
+
} : undefined,
|
7566
8380
|
},
|
7567
8381
|
create: {
|
7568
8382
|
url: item.url !== undefined ? item.url : undefined,
|
@@ -7577,7 +8391,9 @@ exports.Trade = {
|
|
7577
8391
|
}
|
7578
8392
|
: { connectOrCreate: {
|
7579
8393
|
where: {
|
7580
|
-
id: item.news.id !== undefined ?
|
8394
|
+
id: item.news.id !== undefined ? {
|
8395
|
+
equals: item.news.id
|
8396
|
+
} : undefined,
|
7581
8397
|
url: item.news.url !== undefined ? item.news.url : undefined,
|
7582
8398
|
title: item.news.title !== undefined ? {
|
7583
8399
|
equals: item.news.title
|
@@ -7609,7 +8425,12 @@ exports.Trade = {
|
|
7609
8425
|
actions: prop.actions ? {
|
7610
8426
|
upsert: prop.actions.map((item) => ({
|
7611
8427
|
where: {
|
7612
|
-
id: item.id !== undefined ?
|
8428
|
+
id: item.id !== undefined ? {
|
8429
|
+
equals: item.id
|
8430
|
+
} : undefined,
|
8431
|
+
tradeId: item.tradeId !== undefined ? {
|
8432
|
+
equals: item.tradeId
|
8433
|
+
} : undefined,
|
7613
8434
|
},
|
7614
8435
|
update: {
|
7615
8436
|
id: item.id !== undefined ? {
|
@@ -7636,6 +8457,18 @@ exports.Trade = {
|
|
7636
8457
|
id: item.order.id !== undefined ? {
|
7637
8458
|
equals: item.order.id
|
7638
8459
|
} : undefined,
|
8460
|
+
clientOrderId: item.order.clientOrderId !== undefined ? {
|
8461
|
+
equals: item.order.clientOrderId
|
8462
|
+
} : undefined,
|
8463
|
+
alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
|
8464
|
+
equals: item.order.alpacaAccountId
|
8465
|
+
} : undefined,
|
8466
|
+
assetId: item.order.assetId !== undefined ? {
|
8467
|
+
equals: item.order.assetId
|
8468
|
+
} : undefined,
|
8469
|
+
actionId: item.order.actionId !== undefined ? {
|
8470
|
+
equals: item.order.actionId
|
8471
|
+
} : undefined,
|
7639
8472
|
},
|
7640
8473
|
update: {
|
7641
8474
|
id: item.order.id !== undefined ? {
|
@@ -7713,6 +8546,9 @@ exports.Trade = {
|
|
7713
8546
|
id: item.order.stopLoss.id !== undefined ? {
|
7714
8547
|
equals: item.order.stopLoss.id
|
7715
8548
|
} : undefined,
|
8549
|
+
orderId: item.order.stopLoss.orderId !== undefined ? {
|
8550
|
+
equals: item.order.stopLoss.orderId
|
8551
|
+
} : undefined,
|
7716
8552
|
},
|
7717
8553
|
update: {
|
7718
8554
|
id: item.order.stopLoss.id !== undefined ? {
|
@@ -7737,6 +8573,9 @@ exports.Trade = {
|
|
7737
8573
|
id: item.order.takeProfit.id !== undefined ? {
|
7738
8574
|
equals: item.order.takeProfit.id
|
7739
8575
|
} : undefined,
|
8576
|
+
orderId: item.order.takeProfit.orderId !== undefined ? {
|
8577
|
+
equals: item.order.takeProfit.orderId
|
8578
|
+
} : undefined,
|
7740
8579
|
},
|
7741
8580
|
update: {
|
7742
8581
|
id: item.order.takeProfit.id !== undefined ? {
|
@@ -7761,6 +8600,9 @@ exports.Trade = {
|
|
7761
8600
|
id: item.order.alpacaAccount.id !== undefined ? {
|
7762
8601
|
equals: item.order.alpacaAccount.id
|
7763
8602
|
} : undefined,
|
8603
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
8604
|
+
equals: item.order.alpacaAccount.userId
|
8605
|
+
} : undefined,
|
7764
8606
|
},
|
7765
8607
|
update: {
|
7766
8608
|
id: item.order.alpacaAccount.id !== undefined ? {
|
@@ -8081,7 +8923,10 @@ exports.Trade = {
|
|
8081
8923
|
}
|
8082
8924
|
: { connectOrCreate: {
|
8083
8925
|
where: {
|
8084
|
-
id: item.order.stopLoss.id !== undefined ?
|
8926
|
+
id: item.order.stopLoss.id !== undefined ? {
|
8927
|
+
equals: item.order.stopLoss.id
|
8928
|
+
} : undefined,
|
8929
|
+
orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
|
8085
8930
|
},
|
8086
8931
|
create: {
|
8087
8932
|
stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
|
@@ -8097,7 +8942,10 @@ exports.Trade = {
|
|
8097
8942
|
}
|
8098
8943
|
: { connectOrCreate: {
|
8099
8944
|
where: {
|
8100
|
-
id: item.order.takeProfit.id !== undefined ?
|
8945
|
+
id: item.order.takeProfit.id !== undefined ? {
|
8946
|
+
equals: item.order.takeProfit.id
|
8947
|
+
} : undefined,
|
8948
|
+
orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
|
8101
8949
|
},
|
8102
8950
|
create: {
|
8103
8951
|
limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
|
@@ -8113,7 +8961,12 @@ exports.Trade = {
|
|
8113
8961
|
}
|
8114
8962
|
: { connectOrCreate: {
|
8115
8963
|
where: {
|
8116
|
-
id: item.order.alpacaAccount.id !== undefined ?
|
8964
|
+
id: item.order.alpacaAccount.id !== undefined ? {
|
8965
|
+
equals: item.order.alpacaAccount.id
|
8966
|
+
} : undefined,
|
8967
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
8968
|
+
equals: item.order.alpacaAccount.userId
|
8969
|
+
} : undefined,
|
8117
8970
|
},
|
8118
8971
|
create: {
|
8119
8972
|
type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
|
@@ -8136,7 +8989,9 @@ exports.Trade = {
|
|
8136
8989
|
}
|
8137
8990
|
: { connectOrCreate: {
|
8138
8991
|
where: {
|
8139
|
-
id: item.order.asset.id !== undefined ?
|
8992
|
+
id: item.order.asset.id !== undefined ? {
|
8993
|
+
equals: item.order.asset.id
|
8994
|
+
} : undefined,
|
8140
8995
|
symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
|
8141
8996
|
name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
|
8142
8997
|
},
|
@@ -8217,7 +9072,18 @@ exports.Trade = {
|
|
8217
9072
|
}
|
8218
9073
|
: { connectOrCreate: {
|
8219
9074
|
where: {
|
8220
|
-
id: item.order.id !== undefined ?
|
9075
|
+
id: item.order.id !== undefined ? {
|
9076
|
+
equals: item.order.id
|
9077
|
+
} : undefined,
|
9078
|
+
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
9079
|
+
actionId: item.order.actionId !== undefined ? item.order.actionId : undefined,
|
9080
|
+
stopLossId: item.order.stopLossId !== undefined ? item.order.stopLossId : undefined,
|
9081
|
+
alpacaAccountId: item.order.alpacaAccountId !== undefined ? {
|
9082
|
+
equals: item.order.alpacaAccountId
|
9083
|
+
} : undefined,
|
9084
|
+
assetId: item.order.assetId !== undefined ? {
|
9085
|
+
equals: item.order.assetId
|
9086
|
+
} : undefined,
|
8221
9087
|
},
|
8222
9088
|
create: {
|
8223
9089
|
clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
|
@@ -8250,7 +9116,10 @@ exports.Trade = {
|
|
8250
9116
|
}
|
8251
9117
|
: { connectOrCreate: {
|
8252
9118
|
where: {
|
8253
|
-
id: item.order.stopLoss.id !== undefined ?
|
9119
|
+
id: item.order.stopLoss.id !== undefined ? {
|
9120
|
+
equals: item.order.stopLoss.id
|
9121
|
+
} : undefined,
|
9122
|
+
orderId: item.order.stopLoss.orderId !== undefined ? item.order.stopLoss.orderId : undefined,
|
8254
9123
|
},
|
8255
9124
|
create: {
|
8256
9125
|
stopPrice: item.order.stopLoss.stopPrice !== undefined ? item.order.stopLoss.stopPrice : undefined,
|
@@ -8266,7 +9135,10 @@ exports.Trade = {
|
|
8266
9135
|
}
|
8267
9136
|
: { connectOrCreate: {
|
8268
9137
|
where: {
|
8269
|
-
id: item.order.takeProfit.id !== undefined ?
|
9138
|
+
id: item.order.takeProfit.id !== undefined ? {
|
9139
|
+
equals: item.order.takeProfit.id
|
9140
|
+
} : undefined,
|
9141
|
+
orderId: item.order.takeProfit.orderId !== undefined ? item.order.takeProfit.orderId : undefined,
|
8270
9142
|
},
|
8271
9143
|
create: {
|
8272
9144
|
limitPrice: item.order.takeProfit.limitPrice !== undefined ? item.order.takeProfit.limitPrice : undefined,
|
@@ -8282,7 +9154,12 @@ exports.Trade = {
|
|
8282
9154
|
}
|
8283
9155
|
: { connectOrCreate: {
|
8284
9156
|
where: {
|
8285
|
-
id: item.order.alpacaAccount.id !== undefined ?
|
9157
|
+
id: item.order.alpacaAccount.id !== undefined ? {
|
9158
|
+
equals: item.order.alpacaAccount.id
|
9159
|
+
} : undefined,
|
9160
|
+
userId: item.order.alpacaAccount.userId !== undefined ? {
|
9161
|
+
equals: item.order.alpacaAccount.userId
|
9162
|
+
} : undefined,
|
8286
9163
|
},
|
8287
9164
|
create: {
|
8288
9165
|
type: item.order.alpacaAccount.type !== undefined ? item.order.alpacaAccount.type : undefined,
|
@@ -8305,7 +9182,9 @@ exports.Trade = {
|
|
8305
9182
|
}
|
8306
9183
|
: { connectOrCreate: {
|
8307
9184
|
where: {
|
8308
|
-
id: item.order.asset.id !== undefined ?
|
9185
|
+
id: item.order.asset.id !== undefined ? {
|
9186
|
+
equals: item.order.asset.id
|
9187
|
+
} : undefined,
|
8309
9188
|
symbol: item.order.asset.symbol !== undefined ? item.order.asset.symbol : undefined,
|
8310
9189
|
name: item.order.asset.name !== undefined ? item.order.asset.name : undefined,
|
8311
9190
|
},
|
@@ -8444,9 +9323,15 @@ exports.Trade = {
|
|
8444
9323
|
}`;
|
8445
9324
|
const variables = {
|
8446
9325
|
where: {
|
8447
|
-
id: props.id !== undefined ?
|
8448
|
-
|
8449
|
-
|
9326
|
+
id: props.id !== undefined ? {
|
9327
|
+
equals: props.id
|
9328
|
+
} : undefined,
|
9329
|
+
alpacaAccountId: props.alpacaAccountId !== undefined ? {
|
9330
|
+
equals: props.alpacaAccountId
|
9331
|
+
} : undefined,
|
9332
|
+
assetId: props.assetId !== undefined ? {
|
9333
|
+
equals: props.assetId
|
9334
|
+
} : undefined,
|
8450
9335
|
qty: props.qty !== undefined ? props.qty : undefined,
|
8451
9336
|
price: props.price !== undefined ? props.price : undefined,
|
8452
9337
|
total: props.total !== undefined ? props.total : undefined,
|
@@ -8526,8 +9411,12 @@ exports.Trade = {
|
|
8526
9411
|
id: props.id !== undefined ? {
|
8527
9412
|
equals: props.id
|
8528
9413
|
} : undefined,
|
8529
|
-
alpacaAccountId: props.alpacaAccountId !== undefined ?
|
8530
|
-
|
9414
|
+
alpacaAccountId: props.alpacaAccountId !== undefined ? {
|
9415
|
+
equals: props.alpacaAccountId
|
9416
|
+
} : undefined,
|
9417
|
+
assetId: props.assetId !== undefined ? {
|
9418
|
+
equals: props.assetId
|
9419
|
+
} : undefined,
|
8531
9420
|
qty: props.qty !== undefined ? props.qty : undefined,
|
8532
9421
|
price: props.price !== undefined ? props.price : undefined,
|
8533
9422
|
total: props.total !== undefined ? props.total : undefined,
|