adaptic-backend 1.0.151 → 1.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Account.cjs +1029 -0
- package/Action.cjs +3460 -0
- package/Alert.cjs +3800 -0
- package/AlpacaAccount.cjs +2888 -0
- package/Asset.cjs +3659 -0
- package/Authenticator.cjs +1029 -0
- package/Customer.cjs +1029 -0
- package/NewsArticle.cjs +892 -0
- package/NewsArticleAssetSentiment.cjs +1243 -0
- package/Order.cjs +4500 -0
- package/Position.cjs +4288 -0
- package/Session.cjs +1029 -0
- package/StopLoss.cjs +1832 -0
- package/TakeProfit.cjs +1832 -0
- package/Trade.cjs +5276 -0
- package/User.cjs +3103 -0
- package/package.json +1 -1
- package/server/Account.d.ts.map +1 -1
- package/server/Account.js.map +1 -1
- package/server/Account.mjs +1029 -0
- package/server/Action.d.ts.map +1 -1
- package/server/Action.js.map +1 -1
- package/server/Action.mjs +3460 -0
- package/server/Alert.d.ts.map +1 -1
- package/server/Alert.js.map +1 -1
- package/server/Alert.mjs +3800 -0
- package/server/AlpacaAccount.d.ts.map +1 -1
- package/server/AlpacaAccount.js.map +1 -1
- package/server/AlpacaAccount.mjs +2888 -0
- package/server/Asset.d.ts.map +1 -1
- package/server/Asset.js.map +1 -1
- package/server/Asset.mjs +3659 -0
- package/server/Authenticator.d.ts.map +1 -1
- package/server/Authenticator.js.map +1 -1
- package/server/Authenticator.mjs +1029 -0
- package/server/Customer.d.ts.map +1 -1
- package/server/Customer.js.map +1 -1
- package/server/Customer.mjs +1029 -0
- package/server/NewsArticle.d.ts.map +1 -1
- package/server/NewsArticle.js.map +1 -1
- package/server/NewsArticle.mjs +892 -0
- package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
- package/server/NewsArticleAssetSentiment.js.map +1 -1
- package/server/NewsArticleAssetSentiment.mjs +1243 -0
- package/server/Order.d.ts.map +1 -1
- package/server/Order.js.map +1 -1
- package/server/Order.mjs +4500 -0
- package/server/Position.d.ts.map +1 -1
- package/server/Position.js.map +1 -1
- package/server/Position.mjs +4288 -0
- package/server/Session.d.ts.map +1 -1
- package/server/Session.js.map +1 -1
- package/server/Session.mjs +1029 -0
- package/server/StopLoss.d.ts.map +1 -1
- package/server/StopLoss.js.map +1 -1
- package/server/StopLoss.mjs +1832 -0
- package/server/TakeProfit.d.ts.map +1 -1
- package/server/TakeProfit.js.map +1 -1
- package/server/TakeProfit.mjs +1832 -0
- package/server/Trade.d.ts.map +1 -1
- package/server/Trade.js.map +1 -1
- package/server/Trade.mjs +5276 -0
- package/server/User.d.ts.map +1 -1
- package/server/User.js.map +1 -1
- package/server/User.mjs +3103 -0
package/StopLoss.cjs
CHANGED
@@ -105,6 +105,104 @@ exports.StopLoss = {
|
|
105
105
|
maxOrderSize: props.Order.alpacaAccount.maxOrderSize !== undefined ? props.Order.alpacaAccount.maxOrderSize : undefined,
|
106
106
|
minPercentageChange: props.Order.alpacaAccount.minPercentageChange !== undefined ? props.Order.alpacaAccount.minPercentageChange : undefined,
|
107
107
|
volumeThreshold: props.Order.alpacaAccount.volumeThreshold !== undefined ? props.Order.alpacaAccount.volumeThreshold : undefined,
|
108
|
+
user: props.Order.alpacaAccount.user ?
|
109
|
+
typeof props.Order.alpacaAccount.user === 'object' && Object.keys(props.Order.alpacaAccount.user).length === 1 && Object.keys(props.Order.alpacaAccount.user)[0] === 'id'
|
110
|
+
? { connect: {
|
111
|
+
id: props.Order.alpacaAccount.user.id
|
112
|
+
}
|
113
|
+
}
|
114
|
+
: { connectOrCreate: {
|
115
|
+
where: {
|
116
|
+
id: props.Order.alpacaAccount.user.id !== undefined ? props.Order.alpacaAccount.user.id : undefined,
|
117
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
118
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? {
|
119
|
+
equals: props.Order.alpacaAccount.user.name
|
120
|
+
} : undefined,
|
121
|
+
},
|
122
|
+
create: {
|
123
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? props.Order.alpacaAccount.user.name : undefined,
|
124
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
125
|
+
emailVerified: props.Order.alpacaAccount.user.emailVerified !== undefined ? props.Order.alpacaAccount.user.emailVerified : undefined,
|
126
|
+
image: props.Order.alpacaAccount.user.image !== undefined ? props.Order.alpacaAccount.user.image : undefined,
|
127
|
+
role: props.Order.alpacaAccount.user.role !== undefined ? props.Order.alpacaAccount.user.role : undefined,
|
128
|
+
bio: props.Order.alpacaAccount.user.bio !== undefined ? props.Order.alpacaAccount.user.bio : undefined,
|
129
|
+
jobTitle: props.Order.alpacaAccount.user.jobTitle !== undefined ? props.Order.alpacaAccount.user.jobTitle : undefined,
|
130
|
+
currentAccount: props.Order.alpacaAccount.user.currentAccount !== undefined ? props.Order.alpacaAccount.user.currentAccount : undefined,
|
131
|
+
plan: props.Order.alpacaAccount.user.plan !== undefined ? props.Order.alpacaAccount.user.plan : undefined,
|
132
|
+
openaiAPIKey: props.Order.alpacaAccount.user.openaiAPIKey !== undefined ? props.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
133
|
+
openaiModel: props.Order.alpacaAccount.user.openaiModel !== undefined ? props.Order.alpacaAccount.user.openaiModel : undefined,
|
134
|
+
},
|
135
|
+
}
|
136
|
+
} : undefined,
|
137
|
+
trades: props.Order.alpacaAccount.trades ?
|
138
|
+
Array.isArray(props.Order.alpacaAccount.trades) && props.Order.alpacaAccount.trades.length > 0 && props.Order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
139
|
+
connect: props.Order.alpacaAccount.trades.map((item) => ({
|
140
|
+
id: item.id
|
141
|
+
}))
|
142
|
+
}
|
143
|
+
: { connectOrCreate: props.Order.alpacaAccount.trades.map((item) => ({
|
144
|
+
where: {
|
145
|
+
id: item.id !== undefined ? item.id : undefined,
|
146
|
+
},
|
147
|
+
create: {
|
148
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
149
|
+
price: item.price !== undefined ? item.price : undefined,
|
150
|
+
total: item.total !== undefined ? item.total : undefined,
|
151
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
152
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
153
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
154
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
155
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
156
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
157
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
158
|
+
status: item.status !== undefined ? item.status : undefined,
|
159
|
+
},
|
160
|
+
}))
|
161
|
+
} : undefined,
|
162
|
+
positions: props.Order.alpacaAccount.positions ?
|
163
|
+
Array.isArray(props.Order.alpacaAccount.positions) && props.Order.alpacaAccount.positions.length > 0 && props.Order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
164
|
+
connect: props.Order.alpacaAccount.positions.map((item) => ({
|
165
|
+
id: item.id
|
166
|
+
}))
|
167
|
+
}
|
168
|
+
: { connectOrCreate: props.Order.alpacaAccount.positions.map((item) => ({
|
169
|
+
where: {
|
170
|
+
id: item.id !== undefined ? item.id : undefined,
|
171
|
+
},
|
172
|
+
create: {
|
173
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
174
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
175
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
176
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
177
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
178
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
179
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
180
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
181
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
182
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
183
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
184
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
185
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
186
|
+
},
|
187
|
+
}))
|
188
|
+
} : undefined,
|
189
|
+
alerts: props.Order.alpacaAccount.alerts ?
|
190
|
+
Array.isArray(props.Order.alpacaAccount.alerts) && props.Order.alpacaAccount.alerts.length > 0 && props.Order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
191
|
+
connect: props.Order.alpacaAccount.alerts.map((item) => ({
|
192
|
+
id: item.id
|
193
|
+
}))
|
194
|
+
}
|
195
|
+
: { connectOrCreate: props.Order.alpacaAccount.alerts.map((item) => ({
|
196
|
+
where: {
|
197
|
+
id: item.id !== undefined ? item.id : undefined,
|
198
|
+
},
|
199
|
+
create: {
|
200
|
+
message: item.message !== undefined ? item.message : undefined,
|
201
|
+
type: item.type !== undefined ? item.type : undefined,
|
202
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
203
|
+
},
|
204
|
+
}))
|
205
|
+
} : undefined,
|
108
206
|
},
|
109
207
|
}
|
110
208
|
} : undefined,
|
@@ -124,6 +222,31 @@ exports.StopLoss = {
|
|
124
222
|
note: props.Order.action.note !== undefined ? props.Order.action.note : undefined,
|
125
223
|
status: props.Order.action.status !== undefined ? props.Order.action.status : undefined,
|
126
224
|
fee: props.Order.action.fee !== undefined ? props.Order.action.fee : undefined,
|
225
|
+
trade: props.Order.action.trade ?
|
226
|
+
typeof props.Order.action.trade === 'object' && Object.keys(props.Order.action.trade).length === 1 && Object.keys(props.Order.action.trade)[0] === 'id'
|
227
|
+
? { connect: {
|
228
|
+
id: props.Order.action.trade.id
|
229
|
+
}
|
230
|
+
}
|
231
|
+
: { connectOrCreate: {
|
232
|
+
where: {
|
233
|
+
id: props.Order.action.trade.id !== undefined ? props.Order.action.trade.id : undefined,
|
234
|
+
},
|
235
|
+
create: {
|
236
|
+
qty: props.Order.action.trade.qty !== undefined ? props.Order.action.trade.qty : undefined,
|
237
|
+
price: props.Order.action.trade.price !== undefined ? props.Order.action.trade.price : undefined,
|
238
|
+
total: props.Order.action.trade.total !== undefined ? props.Order.action.trade.total : undefined,
|
239
|
+
optionType: props.Order.action.trade.optionType !== undefined ? props.Order.action.trade.optionType : undefined,
|
240
|
+
signal: props.Order.action.trade.signal !== undefined ? props.Order.action.trade.signal : undefined,
|
241
|
+
strategy: props.Order.action.trade.strategy !== undefined ? props.Order.action.trade.strategy : undefined,
|
242
|
+
analysis: props.Order.action.trade.analysis !== undefined ? props.Order.action.trade.analysis : undefined,
|
243
|
+
summary: props.Order.action.trade.summary !== undefined ? props.Order.action.trade.summary : undefined,
|
244
|
+
confidence: props.Order.action.trade.confidence !== undefined ? props.Order.action.trade.confidence : undefined,
|
245
|
+
timestamp: props.Order.action.trade.timestamp !== undefined ? props.Order.action.trade.timestamp : undefined,
|
246
|
+
status: props.Order.action.trade.status !== undefined ? props.Order.action.trade.status : undefined,
|
247
|
+
},
|
248
|
+
}
|
249
|
+
} : undefined,
|
127
250
|
},
|
128
251
|
}
|
129
252
|
} : undefined,
|
@@ -195,6 +318,77 @@ exports.StopLoss = {
|
|
195
318
|
exDividendDate: props.Order.asset.exDividendDate !== undefined ? props.Order.asset.exDividendDate : undefined,
|
196
319
|
askPrice: props.Order.asset.askPrice !== undefined ? props.Order.asset.askPrice : undefined,
|
197
320
|
bidPrice: props.Order.asset.bidPrice !== undefined ? props.Order.asset.bidPrice : undefined,
|
321
|
+
trades: props.Order.asset.trades ?
|
322
|
+
Array.isArray(props.Order.asset.trades) && props.Order.asset.trades.length > 0 && props.Order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
323
|
+
connect: props.Order.asset.trades.map((item) => ({
|
324
|
+
id: item.id
|
325
|
+
}))
|
326
|
+
}
|
327
|
+
: { connectOrCreate: props.Order.asset.trades.map((item) => ({
|
328
|
+
where: {
|
329
|
+
id: item.id !== undefined ? item.id : undefined,
|
330
|
+
},
|
331
|
+
create: {
|
332
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
333
|
+
price: item.price !== undefined ? item.price : undefined,
|
334
|
+
total: item.total !== undefined ? item.total : undefined,
|
335
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
336
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
337
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
338
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
339
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
340
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
341
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
342
|
+
status: item.status !== undefined ? item.status : undefined,
|
343
|
+
},
|
344
|
+
}))
|
345
|
+
} : undefined,
|
346
|
+
positions: props.Order.asset.positions ?
|
347
|
+
Array.isArray(props.Order.asset.positions) && props.Order.asset.positions.length > 0 && props.Order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
348
|
+
connect: props.Order.asset.positions.map((item) => ({
|
349
|
+
id: item.id
|
350
|
+
}))
|
351
|
+
}
|
352
|
+
: { connectOrCreate: props.Order.asset.positions.map((item) => ({
|
353
|
+
where: {
|
354
|
+
id: item.id !== undefined ? item.id : undefined,
|
355
|
+
},
|
356
|
+
create: {
|
357
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
358
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
359
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
360
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
361
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
362
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
363
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
364
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
365
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
366
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
367
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
368
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
369
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
370
|
+
},
|
371
|
+
}))
|
372
|
+
} : undefined,
|
373
|
+
newsMentions: props.Order.asset.newsMentions ?
|
374
|
+
Array.isArray(props.Order.asset.newsMentions) && props.Order.asset.newsMentions.length > 0 && props.Order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
375
|
+
connect: props.Order.asset.newsMentions.map((item) => ({
|
376
|
+
id: item.id
|
377
|
+
}))
|
378
|
+
}
|
379
|
+
: { connectOrCreate: props.Order.asset.newsMentions.map((item) => ({
|
380
|
+
where: {
|
381
|
+
id: item.id !== undefined ? item.id : undefined,
|
382
|
+
url: item.url !== undefined ? item.url : undefined,
|
383
|
+
},
|
384
|
+
create: {
|
385
|
+
url: item.url !== undefined ? item.url : undefined,
|
386
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
387
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
388
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
389
|
+
},
|
390
|
+
}))
|
391
|
+
} : undefined,
|
198
392
|
},
|
199
393
|
}
|
200
394
|
} : undefined,
|
@@ -432,6 +626,222 @@ exports.StopLoss = {
|
|
432
626
|
volumeThreshold: props.Order.alpacaAccount.volumeThreshold !== undefined ? {
|
433
627
|
set: props.Order.alpacaAccount.volumeThreshold
|
434
628
|
} : undefined,
|
629
|
+
user: props.Order.alpacaAccount.user ? {
|
630
|
+
upsert: {
|
631
|
+
where: {
|
632
|
+
id: props.Order.alpacaAccount.user.id !== undefined ? {
|
633
|
+
equals: props.Order.alpacaAccount.user.id
|
634
|
+
} : undefined,
|
635
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? {
|
636
|
+
equals: props.Order.alpacaAccount.user.name
|
637
|
+
} : undefined,
|
638
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? {
|
639
|
+
equals: props.Order.alpacaAccount.user.email
|
640
|
+
} : undefined,
|
641
|
+
},
|
642
|
+
update: {
|
643
|
+
id: props.Order.alpacaAccount.user.id !== undefined ? {
|
644
|
+
set: props.Order.alpacaAccount.user.id
|
645
|
+
} : undefined,
|
646
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? {
|
647
|
+
set: props.Order.alpacaAccount.user.name
|
648
|
+
} : undefined,
|
649
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? {
|
650
|
+
set: props.Order.alpacaAccount.user.email
|
651
|
+
} : undefined,
|
652
|
+
emailVerified: props.Order.alpacaAccount.user.emailVerified !== undefined ? {
|
653
|
+
set: props.Order.alpacaAccount.user.emailVerified
|
654
|
+
} : undefined,
|
655
|
+
image: props.Order.alpacaAccount.user.image !== undefined ? {
|
656
|
+
set: props.Order.alpacaAccount.user.image
|
657
|
+
} : undefined,
|
658
|
+
role: props.Order.alpacaAccount.user.role !== undefined ? {
|
659
|
+
set: props.Order.alpacaAccount.user.role
|
660
|
+
} : undefined,
|
661
|
+
bio: props.Order.alpacaAccount.user.bio !== undefined ? {
|
662
|
+
set: props.Order.alpacaAccount.user.bio
|
663
|
+
} : undefined,
|
664
|
+
jobTitle: props.Order.alpacaAccount.user.jobTitle !== undefined ? {
|
665
|
+
set: props.Order.alpacaAccount.user.jobTitle
|
666
|
+
} : undefined,
|
667
|
+
currentAccount: props.Order.alpacaAccount.user.currentAccount !== undefined ? {
|
668
|
+
set: props.Order.alpacaAccount.user.currentAccount
|
669
|
+
} : undefined,
|
670
|
+
plan: props.Order.alpacaAccount.user.plan !== undefined ? {
|
671
|
+
set: props.Order.alpacaAccount.user.plan
|
672
|
+
} : undefined,
|
673
|
+
openaiAPIKey: props.Order.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
674
|
+
set: props.Order.alpacaAccount.user.openaiAPIKey
|
675
|
+
} : undefined,
|
676
|
+
openaiModel: props.Order.alpacaAccount.user.openaiModel !== undefined ? {
|
677
|
+
set: props.Order.alpacaAccount.user.openaiModel
|
678
|
+
} : undefined,
|
679
|
+
},
|
680
|
+
create: {
|
681
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? props.Order.alpacaAccount.user.name : undefined,
|
682
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
683
|
+
emailVerified: props.Order.alpacaAccount.user.emailVerified !== undefined ? props.Order.alpacaAccount.user.emailVerified : undefined,
|
684
|
+
image: props.Order.alpacaAccount.user.image !== undefined ? props.Order.alpacaAccount.user.image : undefined,
|
685
|
+
role: props.Order.alpacaAccount.user.role !== undefined ? props.Order.alpacaAccount.user.role : undefined,
|
686
|
+
bio: props.Order.alpacaAccount.user.bio !== undefined ? props.Order.alpacaAccount.user.bio : undefined,
|
687
|
+
jobTitle: props.Order.alpacaAccount.user.jobTitle !== undefined ? props.Order.alpacaAccount.user.jobTitle : undefined,
|
688
|
+
currentAccount: props.Order.alpacaAccount.user.currentAccount !== undefined ? props.Order.alpacaAccount.user.currentAccount : undefined,
|
689
|
+
plan: props.Order.alpacaAccount.user.plan !== undefined ? props.Order.alpacaAccount.user.plan : undefined,
|
690
|
+
openaiAPIKey: props.Order.alpacaAccount.user.openaiAPIKey !== undefined ? props.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
691
|
+
openaiModel: props.Order.alpacaAccount.user.openaiModel !== undefined ? props.Order.alpacaAccount.user.openaiModel : undefined,
|
692
|
+
},
|
693
|
+
}
|
694
|
+
} : undefined,
|
695
|
+
trades: props.Order.alpacaAccount.trades ? {
|
696
|
+
upsert: props.Order.alpacaAccount.trades.map((item) => ({
|
697
|
+
where: {
|
698
|
+
id: item.id !== undefined ? item.id : undefined,
|
699
|
+
},
|
700
|
+
update: {
|
701
|
+
id: item.id !== undefined ? {
|
702
|
+
set: item.id
|
703
|
+
} : undefined,
|
704
|
+
qty: item.qty !== undefined ? {
|
705
|
+
set: item.qty
|
706
|
+
} : undefined,
|
707
|
+
price: item.price !== undefined ? {
|
708
|
+
set: item.price
|
709
|
+
} : undefined,
|
710
|
+
total: item.total !== undefined ? {
|
711
|
+
set: item.total
|
712
|
+
} : undefined,
|
713
|
+
optionType: item.optionType !== undefined ? {
|
714
|
+
set: item.optionType
|
715
|
+
} : undefined,
|
716
|
+
signal: item.signal !== undefined ? {
|
717
|
+
set: item.signal
|
718
|
+
} : undefined,
|
719
|
+
strategy: item.strategy !== undefined ? {
|
720
|
+
set: item.strategy
|
721
|
+
} : undefined,
|
722
|
+
analysis: item.analysis !== undefined ? {
|
723
|
+
set: item.analysis
|
724
|
+
} : undefined,
|
725
|
+
summary: item.summary !== undefined ? {
|
726
|
+
set: item.summary
|
727
|
+
} : undefined,
|
728
|
+
confidence: item.confidence !== undefined ? {
|
729
|
+
set: item.confidence
|
730
|
+
} : undefined,
|
731
|
+
timestamp: item.timestamp !== undefined ? {
|
732
|
+
set: item.timestamp
|
733
|
+
} : undefined,
|
734
|
+
status: item.status !== undefined ? {
|
735
|
+
set: item.status
|
736
|
+
} : undefined,
|
737
|
+
},
|
738
|
+
create: {
|
739
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
740
|
+
price: item.price !== undefined ? item.price : undefined,
|
741
|
+
total: item.total !== undefined ? item.total : undefined,
|
742
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
743
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
744
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
745
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
746
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
747
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
748
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
749
|
+
status: item.status !== undefined ? item.status : undefined,
|
750
|
+
},
|
751
|
+
}))
|
752
|
+
} : undefined,
|
753
|
+
positions: props.Order.alpacaAccount.positions ? {
|
754
|
+
upsert: props.Order.alpacaAccount.positions.map((item) => ({
|
755
|
+
where: {
|
756
|
+
id: item.id !== undefined ? item.id : undefined,
|
757
|
+
},
|
758
|
+
update: {
|
759
|
+
id: item.id !== undefined ? {
|
760
|
+
set: item.id
|
761
|
+
} : undefined,
|
762
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
763
|
+
set: item.averageEntryPrice
|
764
|
+
} : undefined,
|
765
|
+
qty: item.qty !== undefined ? {
|
766
|
+
set: item.qty
|
767
|
+
} : undefined,
|
768
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
769
|
+
set: item.qtyAvailable
|
770
|
+
} : undefined,
|
771
|
+
marketValue: item.marketValue !== undefined ? {
|
772
|
+
set: item.marketValue
|
773
|
+
} : undefined,
|
774
|
+
costBasis: item.costBasis !== undefined ? {
|
775
|
+
set: item.costBasis
|
776
|
+
} : undefined,
|
777
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
778
|
+
set: item.unrealizedPL
|
779
|
+
} : undefined,
|
780
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
781
|
+
set: item.unrealizedPLPC
|
782
|
+
} : undefined,
|
783
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
784
|
+
set: item.unrealisedIntradayPL
|
785
|
+
} : undefined,
|
786
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
787
|
+
set: item.unrealisedIntradayPLPC
|
788
|
+
} : undefined,
|
789
|
+
currentPrice: item.currentPrice !== undefined ? {
|
790
|
+
set: item.currentPrice
|
791
|
+
} : undefined,
|
792
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
793
|
+
set: item.lastTradePrice
|
794
|
+
} : undefined,
|
795
|
+
changeToday: item.changeToday !== undefined ? {
|
796
|
+
set: item.changeToday
|
797
|
+
} : undefined,
|
798
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
799
|
+
set: item.assetMarginable
|
800
|
+
} : undefined,
|
801
|
+
},
|
802
|
+
create: {
|
803
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
804
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
805
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
806
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
807
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
808
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
809
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
810
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
811
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
812
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
813
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
814
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
815
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
816
|
+
},
|
817
|
+
}))
|
818
|
+
} : undefined,
|
819
|
+
alerts: props.Order.alpacaAccount.alerts ? {
|
820
|
+
upsert: props.Order.alpacaAccount.alerts.map((item) => ({
|
821
|
+
where: {
|
822
|
+
id: item.id !== undefined ? item.id : undefined,
|
823
|
+
},
|
824
|
+
update: {
|
825
|
+
id: item.id !== undefined ? {
|
826
|
+
set: item.id
|
827
|
+
} : undefined,
|
828
|
+
message: item.message !== undefined ? {
|
829
|
+
set: item.message
|
830
|
+
} : undefined,
|
831
|
+
type: item.type !== undefined ? {
|
832
|
+
set: item.type
|
833
|
+
} : undefined,
|
834
|
+
isRead: item.isRead !== undefined ? {
|
835
|
+
set: item.isRead
|
836
|
+
} : undefined,
|
837
|
+
},
|
838
|
+
create: {
|
839
|
+
message: item.message !== undefined ? item.message : undefined,
|
840
|
+
type: item.type !== undefined ? item.type : undefined,
|
841
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
842
|
+
},
|
843
|
+
}))
|
844
|
+
} : undefined,
|
435
845
|
},
|
436
846
|
create: {
|
437
847
|
type: props.Order.alpacaAccount.type !== undefined ? props.Order.alpacaAccount.type : undefined,
|
@@ -443,6 +853,104 @@ exports.StopLoss = {
|
|
443
853
|
maxOrderSize: props.Order.alpacaAccount.maxOrderSize !== undefined ? props.Order.alpacaAccount.maxOrderSize : undefined,
|
444
854
|
minPercentageChange: props.Order.alpacaAccount.minPercentageChange !== undefined ? props.Order.alpacaAccount.minPercentageChange : undefined,
|
445
855
|
volumeThreshold: props.Order.alpacaAccount.volumeThreshold !== undefined ? props.Order.alpacaAccount.volumeThreshold : undefined,
|
856
|
+
user: props.Order.alpacaAccount.user ?
|
857
|
+
typeof props.Order.alpacaAccount.user === 'object' && Object.keys(props.Order.alpacaAccount.user).length === 1 && Object.keys(props.Order.alpacaAccount.user)[0] === 'id'
|
858
|
+
? { connect: {
|
859
|
+
id: props.Order.alpacaAccount.user.id
|
860
|
+
}
|
861
|
+
}
|
862
|
+
: { connectOrCreate: {
|
863
|
+
where: {
|
864
|
+
id: props.Order.alpacaAccount.user.id !== undefined ? props.Order.alpacaAccount.user.id : undefined,
|
865
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
866
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? {
|
867
|
+
equals: props.Order.alpacaAccount.user.name
|
868
|
+
} : undefined,
|
869
|
+
},
|
870
|
+
create: {
|
871
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? props.Order.alpacaAccount.user.name : undefined,
|
872
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
873
|
+
emailVerified: props.Order.alpacaAccount.user.emailVerified !== undefined ? props.Order.alpacaAccount.user.emailVerified : undefined,
|
874
|
+
image: props.Order.alpacaAccount.user.image !== undefined ? props.Order.alpacaAccount.user.image : undefined,
|
875
|
+
role: props.Order.alpacaAccount.user.role !== undefined ? props.Order.alpacaAccount.user.role : undefined,
|
876
|
+
bio: props.Order.alpacaAccount.user.bio !== undefined ? props.Order.alpacaAccount.user.bio : undefined,
|
877
|
+
jobTitle: props.Order.alpacaAccount.user.jobTitle !== undefined ? props.Order.alpacaAccount.user.jobTitle : undefined,
|
878
|
+
currentAccount: props.Order.alpacaAccount.user.currentAccount !== undefined ? props.Order.alpacaAccount.user.currentAccount : undefined,
|
879
|
+
plan: props.Order.alpacaAccount.user.plan !== undefined ? props.Order.alpacaAccount.user.plan : undefined,
|
880
|
+
openaiAPIKey: props.Order.alpacaAccount.user.openaiAPIKey !== undefined ? props.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
881
|
+
openaiModel: props.Order.alpacaAccount.user.openaiModel !== undefined ? props.Order.alpacaAccount.user.openaiModel : undefined,
|
882
|
+
},
|
883
|
+
}
|
884
|
+
} : undefined,
|
885
|
+
trades: props.Order.alpacaAccount.trades ?
|
886
|
+
Array.isArray(props.Order.alpacaAccount.trades) && props.Order.alpacaAccount.trades.length > 0 && props.Order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
887
|
+
connect: props.Order.alpacaAccount.trades.map((item) => ({
|
888
|
+
id: item.id
|
889
|
+
}))
|
890
|
+
}
|
891
|
+
: { connectOrCreate: props.Order.alpacaAccount.trades.map((item) => ({
|
892
|
+
where: {
|
893
|
+
id: item.id !== undefined ? item.id : undefined,
|
894
|
+
},
|
895
|
+
create: {
|
896
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
897
|
+
price: item.price !== undefined ? item.price : undefined,
|
898
|
+
total: item.total !== undefined ? item.total : undefined,
|
899
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
900
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
901
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
902
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
903
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
904
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
905
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
906
|
+
status: item.status !== undefined ? item.status : undefined,
|
907
|
+
},
|
908
|
+
}))
|
909
|
+
} : undefined,
|
910
|
+
positions: props.Order.alpacaAccount.positions ?
|
911
|
+
Array.isArray(props.Order.alpacaAccount.positions) && props.Order.alpacaAccount.positions.length > 0 && props.Order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
912
|
+
connect: props.Order.alpacaAccount.positions.map((item) => ({
|
913
|
+
id: item.id
|
914
|
+
}))
|
915
|
+
}
|
916
|
+
: { connectOrCreate: props.Order.alpacaAccount.positions.map((item) => ({
|
917
|
+
where: {
|
918
|
+
id: item.id !== undefined ? item.id : undefined,
|
919
|
+
},
|
920
|
+
create: {
|
921
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
922
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
923
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
924
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
925
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
926
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
927
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
928
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
929
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
930
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
931
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
932
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
933
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
934
|
+
},
|
935
|
+
}))
|
936
|
+
} : undefined,
|
937
|
+
alerts: props.Order.alpacaAccount.alerts ?
|
938
|
+
Array.isArray(props.Order.alpacaAccount.alerts) && props.Order.alpacaAccount.alerts.length > 0 && props.Order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
939
|
+
connect: props.Order.alpacaAccount.alerts.map((item) => ({
|
940
|
+
id: item.id
|
941
|
+
}))
|
942
|
+
}
|
943
|
+
: { connectOrCreate: props.Order.alpacaAccount.alerts.map((item) => ({
|
944
|
+
where: {
|
945
|
+
id: item.id !== undefined ? item.id : undefined,
|
946
|
+
},
|
947
|
+
create: {
|
948
|
+
message: item.message !== undefined ? item.message : undefined,
|
949
|
+
type: item.type !== undefined ? item.type : undefined,
|
950
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
951
|
+
},
|
952
|
+
}))
|
953
|
+
} : undefined,
|
446
954
|
},
|
447
955
|
}
|
448
956
|
} : undefined,
|
@@ -472,6 +980,66 @@ exports.StopLoss = {
|
|
472
980
|
fee: props.Order.action.fee !== undefined ? {
|
473
981
|
set: props.Order.action.fee
|
474
982
|
} : undefined,
|
983
|
+
trade: props.Order.action.trade ? {
|
984
|
+
upsert: {
|
985
|
+
where: {
|
986
|
+
id: props.Order.action.trade.id !== undefined ? {
|
987
|
+
equals: props.Order.action.trade.id
|
988
|
+
} : undefined,
|
989
|
+
},
|
990
|
+
update: {
|
991
|
+
id: props.Order.action.trade.id !== undefined ? {
|
992
|
+
set: props.Order.action.trade.id
|
993
|
+
} : undefined,
|
994
|
+
qty: props.Order.action.trade.qty !== undefined ? {
|
995
|
+
set: props.Order.action.trade.qty
|
996
|
+
} : undefined,
|
997
|
+
price: props.Order.action.trade.price !== undefined ? {
|
998
|
+
set: props.Order.action.trade.price
|
999
|
+
} : undefined,
|
1000
|
+
total: props.Order.action.trade.total !== undefined ? {
|
1001
|
+
set: props.Order.action.trade.total
|
1002
|
+
} : undefined,
|
1003
|
+
optionType: props.Order.action.trade.optionType !== undefined ? {
|
1004
|
+
set: props.Order.action.trade.optionType
|
1005
|
+
} : undefined,
|
1006
|
+
signal: props.Order.action.trade.signal !== undefined ? {
|
1007
|
+
set: props.Order.action.trade.signal
|
1008
|
+
} : undefined,
|
1009
|
+
strategy: props.Order.action.trade.strategy !== undefined ? {
|
1010
|
+
set: props.Order.action.trade.strategy
|
1011
|
+
} : undefined,
|
1012
|
+
analysis: props.Order.action.trade.analysis !== undefined ? {
|
1013
|
+
set: props.Order.action.trade.analysis
|
1014
|
+
} : undefined,
|
1015
|
+
summary: props.Order.action.trade.summary !== undefined ? {
|
1016
|
+
set: props.Order.action.trade.summary
|
1017
|
+
} : undefined,
|
1018
|
+
confidence: props.Order.action.trade.confidence !== undefined ? {
|
1019
|
+
set: props.Order.action.trade.confidence
|
1020
|
+
} : undefined,
|
1021
|
+
timestamp: props.Order.action.trade.timestamp !== undefined ? {
|
1022
|
+
set: props.Order.action.trade.timestamp
|
1023
|
+
} : undefined,
|
1024
|
+
status: props.Order.action.trade.status !== undefined ? {
|
1025
|
+
set: props.Order.action.trade.status
|
1026
|
+
} : undefined,
|
1027
|
+
},
|
1028
|
+
create: {
|
1029
|
+
qty: props.Order.action.trade.qty !== undefined ? props.Order.action.trade.qty : undefined,
|
1030
|
+
price: props.Order.action.trade.price !== undefined ? props.Order.action.trade.price : undefined,
|
1031
|
+
total: props.Order.action.trade.total !== undefined ? props.Order.action.trade.total : undefined,
|
1032
|
+
optionType: props.Order.action.trade.optionType !== undefined ? props.Order.action.trade.optionType : undefined,
|
1033
|
+
signal: props.Order.action.trade.signal !== undefined ? props.Order.action.trade.signal : undefined,
|
1034
|
+
strategy: props.Order.action.trade.strategy !== undefined ? props.Order.action.trade.strategy : undefined,
|
1035
|
+
analysis: props.Order.action.trade.analysis !== undefined ? props.Order.action.trade.analysis : undefined,
|
1036
|
+
summary: props.Order.action.trade.summary !== undefined ? props.Order.action.trade.summary : undefined,
|
1037
|
+
confidence: props.Order.action.trade.confidence !== undefined ? props.Order.action.trade.confidence : undefined,
|
1038
|
+
timestamp: props.Order.action.trade.timestamp !== undefined ? props.Order.action.trade.timestamp : undefined,
|
1039
|
+
status: props.Order.action.trade.status !== undefined ? props.Order.action.trade.status : undefined,
|
1040
|
+
},
|
1041
|
+
}
|
1042
|
+
} : undefined,
|
475
1043
|
},
|
476
1044
|
create: {
|
477
1045
|
sequence: props.Order.action.sequence !== undefined ? props.Order.action.sequence : undefined,
|
@@ -479,6 +1047,31 @@ exports.StopLoss = {
|
|
479
1047
|
note: props.Order.action.note !== undefined ? props.Order.action.note : undefined,
|
480
1048
|
status: props.Order.action.status !== undefined ? props.Order.action.status : undefined,
|
481
1049
|
fee: props.Order.action.fee !== undefined ? props.Order.action.fee : undefined,
|
1050
|
+
trade: props.Order.action.trade ?
|
1051
|
+
typeof props.Order.action.trade === 'object' && Object.keys(props.Order.action.trade).length === 1 && Object.keys(props.Order.action.trade)[0] === 'id'
|
1052
|
+
? { connect: {
|
1053
|
+
id: props.Order.action.trade.id
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
: { connectOrCreate: {
|
1057
|
+
where: {
|
1058
|
+
id: props.Order.action.trade.id !== undefined ? props.Order.action.trade.id : undefined,
|
1059
|
+
},
|
1060
|
+
create: {
|
1061
|
+
qty: props.Order.action.trade.qty !== undefined ? props.Order.action.trade.qty : undefined,
|
1062
|
+
price: props.Order.action.trade.price !== undefined ? props.Order.action.trade.price : undefined,
|
1063
|
+
total: props.Order.action.trade.total !== undefined ? props.Order.action.trade.total : undefined,
|
1064
|
+
optionType: props.Order.action.trade.optionType !== undefined ? props.Order.action.trade.optionType : undefined,
|
1065
|
+
signal: props.Order.action.trade.signal !== undefined ? props.Order.action.trade.signal : undefined,
|
1066
|
+
strategy: props.Order.action.trade.strategy !== undefined ? props.Order.action.trade.strategy : undefined,
|
1067
|
+
analysis: props.Order.action.trade.analysis !== undefined ? props.Order.action.trade.analysis : undefined,
|
1068
|
+
summary: props.Order.action.trade.summary !== undefined ? props.Order.action.trade.summary : undefined,
|
1069
|
+
confidence: props.Order.action.trade.confidence !== undefined ? props.Order.action.trade.confidence : undefined,
|
1070
|
+
timestamp: props.Order.action.trade.timestamp !== undefined ? props.Order.action.trade.timestamp : undefined,
|
1071
|
+
status: props.Order.action.trade.status !== undefined ? props.Order.action.trade.status : undefined,
|
1072
|
+
},
|
1073
|
+
}
|
1074
|
+
} : undefined,
|
482
1075
|
},
|
483
1076
|
}
|
484
1077
|
} : undefined,
|
@@ -664,6 +1257,161 @@ exports.StopLoss = {
|
|
664
1257
|
bidPrice: props.Order.asset.bidPrice !== undefined ? {
|
665
1258
|
set: props.Order.asset.bidPrice
|
666
1259
|
} : undefined,
|
1260
|
+
trades: props.Order.asset.trades ? {
|
1261
|
+
upsert: props.Order.asset.trades.map((item) => ({
|
1262
|
+
where: {
|
1263
|
+
id: item.id !== undefined ? item.id : undefined,
|
1264
|
+
},
|
1265
|
+
update: {
|
1266
|
+
id: item.id !== undefined ? {
|
1267
|
+
set: item.id
|
1268
|
+
} : undefined,
|
1269
|
+
qty: item.qty !== undefined ? {
|
1270
|
+
set: item.qty
|
1271
|
+
} : undefined,
|
1272
|
+
price: item.price !== undefined ? {
|
1273
|
+
set: item.price
|
1274
|
+
} : undefined,
|
1275
|
+
total: item.total !== undefined ? {
|
1276
|
+
set: item.total
|
1277
|
+
} : undefined,
|
1278
|
+
optionType: item.optionType !== undefined ? {
|
1279
|
+
set: item.optionType
|
1280
|
+
} : undefined,
|
1281
|
+
signal: item.signal !== undefined ? {
|
1282
|
+
set: item.signal
|
1283
|
+
} : undefined,
|
1284
|
+
strategy: item.strategy !== undefined ? {
|
1285
|
+
set: item.strategy
|
1286
|
+
} : undefined,
|
1287
|
+
analysis: item.analysis !== undefined ? {
|
1288
|
+
set: item.analysis
|
1289
|
+
} : undefined,
|
1290
|
+
summary: item.summary !== undefined ? {
|
1291
|
+
set: item.summary
|
1292
|
+
} : undefined,
|
1293
|
+
confidence: item.confidence !== undefined ? {
|
1294
|
+
set: item.confidence
|
1295
|
+
} : undefined,
|
1296
|
+
timestamp: item.timestamp !== undefined ? {
|
1297
|
+
set: item.timestamp
|
1298
|
+
} : undefined,
|
1299
|
+
status: item.status !== undefined ? {
|
1300
|
+
set: item.status
|
1301
|
+
} : undefined,
|
1302
|
+
},
|
1303
|
+
create: {
|
1304
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1305
|
+
price: item.price !== undefined ? item.price : undefined,
|
1306
|
+
total: item.total !== undefined ? item.total : undefined,
|
1307
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
1308
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
1309
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
1310
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
1311
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
1312
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
1313
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
1314
|
+
status: item.status !== undefined ? item.status : undefined,
|
1315
|
+
},
|
1316
|
+
}))
|
1317
|
+
} : undefined,
|
1318
|
+
positions: props.Order.asset.positions ? {
|
1319
|
+
upsert: props.Order.asset.positions.map((item) => ({
|
1320
|
+
where: {
|
1321
|
+
id: item.id !== undefined ? item.id : undefined,
|
1322
|
+
},
|
1323
|
+
update: {
|
1324
|
+
id: item.id !== undefined ? {
|
1325
|
+
set: item.id
|
1326
|
+
} : undefined,
|
1327
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
1328
|
+
set: item.averageEntryPrice
|
1329
|
+
} : undefined,
|
1330
|
+
qty: item.qty !== undefined ? {
|
1331
|
+
set: item.qty
|
1332
|
+
} : undefined,
|
1333
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
1334
|
+
set: item.qtyAvailable
|
1335
|
+
} : undefined,
|
1336
|
+
marketValue: item.marketValue !== undefined ? {
|
1337
|
+
set: item.marketValue
|
1338
|
+
} : undefined,
|
1339
|
+
costBasis: item.costBasis !== undefined ? {
|
1340
|
+
set: item.costBasis
|
1341
|
+
} : undefined,
|
1342
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
1343
|
+
set: item.unrealizedPL
|
1344
|
+
} : undefined,
|
1345
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
1346
|
+
set: item.unrealizedPLPC
|
1347
|
+
} : undefined,
|
1348
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
1349
|
+
set: item.unrealisedIntradayPL
|
1350
|
+
} : undefined,
|
1351
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
1352
|
+
set: item.unrealisedIntradayPLPC
|
1353
|
+
} : undefined,
|
1354
|
+
currentPrice: item.currentPrice !== undefined ? {
|
1355
|
+
set: item.currentPrice
|
1356
|
+
} : undefined,
|
1357
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
1358
|
+
set: item.lastTradePrice
|
1359
|
+
} : undefined,
|
1360
|
+
changeToday: item.changeToday !== undefined ? {
|
1361
|
+
set: item.changeToday
|
1362
|
+
} : undefined,
|
1363
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
1364
|
+
set: item.assetMarginable
|
1365
|
+
} : undefined,
|
1366
|
+
},
|
1367
|
+
create: {
|
1368
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1369
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1370
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1371
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1372
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1373
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1374
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1375
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1376
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1377
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1378
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1379
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1380
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1381
|
+
},
|
1382
|
+
}))
|
1383
|
+
} : undefined,
|
1384
|
+
newsMentions: props.Order.asset.newsMentions ? {
|
1385
|
+
upsert: props.Order.asset.newsMentions.map((item) => ({
|
1386
|
+
where: {
|
1387
|
+
id: item.id !== undefined ? item.id : undefined,
|
1388
|
+
url: item.url !== undefined ? item.url : undefined,
|
1389
|
+
},
|
1390
|
+
update: {
|
1391
|
+
id: item.id !== undefined ? {
|
1392
|
+
set: item.id
|
1393
|
+
} : undefined,
|
1394
|
+
url: item.url !== undefined ? {
|
1395
|
+
set: item.url
|
1396
|
+
} : undefined,
|
1397
|
+
relevancyScore: item.relevancyScore !== undefined ? {
|
1398
|
+
set: item.relevancyScore
|
1399
|
+
} : undefined,
|
1400
|
+
sentimentScore: item.sentimentScore !== undefined ? {
|
1401
|
+
set: item.sentimentScore
|
1402
|
+
} : undefined,
|
1403
|
+
sentimentLabel: item.sentimentLabel !== undefined ? {
|
1404
|
+
set: item.sentimentLabel
|
1405
|
+
} : undefined,
|
1406
|
+
},
|
1407
|
+
create: {
|
1408
|
+
url: item.url !== undefined ? item.url : undefined,
|
1409
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
1410
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
1411
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
1412
|
+
},
|
1413
|
+
}))
|
1414
|
+
} : undefined,
|
667
1415
|
},
|
668
1416
|
create: {
|
669
1417
|
symbol: props.Order.asset.symbol !== undefined ? props.Order.asset.symbol : undefined,
|
@@ -721,6 +1469,77 @@ exports.StopLoss = {
|
|
721
1469
|
exDividendDate: props.Order.asset.exDividendDate !== undefined ? props.Order.asset.exDividendDate : undefined,
|
722
1470
|
askPrice: props.Order.asset.askPrice !== undefined ? props.Order.asset.askPrice : undefined,
|
723
1471
|
bidPrice: props.Order.asset.bidPrice !== undefined ? props.Order.asset.bidPrice : undefined,
|
1472
|
+
trades: props.Order.asset.trades ?
|
1473
|
+
Array.isArray(props.Order.asset.trades) && props.Order.asset.trades.length > 0 && props.Order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1474
|
+
connect: props.Order.asset.trades.map((item) => ({
|
1475
|
+
id: item.id
|
1476
|
+
}))
|
1477
|
+
}
|
1478
|
+
: { connectOrCreate: props.Order.asset.trades.map((item) => ({
|
1479
|
+
where: {
|
1480
|
+
id: item.id !== undefined ? item.id : undefined,
|
1481
|
+
},
|
1482
|
+
create: {
|
1483
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1484
|
+
price: item.price !== undefined ? item.price : undefined,
|
1485
|
+
total: item.total !== undefined ? item.total : undefined,
|
1486
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
1487
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
1488
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
1489
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
1490
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
1491
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
1492
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
1493
|
+
status: item.status !== undefined ? item.status : undefined,
|
1494
|
+
},
|
1495
|
+
}))
|
1496
|
+
} : undefined,
|
1497
|
+
positions: props.Order.asset.positions ?
|
1498
|
+
Array.isArray(props.Order.asset.positions) && props.Order.asset.positions.length > 0 && props.Order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1499
|
+
connect: props.Order.asset.positions.map((item) => ({
|
1500
|
+
id: item.id
|
1501
|
+
}))
|
1502
|
+
}
|
1503
|
+
: { connectOrCreate: props.Order.asset.positions.map((item) => ({
|
1504
|
+
where: {
|
1505
|
+
id: item.id !== undefined ? item.id : undefined,
|
1506
|
+
},
|
1507
|
+
create: {
|
1508
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1509
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1510
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1511
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1512
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1513
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1514
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1515
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1516
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1517
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1518
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1519
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1520
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1521
|
+
},
|
1522
|
+
}))
|
1523
|
+
} : undefined,
|
1524
|
+
newsMentions: props.Order.asset.newsMentions ?
|
1525
|
+
Array.isArray(props.Order.asset.newsMentions) && props.Order.asset.newsMentions.length > 0 && props.Order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1526
|
+
connect: props.Order.asset.newsMentions.map((item) => ({
|
1527
|
+
id: item.id
|
1528
|
+
}))
|
1529
|
+
}
|
1530
|
+
: { connectOrCreate: props.Order.asset.newsMentions.map((item) => ({
|
1531
|
+
where: {
|
1532
|
+
id: item.id !== undefined ? item.id : undefined,
|
1533
|
+
url: item.url !== undefined ? item.url : undefined,
|
1534
|
+
},
|
1535
|
+
create: {
|
1536
|
+
url: item.url !== undefined ? item.url : undefined,
|
1537
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
1538
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
1539
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
1540
|
+
},
|
1541
|
+
}))
|
1542
|
+
} : undefined,
|
724
1543
|
},
|
725
1544
|
}
|
726
1545
|
} : undefined,
|
@@ -784,6 +1603,104 @@ exports.StopLoss = {
|
|
784
1603
|
maxOrderSize: props.Order.alpacaAccount.maxOrderSize !== undefined ? props.Order.alpacaAccount.maxOrderSize : undefined,
|
785
1604
|
minPercentageChange: props.Order.alpacaAccount.minPercentageChange !== undefined ? props.Order.alpacaAccount.minPercentageChange : undefined,
|
786
1605
|
volumeThreshold: props.Order.alpacaAccount.volumeThreshold !== undefined ? props.Order.alpacaAccount.volumeThreshold : undefined,
|
1606
|
+
user: props.Order.alpacaAccount.user ?
|
1607
|
+
typeof props.Order.alpacaAccount.user === 'object' && Object.keys(props.Order.alpacaAccount.user).length === 1 && Object.keys(props.Order.alpacaAccount.user)[0] === 'id'
|
1608
|
+
? { connect: {
|
1609
|
+
id: props.Order.alpacaAccount.user.id
|
1610
|
+
}
|
1611
|
+
}
|
1612
|
+
: { connectOrCreate: {
|
1613
|
+
where: {
|
1614
|
+
id: props.Order.alpacaAccount.user.id !== undefined ? props.Order.alpacaAccount.user.id : undefined,
|
1615
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
1616
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? {
|
1617
|
+
equals: props.Order.alpacaAccount.user.name
|
1618
|
+
} : undefined,
|
1619
|
+
},
|
1620
|
+
create: {
|
1621
|
+
name: props.Order.alpacaAccount.user.name !== undefined ? props.Order.alpacaAccount.user.name : undefined,
|
1622
|
+
email: props.Order.alpacaAccount.user.email !== undefined ? props.Order.alpacaAccount.user.email : undefined,
|
1623
|
+
emailVerified: props.Order.alpacaAccount.user.emailVerified !== undefined ? props.Order.alpacaAccount.user.emailVerified : undefined,
|
1624
|
+
image: props.Order.alpacaAccount.user.image !== undefined ? props.Order.alpacaAccount.user.image : undefined,
|
1625
|
+
role: props.Order.alpacaAccount.user.role !== undefined ? props.Order.alpacaAccount.user.role : undefined,
|
1626
|
+
bio: props.Order.alpacaAccount.user.bio !== undefined ? props.Order.alpacaAccount.user.bio : undefined,
|
1627
|
+
jobTitle: props.Order.alpacaAccount.user.jobTitle !== undefined ? props.Order.alpacaAccount.user.jobTitle : undefined,
|
1628
|
+
currentAccount: props.Order.alpacaAccount.user.currentAccount !== undefined ? props.Order.alpacaAccount.user.currentAccount : undefined,
|
1629
|
+
plan: props.Order.alpacaAccount.user.plan !== undefined ? props.Order.alpacaAccount.user.plan : undefined,
|
1630
|
+
openaiAPIKey: props.Order.alpacaAccount.user.openaiAPIKey !== undefined ? props.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
1631
|
+
openaiModel: props.Order.alpacaAccount.user.openaiModel !== undefined ? props.Order.alpacaAccount.user.openaiModel : undefined,
|
1632
|
+
},
|
1633
|
+
}
|
1634
|
+
} : undefined,
|
1635
|
+
trades: props.Order.alpacaAccount.trades ?
|
1636
|
+
Array.isArray(props.Order.alpacaAccount.trades) && props.Order.alpacaAccount.trades.length > 0 && props.Order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1637
|
+
connect: props.Order.alpacaAccount.trades.map((item) => ({
|
1638
|
+
id: item.id
|
1639
|
+
}))
|
1640
|
+
}
|
1641
|
+
: { connectOrCreate: props.Order.alpacaAccount.trades.map((item) => ({
|
1642
|
+
where: {
|
1643
|
+
id: item.id !== undefined ? item.id : undefined,
|
1644
|
+
},
|
1645
|
+
create: {
|
1646
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1647
|
+
price: item.price !== undefined ? item.price : undefined,
|
1648
|
+
total: item.total !== undefined ? item.total : undefined,
|
1649
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
1650
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
1651
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
1652
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
1653
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
1654
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
1655
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
1656
|
+
status: item.status !== undefined ? item.status : undefined,
|
1657
|
+
},
|
1658
|
+
}))
|
1659
|
+
} : undefined,
|
1660
|
+
positions: props.Order.alpacaAccount.positions ?
|
1661
|
+
Array.isArray(props.Order.alpacaAccount.positions) && props.Order.alpacaAccount.positions.length > 0 && props.Order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1662
|
+
connect: props.Order.alpacaAccount.positions.map((item) => ({
|
1663
|
+
id: item.id
|
1664
|
+
}))
|
1665
|
+
}
|
1666
|
+
: { connectOrCreate: props.Order.alpacaAccount.positions.map((item) => ({
|
1667
|
+
where: {
|
1668
|
+
id: item.id !== undefined ? item.id : undefined,
|
1669
|
+
},
|
1670
|
+
create: {
|
1671
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1672
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1673
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1674
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1675
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1676
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1677
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1678
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1679
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1680
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1681
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1682
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1683
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1684
|
+
},
|
1685
|
+
}))
|
1686
|
+
} : undefined,
|
1687
|
+
alerts: props.Order.alpacaAccount.alerts ?
|
1688
|
+
Array.isArray(props.Order.alpacaAccount.alerts) && props.Order.alpacaAccount.alerts.length > 0 && props.Order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1689
|
+
connect: props.Order.alpacaAccount.alerts.map((item) => ({
|
1690
|
+
id: item.id
|
1691
|
+
}))
|
1692
|
+
}
|
1693
|
+
: { connectOrCreate: props.Order.alpacaAccount.alerts.map((item) => ({
|
1694
|
+
where: {
|
1695
|
+
id: item.id !== undefined ? item.id : undefined,
|
1696
|
+
},
|
1697
|
+
create: {
|
1698
|
+
message: item.message !== undefined ? item.message : undefined,
|
1699
|
+
type: item.type !== undefined ? item.type : undefined,
|
1700
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
1701
|
+
},
|
1702
|
+
}))
|
1703
|
+
} : undefined,
|
787
1704
|
},
|
788
1705
|
}
|
789
1706
|
} : undefined,
|
@@ -803,6 +1720,31 @@ exports.StopLoss = {
|
|
803
1720
|
note: props.Order.action.note !== undefined ? props.Order.action.note : undefined,
|
804
1721
|
status: props.Order.action.status !== undefined ? props.Order.action.status : undefined,
|
805
1722
|
fee: props.Order.action.fee !== undefined ? props.Order.action.fee : undefined,
|
1723
|
+
trade: props.Order.action.trade ?
|
1724
|
+
typeof props.Order.action.trade === 'object' && Object.keys(props.Order.action.trade).length === 1 && Object.keys(props.Order.action.trade)[0] === 'id'
|
1725
|
+
? { connect: {
|
1726
|
+
id: props.Order.action.trade.id
|
1727
|
+
}
|
1728
|
+
}
|
1729
|
+
: { connectOrCreate: {
|
1730
|
+
where: {
|
1731
|
+
id: props.Order.action.trade.id !== undefined ? props.Order.action.trade.id : undefined,
|
1732
|
+
},
|
1733
|
+
create: {
|
1734
|
+
qty: props.Order.action.trade.qty !== undefined ? props.Order.action.trade.qty : undefined,
|
1735
|
+
price: props.Order.action.trade.price !== undefined ? props.Order.action.trade.price : undefined,
|
1736
|
+
total: props.Order.action.trade.total !== undefined ? props.Order.action.trade.total : undefined,
|
1737
|
+
optionType: props.Order.action.trade.optionType !== undefined ? props.Order.action.trade.optionType : undefined,
|
1738
|
+
signal: props.Order.action.trade.signal !== undefined ? props.Order.action.trade.signal : undefined,
|
1739
|
+
strategy: props.Order.action.trade.strategy !== undefined ? props.Order.action.trade.strategy : undefined,
|
1740
|
+
analysis: props.Order.action.trade.analysis !== undefined ? props.Order.action.trade.analysis : undefined,
|
1741
|
+
summary: props.Order.action.trade.summary !== undefined ? props.Order.action.trade.summary : undefined,
|
1742
|
+
confidence: props.Order.action.trade.confidence !== undefined ? props.Order.action.trade.confidence : undefined,
|
1743
|
+
timestamp: props.Order.action.trade.timestamp !== undefined ? props.Order.action.trade.timestamp : undefined,
|
1744
|
+
status: props.Order.action.trade.status !== undefined ? props.Order.action.trade.status : undefined,
|
1745
|
+
},
|
1746
|
+
}
|
1747
|
+
} : undefined,
|
806
1748
|
},
|
807
1749
|
}
|
808
1750
|
} : undefined,
|
@@ -874,6 +1816,77 @@ exports.StopLoss = {
|
|
874
1816
|
exDividendDate: props.Order.asset.exDividendDate !== undefined ? props.Order.asset.exDividendDate : undefined,
|
875
1817
|
askPrice: props.Order.asset.askPrice !== undefined ? props.Order.asset.askPrice : undefined,
|
876
1818
|
bidPrice: props.Order.asset.bidPrice !== undefined ? props.Order.asset.bidPrice : undefined,
|
1819
|
+
trades: props.Order.asset.trades ?
|
1820
|
+
Array.isArray(props.Order.asset.trades) && props.Order.asset.trades.length > 0 && props.Order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1821
|
+
connect: props.Order.asset.trades.map((item) => ({
|
1822
|
+
id: item.id
|
1823
|
+
}))
|
1824
|
+
}
|
1825
|
+
: { connectOrCreate: props.Order.asset.trades.map((item) => ({
|
1826
|
+
where: {
|
1827
|
+
id: item.id !== undefined ? item.id : undefined,
|
1828
|
+
},
|
1829
|
+
create: {
|
1830
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1831
|
+
price: item.price !== undefined ? item.price : undefined,
|
1832
|
+
total: item.total !== undefined ? item.total : undefined,
|
1833
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
1834
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
1835
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
1836
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
1837
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
1838
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
1839
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
1840
|
+
status: item.status !== undefined ? item.status : undefined,
|
1841
|
+
},
|
1842
|
+
}))
|
1843
|
+
} : undefined,
|
1844
|
+
positions: props.Order.asset.positions ?
|
1845
|
+
Array.isArray(props.Order.asset.positions) && props.Order.asset.positions.length > 0 && props.Order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1846
|
+
connect: props.Order.asset.positions.map((item) => ({
|
1847
|
+
id: item.id
|
1848
|
+
}))
|
1849
|
+
}
|
1850
|
+
: { connectOrCreate: props.Order.asset.positions.map((item) => ({
|
1851
|
+
where: {
|
1852
|
+
id: item.id !== undefined ? item.id : undefined,
|
1853
|
+
},
|
1854
|
+
create: {
|
1855
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1856
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1857
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1858
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1859
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1860
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1861
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1862
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1863
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1864
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1865
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1866
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1867
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1868
|
+
},
|
1869
|
+
}))
|
1870
|
+
} : undefined,
|
1871
|
+
newsMentions: props.Order.asset.newsMentions ?
|
1872
|
+
Array.isArray(props.Order.asset.newsMentions) && props.Order.asset.newsMentions.length > 0 && props.Order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
1873
|
+
connect: props.Order.asset.newsMentions.map((item) => ({
|
1874
|
+
id: item.id
|
1875
|
+
}))
|
1876
|
+
}
|
1877
|
+
: { connectOrCreate: props.Order.asset.newsMentions.map((item) => ({
|
1878
|
+
where: {
|
1879
|
+
id: item.id !== undefined ? item.id : undefined,
|
1880
|
+
url: item.url !== undefined ? item.url : undefined,
|
1881
|
+
},
|
1882
|
+
create: {
|
1883
|
+
url: item.url !== undefined ? item.url : undefined,
|
1884
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
1885
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
1886
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
1887
|
+
},
|
1888
|
+
}))
|
1889
|
+
} : undefined,
|
877
1890
|
},
|
878
1891
|
}
|
879
1892
|
} : undefined,
|
@@ -1074,6 +2087,222 @@ exports.StopLoss = {
|
|
1074
2087
|
volumeThreshold: prop.Order.alpacaAccount.volumeThreshold !== undefined ? {
|
1075
2088
|
set: prop.Order.alpacaAccount.volumeThreshold
|
1076
2089
|
} : undefined,
|
2090
|
+
user: prop.Order.alpacaAccount.user ? {
|
2091
|
+
upsert: {
|
2092
|
+
where: {
|
2093
|
+
id: prop.Order.alpacaAccount.user.id !== undefined ? {
|
2094
|
+
equals: prop.Order.alpacaAccount.user.id
|
2095
|
+
} : undefined,
|
2096
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? {
|
2097
|
+
equals: prop.Order.alpacaAccount.user.name
|
2098
|
+
} : undefined,
|
2099
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? {
|
2100
|
+
equals: prop.Order.alpacaAccount.user.email
|
2101
|
+
} : undefined,
|
2102
|
+
},
|
2103
|
+
update: {
|
2104
|
+
id: prop.Order.alpacaAccount.user.id !== undefined ? {
|
2105
|
+
set: prop.Order.alpacaAccount.user.id
|
2106
|
+
} : undefined,
|
2107
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? {
|
2108
|
+
set: prop.Order.alpacaAccount.user.name
|
2109
|
+
} : undefined,
|
2110
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? {
|
2111
|
+
set: prop.Order.alpacaAccount.user.email
|
2112
|
+
} : undefined,
|
2113
|
+
emailVerified: prop.Order.alpacaAccount.user.emailVerified !== undefined ? {
|
2114
|
+
set: prop.Order.alpacaAccount.user.emailVerified
|
2115
|
+
} : undefined,
|
2116
|
+
image: prop.Order.alpacaAccount.user.image !== undefined ? {
|
2117
|
+
set: prop.Order.alpacaAccount.user.image
|
2118
|
+
} : undefined,
|
2119
|
+
role: prop.Order.alpacaAccount.user.role !== undefined ? {
|
2120
|
+
set: prop.Order.alpacaAccount.user.role
|
2121
|
+
} : undefined,
|
2122
|
+
bio: prop.Order.alpacaAccount.user.bio !== undefined ? {
|
2123
|
+
set: prop.Order.alpacaAccount.user.bio
|
2124
|
+
} : undefined,
|
2125
|
+
jobTitle: prop.Order.alpacaAccount.user.jobTitle !== undefined ? {
|
2126
|
+
set: prop.Order.alpacaAccount.user.jobTitle
|
2127
|
+
} : undefined,
|
2128
|
+
currentAccount: prop.Order.alpacaAccount.user.currentAccount !== undefined ? {
|
2129
|
+
set: prop.Order.alpacaAccount.user.currentAccount
|
2130
|
+
} : undefined,
|
2131
|
+
plan: prop.Order.alpacaAccount.user.plan !== undefined ? {
|
2132
|
+
set: prop.Order.alpacaAccount.user.plan
|
2133
|
+
} : undefined,
|
2134
|
+
openaiAPIKey: prop.Order.alpacaAccount.user.openaiAPIKey !== undefined ? {
|
2135
|
+
set: prop.Order.alpacaAccount.user.openaiAPIKey
|
2136
|
+
} : undefined,
|
2137
|
+
openaiModel: prop.Order.alpacaAccount.user.openaiModel !== undefined ? {
|
2138
|
+
set: prop.Order.alpacaAccount.user.openaiModel
|
2139
|
+
} : undefined,
|
2140
|
+
},
|
2141
|
+
create: {
|
2142
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? prop.Order.alpacaAccount.user.name : undefined,
|
2143
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? prop.Order.alpacaAccount.user.email : undefined,
|
2144
|
+
emailVerified: prop.Order.alpacaAccount.user.emailVerified !== undefined ? prop.Order.alpacaAccount.user.emailVerified : undefined,
|
2145
|
+
image: prop.Order.alpacaAccount.user.image !== undefined ? prop.Order.alpacaAccount.user.image : undefined,
|
2146
|
+
role: prop.Order.alpacaAccount.user.role !== undefined ? prop.Order.alpacaAccount.user.role : undefined,
|
2147
|
+
bio: prop.Order.alpacaAccount.user.bio !== undefined ? prop.Order.alpacaAccount.user.bio : undefined,
|
2148
|
+
jobTitle: prop.Order.alpacaAccount.user.jobTitle !== undefined ? prop.Order.alpacaAccount.user.jobTitle : undefined,
|
2149
|
+
currentAccount: prop.Order.alpacaAccount.user.currentAccount !== undefined ? prop.Order.alpacaAccount.user.currentAccount : undefined,
|
2150
|
+
plan: prop.Order.alpacaAccount.user.plan !== undefined ? prop.Order.alpacaAccount.user.plan : undefined,
|
2151
|
+
openaiAPIKey: prop.Order.alpacaAccount.user.openaiAPIKey !== undefined ? prop.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
2152
|
+
openaiModel: prop.Order.alpacaAccount.user.openaiModel !== undefined ? prop.Order.alpacaAccount.user.openaiModel : undefined,
|
2153
|
+
},
|
2154
|
+
}
|
2155
|
+
} : undefined,
|
2156
|
+
trades: prop.Order.alpacaAccount.trades ? {
|
2157
|
+
upsert: prop.Order.alpacaAccount.trades.map((item) => ({
|
2158
|
+
where: {
|
2159
|
+
id: item.id !== undefined ? item.id : undefined,
|
2160
|
+
},
|
2161
|
+
update: {
|
2162
|
+
id: item.id !== undefined ? {
|
2163
|
+
set: item.id
|
2164
|
+
} : undefined,
|
2165
|
+
qty: item.qty !== undefined ? {
|
2166
|
+
set: item.qty
|
2167
|
+
} : undefined,
|
2168
|
+
price: item.price !== undefined ? {
|
2169
|
+
set: item.price
|
2170
|
+
} : undefined,
|
2171
|
+
total: item.total !== undefined ? {
|
2172
|
+
set: item.total
|
2173
|
+
} : undefined,
|
2174
|
+
optionType: item.optionType !== undefined ? {
|
2175
|
+
set: item.optionType
|
2176
|
+
} : undefined,
|
2177
|
+
signal: item.signal !== undefined ? {
|
2178
|
+
set: item.signal
|
2179
|
+
} : undefined,
|
2180
|
+
strategy: item.strategy !== undefined ? {
|
2181
|
+
set: item.strategy
|
2182
|
+
} : undefined,
|
2183
|
+
analysis: item.analysis !== undefined ? {
|
2184
|
+
set: item.analysis
|
2185
|
+
} : undefined,
|
2186
|
+
summary: item.summary !== undefined ? {
|
2187
|
+
set: item.summary
|
2188
|
+
} : undefined,
|
2189
|
+
confidence: item.confidence !== undefined ? {
|
2190
|
+
set: item.confidence
|
2191
|
+
} : undefined,
|
2192
|
+
timestamp: item.timestamp !== undefined ? {
|
2193
|
+
set: item.timestamp
|
2194
|
+
} : undefined,
|
2195
|
+
status: item.status !== undefined ? {
|
2196
|
+
set: item.status
|
2197
|
+
} : undefined,
|
2198
|
+
},
|
2199
|
+
create: {
|
2200
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2201
|
+
price: item.price !== undefined ? item.price : undefined,
|
2202
|
+
total: item.total !== undefined ? item.total : undefined,
|
2203
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2204
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2205
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2206
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2207
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2208
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2209
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2210
|
+
status: item.status !== undefined ? item.status : undefined,
|
2211
|
+
},
|
2212
|
+
}))
|
2213
|
+
} : undefined,
|
2214
|
+
positions: prop.Order.alpacaAccount.positions ? {
|
2215
|
+
upsert: prop.Order.alpacaAccount.positions.map((item) => ({
|
2216
|
+
where: {
|
2217
|
+
id: item.id !== undefined ? item.id : undefined,
|
2218
|
+
},
|
2219
|
+
update: {
|
2220
|
+
id: item.id !== undefined ? {
|
2221
|
+
set: item.id
|
2222
|
+
} : undefined,
|
2223
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
2224
|
+
set: item.averageEntryPrice
|
2225
|
+
} : undefined,
|
2226
|
+
qty: item.qty !== undefined ? {
|
2227
|
+
set: item.qty
|
2228
|
+
} : undefined,
|
2229
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
2230
|
+
set: item.qtyAvailable
|
2231
|
+
} : undefined,
|
2232
|
+
marketValue: item.marketValue !== undefined ? {
|
2233
|
+
set: item.marketValue
|
2234
|
+
} : undefined,
|
2235
|
+
costBasis: item.costBasis !== undefined ? {
|
2236
|
+
set: item.costBasis
|
2237
|
+
} : undefined,
|
2238
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
2239
|
+
set: item.unrealizedPL
|
2240
|
+
} : undefined,
|
2241
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
2242
|
+
set: item.unrealizedPLPC
|
2243
|
+
} : undefined,
|
2244
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
2245
|
+
set: item.unrealisedIntradayPL
|
2246
|
+
} : undefined,
|
2247
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
2248
|
+
set: item.unrealisedIntradayPLPC
|
2249
|
+
} : undefined,
|
2250
|
+
currentPrice: item.currentPrice !== undefined ? {
|
2251
|
+
set: item.currentPrice
|
2252
|
+
} : undefined,
|
2253
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
2254
|
+
set: item.lastTradePrice
|
2255
|
+
} : undefined,
|
2256
|
+
changeToday: item.changeToday !== undefined ? {
|
2257
|
+
set: item.changeToday
|
2258
|
+
} : undefined,
|
2259
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
2260
|
+
set: item.assetMarginable
|
2261
|
+
} : undefined,
|
2262
|
+
},
|
2263
|
+
create: {
|
2264
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2265
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2266
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2267
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2268
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2269
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2270
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2271
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2272
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2273
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2274
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2275
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2276
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2277
|
+
},
|
2278
|
+
}))
|
2279
|
+
} : undefined,
|
2280
|
+
alerts: prop.Order.alpacaAccount.alerts ? {
|
2281
|
+
upsert: prop.Order.alpacaAccount.alerts.map((item) => ({
|
2282
|
+
where: {
|
2283
|
+
id: item.id !== undefined ? item.id : undefined,
|
2284
|
+
},
|
2285
|
+
update: {
|
2286
|
+
id: item.id !== undefined ? {
|
2287
|
+
set: item.id
|
2288
|
+
} : undefined,
|
2289
|
+
message: item.message !== undefined ? {
|
2290
|
+
set: item.message
|
2291
|
+
} : undefined,
|
2292
|
+
type: item.type !== undefined ? {
|
2293
|
+
set: item.type
|
2294
|
+
} : undefined,
|
2295
|
+
isRead: item.isRead !== undefined ? {
|
2296
|
+
set: item.isRead
|
2297
|
+
} : undefined,
|
2298
|
+
},
|
2299
|
+
create: {
|
2300
|
+
message: item.message !== undefined ? item.message : undefined,
|
2301
|
+
type: item.type !== undefined ? item.type : undefined,
|
2302
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2303
|
+
},
|
2304
|
+
}))
|
2305
|
+
} : undefined,
|
1077
2306
|
},
|
1078
2307
|
create: {
|
1079
2308
|
type: prop.Order.alpacaAccount.type !== undefined ? prop.Order.alpacaAccount.type : undefined,
|
@@ -1085,6 +2314,104 @@ exports.StopLoss = {
|
|
1085
2314
|
maxOrderSize: prop.Order.alpacaAccount.maxOrderSize !== undefined ? prop.Order.alpacaAccount.maxOrderSize : undefined,
|
1086
2315
|
minPercentageChange: prop.Order.alpacaAccount.minPercentageChange !== undefined ? prop.Order.alpacaAccount.minPercentageChange : undefined,
|
1087
2316
|
volumeThreshold: prop.Order.alpacaAccount.volumeThreshold !== undefined ? prop.Order.alpacaAccount.volumeThreshold : undefined,
|
2317
|
+
user: prop.Order.alpacaAccount.user ?
|
2318
|
+
typeof prop.Order.alpacaAccount.user === 'object' && Object.keys(prop.Order.alpacaAccount.user).length === 1 && Object.keys(prop.Order.alpacaAccount.user)[0] === 'id'
|
2319
|
+
? { connect: {
|
2320
|
+
id: prop.Order.alpacaAccount.user.id
|
2321
|
+
}
|
2322
|
+
}
|
2323
|
+
: { connectOrCreate: {
|
2324
|
+
where: {
|
2325
|
+
id: prop.Order.alpacaAccount.user.id !== undefined ? prop.Order.alpacaAccount.user.id : undefined,
|
2326
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? prop.Order.alpacaAccount.user.email : undefined,
|
2327
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? {
|
2328
|
+
equals: prop.Order.alpacaAccount.user.name
|
2329
|
+
} : undefined,
|
2330
|
+
},
|
2331
|
+
create: {
|
2332
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? prop.Order.alpacaAccount.user.name : undefined,
|
2333
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? prop.Order.alpacaAccount.user.email : undefined,
|
2334
|
+
emailVerified: prop.Order.alpacaAccount.user.emailVerified !== undefined ? prop.Order.alpacaAccount.user.emailVerified : undefined,
|
2335
|
+
image: prop.Order.alpacaAccount.user.image !== undefined ? prop.Order.alpacaAccount.user.image : undefined,
|
2336
|
+
role: prop.Order.alpacaAccount.user.role !== undefined ? prop.Order.alpacaAccount.user.role : undefined,
|
2337
|
+
bio: prop.Order.alpacaAccount.user.bio !== undefined ? prop.Order.alpacaAccount.user.bio : undefined,
|
2338
|
+
jobTitle: prop.Order.alpacaAccount.user.jobTitle !== undefined ? prop.Order.alpacaAccount.user.jobTitle : undefined,
|
2339
|
+
currentAccount: prop.Order.alpacaAccount.user.currentAccount !== undefined ? prop.Order.alpacaAccount.user.currentAccount : undefined,
|
2340
|
+
plan: prop.Order.alpacaAccount.user.plan !== undefined ? prop.Order.alpacaAccount.user.plan : undefined,
|
2341
|
+
openaiAPIKey: prop.Order.alpacaAccount.user.openaiAPIKey !== undefined ? prop.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
2342
|
+
openaiModel: prop.Order.alpacaAccount.user.openaiModel !== undefined ? prop.Order.alpacaAccount.user.openaiModel : undefined,
|
2343
|
+
},
|
2344
|
+
}
|
2345
|
+
} : undefined,
|
2346
|
+
trades: prop.Order.alpacaAccount.trades ?
|
2347
|
+
Array.isArray(prop.Order.alpacaAccount.trades) && prop.Order.alpacaAccount.trades.length > 0 && prop.Order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2348
|
+
connect: prop.Order.alpacaAccount.trades.map((item) => ({
|
2349
|
+
id: item.id
|
2350
|
+
}))
|
2351
|
+
}
|
2352
|
+
: { connectOrCreate: prop.Order.alpacaAccount.trades.map((item) => ({
|
2353
|
+
where: {
|
2354
|
+
id: item.id !== undefined ? item.id : undefined,
|
2355
|
+
},
|
2356
|
+
create: {
|
2357
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2358
|
+
price: item.price !== undefined ? item.price : undefined,
|
2359
|
+
total: item.total !== undefined ? item.total : undefined,
|
2360
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2361
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2362
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2363
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2364
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2365
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2366
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2367
|
+
status: item.status !== undefined ? item.status : undefined,
|
2368
|
+
},
|
2369
|
+
}))
|
2370
|
+
} : undefined,
|
2371
|
+
positions: prop.Order.alpacaAccount.positions ?
|
2372
|
+
Array.isArray(prop.Order.alpacaAccount.positions) && prop.Order.alpacaAccount.positions.length > 0 && prop.Order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2373
|
+
connect: prop.Order.alpacaAccount.positions.map((item) => ({
|
2374
|
+
id: item.id
|
2375
|
+
}))
|
2376
|
+
}
|
2377
|
+
: { connectOrCreate: prop.Order.alpacaAccount.positions.map((item) => ({
|
2378
|
+
where: {
|
2379
|
+
id: item.id !== undefined ? item.id : undefined,
|
2380
|
+
},
|
2381
|
+
create: {
|
2382
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2383
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2384
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2385
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2386
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2387
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2388
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2389
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2390
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2391
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2392
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2393
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2394
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2395
|
+
},
|
2396
|
+
}))
|
2397
|
+
} : undefined,
|
2398
|
+
alerts: prop.Order.alpacaAccount.alerts ?
|
2399
|
+
Array.isArray(prop.Order.alpacaAccount.alerts) && prop.Order.alpacaAccount.alerts.length > 0 && prop.Order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2400
|
+
connect: prop.Order.alpacaAccount.alerts.map((item) => ({
|
2401
|
+
id: item.id
|
2402
|
+
}))
|
2403
|
+
}
|
2404
|
+
: { connectOrCreate: prop.Order.alpacaAccount.alerts.map((item) => ({
|
2405
|
+
where: {
|
2406
|
+
id: item.id !== undefined ? item.id : undefined,
|
2407
|
+
},
|
2408
|
+
create: {
|
2409
|
+
message: item.message !== undefined ? item.message : undefined,
|
2410
|
+
type: item.type !== undefined ? item.type : undefined,
|
2411
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2412
|
+
},
|
2413
|
+
}))
|
2414
|
+
} : undefined,
|
1088
2415
|
},
|
1089
2416
|
}
|
1090
2417
|
} : undefined,
|
@@ -1114,6 +2441,66 @@ exports.StopLoss = {
|
|
1114
2441
|
fee: prop.Order.action.fee !== undefined ? {
|
1115
2442
|
set: prop.Order.action.fee
|
1116
2443
|
} : undefined,
|
2444
|
+
trade: prop.Order.action.trade ? {
|
2445
|
+
upsert: {
|
2446
|
+
where: {
|
2447
|
+
id: prop.Order.action.trade.id !== undefined ? {
|
2448
|
+
equals: prop.Order.action.trade.id
|
2449
|
+
} : undefined,
|
2450
|
+
},
|
2451
|
+
update: {
|
2452
|
+
id: prop.Order.action.trade.id !== undefined ? {
|
2453
|
+
set: prop.Order.action.trade.id
|
2454
|
+
} : undefined,
|
2455
|
+
qty: prop.Order.action.trade.qty !== undefined ? {
|
2456
|
+
set: prop.Order.action.trade.qty
|
2457
|
+
} : undefined,
|
2458
|
+
price: prop.Order.action.trade.price !== undefined ? {
|
2459
|
+
set: prop.Order.action.trade.price
|
2460
|
+
} : undefined,
|
2461
|
+
total: prop.Order.action.trade.total !== undefined ? {
|
2462
|
+
set: prop.Order.action.trade.total
|
2463
|
+
} : undefined,
|
2464
|
+
optionType: prop.Order.action.trade.optionType !== undefined ? {
|
2465
|
+
set: prop.Order.action.trade.optionType
|
2466
|
+
} : undefined,
|
2467
|
+
signal: prop.Order.action.trade.signal !== undefined ? {
|
2468
|
+
set: prop.Order.action.trade.signal
|
2469
|
+
} : undefined,
|
2470
|
+
strategy: prop.Order.action.trade.strategy !== undefined ? {
|
2471
|
+
set: prop.Order.action.trade.strategy
|
2472
|
+
} : undefined,
|
2473
|
+
analysis: prop.Order.action.trade.analysis !== undefined ? {
|
2474
|
+
set: prop.Order.action.trade.analysis
|
2475
|
+
} : undefined,
|
2476
|
+
summary: prop.Order.action.trade.summary !== undefined ? {
|
2477
|
+
set: prop.Order.action.trade.summary
|
2478
|
+
} : undefined,
|
2479
|
+
confidence: prop.Order.action.trade.confidence !== undefined ? {
|
2480
|
+
set: prop.Order.action.trade.confidence
|
2481
|
+
} : undefined,
|
2482
|
+
timestamp: prop.Order.action.trade.timestamp !== undefined ? {
|
2483
|
+
set: prop.Order.action.trade.timestamp
|
2484
|
+
} : undefined,
|
2485
|
+
status: prop.Order.action.trade.status !== undefined ? {
|
2486
|
+
set: prop.Order.action.trade.status
|
2487
|
+
} : undefined,
|
2488
|
+
},
|
2489
|
+
create: {
|
2490
|
+
qty: prop.Order.action.trade.qty !== undefined ? prop.Order.action.trade.qty : undefined,
|
2491
|
+
price: prop.Order.action.trade.price !== undefined ? prop.Order.action.trade.price : undefined,
|
2492
|
+
total: prop.Order.action.trade.total !== undefined ? prop.Order.action.trade.total : undefined,
|
2493
|
+
optionType: prop.Order.action.trade.optionType !== undefined ? prop.Order.action.trade.optionType : undefined,
|
2494
|
+
signal: prop.Order.action.trade.signal !== undefined ? prop.Order.action.trade.signal : undefined,
|
2495
|
+
strategy: prop.Order.action.trade.strategy !== undefined ? prop.Order.action.trade.strategy : undefined,
|
2496
|
+
analysis: prop.Order.action.trade.analysis !== undefined ? prop.Order.action.trade.analysis : undefined,
|
2497
|
+
summary: prop.Order.action.trade.summary !== undefined ? prop.Order.action.trade.summary : undefined,
|
2498
|
+
confidence: prop.Order.action.trade.confidence !== undefined ? prop.Order.action.trade.confidence : undefined,
|
2499
|
+
timestamp: prop.Order.action.trade.timestamp !== undefined ? prop.Order.action.trade.timestamp : undefined,
|
2500
|
+
status: prop.Order.action.trade.status !== undefined ? prop.Order.action.trade.status : undefined,
|
2501
|
+
},
|
2502
|
+
}
|
2503
|
+
} : undefined,
|
1117
2504
|
},
|
1118
2505
|
create: {
|
1119
2506
|
sequence: prop.Order.action.sequence !== undefined ? prop.Order.action.sequence : undefined,
|
@@ -1121,6 +2508,31 @@ exports.StopLoss = {
|
|
1121
2508
|
note: prop.Order.action.note !== undefined ? prop.Order.action.note : undefined,
|
1122
2509
|
status: prop.Order.action.status !== undefined ? prop.Order.action.status : undefined,
|
1123
2510
|
fee: prop.Order.action.fee !== undefined ? prop.Order.action.fee : undefined,
|
2511
|
+
trade: prop.Order.action.trade ?
|
2512
|
+
typeof prop.Order.action.trade === 'object' && Object.keys(prop.Order.action.trade).length === 1 && Object.keys(prop.Order.action.trade)[0] === 'id'
|
2513
|
+
? { connect: {
|
2514
|
+
id: prop.Order.action.trade.id
|
2515
|
+
}
|
2516
|
+
}
|
2517
|
+
: { connectOrCreate: {
|
2518
|
+
where: {
|
2519
|
+
id: prop.Order.action.trade.id !== undefined ? prop.Order.action.trade.id : undefined,
|
2520
|
+
},
|
2521
|
+
create: {
|
2522
|
+
qty: prop.Order.action.trade.qty !== undefined ? prop.Order.action.trade.qty : undefined,
|
2523
|
+
price: prop.Order.action.trade.price !== undefined ? prop.Order.action.trade.price : undefined,
|
2524
|
+
total: prop.Order.action.trade.total !== undefined ? prop.Order.action.trade.total : undefined,
|
2525
|
+
optionType: prop.Order.action.trade.optionType !== undefined ? prop.Order.action.trade.optionType : undefined,
|
2526
|
+
signal: prop.Order.action.trade.signal !== undefined ? prop.Order.action.trade.signal : undefined,
|
2527
|
+
strategy: prop.Order.action.trade.strategy !== undefined ? prop.Order.action.trade.strategy : undefined,
|
2528
|
+
analysis: prop.Order.action.trade.analysis !== undefined ? prop.Order.action.trade.analysis : undefined,
|
2529
|
+
summary: prop.Order.action.trade.summary !== undefined ? prop.Order.action.trade.summary : undefined,
|
2530
|
+
confidence: prop.Order.action.trade.confidence !== undefined ? prop.Order.action.trade.confidence : undefined,
|
2531
|
+
timestamp: prop.Order.action.trade.timestamp !== undefined ? prop.Order.action.trade.timestamp : undefined,
|
2532
|
+
status: prop.Order.action.trade.status !== undefined ? prop.Order.action.trade.status : undefined,
|
2533
|
+
},
|
2534
|
+
}
|
2535
|
+
} : undefined,
|
1124
2536
|
},
|
1125
2537
|
}
|
1126
2538
|
} : undefined,
|
@@ -1306,6 +2718,161 @@ exports.StopLoss = {
|
|
1306
2718
|
bidPrice: prop.Order.asset.bidPrice !== undefined ? {
|
1307
2719
|
set: prop.Order.asset.bidPrice
|
1308
2720
|
} : undefined,
|
2721
|
+
trades: prop.Order.asset.trades ? {
|
2722
|
+
upsert: prop.Order.asset.trades.map((item) => ({
|
2723
|
+
where: {
|
2724
|
+
id: item.id !== undefined ? item.id : undefined,
|
2725
|
+
},
|
2726
|
+
update: {
|
2727
|
+
id: item.id !== undefined ? {
|
2728
|
+
set: item.id
|
2729
|
+
} : undefined,
|
2730
|
+
qty: item.qty !== undefined ? {
|
2731
|
+
set: item.qty
|
2732
|
+
} : undefined,
|
2733
|
+
price: item.price !== undefined ? {
|
2734
|
+
set: item.price
|
2735
|
+
} : undefined,
|
2736
|
+
total: item.total !== undefined ? {
|
2737
|
+
set: item.total
|
2738
|
+
} : undefined,
|
2739
|
+
optionType: item.optionType !== undefined ? {
|
2740
|
+
set: item.optionType
|
2741
|
+
} : undefined,
|
2742
|
+
signal: item.signal !== undefined ? {
|
2743
|
+
set: item.signal
|
2744
|
+
} : undefined,
|
2745
|
+
strategy: item.strategy !== undefined ? {
|
2746
|
+
set: item.strategy
|
2747
|
+
} : undefined,
|
2748
|
+
analysis: item.analysis !== undefined ? {
|
2749
|
+
set: item.analysis
|
2750
|
+
} : undefined,
|
2751
|
+
summary: item.summary !== undefined ? {
|
2752
|
+
set: item.summary
|
2753
|
+
} : undefined,
|
2754
|
+
confidence: item.confidence !== undefined ? {
|
2755
|
+
set: item.confidence
|
2756
|
+
} : undefined,
|
2757
|
+
timestamp: item.timestamp !== undefined ? {
|
2758
|
+
set: item.timestamp
|
2759
|
+
} : undefined,
|
2760
|
+
status: item.status !== undefined ? {
|
2761
|
+
set: item.status
|
2762
|
+
} : undefined,
|
2763
|
+
},
|
2764
|
+
create: {
|
2765
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2766
|
+
price: item.price !== undefined ? item.price : undefined,
|
2767
|
+
total: item.total !== undefined ? item.total : undefined,
|
2768
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2769
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2770
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2771
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2772
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2773
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2774
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2775
|
+
status: item.status !== undefined ? item.status : undefined,
|
2776
|
+
},
|
2777
|
+
}))
|
2778
|
+
} : undefined,
|
2779
|
+
positions: prop.Order.asset.positions ? {
|
2780
|
+
upsert: prop.Order.asset.positions.map((item) => ({
|
2781
|
+
where: {
|
2782
|
+
id: item.id !== undefined ? item.id : undefined,
|
2783
|
+
},
|
2784
|
+
update: {
|
2785
|
+
id: item.id !== undefined ? {
|
2786
|
+
set: item.id
|
2787
|
+
} : undefined,
|
2788
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? {
|
2789
|
+
set: item.averageEntryPrice
|
2790
|
+
} : undefined,
|
2791
|
+
qty: item.qty !== undefined ? {
|
2792
|
+
set: item.qty
|
2793
|
+
} : undefined,
|
2794
|
+
qtyAvailable: item.qtyAvailable !== undefined ? {
|
2795
|
+
set: item.qtyAvailable
|
2796
|
+
} : undefined,
|
2797
|
+
marketValue: item.marketValue !== undefined ? {
|
2798
|
+
set: item.marketValue
|
2799
|
+
} : undefined,
|
2800
|
+
costBasis: item.costBasis !== undefined ? {
|
2801
|
+
set: item.costBasis
|
2802
|
+
} : undefined,
|
2803
|
+
unrealizedPL: item.unrealizedPL !== undefined ? {
|
2804
|
+
set: item.unrealizedPL
|
2805
|
+
} : undefined,
|
2806
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
|
2807
|
+
set: item.unrealizedPLPC
|
2808
|
+
} : undefined,
|
2809
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
|
2810
|
+
set: item.unrealisedIntradayPL
|
2811
|
+
} : undefined,
|
2812
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
|
2813
|
+
set: item.unrealisedIntradayPLPC
|
2814
|
+
} : undefined,
|
2815
|
+
currentPrice: item.currentPrice !== undefined ? {
|
2816
|
+
set: item.currentPrice
|
2817
|
+
} : undefined,
|
2818
|
+
lastTradePrice: item.lastTradePrice !== undefined ? {
|
2819
|
+
set: item.lastTradePrice
|
2820
|
+
} : undefined,
|
2821
|
+
changeToday: item.changeToday !== undefined ? {
|
2822
|
+
set: item.changeToday
|
2823
|
+
} : undefined,
|
2824
|
+
assetMarginable: item.assetMarginable !== undefined ? {
|
2825
|
+
set: item.assetMarginable
|
2826
|
+
} : undefined,
|
2827
|
+
},
|
2828
|
+
create: {
|
2829
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2830
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2831
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2832
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2833
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2834
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2835
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2836
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2837
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2838
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2839
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2840
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2841
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2842
|
+
},
|
2843
|
+
}))
|
2844
|
+
} : undefined,
|
2845
|
+
newsMentions: prop.Order.asset.newsMentions ? {
|
2846
|
+
upsert: prop.Order.asset.newsMentions.map((item) => ({
|
2847
|
+
where: {
|
2848
|
+
id: item.id !== undefined ? item.id : undefined,
|
2849
|
+
url: item.url !== undefined ? item.url : undefined,
|
2850
|
+
},
|
2851
|
+
update: {
|
2852
|
+
id: item.id !== undefined ? {
|
2853
|
+
set: item.id
|
2854
|
+
} : undefined,
|
2855
|
+
url: item.url !== undefined ? {
|
2856
|
+
set: item.url
|
2857
|
+
} : undefined,
|
2858
|
+
relevancyScore: item.relevancyScore !== undefined ? {
|
2859
|
+
set: item.relevancyScore
|
2860
|
+
} : undefined,
|
2861
|
+
sentimentScore: item.sentimentScore !== undefined ? {
|
2862
|
+
set: item.sentimentScore
|
2863
|
+
} : undefined,
|
2864
|
+
sentimentLabel: item.sentimentLabel !== undefined ? {
|
2865
|
+
set: item.sentimentLabel
|
2866
|
+
} : undefined,
|
2867
|
+
},
|
2868
|
+
create: {
|
2869
|
+
url: item.url !== undefined ? item.url : undefined,
|
2870
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
2871
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
2872
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
2873
|
+
},
|
2874
|
+
}))
|
2875
|
+
} : undefined,
|
1309
2876
|
},
|
1310
2877
|
create: {
|
1311
2878
|
symbol: prop.Order.asset.symbol !== undefined ? prop.Order.asset.symbol : undefined,
|
@@ -1363,6 +2930,77 @@ exports.StopLoss = {
|
|
1363
2930
|
exDividendDate: prop.Order.asset.exDividendDate !== undefined ? prop.Order.asset.exDividendDate : undefined,
|
1364
2931
|
askPrice: prop.Order.asset.askPrice !== undefined ? prop.Order.asset.askPrice : undefined,
|
1365
2932
|
bidPrice: prop.Order.asset.bidPrice !== undefined ? prop.Order.asset.bidPrice : undefined,
|
2933
|
+
trades: prop.Order.asset.trades ?
|
2934
|
+
Array.isArray(prop.Order.asset.trades) && prop.Order.asset.trades.length > 0 && prop.Order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2935
|
+
connect: prop.Order.asset.trades.map((item) => ({
|
2936
|
+
id: item.id
|
2937
|
+
}))
|
2938
|
+
}
|
2939
|
+
: { connectOrCreate: prop.Order.asset.trades.map((item) => ({
|
2940
|
+
where: {
|
2941
|
+
id: item.id !== undefined ? item.id : undefined,
|
2942
|
+
},
|
2943
|
+
create: {
|
2944
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2945
|
+
price: item.price !== undefined ? item.price : undefined,
|
2946
|
+
total: item.total !== undefined ? item.total : undefined,
|
2947
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
2948
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2949
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2950
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2951
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
2952
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2953
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2954
|
+
status: item.status !== undefined ? item.status : undefined,
|
2955
|
+
},
|
2956
|
+
}))
|
2957
|
+
} : undefined,
|
2958
|
+
positions: prop.Order.asset.positions ?
|
2959
|
+
Array.isArray(prop.Order.asset.positions) && prop.Order.asset.positions.length > 0 && prop.Order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2960
|
+
connect: prop.Order.asset.positions.map((item) => ({
|
2961
|
+
id: item.id
|
2962
|
+
}))
|
2963
|
+
}
|
2964
|
+
: { connectOrCreate: prop.Order.asset.positions.map((item) => ({
|
2965
|
+
where: {
|
2966
|
+
id: item.id !== undefined ? item.id : undefined,
|
2967
|
+
},
|
2968
|
+
create: {
|
2969
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2970
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2971
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2972
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2973
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2974
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2975
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2976
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2977
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2978
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2979
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2980
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2981
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2982
|
+
},
|
2983
|
+
}))
|
2984
|
+
} : undefined,
|
2985
|
+
newsMentions: prop.Order.asset.newsMentions ?
|
2986
|
+
Array.isArray(prop.Order.asset.newsMentions) && prop.Order.asset.newsMentions.length > 0 && prop.Order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
2987
|
+
connect: prop.Order.asset.newsMentions.map((item) => ({
|
2988
|
+
id: item.id
|
2989
|
+
}))
|
2990
|
+
}
|
2991
|
+
: { connectOrCreate: prop.Order.asset.newsMentions.map((item) => ({
|
2992
|
+
where: {
|
2993
|
+
id: item.id !== undefined ? item.id : undefined,
|
2994
|
+
url: item.url !== undefined ? item.url : undefined,
|
2995
|
+
},
|
2996
|
+
create: {
|
2997
|
+
url: item.url !== undefined ? item.url : undefined,
|
2998
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
2999
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
3000
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
3001
|
+
},
|
3002
|
+
}))
|
3003
|
+
} : undefined,
|
1366
3004
|
},
|
1367
3005
|
}
|
1368
3006
|
} : undefined,
|
@@ -1426,6 +3064,104 @@ exports.StopLoss = {
|
|
1426
3064
|
maxOrderSize: prop.Order.alpacaAccount.maxOrderSize !== undefined ? prop.Order.alpacaAccount.maxOrderSize : undefined,
|
1427
3065
|
minPercentageChange: prop.Order.alpacaAccount.minPercentageChange !== undefined ? prop.Order.alpacaAccount.minPercentageChange : undefined,
|
1428
3066
|
volumeThreshold: prop.Order.alpacaAccount.volumeThreshold !== undefined ? prop.Order.alpacaAccount.volumeThreshold : undefined,
|
3067
|
+
user: prop.Order.alpacaAccount.user ?
|
3068
|
+
typeof prop.Order.alpacaAccount.user === 'object' && Object.keys(prop.Order.alpacaAccount.user).length === 1 && Object.keys(prop.Order.alpacaAccount.user)[0] === 'id'
|
3069
|
+
? { connect: {
|
3070
|
+
id: prop.Order.alpacaAccount.user.id
|
3071
|
+
}
|
3072
|
+
}
|
3073
|
+
: { connectOrCreate: {
|
3074
|
+
where: {
|
3075
|
+
id: prop.Order.alpacaAccount.user.id !== undefined ? prop.Order.alpacaAccount.user.id : undefined,
|
3076
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? prop.Order.alpacaAccount.user.email : undefined,
|
3077
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? {
|
3078
|
+
equals: prop.Order.alpacaAccount.user.name
|
3079
|
+
} : undefined,
|
3080
|
+
},
|
3081
|
+
create: {
|
3082
|
+
name: prop.Order.alpacaAccount.user.name !== undefined ? prop.Order.alpacaAccount.user.name : undefined,
|
3083
|
+
email: prop.Order.alpacaAccount.user.email !== undefined ? prop.Order.alpacaAccount.user.email : undefined,
|
3084
|
+
emailVerified: prop.Order.alpacaAccount.user.emailVerified !== undefined ? prop.Order.alpacaAccount.user.emailVerified : undefined,
|
3085
|
+
image: prop.Order.alpacaAccount.user.image !== undefined ? prop.Order.alpacaAccount.user.image : undefined,
|
3086
|
+
role: prop.Order.alpacaAccount.user.role !== undefined ? prop.Order.alpacaAccount.user.role : undefined,
|
3087
|
+
bio: prop.Order.alpacaAccount.user.bio !== undefined ? prop.Order.alpacaAccount.user.bio : undefined,
|
3088
|
+
jobTitle: prop.Order.alpacaAccount.user.jobTitle !== undefined ? prop.Order.alpacaAccount.user.jobTitle : undefined,
|
3089
|
+
currentAccount: prop.Order.alpacaAccount.user.currentAccount !== undefined ? prop.Order.alpacaAccount.user.currentAccount : undefined,
|
3090
|
+
plan: prop.Order.alpacaAccount.user.plan !== undefined ? prop.Order.alpacaAccount.user.plan : undefined,
|
3091
|
+
openaiAPIKey: prop.Order.alpacaAccount.user.openaiAPIKey !== undefined ? prop.Order.alpacaAccount.user.openaiAPIKey : undefined,
|
3092
|
+
openaiModel: prop.Order.alpacaAccount.user.openaiModel !== undefined ? prop.Order.alpacaAccount.user.openaiModel : undefined,
|
3093
|
+
},
|
3094
|
+
}
|
3095
|
+
} : undefined,
|
3096
|
+
trades: prop.Order.alpacaAccount.trades ?
|
3097
|
+
Array.isArray(prop.Order.alpacaAccount.trades) && prop.Order.alpacaAccount.trades.length > 0 && prop.Order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3098
|
+
connect: prop.Order.alpacaAccount.trades.map((item) => ({
|
3099
|
+
id: item.id
|
3100
|
+
}))
|
3101
|
+
}
|
3102
|
+
: { connectOrCreate: prop.Order.alpacaAccount.trades.map((item) => ({
|
3103
|
+
where: {
|
3104
|
+
id: item.id !== undefined ? item.id : undefined,
|
3105
|
+
},
|
3106
|
+
create: {
|
3107
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3108
|
+
price: item.price !== undefined ? item.price : undefined,
|
3109
|
+
total: item.total !== undefined ? item.total : undefined,
|
3110
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3111
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
3112
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
3113
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
3114
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
3115
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
3116
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
3117
|
+
status: item.status !== undefined ? item.status : undefined,
|
3118
|
+
},
|
3119
|
+
}))
|
3120
|
+
} : undefined,
|
3121
|
+
positions: prop.Order.alpacaAccount.positions ?
|
3122
|
+
Array.isArray(prop.Order.alpacaAccount.positions) && prop.Order.alpacaAccount.positions.length > 0 && prop.Order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3123
|
+
connect: prop.Order.alpacaAccount.positions.map((item) => ({
|
3124
|
+
id: item.id
|
3125
|
+
}))
|
3126
|
+
}
|
3127
|
+
: { connectOrCreate: prop.Order.alpacaAccount.positions.map((item) => ({
|
3128
|
+
where: {
|
3129
|
+
id: item.id !== undefined ? item.id : undefined,
|
3130
|
+
},
|
3131
|
+
create: {
|
3132
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
3133
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3134
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
3135
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
3136
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
3137
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
3138
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
3139
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
3140
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
3141
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
3142
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
3143
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
3144
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
3145
|
+
},
|
3146
|
+
}))
|
3147
|
+
} : undefined,
|
3148
|
+
alerts: prop.Order.alpacaAccount.alerts ?
|
3149
|
+
Array.isArray(prop.Order.alpacaAccount.alerts) && prop.Order.alpacaAccount.alerts.length > 0 && prop.Order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3150
|
+
connect: prop.Order.alpacaAccount.alerts.map((item) => ({
|
3151
|
+
id: item.id
|
3152
|
+
}))
|
3153
|
+
}
|
3154
|
+
: { connectOrCreate: prop.Order.alpacaAccount.alerts.map((item) => ({
|
3155
|
+
where: {
|
3156
|
+
id: item.id !== undefined ? item.id : undefined,
|
3157
|
+
},
|
3158
|
+
create: {
|
3159
|
+
message: item.message !== undefined ? item.message : undefined,
|
3160
|
+
type: item.type !== undefined ? item.type : undefined,
|
3161
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
3162
|
+
},
|
3163
|
+
}))
|
3164
|
+
} : undefined,
|
1429
3165
|
},
|
1430
3166
|
}
|
1431
3167
|
} : undefined,
|
@@ -1445,6 +3181,31 @@ exports.StopLoss = {
|
|
1445
3181
|
note: prop.Order.action.note !== undefined ? prop.Order.action.note : undefined,
|
1446
3182
|
status: prop.Order.action.status !== undefined ? prop.Order.action.status : undefined,
|
1447
3183
|
fee: prop.Order.action.fee !== undefined ? prop.Order.action.fee : undefined,
|
3184
|
+
trade: prop.Order.action.trade ?
|
3185
|
+
typeof prop.Order.action.trade === 'object' && Object.keys(prop.Order.action.trade).length === 1 && Object.keys(prop.Order.action.trade)[0] === 'id'
|
3186
|
+
? { connect: {
|
3187
|
+
id: prop.Order.action.trade.id
|
3188
|
+
}
|
3189
|
+
}
|
3190
|
+
: { connectOrCreate: {
|
3191
|
+
where: {
|
3192
|
+
id: prop.Order.action.trade.id !== undefined ? prop.Order.action.trade.id : undefined,
|
3193
|
+
},
|
3194
|
+
create: {
|
3195
|
+
qty: prop.Order.action.trade.qty !== undefined ? prop.Order.action.trade.qty : undefined,
|
3196
|
+
price: prop.Order.action.trade.price !== undefined ? prop.Order.action.trade.price : undefined,
|
3197
|
+
total: prop.Order.action.trade.total !== undefined ? prop.Order.action.trade.total : undefined,
|
3198
|
+
optionType: prop.Order.action.trade.optionType !== undefined ? prop.Order.action.trade.optionType : undefined,
|
3199
|
+
signal: prop.Order.action.trade.signal !== undefined ? prop.Order.action.trade.signal : undefined,
|
3200
|
+
strategy: prop.Order.action.trade.strategy !== undefined ? prop.Order.action.trade.strategy : undefined,
|
3201
|
+
analysis: prop.Order.action.trade.analysis !== undefined ? prop.Order.action.trade.analysis : undefined,
|
3202
|
+
summary: prop.Order.action.trade.summary !== undefined ? prop.Order.action.trade.summary : undefined,
|
3203
|
+
confidence: prop.Order.action.trade.confidence !== undefined ? prop.Order.action.trade.confidence : undefined,
|
3204
|
+
timestamp: prop.Order.action.trade.timestamp !== undefined ? prop.Order.action.trade.timestamp : undefined,
|
3205
|
+
status: prop.Order.action.trade.status !== undefined ? prop.Order.action.trade.status : undefined,
|
3206
|
+
},
|
3207
|
+
}
|
3208
|
+
} : undefined,
|
1448
3209
|
},
|
1449
3210
|
}
|
1450
3211
|
} : undefined,
|
@@ -1516,6 +3277,77 @@ exports.StopLoss = {
|
|
1516
3277
|
exDividendDate: prop.Order.asset.exDividendDate !== undefined ? prop.Order.asset.exDividendDate : undefined,
|
1517
3278
|
askPrice: prop.Order.asset.askPrice !== undefined ? prop.Order.asset.askPrice : undefined,
|
1518
3279
|
bidPrice: prop.Order.asset.bidPrice !== undefined ? prop.Order.asset.bidPrice : undefined,
|
3280
|
+
trades: prop.Order.asset.trades ?
|
3281
|
+
Array.isArray(prop.Order.asset.trades) && prop.Order.asset.trades.length > 0 && prop.Order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3282
|
+
connect: prop.Order.asset.trades.map((item) => ({
|
3283
|
+
id: item.id
|
3284
|
+
}))
|
3285
|
+
}
|
3286
|
+
: { connectOrCreate: prop.Order.asset.trades.map((item) => ({
|
3287
|
+
where: {
|
3288
|
+
id: item.id !== undefined ? item.id : undefined,
|
3289
|
+
},
|
3290
|
+
create: {
|
3291
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3292
|
+
price: item.price !== undefined ? item.price : undefined,
|
3293
|
+
total: item.total !== undefined ? item.total : undefined,
|
3294
|
+
optionType: item.optionType !== undefined ? item.optionType : undefined,
|
3295
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
3296
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
3297
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
3298
|
+
summary: item.summary !== undefined ? item.summary : undefined,
|
3299
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
3300
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
3301
|
+
status: item.status !== undefined ? item.status : undefined,
|
3302
|
+
},
|
3303
|
+
}))
|
3304
|
+
} : undefined,
|
3305
|
+
positions: prop.Order.asset.positions ?
|
3306
|
+
Array.isArray(prop.Order.asset.positions) && prop.Order.asset.positions.length > 0 && prop.Order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3307
|
+
connect: prop.Order.asset.positions.map((item) => ({
|
3308
|
+
id: item.id
|
3309
|
+
}))
|
3310
|
+
}
|
3311
|
+
: { connectOrCreate: prop.Order.asset.positions.map((item) => ({
|
3312
|
+
where: {
|
3313
|
+
id: item.id !== undefined ? item.id : undefined,
|
3314
|
+
},
|
3315
|
+
create: {
|
3316
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
3317
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
3318
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
3319
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
3320
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
3321
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
3322
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
3323
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
3324
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
3325
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
3326
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
3327
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
3328
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
3329
|
+
},
|
3330
|
+
}))
|
3331
|
+
} : undefined,
|
3332
|
+
newsMentions: prop.Order.asset.newsMentions ?
|
3333
|
+
Array.isArray(prop.Order.asset.newsMentions) && prop.Order.asset.newsMentions.length > 0 && prop.Order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
|
3334
|
+
connect: prop.Order.asset.newsMentions.map((item) => ({
|
3335
|
+
id: item.id
|
3336
|
+
}))
|
3337
|
+
}
|
3338
|
+
: { connectOrCreate: prop.Order.asset.newsMentions.map((item) => ({
|
3339
|
+
where: {
|
3340
|
+
id: item.id !== undefined ? item.id : undefined,
|
3341
|
+
url: item.url !== undefined ? item.url : undefined,
|
3342
|
+
},
|
3343
|
+
create: {
|
3344
|
+
url: item.url !== undefined ? item.url : undefined,
|
3345
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
3346
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
3347
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
3348
|
+
},
|
3349
|
+
}))
|
3350
|
+
} : undefined,
|
1519
3351
|
},
|
1520
3352
|
}
|
1521
3353
|
} : undefined,
|