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.
- package/Account.cjs +255 -190
- package/Action.cjs +594 -524
- package/Alert.cjs +343 -278
- package/AlpacaAccount.cjs +1181 -1021
- package/Asset.cjs +478 -368
- package/Authenticator.cjs +276 -211
- package/Customer.cjs +255 -190
- package/NewsArticle.cjs +232 -212
- package/NewsArticleAssetSentiment.cjs +345 -290
- package/Order.cjs +676 -541
- package/Position.cjs +603 -488
- package/Session.cjs +279 -214
- package/Trade.cjs +748 -613
- package/User.cjs +394 -309
- package/package.json +1 -1
- package/server/Account.d.ts.map +1 -1
- package/server/Account.js.map +1 -1
- package/server/Account.mjs +255 -190
- package/server/Action.d.ts.map +1 -1
- package/server/Action.js.map +1 -1
- package/server/Action.mjs +594 -524
- package/server/Alert.d.ts.map +1 -1
- package/server/Alert.js.map +1 -1
- package/server/Alert.mjs +343 -278
- package/server/AlpacaAccount.d.ts.map +1 -1
- package/server/AlpacaAccount.js.map +1 -1
- package/server/AlpacaAccount.mjs +1181 -1021
- package/server/Asset.d.ts.map +1 -1
- package/server/Asset.js.map +1 -1
- package/server/Asset.mjs +478 -368
- package/server/Authenticator.d.ts.map +1 -1
- package/server/Authenticator.js.map +1 -1
- package/server/Authenticator.mjs +276 -211
- package/server/Customer.d.ts.map +1 -1
- package/server/Customer.js.map +1 -1
- package/server/Customer.mjs +255 -190
- package/server/NewsArticle.d.ts.map +1 -1
- package/server/NewsArticle.js.map +1 -1
- package/server/NewsArticle.mjs +232 -212
- package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
- package/server/NewsArticleAssetSentiment.js.map +1 -1
- package/server/NewsArticleAssetSentiment.mjs +345 -290
- package/server/Order.d.ts.map +1 -1
- package/server/Order.js.map +1 -1
- package/server/Order.mjs +676 -541
- package/server/Position.d.ts.map +1 -1
- package/server/Position.js.map +1 -1
- package/server/Position.mjs +603 -488
- package/server/Session.d.ts.map +1 -1
- package/server/Session.js.map +1 -1
- package/server/Session.mjs +279 -214
- package/server/Trade.d.ts.map +1 -1
- package/server/Trade.js.map +1 -1
- package/server/Trade.mjs +748 -613
- package/server/User.d.ts.map +1 -1
- package/server/User.js.map +1 -1
- package/server/User.mjs +394 -309
package/server/Order.mjs
CHANGED
@@ -297,249 +297,304 @@ export const Order = {
|
|
297
297
|
filledAt: props.filledAt !== undefined ? props.filledAt : undefined,
|
298
298
|
filledAvgPrice: props.filledAvgPrice !== undefined ? props.filledAvgPrice : undefined,
|
299
299
|
fee: props.fee !== undefined ? props.fee : undefined,
|
300
|
-
alpacaAccount: props.alpacaAccount ?
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
}
|
419
|
-
}
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
300
|
+
alpacaAccount: props.alpacaAccount ?
|
301
|
+
typeof props.alpacaAccount === 'object' && Object.keys(props.alpacaAccount).length === 1 && Object.keys(props.alpacaAccount)[0] === 'id'
|
302
|
+
? { connect: {
|
303
|
+
id: props.alpacaAccount.id
|
304
|
+
}
|
305
|
+
}
|
306
|
+
: { connectOrCreate: {
|
307
|
+
where: {
|
308
|
+
id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
|
309
|
+
},
|
310
|
+
create: {
|
311
|
+
type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
|
312
|
+
APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
|
313
|
+
APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
|
314
|
+
configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
|
315
|
+
marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
|
316
|
+
user: props.alpacaAccount.user ?
|
317
|
+
typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
|
318
|
+
? { connect: {
|
319
|
+
id: props.alpacaAccount.user.id
|
320
|
+
}
|
321
|
+
}
|
322
|
+
: { connectOrCreate: {
|
323
|
+
where: {
|
324
|
+
id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
|
325
|
+
email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
|
326
|
+
name: props.alpacaAccount.user.name !== undefined ? {
|
327
|
+
equals: props.alpacaAccount.user.name
|
328
|
+
} : undefined,
|
329
|
+
},
|
330
|
+
create: {
|
331
|
+
name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
|
332
|
+
email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
|
333
|
+
emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
|
334
|
+
image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
|
335
|
+
role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
|
336
|
+
bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
|
337
|
+
jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
|
338
|
+
currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
|
339
|
+
plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
|
340
|
+
},
|
341
|
+
}
|
342
|
+
} : undefined,
|
343
|
+
trades: props.alpacaAccount.trades ?
|
344
|
+
typeof props.alpacaAccount.trades[0] === 'object' && Object.keys(props.alpacaAccount.trades).length === 1 && Object.keys(props.alpacaAccount.trades)[0] === 'id'
|
345
|
+
? { connect: props.alpacaAccount.trades.map((item) => ({
|
346
|
+
id: item.id
|
347
|
+
}))
|
348
|
+
}
|
349
|
+
: { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
|
350
|
+
where: {
|
351
|
+
id: item.id !== undefined ? item.id : undefined,
|
352
|
+
},
|
353
|
+
create: {
|
354
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
355
|
+
price: item.price !== undefined ? item.price : undefined,
|
356
|
+
total: item.total !== undefined ? item.total : undefined,
|
357
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
358
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
359
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
360
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
361
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
362
|
+
status: item.status !== undefined ? item.status : undefined,
|
363
|
+
optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
|
364
|
+
},
|
365
|
+
}))
|
366
|
+
} : undefined,
|
367
|
+
positions: props.alpacaAccount.positions ?
|
368
|
+
typeof props.alpacaAccount.positions[0] === 'object' && Object.keys(props.alpacaAccount.positions).length === 1 && Object.keys(props.alpacaAccount.positions)[0] === 'id'
|
369
|
+
? { connect: props.alpacaAccount.positions.map((item) => ({
|
370
|
+
id: item.id
|
371
|
+
}))
|
372
|
+
}
|
373
|
+
: { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
|
374
|
+
where: {
|
375
|
+
id: item.id !== undefined ? item.id : undefined,
|
376
|
+
},
|
377
|
+
create: {
|
378
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
379
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
380
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
381
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
382
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
383
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
384
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
385
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
386
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
387
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
388
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
389
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
390
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
391
|
+
},
|
392
|
+
}))
|
393
|
+
} : undefined,
|
394
|
+
alerts: props.alpacaAccount.alerts ?
|
395
|
+
typeof props.alpacaAccount.alerts[0] === 'object' && Object.keys(props.alpacaAccount.alerts).length === 1 && Object.keys(props.alpacaAccount.alerts)[0] === 'id'
|
396
|
+
? { connect: props.alpacaAccount.alerts.map((item) => ({
|
397
|
+
id: item.id
|
398
|
+
}))
|
399
|
+
}
|
400
|
+
: { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
|
401
|
+
where: {
|
402
|
+
id: item.id !== undefined ? item.id : undefined,
|
403
|
+
},
|
404
|
+
create: {
|
405
|
+
message: item.message !== undefined ? item.message : undefined,
|
406
|
+
type: item.type !== undefined ? item.type : undefined,
|
407
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
408
|
+
},
|
409
|
+
}))
|
410
|
+
} : undefined,
|
411
|
+
},
|
412
|
+
}
|
413
|
+
} : undefined,
|
414
|
+
action: props.action ?
|
415
|
+
typeof props.action === 'object' && Object.keys(props.action).length === 1 && Object.keys(props.action)[0] === 'id'
|
416
|
+
? { connect: {
|
417
|
+
id: props.action.id
|
418
|
+
}
|
419
|
+
}
|
420
|
+
: { connectOrCreate: {
|
421
|
+
where: {
|
422
|
+
id: props.action.id !== undefined ? props.action.id : undefined,
|
423
|
+
},
|
424
|
+
create: {
|
425
|
+
sequence: props.action.sequence !== undefined ? props.action.sequence : undefined,
|
426
|
+
type: props.action.type !== undefined ? props.action.type : undefined,
|
427
|
+
note: props.action.note !== undefined ? props.action.note : undefined,
|
428
|
+
status: props.action.status !== undefined ? props.action.status : undefined,
|
429
|
+
fee: props.action.fee !== undefined ? props.action.fee : undefined,
|
430
|
+
trade: props.action.trade ?
|
431
|
+
typeof props.action.trade === 'object' && Object.keys(props.action.trade).length === 1 && Object.keys(props.action.trade)[0] === 'id'
|
432
|
+
? { connect: {
|
433
|
+
id: props.action.trade.id
|
434
|
+
}
|
435
|
+
}
|
436
|
+
: { connectOrCreate: {
|
437
|
+
where: {
|
438
|
+
id: props.action.trade.id !== undefined ? props.action.trade.id : undefined,
|
439
|
+
},
|
440
|
+
create: {
|
441
|
+
qty: props.action.trade.qty !== undefined ? props.action.trade.qty : undefined,
|
442
|
+
price: props.action.trade.price !== undefined ? props.action.trade.price : undefined,
|
443
|
+
total: props.action.trade.total !== undefined ? props.action.trade.total : undefined,
|
444
|
+
signal: props.action.trade.signal !== undefined ? props.action.trade.signal : undefined,
|
445
|
+
strategy: props.action.trade.strategy !== undefined ? props.action.trade.strategy : undefined,
|
446
|
+
analysis: props.action.trade.analysis !== undefined ? props.action.trade.analysis : undefined,
|
447
|
+
confidence: props.action.trade.confidence !== undefined ? props.action.trade.confidence : undefined,
|
448
|
+
timestamp: props.action.trade.timestamp !== undefined ? props.action.trade.timestamp : undefined,
|
449
|
+
status: props.action.trade.status !== undefined ? props.action.trade.status : undefined,
|
450
|
+
optionContractType: props.action.trade.optionContractType !== undefined ? props.action.trade.optionContractType : undefined,
|
451
|
+
},
|
452
|
+
}
|
453
|
+
} : undefined,
|
454
|
+
},
|
455
|
+
}
|
456
|
+
} : undefined,
|
457
|
+
asset: props.asset ?
|
458
|
+
typeof props.asset === 'object' && Object.keys(props.asset).length === 1 && Object.keys(props.asset)[0] === 'id'
|
459
|
+
? { connect: {
|
460
|
+
id: props.asset.id
|
461
|
+
}
|
462
|
+
}
|
463
|
+
: { connectOrCreate: {
|
464
|
+
where: {
|
465
|
+
id: props.asset.id !== undefined ? props.asset.id : undefined,
|
466
|
+
symbol: props.asset.symbol !== undefined ? props.asset.symbol : undefined,
|
467
|
+
name: props.asset.name !== undefined ? props.asset.name : undefined,
|
468
|
+
},
|
469
|
+
create: {
|
470
|
+
symbol: props.asset.symbol !== undefined ? props.asset.symbol : undefined,
|
471
|
+
name: props.asset.name !== undefined ? props.asset.name : undefined,
|
472
|
+
type: props.asset.type !== undefined ? props.asset.type : undefined,
|
473
|
+
logoUrl: props.asset.logoUrl !== undefined ? props.asset.logoUrl : undefined,
|
474
|
+
description: props.asset.description !== undefined ? props.asset.description : undefined,
|
475
|
+
cik: props.asset.cik !== undefined ? props.asset.cik : undefined,
|
476
|
+
exchange: props.asset.exchange !== undefined ? props.asset.exchange : undefined,
|
477
|
+
currency: props.asset.currency !== undefined ? props.asset.currency : undefined,
|
478
|
+
country: props.asset.country !== undefined ? props.asset.country : undefined,
|
479
|
+
sector: props.asset.sector !== undefined ? props.asset.sector : undefined,
|
480
|
+
industry: props.asset.industry !== undefined ? props.asset.industry : undefined,
|
481
|
+
address: props.asset.address !== undefined ? props.asset.address : undefined,
|
482
|
+
officialSite: props.asset.officialSite !== undefined ? props.asset.officialSite : undefined,
|
483
|
+
fiscalYearEnd: props.asset.fiscalYearEnd !== undefined ? props.asset.fiscalYearEnd : undefined,
|
484
|
+
latestQuarter: props.asset.latestQuarter !== undefined ? props.asset.latestQuarter : undefined,
|
485
|
+
marketCapitalization: props.asset.marketCapitalization !== undefined ? props.asset.marketCapitalization : undefined,
|
486
|
+
ebitda: props.asset.ebitda !== undefined ? props.asset.ebitda : undefined,
|
487
|
+
peRatio: props.asset.peRatio !== undefined ? props.asset.peRatio : undefined,
|
488
|
+
pegRatio: props.asset.pegRatio !== undefined ? props.asset.pegRatio : undefined,
|
489
|
+
bookValue: props.asset.bookValue !== undefined ? props.asset.bookValue : undefined,
|
490
|
+
dividendPerShare: props.asset.dividendPerShare !== undefined ? props.asset.dividendPerShare : undefined,
|
491
|
+
dividendYield: props.asset.dividendYield !== undefined ? props.asset.dividendYield : undefined,
|
492
|
+
eps: props.asset.eps !== undefined ? props.asset.eps : undefined,
|
493
|
+
revenuePerShareTTM: props.asset.revenuePerShareTTM !== undefined ? props.asset.revenuePerShareTTM : undefined,
|
494
|
+
profitMargin: props.asset.profitMargin !== undefined ? props.asset.profitMargin : undefined,
|
495
|
+
operatingMarginTTM: props.asset.operatingMarginTTM !== undefined ? props.asset.operatingMarginTTM : undefined,
|
496
|
+
returnOnAssetsTTM: props.asset.returnOnAssetsTTM !== undefined ? props.asset.returnOnAssetsTTM : undefined,
|
497
|
+
returnOnEquityTTM: props.asset.returnOnEquityTTM !== undefined ? props.asset.returnOnEquityTTM : undefined,
|
498
|
+
revenueTTM: props.asset.revenueTTM !== undefined ? props.asset.revenueTTM : undefined,
|
499
|
+
grossProfitTTM: props.asset.grossProfitTTM !== undefined ? props.asset.grossProfitTTM : undefined,
|
500
|
+
dilutedEPSTTM: props.asset.dilutedEPSTTM !== undefined ? props.asset.dilutedEPSTTM : undefined,
|
501
|
+
quarterlyEarningsGrowthYOY: props.asset.quarterlyEarningsGrowthYOY !== undefined ? props.asset.quarterlyEarningsGrowthYOY : undefined,
|
502
|
+
quarterlyRevenueGrowthYOY: props.asset.quarterlyRevenueGrowthYOY !== undefined ? props.asset.quarterlyRevenueGrowthYOY : undefined,
|
503
|
+
analystTargetPrice: props.asset.analystTargetPrice !== undefined ? props.asset.analystTargetPrice : undefined,
|
504
|
+
analystRatingStrongBuy: props.asset.analystRatingStrongBuy !== undefined ? props.asset.analystRatingStrongBuy : undefined,
|
505
|
+
analystRatingBuy: props.asset.analystRatingBuy !== undefined ? props.asset.analystRatingBuy : undefined,
|
506
|
+
analystRatingHold: props.asset.analystRatingHold !== undefined ? props.asset.analystRatingHold : undefined,
|
507
|
+
analystRatingSell: props.asset.analystRatingSell !== undefined ? props.asset.analystRatingSell : undefined,
|
508
|
+
analystRatingStrongSell: props.asset.analystRatingStrongSell !== undefined ? props.asset.analystRatingStrongSell : undefined,
|
509
|
+
trailingPE: props.asset.trailingPE !== undefined ? props.asset.trailingPE : undefined,
|
510
|
+
forwardPE: props.asset.forwardPE !== undefined ? props.asset.forwardPE : undefined,
|
511
|
+
priceToSalesRatioTTM: props.asset.priceToSalesRatioTTM !== undefined ? props.asset.priceToSalesRatioTTM : undefined,
|
512
|
+
priceToBookRatio: props.asset.priceToBookRatio !== undefined ? props.asset.priceToBookRatio : undefined,
|
513
|
+
evToRevenue: props.asset.evToRevenue !== undefined ? props.asset.evToRevenue : undefined,
|
514
|
+
evToEbitda: props.asset.evToEbitda !== undefined ? props.asset.evToEbitda : undefined,
|
515
|
+
beta: props.asset.beta !== undefined ? props.asset.beta : undefined,
|
516
|
+
week52High: props.asset.week52High !== undefined ? props.asset.week52High : undefined,
|
517
|
+
week52Low: props.asset.week52Low !== undefined ? props.asset.week52Low : undefined,
|
518
|
+
day50MovingAverage: props.asset.day50MovingAverage !== undefined ? props.asset.day50MovingAverage : undefined,
|
519
|
+
day200MovingAverage: props.asset.day200MovingAverage !== undefined ? props.asset.day200MovingAverage : undefined,
|
520
|
+
sharesOutstanding: props.asset.sharesOutstanding !== undefined ? props.asset.sharesOutstanding : undefined,
|
521
|
+
dividendDate: props.asset.dividendDate !== undefined ? props.asset.dividendDate : undefined,
|
522
|
+
exDividendDate: props.asset.exDividendDate !== undefined ? props.asset.exDividendDate : undefined,
|
523
|
+
sellPrice: props.asset.sellPrice !== undefined ? props.asset.sellPrice : undefined,
|
524
|
+
buyPrice: props.asset.buyPrice !== undefined ? props.asset.buyPrice : undefined,
|
525
|
+
trades: props.asset.trades ?
|
526
|
+
typeof props.asset.trades[0] === 'object' && Object.keys(props.asset.trades).length === 1 && Object.keys(props.asset.trades)[0] === 'id'
|
527
|
+
? { connect: props.asset.trades.map((item) => ({
|
528
|
+
id: item.id
|
529
|
+
}))
|
530
|
+
}
|
531
|
+
: { connectOrCreate: props.asset.trades.map((item) => ({
|
532
|
+
where: {
|
533
|
+
id: item.id !== undefined ? item.id : undefined,
|
534
|
+
},
|
535
|
+
create: {
|
536
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
537
|
+
price: item.price !== undefined ? item.price : undefined,
|
538
|
+
total: item.total !== undefined ? item.total : undefined,
|
539
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
540
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
541
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
542
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
543
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
544
|
+
status: item.status !== undefined ? item.status : undefined,
|
545
|
+
optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
|
546
|
+
},
|
547
|
+
}))
|
548
|
+
} : undefined,
|
549
|
+
positions: props.asset.positions ?
|
550
|
+
typeof props.asset.positions[0] === 'object' && Object.keys(props.asset.positions).length === 1 && Object.keys(props.asset.positions)[0] === 'id'
|
551
|
+
? { connect: props.asset.positions.map((item) => ({
|
552
|
+
id: item.id
|
553
|
+
}))
|
554
|
+
}
|
555
|
+
: { connectOrCreate: props.asset.positions.map((item) => ({
|
556
|
+
where: {
|
557
|
+
id: item.id !== undefined ? item.id : undefined,
|
558
|
+
},
|
559
|
+
create: {
|
560
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
561
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
562
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
563
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
564
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
565
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
566
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
567
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
568
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
569
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
570
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
571
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
572
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
573
|
+
},
|
574
|
+
}))
|
575
|
+
} : undefined,
|
576
|
+
newsMentions: props.asset.newsMentions ?
|
577
|
+
typeof props.asset.newsMentions[0] === 'object' && Object.keys(props.asset.newsMentions).length === 1 && Object.keys(props.asset.newsMentions)[0] === 'id'
|
578
|
+
? { connect: props.asset.newsMentions.map((item) => ({
|
579
|
+
id: item.id
|
580
|
+
}))
|
581
|
+
}
|
582
|
+
: { connectOrCreate: props.asset.newsMentions.map((item) => ({
|
583
|
+
where: {
|
584
|
+
id: item.id !== undefined ? item.id : undefined,
|
585
|
+
url: item.url !== undefined ? item.url : undefined,
|
586
|
+
},
|
587
|
+
create: {
|
588
|
+
url: item.url !== undefined ? item.url : undefined,
|
589
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
590
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
591
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
592
|
+
},
|
593
|
+
}))
|
594
|
+
} : undefined,
|
595
|
+
},
|
596
|
+
}
|
597
|
+
} : undefined,
|
543
598
|
},
|
544
599
|
};
|
545
600
|
const filteredVariables = removeUndefinedProps(variables);
|
@@ -1183,81 +1238,101 @@ export const Order = {
|
|
1183
1238
|
APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
|
1184
1239
|
configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
|
1185
1240
|
marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
|
1186
|
-
user: props.alpacaAccount.user ?
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
},
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1241
|
+
user: props.alpacaAccount.user ?
|
1242
|
+
typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
|
1243
|
+
? { connect: {
|
1244
|
+
id: props.alpacaAccount.user.id
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
: { connectOrCreate: {
|
1248
|
+
where: {
|
1249
|
+
id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
|
1250
|
+
email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
|
1251
|
+
name: props.alpacaAccount.user.name !== undefined ? {
|
1252
|
+
equals: props.alpacaAccount.user.name
|
1253
|
+
} : undefined,
|
1254
|
+
},
|
1255
|
+
create: {
|
1256
|
+
name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
|
1257
|
+
email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
|
1258
|
+
emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
|
1259
|
+
image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
|
1260
|
+
role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
|
1261
|
+
bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
|
1262
|
+
jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
|
1263
|
+
currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
|
1264
|
+
plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
|
1265
|
+
},
|
1266
|
+
}
|
1267
|
+
} : undefined,
|
1268
|
+
trades: props.alpacaAccount.trades ?
|
1269
|
+
typeof props.alpacaAccount.trades[0] === 'object' && Object.keys(props.alpacaAccount.trades).length === 1 && Object.keys(props.alpacaAccount.trades)[0] === 'id'
|
1270
|
+
? { connect: props.alpacaAccount.trades.map((item) => ({
|
1271
|
+
id: item.id
|
1272
|
+
}))
|
1273
|
+
}
|
1274
|
+
: { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
|
1275
|
+
where: {
|
1276
|
+
id: item.id !== undefined ? item.id : undefined,
|
1277
|
+
},
|
1278
|
+
create: {
|
1279
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1280
|
+
price: item.price !== undefined ? item.price : undefined,
|
1281
|
+
total: item.total !== undefined ? item.total : undefined,
|
1282
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
1283
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
1284
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
1285
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
1286
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
1287
|
+
status: item.status !== undefined ? item.status : undefined,
|
1288
|
+
optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
|
1289
|
+
},
|
1290
|
+
}))
|
1291
|
+
} : undefined,
|
1292
|
+
positions: props.alpacaAccount.positions ?
|
1293
|
+
typeof props.alpacaAccount.positions[0] === 'object' && Object.keys(props.alpacaAccount.positions).length === 1 && Object.keys(props.alpacaAccount.positions)[0] === 'id'
|
1294
|
+
? { connect: props.alpacaAccount.positions.map((item) => ({
|
1295
|
+
id: item.id
|
1296
|
+
}))
|
1297
|
+
}
|
1298
|
+
: { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
|
1299
|
+
where: {
|
1300
|
+
id: item.id !== undefined ? item.id : undefined,
|
1301
|
+
},
|
1302
|
+
create: {
|
1303
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1304
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1305
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1306
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1307
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1308
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1309
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1310
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1311
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1312
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1313
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1314
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1315
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1316
|
+
},
|
1317
|
+
}))
|
1318
|
+
} : undefined,
|
1319
|
+
alerts: props.alpacaAccount.alerts ?
|
1320
|
+
typeof props.alpacaAccount.alerts[0] === 'object' && Object.keys(props.alpacaAccount.alerts).length === 1 && Object.keys(props.alpacaAccount.alerts)[0] === 'id'
|
1321
|
+
? { connect: props.alpacaAccount.alerts.map((item) => ({
|
1322
|
+
id: item.id
|
1323
|
+
}))
|
1324
|
+
}
|
1325
|
+
: { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
|
1326
|
+
where: {
|
1327
|
+
id: item.id !== undefined ? item.id : undefined,
|
1328
|
+
},
|
1329
|
+
create: {
|
1330
|
+
message: item.message !== undefined ? item.message : undefined,
|
1331
|
+
type: item.type !== undefined ? item.type : undefined,
|
1332
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
1333
|
+
},
|
1334
|
+
}))
|
1335
|
+
} : undefined,
|
1261
1336
|
},
|
1262
1337
|
}
|
1263
1338
|
} : undefined,
|
@@ -1350,25 +1425,30 @@ export const Order = {
|
|
1350
1425
|
note: props.action.note !== undefined ? props.action.note : undefined,
|
1351
1426
|
status: props.action.status !== undefined ? props.action.status : undefined,
|
1352
1427
|
fee: props.action.fee !== undefined ? props.action.fee : undefined,
|
1353
|
-
trade: props.action.trade ?
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1428
|
+
trade: props.action.trade ?
|
1429
|
+
typeof props.action.trade === 'object' && Object.keys(props.action.trade).length === 1 && Object.keys(props.action.trade)[0] === 'id'
|
1430
|
+
? { connect: {
|
1431
|
+
id: props.action.trade.id
|
1432
|
+
}
|
1433
|
+
}
|
1434
|
+
: { connectOrCreate: {
|
1435
|
+
where: {
|
1436
|
+
id: props.action.trade.id !== undefined ? props.action.trade.id : undefined,
|
1437
|
+
},
|
1438
|
+
create: {
|
1439
|
+
qty: props.action.trade.qty !== undefined ? props.action.trade.qty : undefined,
|
1440
|
+
price: props.action.trade.price !== undefined ? props.action.trade.price : undefined,
|
1441
|
+
total: props.action.trade.total !== undefined ? props.action.trade.total : undefined,
|
1442
|
+
signal: props.action.trade.signal !== undefined ? props.action.trade.signal : undefined,
|
1443
|
+
strategy: props.action.trade.strategy !== undefined ? props.action.trade.strategy : undefined,
|
1444
|
+
analysis: props.action.trade.analysis !== undefined ? props.action.trade.analysis : undefined,
|
1445
|
+
confidence: props.action.trade.confidence !== undefined ? props.action.trade.confidence : undefined,
|
1446
|
+
timestamp: props.action.trade.timestamp !== undefined ? props.action.trade.timestamp : undefined,
|
1447
|
+
status: props.action.trade.status !== undefined ? props.action.trade.status : undefined,
|
1448
|
+
optionContractType: props.action.trade.optionContractType !== undefined ? props.action.trade.optionContractType : undefined,
|
1449
|
+
},
|
1450
|
+
}
|
1451
|
+
} : undefined,
|
1372
1452
|
},
|
1373
1453
|
}
|
1374
1454
|
} : undefined,
|
@@ -1762,61 +1842,76 @@ export const Order = {
|
|
1762
1842
|
exDividendDate: props.asset.exDividendDate !== undefined ? props.asset.exDividendDate : undefined,
|
1763
1843
|
sellPrice: props.asset.sellPrice !== undefined ? props.asset.sellPrice : undefined,
|
1764
1844
|
buyPrice: props.asset.buyPrice !== undefined ? props.asset.buyPrice : undefined,
|
1765
|
-
trades: props.asset.trades ?
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
},
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1845
|
+
trades: props.asset.trades ?
|
1846
|
+
typeof props.asset.trades[0] === 'object' && Object.keys(props.asset.trades).length === 1 && Object.keys(props.asset.trades)[0] === 'id'
|
1847
|
+
? { connect: props.asset.trades.map((item) => ({
|
1848
|
+
id: item.id
|
1849
|
+
}))
|
1850
|
+
}
|
1851
|
+
: { connectOrCreate: props.asset.trades.map((item) => ({
|
1852
|
+
where: {
|
1853
|
+
id: item.id !== undefined ? item.id : undefined,
|
1854
|
+
},
|
1855
|
+
create: {
|
1856
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1857
|
+
price: item.price !== undefined ? item.price : undefined,
|
1858
|
+
total: item.total !== undefined ? item.total : undefined,
|
1859
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
1860
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
1861
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
1862
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
1863
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
1864
|
+
status: item.status !== undefined ? item.status : undefined,
|
1865
|
+
optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
|
1866
|
+
},
|
1867
|
+
}))
|
1868
|
+
} : undefined,
|
1869
|
+
positions: props.asset.positions ?
|
1870
|
+
typeof props.asset.positions[0] === 'object' && Object.keys(props.asset.positions).length === 1 && Object.keys(props.asset.positions)[0] === 'id'
|
1871
|
+
? { connect: props.asset.positions.map((item) => ({
|
1872
|
+
id: item.id
|
1873
|
+
}))
|
1874
|
+
}
|
1875
|
+
: { connectOrCreate: props.asset.positions.map((item) => ({
|
1876
|
+
where: {
|
1877
|
+
id: item.id !== undefined ? item.id : undefined,
|
1878
|
+
},
|
1879
|
+
create: {
|
1880
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
1881
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
1882
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
1883
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
1884
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
1885
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
1886
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
1887
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
1888
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
1889
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
1890
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
1891
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
1892
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
1893
|
+
},
|
1894
|
+
}))
|
1895
|
+
} : undefined,
|
1896
|
+
newsMentions: props.asset.newsMentions ?
|
1897
|
+
typeof props.asset.newsMentions[0] === 'object' && Object.keys(props.asset.newsMentions).length === 1 && Object.keys(props.asset.newsMentions)[0] === 'id'
|
1898
|
+
? { connect: props.asset.newsMentions.map((item) => ({
|
1899
|
+
id: item.id
|
1900
|
+
}))
|
1901
|
+
}
|
1902
|
+
: { connectOrCreate: props.asset.newsMentions.map((item) => ({
|
1903
|
+
where: {
|
1904
|
+
id: item.id !== undefined ? item.id : undefined,
|
1905
|
+
url: item.url !== undefined ? item.url : undefined,
|
1906
|
+
},
|
1907
|
+
create: {
|
1908
|
+
url: item.url !== undefined ? item.url : undefined,
|
1909
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
1910
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
1911
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
1912
|
+
},
|
1913
|
+
}))
|
1914
|
+
} : undefined,
|
1820
1915
|
},
|
1821
1916
|
}
|
1822
1917
|
} : undefined,
|
@@ -2151,81 +2246,101 @@ export const Order = {
|
|
2151
2246
|
APISecret: prop.alpacaAccount.APISecret !== undefined ? prop.alpacaAccount.APISecret : undefined,
|
2152
2247
|
configuration: prop.alpacaAccount.configuration !== undefined ? prop.alpacaAccount.configuration : undefined,
|
2153
2248
|
marketOpen: prop.alpacaAccount.marketOpen !== undefined ? prop.alpacaAccount.marketOpen : undefined,
|
2154
|
-
user: prop.alpacaAccount.user ?
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
},
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2198
|
-
|
2199
|
-
|
2200
|
-
|
2201
|
-
|
2202
|
-
|
2203
|
-
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2249
|
+
user: prop.alpacaAccount.user ?
|
2250
|
+
typeof prop.alpacaAccount.user === 'object' && Object.keys(prop.alpacaAccount.user).length === 1 && Object.keys(prop.alpacaAccount.user)[0] === 'id'
|
2251
|
+
? { connect: {
|
2252
|
+
id: prop.alpacaAccount.user.id
|
2253
|
+
}
|
2254
|
+
}
|
2255
|
+
: { connectOrCreate: {
|
2256
|
+
where: {
|
2257
|
+
id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
|
2258
|
+
email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
|
2259
|
+
name: prop.alpacaAccount.user.name !== undefined ? {
|
2260
|
+
equals: prop.alpacaAccount.user.name
|
2261
|
+
} : undefined,
|
2262
|
+
},
|
2263
|
+
create: {
|
2264
|
+
name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
|
2265
|
+
email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
|
2266
|
+
emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
|
2267
|
+
image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
|
2268
|
+
role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
|
2269
|
+
bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
|
2270
|
+
jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
|
2271
|
+
currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
|
2272
|
+
plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
|
2273
|
+
},
|
2274
|
+
}
|
2275
|
+
} : undefined,
|
2276
|
+
trades: prop.alpacaAccount.trades ?
|
2277
|
+
typeof prop.alpacaAccount.trades[0] === 'object' && Object.keys(prop.alpacaAccount.trades).length === 1 && Object.keys(prop.alpacaAccount.trades)[0] === 'id'
|
2278
|
+
? { connect: prop.alpacaAccount.trades.map((item) => ({
|
2279
|
+
id: item.id
|
2280
|
+
}))
|
2281
|
+
}
|
2282
|
+
: { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
|
2283
|
+
where: {
|
2284
|
+
id: item.id !== undefined ? item.id : undefined,
|
2285
|
+
},
|
2286
|
+
create: {
|
2287
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2288
|
+
price: item.price !== undefined ? item.price : undefined,
|
2289
|
+
total: item.total !== undefined ? item.total : undefined,
|
2290
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2291
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2292
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2293
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2294
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2295
|
+
status: item.status !== undefined ? item.status : undefined,
|
2296
|
+
optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
|
2297
|
+
},
|
2298
|
+
}))
|
2299
|
+
} : undefined,
|
2300
|
+
positions: prop.alpacaAccount.positions ?
|
2301
|
+
typeof prop.alpacaAccount.positions[0] === 'object' && Object.keys(prop.alpacaAccount.positions).length === 1 && Object.keys(prop.alpacaAccount.positions)[0] === 'id'
|
2302
|
+
? { connect: prop.alpacaAccount.positions.map((item) => ({
|
2303
|
+
id: item.id
|
2304
|
+
}))
|
2305
|
+
}
|
2306
|
+
: { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
|
2307
|
+
where: {
|
2308
|
+
id: item.id !== undefined ? item.id : undefined,
|
2309
|
+
},
|
2310
|
+
create: {
|
2311
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2312
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2313
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2314
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2315
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2316
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2317
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2318
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2319
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2320
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2321
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2322
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2323
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2324
|
+
},
|
2325
|
+
}))
|
2326
|
+
} : undefined,
|
2327
|
+
alerts: prop.alpacaAccount.alerts ?
|
2328
|
+
typeof prop.alpacaAccount.alerts[0] === 'object' && Object.keys(prop.alpacaAccount.alerts).length === 1 && Object.keys(prop.alpacaAccount.alerts)[0] === 'id'
|
2329
|
+
? { connect: prop.alpacaAccount.alerts.map((item) => ({
|
2330
|
+
id: item.id
|
2331
|
+
}))
|
2332
|
+
}
|
2333
|
+
: { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
|
2334
|
+
where: {
|
2335
|
+
id: item.id !== undefined ? item.id : undefined,
|
2336
|
+
},
|
2337
|
+
create: {
|
2338
|
+
message: item.message !== undefined ? item.message : undefined,
|
2339
|
+
type: item.type !== undefined ? item.type : undefined,
|
2340
|
+
isRead: item.isRead !== undefined ? item.isRead : undefined,
|
2341
|
+
},
|
2342
|
+
}))
|
2343
|
+
} : undefined,
|
2229
2344
|
},
|
2230
2345
|
}
|
2231
2346
|
} : undefined,
|
@@ -2318,25 +2433,30 @@ export const Order = {
|
|
2318
2433
|
note: prop.action.note !== undefined ? prop.action.note : undefined,
|
2319
2434
|
status: prop.action.status !== undefined ? prop.action.status : undefined,
|
2320
2435
|
fee: prop.action.fee !== undefined ? prop.action.fee : undefined,
|
2321
|
-
trade: prop.action.trade ?
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2436
|
+
trade: prop.action.trade ?
|
2437
|
+
typeof prop.action.trade === 'object' && Object.keys(prop.action.trade).length === 1 && Object.keys(prop.action.trade)[0] === 'id'
|
2438
|
+
? { connect: {
|
2439
|
+
id: prop.action.trade.id
|
2440
|
+
}
|
2441
|
+
}
|
2442
|
+
: { connectOrCreate: {
|
2443
|
+
where: {
|
2444
|
+
id: prop.action.trade.id !== undefined ? prop.action.trade.id : undefined,
|
2445
|
+
},
|
2446
|
+
create: {
|
2447
|
+
qty: prop.action.trade.qty !== undefined ? prop.action.trade.qty : undefined,
|
2448
|
+
price: prop.action.trade.price !== undefined ? prop.action.trade.price : undefined,
|
2449
|
+
total: prop.action.trade.total !== undefined ? prop.action.trade.total : undefined,
|
2450
|
+
signal: prop.action.trade.signal !== undefined ? prop.action.trade.signal : undefined,
|
2451
|
+
strategy: prop.action.trade.strategy !== undefined ? prop.action.trade.strategy : undefined,
|
2452
|
+
analysis: prop.action.trade.analysis !== undefined ? prop.action.trade.analysis : undefined,
|
2453
|
+
confidence: prop.action.trade.confidence !== undefined ? prop.action.trade.confidence : undefined,
|
2454
|
+
timestamp: prop.action.trade.timestamp !== undefined ? prop.action.trade.timestamp : undefined,
|
2455
|
+
status: prop.action.trade.status !== undefined ? prop.action.trade.status : undefined,
|
2456
|
+
optionContractType: prop.action.trade.optionContractType !== undefined ? prop.action.trade.optionContractType : undefined,
|
2457
|
+
},
|
2458
|
+
}
|
2459
|
+
} : undefined,
|
2340
2460
|
},
|
2341
2461
|
}
|
2342
2462
|
} : undefined,
|
@@ -2730,61 +2850,76 @@ export const Order = {
|
|
2730
2850
|
exDividendDate: prop.asset.exDividendDate !== undefined ? prop.asset.exDividendDate : undefined,
|
2731
2851
|
sellPrice: prop.asset.sellPrice !== undefined ? prop.asset.sellPrice : undefined,
|
2732
2852
|
buyPrice: prop.asset.buyPrice !== undefined ? prop.asset.buyPrice : undefined,
|
2733
|
-
trades: prop.asset.trades ?
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2740
|
-
|
2741
|
-
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
|
2756
|
-
},
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2777
|
-
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2783
|
-
|
2784
|
-
|
2785
|
-
|
2786
|
-
|
2787
|
-
|
2853
|
+
trades: prop.asset.trades ?
|
2854
|
+
typeof prop.asset.trades[0] === 'object' && Object.keys(prop.asset.trades).length === 1 && Object.keys(prop.asset.trades)[0] === 'id'
|
2855
|
+
? { connect: prop.asset.trades.map((item) => ({
|
2856
|
+
id: item.id
|
2857
|
+
}))
|
2858
|
+
}
|
2859
|
+
: { connectOrCreate: prop.asset.trades.map((item) => ({
|
2860
|
+
where: {
|
2861
|
+
id: item.id !== undefined ? item.id : undefined,
|
2862
|
+
},
|
2863
|
+
create: {
|
2864
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2865
|
+
price: item.price !== undefined ? item.price : undefined,
|
2866
|
+
total: item.total !== undefined ? item.total : undefined,
|
2867
|
+
signal: item.signal !== undefined ? item.signal : undefined,
|
2868
|
+
strategy: item.strategy !== undefined ? item.strategy : undefined,
|
2869
|
+
analysis: item.analysis !== undefined ? item.analysis : undefined,
|
2870
|
+
confidence: item.confidence !== undefined ? item.confidence : undefined,
|
2871
|
+
timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
|
2872
|
+
status: item.status !== undefined ? item.status : undefined,
|
2873
|
+
optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
|
2874
|
+
},
|
2875
|
+
}))
|
2876
|
+
} : undefined,
|
2877
|
+
positions: prop.asset.positions ?
|
2878
|
+
typeof prop.asset.positions[0] === 'object' && Object.keys(prop.asset.positions).length === 1 && Object.keys(prop.asset.positions)[0] === 'id'
|
2879
|
+
? { connect: prop.asset.positions.map((item) => ({
|
2880
|
+
id: item.id
|
2881
|
+
}))
|
2882
|
+
}
|
2883
|
+
: { connectOrCreate: prop.asset.positions.map((item) => ({
|
2884
|
+
where: {
|
2885
|
+
id: item.id !== undefined ? item.id : undefined,
|
2886
|
+
},
|
2887
|
+
create: {
|
2888
|
+
averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
|
2889
|
+
qty: item.qty !== undefined ? item.qty : undefined,
|
2890
|
+
qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
|
2891
|
+
marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
|
2892
|
+
costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
|
2893
|
+
unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
|
2894
|
+
unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
|
2895
|
+
unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
|
2896
|
+
unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
|
2897
|
+
currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
|
2898
|
+
lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
|
2899
|
+
changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
|
2900
|
+
assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
|
2901
|
+
},
|
2902
|
+
}))
|
2903
|
+
} : undefined,
|
2904
|
+
newsMentions: prop.asset.newsMentions ?
|
2905
|
+
typeof prop.asset.newsMentions[0] === 'object' && Object.keys(prop.asset.newsMentions).length === 1 && Object.keys(prop.asset.newsMentions)[0] === 'id'
|
2906
|
+
? { connect: prop.asset.newsMentions.map((item) => ({
|
2907
|
+
id: item.id
|
2908
|
+
}))
|
2909
|
+
}
|
2910
|
+
: { connectOrCreate: prop.asset.newsMentions.map((item) => ({
|
2911
|
+
where: {
|
2912
|
+
id: item.id !== undefined ? item.id : undefined,
|
2913
|
+
url: item.url !== undefined ? item.url : undefined,
|
2914
|
+
},
|
2915
|
+
create: {
|
2916
|
+
url: item.url !== undefined ? item.url : undefined,
|
2917
|
+
relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
|
2918
|
+
sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
|
2919
|
+
sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
|
2920
|
+
},
|
2921
|
+
}))
|
2922
|
+
} : undefined,
|
2788
2923
|
},
|
2789
2924
|
}
|
2790
2925
|
} : undefined,
|