adaptic-backend 1.0.75 → 1.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/Account.cjs +255 -190
  2. package/Action.cjs +594 -524
  3. package/Alert.cjs +343 -278
  4. package/AlpacaAccount.cjs +1181 -1021
  5. package/Asset.cjs +478 -368
  6. package/Authenticator.cjs +276 -211
  7. package/Customer.cjs +255 -190
  8. package/NewsArticle.cjs +232 -212
  9. package/NewsArticleAssetSentiment.cjs +345 -290
  10. package/Order.cjs +676 -541
  11. package/Position.cjs +603 -488
  12. package/Session.cjs +279 -214
  13. package/Trade.cjs +748 -613
  14. package/User.cjs +394 -309
  15. package/package.json +1 -1
  16. package/server/Account.d.ts.map +1 -1
  17. package/server/Account.js.map +1 -1
  18. package/server/Account.mjs +255 -190
  19. package/server/Action.d.ts.map +1 -1
  20. package/server/Action.js.map +1 -1
  21. package/server/Action.mjs +594 -524
  22. package/server/Alert.d.ts.map +1 -1
  23. package/server/Alert.js.map +1 -1
  24. package/server/Alert.mjs +343 -278
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +1181 -1021
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +478 -368
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +276 -211
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +255 -190
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +232 -212
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +345 -290
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +676 -541
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +603 -488
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +279 -214
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +748 -613
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +394 -309
package/Alert.cjs CHANGED
@@ -286,108 +286,133 @@ exports.Alert = {
286
286
  message: props.message !== undefined ? props.message : undefined,
287
287
  type: props.type !== undefined ? props.type : undefined,
288
288
  isRead: props.isRead !== undefined ? props.isRead : undefined,
289
- alpacaAccount: props.alpacaAccount ? {
290
- connectOrCreate: {
291
- where: {
292
- id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
293
- },
294
- create: {
295
- type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
296
- APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
297
- APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
298
- configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
299
- marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
300
- user: props.alpacaAccount.user ? {
301
- connectOrCreate: {
302
- where: {
303
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
304
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
305
- name: props.alpacaAccount.user.name !== undefined ? {
306
- equals: props.alpacaAccount.user.name
307
- } : undefined,
308
- },
309
- create: {
310
- name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
311
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
312
- emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
313
- image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
314
- role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
315
- bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
316
- jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
317
- currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
318
- plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
319
- },
320
- }
321
- } : undefined,
322
- trades: props.alpacaAccount.trades ? {
323
- connectOrCreate: props.alpacaAccount.trades.map((item) => ({
324
- where: {
325
- id: item.id !== undefined ? item.id : undefined,
326
- },
327
- create: {
328
- qty: item.qty !== undefined ? item.qty : undefined,
329
- price: item.price !== undefined ? item.price : undefined,
330
- total: item.total !== undefined ? item.total : undefined,
331
- signal: item.signal !== undefined ? item.signal : undefined,
332
- strategy: item.strategy !== undefined ? item.strategy : undefined,
333
- analysis: item.analysis !== undefined ? item.analysis : undefined,
334
- confidence: item.confidence !== undefined ? item.confidence : undefined,
335
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
336
- status: item.status !== undefined ? item.status : undefined,
337
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
338
- },
339
- }))
340
- } : undefined,
341
- orders: props.alpacaAccount.orders ? {
342
- connectOrCreate: props.alpacaAccount.orders.map((item) => ({
343
- where: {
344
- id: item.id !== undefined ? item.id : undefined,
345
- },
346
- create: {
347
- qty: item.qty !== undefined ? item.qty : undefined,
348
- notional: item.notional !== undefined ? item.notional : undefined,
349
- side: item.side !== undefined ? item.side : undefined,
350
- type: item.type !== undefined ? item.type : undefined,
351
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
352
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
353
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
354
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
355
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
356
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
357
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
358
- status: item.status !== undefined ? item.status : undefined,
359
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
360
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
361
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
362
- fee: item.fee !== undefined ? item.fee : undefined,
363
- },
364
- }))
365
- } : undefined,
366
- positions: props.alpacaAccount.positions ? {
367
- connectOrCreate: props.alpacaAccount.positions.map((item) => ({
368
- where: {
369
- id: item.id !== undefined ? item.id : undefined,
370
- },
371
- create: {
372
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
373
- qty: item.qty !== undefined ? item.qty : undefined,
374
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
375
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
376
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
377
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
378
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
379
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
380
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
381
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
382
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
383
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
384
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
385
- },
386
- }))
387
- } : undefined,
388
- },
389
- }
390
- } : undefined,
289
+ alpacaAccount: props.alpacaAccount ?
290
+ typeof props.alpacaAccount === 'object' && Object.keys(props.alpacaAccount).length === 1 && Object.keys(props.alpacaAccount)[0] === 'id'
291
+ ? { connect: {
292
+ id: props.alpacaAccount.id
293
+ }
294
+ }
295
+ : { connectOrCreate: {
296
+ where: {
297
+ id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
298
+ },
299
+ create: {
300
+ type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
301
+ APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
302
+ APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
303
+ configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
304
+ marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
305
+ user: props.alpacaAccount.user ?
306
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
307
+ ? { connect: {
308
+ id: props.alpacaAccount.user.id
309
+ }
310
+ }
311
+ : { connectOrCreate: {
312
+ where: {
313
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
314
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
315
+ name: props.alpacaAccount.user.name !== undefined ? {
316
+ equals: props.alpacaAccount.user.name
317
+ } : undefined,
318
+ },
319
+ create: {
320
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
321
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
322
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
323
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
324
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
325
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
326
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
327
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
328
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
329
+ },
330
+ }
331
+ } : undefined,
332
+ trades: props.alpacaAccount.trades ?
333
+ typeof props.alpacaAccount.trades[0] === 'object' && Object.keys(props.alpacaAccount.trades).length === 1 && Object.keys(props.alpacaAccount.trades)[0] === 'id'
334
+ ? { connect: props.alpacaAccount.trades.map((item) => ({
335
+ id: item.id
336
+ }))
337
+ }
338
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
339
+ where: {
340
+ id: item.id !== undefined ? item.id : undefined,
341
+ },
342
+ create: {
343
+ qty: item.qty !== undefined ? item.qty : undefined,
344
+ price: item.price !== undefined ? item.price : undefined,
345
+ total: item.total !== undefined ? item.total : undefined,
346
+ signal: item.signal !== undefined ? item.signal : undefined,
347
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
348
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
349
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
350
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
351
+ status: item.status !== undefined ? item.status : undefined,
352
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
353
+ },
354
+ }))
355
+ } : undefined,
356
+ orders: props.alpacaAccount.orders ?
357
+ typeof props.alpacaAccount.orders[0] === 'object' && Object.keys(props.alpacaAccount.orders).length === 1 && Object.keys(props.alpacaAccount.orders)[0] === 'id'
358
+ ? { connect: props.alpacaAccount.orders.map((item) => ({
359
+ id: item.id
360
+ }))
361
+ }
362
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
363
+ where: {
364
+ id: item.id !== undefined ? item.id : undefined,
365
+ },
366
+ create: {
367
+ qty: item.qty !== undefined ? item.qty : undefined,
368
+ notional: item.notional !== undefined ? item.notional : undefined,
369
+ side: item.side !== undefined ? item.side : undefined,
370
+ type: item.type !== undefined ? item.type : undefined,
371
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
372
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
373
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
374
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
375
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
376
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
377
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
378
+ status: item.status !== undefined ? item.status : undefined,
379
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
380
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
381
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
382
+ fee: item.fee !== undefined ? item.fee : undefined,
383
+ },
384
+ }))
385
+ } : undefined,
386
+ positions: props.alpacaAccount.positions ?
387
+ typeof props.alpacaAccount.positions[0] === 'object' && Object.keys(props.alpacaAccount.positions).length === 1 && Object.keys(props.alpacaAccount.positions)[0] === 'id'
388
+ ? { connect: props.alpacaAccount.positions.map((item) => ({
389
+ id: item.id
390
+ }))
391
+ }
392
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
393
+ where: {
394
+ id: item.id !== undefined ? item.id : undefined,
395
+ },
396
+ create: {
397
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
398
+ qty: item.qty !== undefined ? item.qty : undefined,
399
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
400
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
401
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
402
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
403
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
404
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
405
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
406
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
407
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
408
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
409
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
410
+ },
411
+ }))
412
+ } : undefined,
413
+ },
414
+ }
415
+ } : undefined,
391
416
  },
392
417
  };
393
418
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);
@@ -1029,94 +1054,114 @@ exports.Alert = {
1029
1054
  APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
1030
1055
  configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
1031
1056
  marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
1032
- user: props.alpacaAccount.user ? {
1033
- connectOrCreate: {
1034
- where: {
1035
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1036
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1037
- name: props.alpacaAccount.user.name !== undefined ? {
1038
- equals: props.alpacaAccount.user.name
1039
- } : undefined,
1040
- },
1041
- create: {
1042
- name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1043
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1044
- emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1045
- image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1046
- role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1047
- bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1048
- jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1049
- currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1050
- plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1051
- },
1052
- }
1053
- } : undefined,
1054
- trades: props.alpacaAccount.trades ? {
1055
- connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1056
- where: {
1057
- id: item.id !== undefined ? item.id : undefined,
1058
- },
1059
- create: {
1060
- qty: item.qty !== undefined ? item.qty : undefined,
1061
- price: item.price !== undefined ? item.price : undefined,
1062
- total: item.total !== undefined ? item.total : undefined,
1063
- signal: item.signal !== undefined ? item.signal : undefined,
1064
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1065
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1066
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1067
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1068
- status: item.status !== undefined ? item.status : undefined,
1069
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1070
- },
1071
- }))
1072
- } : undefined,
1073
- orders: props.alpacaAccount.orders ? {
1074
- connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1075
- where: {
1076
- id: item.id !== undefined ? item.id : undefined,
1077
- },
1078
- create: {
1079
- qty: item.qty !== undefined ? item.qty : undefined,
1080
- notional: item.notional !== undefined ? item.notional : undefined,
1081
- side: item.side !== undefined ? item.side : undefined,
1082
- type: item.type !== undefined ? item.type : undefined,
1083
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1084
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1085
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1086
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1087
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1088
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1089
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1090
- status: item.status !== undefined ? item.status : undefined,
1091
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1092
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1093
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1094
- fee: item.fee !== undefined ? item.fee : undefined,
1095
- },
1096
- }))
1097
- } : undefined,
1098
- positions: props.alpacaAccount.positions ? {
1099
- connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1100
- where: {
1101
- id: item.id !== undefined ? item.id : undefined,
1102
- },
1103
- create: {
1104
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1105
- qty: item.qty !== undefined ? item.qty : undefined,
1106
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1107
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1108
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1109
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1110
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1111
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1112
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1113
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1114
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1115
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1116
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1117
- },
1118
- }))
1119
- } : undefined,
1057
+ user: props.alpacaAccount.user ?
1058
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
1059
+ ? { connect: {
1060
+ id: props.alpacaAccount.user.id
1061
+ }
1062
+ }
1063
+ : { connectOrCreate: {
1064
+ where: {
1065
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1066
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1067
+ name: props.alpacaAccount.user.name !== undefined ? {
1068
+ equals: props.alpacaAccount.user.name
1069
+ } : undefined,
1070
+ },
1071
+ create: {
1072
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1073
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1074
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1075
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1076
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1077
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1078
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1079
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1080
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1081
+ },
1082
+ }
1083
+ } : undefined,
1084
+ trades: props.alpacaAccount.trades ?
1085
+ typeof props.alpacaAccount.trades[0] === 'object' && Object.keys(props.alpacaAccount.trades).length === 1 && Object.keys(props.alpacaAccount.trades)[0] === 'id'
1086
+ ? { connect: props.alpacaAccount.trades.map((item) => ({
1087
+ id: item.id
1088
+ }))
1089
+ }
1090
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1091
+ where: {
1092
+ id: item.id !== undefined ? item.id : undefined,
1093
+ },
1094
+ create: {
1095
+ qty: item.qty !== undefined ? item.qty : undefined,
1096
+ price: item.price !== undefined ? item.price : undefined,
1097
+ total: item.total !== undefined ? item.total : undefined,
1098
+ signal: item.signal !== undefined ? item.signal : undefined,
1099
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1100
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1101
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1102
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1103
+ status: item.status !== undefined ? item.status : undefined,
1104
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1105
+ },
1106
+ }))
1107
+ } : undefined,
1108
+ orders: props.alpacaAccount.orders ?
1109
+ typeof props.alpacaAccount.orders[0] === 'object' && Object.keys(props.alpacaAccount.orders).length === 1 && Object.keys(props.alpacaAccount.orders)[0] === 'id'
1110
+ ? { connect: props.alpacaAccount.orders.map((item) => ({
1111
+ id: item.id
1112
+ }))
1113
+ }
1114
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1115
+ where: {
1116
+ id: item.id !== undefined ? item.id : undefined,
1117
+ },
1118
+ create: {
1119
+ qty: item.qty !== undefined ? item.qty : undefined,
1120
+ notional: item.notional !== undefined ? item.notional : undefined,
1121
+ side: item.side !== undefined ? item.side : undefined,
1122
+ type: item.type !== undefined ? item.type : undefined,
1123
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1124
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1125
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1126
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1127
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1128
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1129
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1130
+ status: item.status !== undefined ? item.status : undefined,
1131
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1132
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1133
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1134
+ fee: item.fee !== undefined ? item.fee : undefined,
1135
+ },
1136
+ }))
1137
+ } : undefined,
1138
+ positions: props.alpacaAccount.positions ?
1139
+ typeof props.alpacaAccount.positions[0] === 'object' && Object.keys(props.alpacaAccount.positions).length === 1 && Object.keys(props.alpacaAccount.positions)[0] === 'id'
1140
+ ? { connect: props.alpacaAccount.positions.map((item) => ({
1141
+ id: item.id
1142
+ }))
1143
+ }
1144
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1145
+ where: {
1146
+ id: item.id !== undefined ? item.id : undefined,
1147
+ },
1148
+ create: {
1149
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1150
+ qty: item.qty !== undefined ? item.qty : undefined,
1151
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1152
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1153
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1154
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1155
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1156
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1157
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1158
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1159
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1160
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1161
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1162
+ },
1163
+ }))
1164
+ } : undefined,
1120
1165
  },
1121
1166
  }
1122
1167
  } : undefined,
@@ -1464,94 +1509,114 @@ exports.Alert = {
1464
1509
  APISecret: prop.alpacaAccount.APISecret !== undefined ? prop.alpacaAccount.APISecret : undefined,
1465
1510
  configuration: prop.alpacaAccount.configuration !== undefined ? prop.alpacaAccount.configuration : undefined,
1466
1511
  marketOpen: prop.alpacaAccount.marketOpen !== undefined ? prop.alpacaAccount.marketOpen : undefined,
1467
- user: prop.alpacaAccount.user ? {
1468
- connectOrCreate: {
1469
- where: {
1470
- id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1471
- email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1472
- name: prop.alpacaAccount.user.name !== undefined ? {
1473
- equals: prop.alpacaAccount.user.name
1474
- } : undefined,
1475
- },
1476
- create: {
1477
- name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1478
- email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1479
- emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1480
- image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1481
- role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1482
- bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1483
- jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1484
- currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1485
- plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1486
- },
1487
- }
1488
- } : undefined,
1489
- trades: prop.alpacaAccount.trades ? {
1490
- connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1491
- where: {
1492
- id: item.id !== undefined ? item.id : undefined,
1493
- },
1494
- create: {
1495
- qty: item.qty !== undefined ? item.qty : undefined,
1496
- price: item.price !== undefined ? item.price : undefined,
1497
- total: item.total !== undefined ? item.total : undefined,
1498
- signal: item.signal !== undefined ? item.signal : undefined,
1499
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1500
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1501
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1502
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1503
- status: item.status !== undefined ? item.status : undefined,
1504
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1505
- },
1506
- }))
1507
- } : undefined,
1508
- orders: prop.alpacaAccount.orders ? {
1509
- connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1510
- where: {
1511
- id: item.id !== undefined ? item.id : undefined,
1512
- },
1513
- create: {
1514
- qty: item.qty !== undefined ? item.qty : undefined,
1515
- notional: item.notional !== undefined ? item.notional : undefined,
1516
- side: item.side !== undefined ? item.side : undefined,
1517
- type: item.type !== undefined ? item.type : undefined,
1518
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1519
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1520
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1521
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1522
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1523
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1524
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1525
- status: item.status !== undefined ? item.status : undefined,
1526
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1527
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1528
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1529
- fee: item.fee !== undefined ? item.fee : undefined,
1530
- },
1531
- }))
1532
- } : undefined,
1533
- positions: prop.alpacaAccount.positions ? {
1534
- connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1535
- where: {
1536
- id: item.id !== undefined ? item.id : undefined,
1537
- },
1538
- create: {
1539
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1540
- qty: item.qty !== undefined ? item.qty : undefined,
1541
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1542
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1543
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1544
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1545
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1546
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1547
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1548
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1549
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1550
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1551
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1552
- },
1553
- }))
1554
- } : undefined,
1512
+ user: prop.alpacaAccount.user ?
1513
+ typeof prop.alpacaAccount.user === 'object' && Object.keys(prop.alpacaAccount.user).length === 1 && Object.keys(prop.alpacaAccount.user)[0] === 'id'
1514
+ ? { connect: {
1515
+ id: prop.alpacaAccount.user.id
1516
+ }
1517
+ }
1518
+ : { connectOrCreate: {
1519
+ where: {
1520
+ id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1521
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1522
+ name: prop.alpacaAccount.user.name !== undefined ? {
1523
+ equals: prop.alpacaAccount.user.name
1524
+ } : undefined,
1525
+ },
1526
+ create: {
1527
+ name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1528
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1529
+ emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1530
+ image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1531
+ role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1532
+ bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1533
+ jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1534
+ currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1535
+ plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1536
+ },
1537
+ }
1538
+ } : undefined,
1539
+ trades: prop.alpacaAccount.trades ?
1540
+ typeof prop.alpacaAccount.trades[0] === 'object' && Object.keys(prop.alpacaAccount.trades).length === 1 && Object.keys(prop.alpacaAccount.trades)[0] === 'id'
1541
+ ? { connect: prop.alpacaAccount.trades.map((item) => ({
1542
+ id: item.id
1543
+ }))
1544
+ }
1545
+ : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1546
+ where: {
1547
+ id: item.id !== undefined ? item.id : undefined,
1548
+ },
1549
+ create: {
1550
+ qty: item.qty !== undefined ? item.qty : undefined,
1551
+ price: item.price !== undefined ? item.price : undefined,
1552
+ total: item.total !== undefined ? item.total : undefined,
1553
+ signal: item.signal !== undefined ? item.signal : undefined,
1554
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1555
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1556
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1557
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1558
+ status: item.status !== undefined ? item.status : undefined,
1559
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1560
+ },
1561
+ }))
1562
+ } : undefined,
1563
+ orders: prop.alpacaAccount.orders ?
1564
+ typeof prop.alpacaAccount.orders[0] === 'object' && Object.keys(prop.alpacaAccount.orders).length === 1 && Object.keys(prop.alpacaAccount.orders)[0] === 'id'
1565
+ ? { connect: prop.alpacaAccount.orders.map((item) => ({
1566
+ id: item.id
1567
+ }))
1568
+ }
1569
+ : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1570
+ where: {
1571
+ id: item.id !== undefined ? item.id : undefined,
1572
+ },
1573
+ create: {
1574
+ qty: item.qty !== undefined ? item.qty : undefined,
1575
+ notional: item.notional !== undefined ? item.notional : undefined,
1576
+ side: item.side !== undefined ? item.side : undefined,
1577
+ type: item.type !== undefined ? item.type : undefined,
1578
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1579
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1580
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1581
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1582
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1583
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1584
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1585
+ status: item.status !== undefined ? item.status : undefined,
1586
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1587
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1588
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1589
+ fee: item.fee !== undefined ? item.fee : undefined,
1590
+ },
1591
+ }))
1592
+ } : undefined,
1593
+ positions: prop.alpacaAccount.positions ?
1594
+ typeof prop.alpacaAccount.positions[0] === 'object' && Object.keys(prop.alpacaAccount.positions).length === 1 && Object.keys(prop.alpacaAccount.positions)[0] === 'id'
1595
+ ? { connect: prop.alpacaAccount.positions.map((item) => ({
1596
+ id: item.id
1597
+ }))
1598
+ }
1599
+ : { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1600
+ where: {
1601
+ id: item.id !== undefined ? item.id : undefined,
1602
+ },
1603
+ create: {
1604
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1605
+ qty: item.qty !== undefined ? item.qty : undefined,
1606
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1607
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1608
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1609
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1610
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1611
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1612
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1613
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1614
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1615
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1616
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1617
+ },
1618
+ }))
1619
+ } : undefined,
1555
1620
  },
1556
1621
  }
1557
1622
  } : undefined,