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/AlpacaAccount.cjs CHANGED
@@ -300,393 +300,463 @@ exports.AlpacaAccount = {
300
300
  APISecret: props.APISecret !== undefined ? props.APISecret : undefined,
301
301
  configuration: props.configuration !== undefined ? props.configuration : undefined,
302
302
  marketOpen: props.marketOpen !== undefined ? props.marketOpen : undefined,
303
- user: props.user ? {
304
- connectOrCreate: {
305
- where: {
306
- id: props.user.id !== undefined ? props.user.id : undefined,
307
- email: props.user.email !== undefined ? props.user.email : undefined,
308
- name: props.user.name !== undefined ? {
309
- equals: props.user.name
310
- } : undefined,
311
- },
312
- create: {
313
- name: props.user.name !== undefined ? props.user.name : undefined,
314
- email: props.user.email !== undefined ? props.user.email : undefined,
315
- emailVerified: props.user.emailVerified !== undefined ? props.user.emailVerified : undefined,
316
- image: props.user.image !== undefined ? props.user.image : undefined,
317
- role: props.user.role !== undefined ? props.user.role : undefined,
318
- bio: props.user.bio !== undefined ? props.user.bio : undefined,
319
- jobTitle: props.user.jobTitle !== undefined ? props.user.jobTitle : undefined,
320
- currentAccount: props.user.currentAccount !== undefined ? props.user.currentAccount : undefined,
321
- plan: props.user.plan !== undefined ? props.user.plan : undefined,
322
- customer: props.user.customer ? {
323
- connectOrCreate: {
324
- where: {
325
- id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
326
- name: props.user.customer.name !== undefined ? {
327
- equals: props.user.customer.name
328
- } : undefined,
329
- },
330
- create: {
331
- authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
332
- name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
333
- plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
334
- stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
335
- stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
336
- stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
337
- stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
338
- },
339
- }
340
- } : undefined,
341
- accounts: props.user.accounts ? {
342
- connectOrCreate: props.user.accounts.map((item) => ({
343
- where: {
344
- id: item.id !== undefined ? item.id : undefined,
345
- },
346
- create: {
347
- type: item.type !== undefined ? item.type : undefined,
348
- provider: item.provider !== undefined ? item.provider : undefined,
349
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
350
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
351
- access_token: item.access_token !== undefined ? item.access_token : undefined,
352
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
353
- token_type: item.token_type !== undefined ? item.token_type : undefined,
354
- scope: item.scope !== undefined ? item.scope : undefined,
355
- id_token: item.id_token !== undefined ? item.id_token : undefined,
356
- session_state: item.session_state !== undefined ? item.session_state : undefined,
357
- },
358
- }))
359
- } : undefined,
360
- sessions: props.user.sessions ? {
361
- connectOrCreate: props.user.sessions.map((item) => ({
362
- where: {
363
- id: item.id !== undefined ? item.id : undefined,
364
- },
365
- create: {
366
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
367
- expires: item.expires !== undefined ? item.expires : undefined,
368
- },
369
- }))
370
- } : undefined,
371
- authenticators: props.user.authenticators ? {
372
- connectOrCreate: props.user.authenticators.map((item) => ({
373
- where: {
374
- id: item.id !== undefined ? item.id : undefined,
375
- },
376
- create: {
377
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
378
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
379
- counter: item.counter !== undefined ? item.counter : undefined,
380
- },
381
- }))
382
- } : undefined,
383
- },
384
- }
385
- } : undefined,
386
- trades: props.trades ? {
387
- connectOrCreate: props.trades.map((item) => ({
388
- where: {
389
- id: item.id !== undefined ? item.id : undefined,
390
- },
391
- create: {
392
- qty: item.qty !== undefined ? item.qty : undefined,
393
- price: item.price !== undefined ? item.price : undefined,
394
- total: item.total !== undefined ? item.total : undefined,
395
- signal: item.signal !== undefined ? item.signal : undefined,
396
- strategy: item.strategy !== undefined ? item.strategy : undefined,
397
- analysis: item.analysis !== undefined ? item.analysis : undefined,
398
- confidence: item.confidence !== undefined ? item.confidence : undefined,
399
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
400
- status: item.status !== undefined ? item.status : undefined,
401
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
402
- asset: item.asset ? {
403
- connectOrCreate: {
404
- where: {
405
- id: item.asset.id !== undefined ? item.asset.id : undefined,
406
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
407
- name: item.asset.name !== undefined ? item.asset.name : undefined,
408
- },
409
- create: {
410
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
411
- name: item.asset.name !== undefined ? item.asset.name : undefined,
412
- type: item.asset.type !== undefined ? item.asset.type : undefined,
413
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
414
- description: item.asset.description !== undefined ? item.asset.description : undefined,
415
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
416
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
417
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
418
- country: item.asset.country !== undefined ? item.asset.country : undefined,
419
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
420
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
421
- address: item.asset.address !== undefined ? item.asset.address : undefined,
422
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
423
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
424
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
425
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
426
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
427
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
428
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
429
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
430
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
431
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
432
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
433
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
434
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
435
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
436
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
437
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
438
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
439
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
440
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
441
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
442
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
443
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
444
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
445
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
446
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
447
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
448
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
449
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
450
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
451
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
452
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
453
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
454
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
455
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
456
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
457
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
458
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
459
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
460
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
461
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
462
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
463
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
464
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
465
- },
466
- }
467
- } : undefined,
468
- actions: item.actions ? {
469
- connectOrCreate: item.actions.map((item) => ({
470
- where: {
471
- id: item.id !== undefined ? item.id : undefined,
472
- },
473
- create: {
474
- sequence: item.sequence !== undefined ? item.sequence : undefined,
475
- type: item.type !== undefined ? item.type : undefined,
476
- note: item.note !== undefined ? item.note : undefined,
477
- status: item.status !== undefined ? item.status : undefined,
478
- fee: item.fee !== undefined ? item.fee : undefined,
479
- },
480
- }))
481
- } : undefined,
482
- },
483
- }))
484
- } : undefined,
485
- orders: props.orders ? {
486
- connectOrCreate: props.orders.map((item) => ({
487
- where: {
488
- id: item.id !== undefined ? item.id : undefined,
489
- },
490
- create: {
491
- qty: item.qty !== undefined ? item.qty : undefined,
492
- notional: item.notional !== undefined ? item.notional : undefined,
493
- side: item.side !== undefined ? item.side : undefined,
494
- type: item.type !== undefined ? item.type : undefined,
495
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
496
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
497
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
498
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
499
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
500
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
501
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
502
- status: item.status !== undefined ? item.status : undefined,
503
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
504
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
505
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
506
- fee: item.fee !== undefined ? item.fee : undefined,
507
- action: item.action ? {
508
- connectOrCreate: {
509
- where: {
510
- id: item.action.id !== undefined ? item.action.id : undefined,
511
- },
512
- create: {
513
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
514
- type: item.action.type !== undefined ? item.action.type : undefined,
515
- note: item.action.note !== undefined ? item.action.note : undefined,
516
- status: item.action.status !== undefined ? item.action.status : undefined,
517
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
518
- },
519
- }
520
- } : undefined,
521
- asset: item.asset ? {
522
- connectOrCreate: {
523
- where: {
524
- id: item.asset.id !== undefined ? item.asset.id : undefined,
525
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
526
- name: item.asset.name !== undefined ? item.asset.name : undefined,
527
- },
528
- create: {
529
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
530
- name: item.asset.name !== undefined ? item.asset.name : undefined,
531
- type: item.asset.type !== undefined ? item.asset.type : undefined,
532
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
533
- description: item.asset.description !== undefined ? item.asset.description : undefined,
534
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
535
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
536
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
537
- country: item.asset.country !== undefined ? item.asset.country : undefined,
538
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
539
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
540
- address: item.asset.address !== undefined ? item.asset.address : undefined,
541
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
542
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
543
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
544
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
545
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
546
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
547
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
548
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
549
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
550
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
551
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
552
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
553
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
554
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
555
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
556
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
557
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
558
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
559
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
560
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
561
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
562
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
563
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
564
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
565
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
566
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
567
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
568
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
569
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
570
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
571
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
572
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
573
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
574
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
575
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
576
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
577
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
578
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
579
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
580
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
581
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
582
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
583
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
584
- },
585
- }
586
- } : undefined,
587
- },
588
- }))
589
- } : undefined,
590
- positions: props.positions ? {
591
- connectOrCreate: props.positions.map((item) => ({
592
- where: {
593
- id: item.id !== undefined ? item.id : undefined,
594
- },
595
- create: {
596
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
597
- qty: item.qty !== undefined ? item.qty : undefined,
598
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
599
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
600
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
601
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
602
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
603
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
604
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
605
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
606
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
607
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
608
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
609
- asset: item.asset ? {
610
- connectOrCreate: {
611
- where: {
612
- id: item.asset.id !== undefined ? item.asset.id : undefined,
613
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
614
- name: item.asset.name !== undefined ? item.asset.name : undefined,
615
- },
616
- create: {
617
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
618
- name: item.asset.name !== undefined ? item.asset.name : undefined,
619
- type: item.asset.type !== undefined ? item.asset.type : undefined,
620
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
621
- description: item.asset.description !== undefined ? item.asset.description : undefined,
622
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
623
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
624
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
625
- country: item.asset.country !== undefined ? item.asset.country : undefined,
626
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
627
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
628
- address: item.asset.address !== undefined ? item.asset.address : undefined,
629
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
630
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
631
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
632
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
633
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
634
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
635
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
636
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
637
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
638
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
639
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
640
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
641
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
642
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
643
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
644
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
645
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
646
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
647
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
648
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
649
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
650
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
651
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
652
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
653
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
654
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
655
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
656
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
657
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
658
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
659
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
660
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
661
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
662
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
663
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
664
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
665
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
666
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
667
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
668
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
669
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
670
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
671
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
672
- },
673
- }
674
- } : undefined,
675
- },
676
- }))
677
- } : undefined,
678
- alerts: props.alerts ? {
679
- connectOrCreate: props.alerts.map((item) => ({
680
- where: {
681
- id: item.id !== undefined ? item.id : undefined,
682
- },
683
- create: {
684
- message: item.message !== undefined ? item.message : undefined,
685
- type: item.type !== undefined ? item.type : undefined,
686
- isRead: item.isRead !== undefined ? item.isRead : undefined,
687
- },
688
- }))
689
- } : undefined,
303
+ user: props.user ?
304
+ typeof props.user === 'object' && Object.keys(props.user).length === 1 && Object.keys(props.user)[0] === 'id'
305
+ ? { connect: {
306
+ id: props.user.id
307
+ }
308
+ }
309
+ : { connectOrCreate: {
310
+ where: {
311
+ id: props.user.id !== undefined ? props.user.id : undefined,
312
+ email: props.user.email !== undefined ? props.user.email : undefined,
313
+ name: props.user.name !== undefined ? {
314
+ equals: props.user.name
315
+ } : undefined,
316
+ },
317
+ create: {
318
+ name: props.user.name !== undefined ? props.user.name : undefined,
319
+ email: props.user.email !== undefined ? props.user.email : undefined,
320
+ emailVerified: props.user.emailVerified !== undefined ? props.user.emailVerified : undefined,
321
+ image: props.user.image !== undefined ? props.user.image : undefined,
322
+ role: props.user.role !== undefined ? props.user.role : undefined,
323
+ bio: props.user.bio !== undefined ? props.user.bio : undefined,
324
+ jobTitle: props.user.jobTitle !== undefined ? props.user.jobTitle : undefined,
325
+ currentAccount: props.user.currentAccount !== undefined ? props.user.currentAccount : undefined,
326
+ plan: props.user.plan !== undefined ? props.user.plan : undefined,
327
+ customer: props.user.customer ?
328
+ typeof props.user.customer === 'object' && Object.keys(props.user.customer).length === 1 && Object.keys(props.user.customer)[0] === 'id'
329
+ ? { connect: {
330
+ id: props.user.customer.id
331
+ }
332
+ }
333
+ : { connectOrCreate: {
334
+ where: {
335
+ id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
336
+ name: props.user.customer.name !== undefined ? {
337
+ equals: props.user.customer.name
338
+ } : undefined,
339
+ },
340
+ create: {
341
+ authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
342
+ name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
343
+ plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
344
+ stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
345
+ stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
346
+ stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
347
+ stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
348
+ },
349
+ }
350
+ } : undefined,
351
+ accounts: props.user.accounts ?
352
+ typeof props.user.accounts[0] === 'object' && Object.keys(props.user.accounts).length === 1 && Object.keys(props.user.accounts)[0] === 'id'
353
+ ? { connect: props.user.accounts.map((item) => ({
354
+ id: item.id
355
+ }))
356
+ }
357
+ : { connectOrCreate: props.user.accounts.map((item) => ({
358
+ where: {
359
+ id: item.id !== undefined ? item.id : undefined,
360
+ },
361
+ create: {
362
+ type: item.type !== undefined ? item.type : undefined,
363
+ provider: item.provider !== undefined ? item.provider : undefined,
364
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
365
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
366
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
367
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
368
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
369
+ scope: item.scope !== undefined ? item.scope : undefined,
370
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
371
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
372
+ },
373
+ }))
374
+ } : undefined,
375
+ sessions: props.user.sessions ?
376
+ typeof props.user.sessions[0] === 'object' && Object.keys(props.user.sessions).length === 1 && Object.keys(props.user.sessions)[0] === 'id'
377
+ ? { connect: props.user.sessions.map((item) => ({
378
+ id: item.id
379
+ }))
380
+ }
381
+ : { connectOrCreate: props.user.sessions.map((item) => ({
382
+ where: {
383
+ id: item.id !== undefined ? item.id : undefined,
384
+ },
385
+ create: {
386
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
387
+ expires: item.expires !== undefined ? item.expires : undefined,
388
+ },
389
+ }))
390
+ } : undefined,
391
+ authenticators: props.user.authenticators ?
392
+ typeof props.user.authenticators[0] === 'object' && Object.keys(props.user.authenticators).length === 1 && Object.keys(props.user.authenticators)[0] === 'id'
393
+ ? { connect: props.user.authenticators.map((item) => ({
394
+ id: item.id
395
+ }))
396
+ }
397
+ : { connectOrCreate: props.user.authenticators.map((item) => ({
398
+ where: {
399
+ id: item.id !== undefined ? item.id : undefined,
400
+ },
401
+ create: {
402
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
403
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
404
+ counter: item.counter !== undefined ? item.counter : undefined,
405
+ },
406
+ }))
407
+ } : undefined,
408
+ },
409
+ }
410
+ } : undefined,
411
+ trades: props.trades ?
412
+ typeof props.trades[0] === 'object' && Object.keys(props.trades).length === 1 && Object.keys(props.trades)[0] === 'id'
413
+ ? { connect: props.trades.map((item) => ({
414
+ id: item.id
415
+ }))
416
+ }
417
+ : { connectOrCreate: props.trades.map((item) => ({
418
+ where: {
419
+ id: item.id !== undefined ? item.id : undefined,
420
+ },
421
+ create: {
422
+ qty: item.qty !== undefined ? item.qty : undefined,
423
+ price: item.price !== undefined ? item.price : undefined,
424
+ total: item.total !== undefined ? item.total : undefined,
425
+ signal: item.signal !== undefined ? item.signal : undefined,
426
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
427
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
428
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
429
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
430
+ status: item.status !== undefined ? item.status : undefined,
431
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
432
+ asset: item.asset ?
433
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
434
+ ? { connect: {
435
+ id: item.asset.id
436
+ }
437
+ }
438
+ : { connectOrCreate: {
439
+ where: {
440
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
441
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
442
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
443
+ },
444
+ create: {
445
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
446
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
447
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
448
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
449
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
450
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
451
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
452
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
453
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
454
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
455
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
456
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
457
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
458
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
459
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
460
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
461
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
462
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
463
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
464
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
465
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
466
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
467
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
468
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
469
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
470
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
471
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
472
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
473
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
474
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
475
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
476
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
477
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
478
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
479
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
480
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
481
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
482
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
483
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
484
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
485
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
486
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
487
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
488
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
489
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
490
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
491
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
492
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
493
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
494
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
495
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
496
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
497
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
498
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
499
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
500
+ },
501
+ }
502
+ } : undefined,
503
+ actions: item.actions ?
504
+ typeof item.actions[0] === 'object' && Object.keys(item.actions).length === 1 && Object.keys(item.actions)[0] === 'id'
505
+ ? { connect: item.actions.map((item) => ({
506
+ id: item.id
507
+ }))
508
+ }
509
+ : { connectOrCreate: item.actions.map((item) => ({
510
+ where: {
511
+ id: item.id !== undefined ? item.id : undefined,
512
+ },
513
+ create: {
514
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
515
+ type: item.type !== undefined ? item.type : undefined,
516
+ note: item.note !== undefined ? item.note : undefined,
517
+ status: item.status !== undefined ? item.status : undefined,
518
+ fee: item.fee !== undefined ? item.fee : undefined,
519
+ },
520
+ }))
521
+ } : undefined,
522
+ },
523
+ }))
524
+ } : undefined,
525
+ orders: props.orders ?
526
+ typeof props.orders[0] === 'object' && Object.keys(props.orders).length === 1 && Object.keys(props.orders)[0] === 'id'
527
+ ? { connect: props.orders.map((item) => ({
528
+ id: item.id
529
+ }))
530
+ }
531
+ : { connectOrCreate: props.orders.map((item) => ({
532
+ where: {
533
+ id: item.id !== undefined ? item.id : undefined,
534
+ },
535
+ create: {
536
+ qty: item.qty !== undefined ? item.qty : undefined,
537
+ notional: item.notional !== undefined ? item.notional : undefined,
538
+ side: item.side !== undefined ? item.side : undefined,
539
+ type: item.type !== undefined ? item.type : undefined,
540
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
541
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
542
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
543
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
544
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
545
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
546
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
547
+ status: item.status !== undefined ? item.status : undefined,
548
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
549
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
550
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
551
+ fee: item.fee !== undefined ? item.fee : undefined,
552
+ action: item.action ?
553
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
554
+ ? { connect: {
555
+ id: item.action.id
556
+ }
557
+ }
558
+ : { connectOrCreate: {
559
+ where: {
560
+ id: item.action.id !== undefined ? item.action.id : undefined,
561
+ },
562
+ create: {
563
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
564
+ type: item.action.type !== undefined ? item.action.type : undefined,
565
+ note: item.action.note !== undefined ? item.action.note : undefined,
566
+ status: item.action.status !== undefined ? item.action.status : undefined,
567
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
568
+ },
569
+ }
570
+ } : undefined,
571
+ asset: item.asset ?
572
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
573
+ ? { connect: {
574
+ id: item.asset.id
575
+ }
576
+ }
577
+ : { connectOrCreate: {
578
+ where: {
579
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
580
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
581
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
582
+ },
583
+ create: {
584
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
585
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
586
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
587
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
588
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
589
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
590
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
591
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
592
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
593
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
594
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
595
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
596
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
597
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
598
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
599
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
600
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
601
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
602
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
603
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
604
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
605
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
606
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
607
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
608
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
609
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
610
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
611
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
612
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
613
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
614
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
615
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
616
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
617
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
618
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
619
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
620
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
621
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
622
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
623
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
624
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
625
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
626
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
627
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
628
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
629
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
630
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
631
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
632
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
633
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
634
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
635
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
636
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
637
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
638
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
639
+ },
640
+ }
641
+ } : undefined,
642
+ },
643
+ }))
644
+ } : undefined,
645
+ positions: props.positions ?
646
+ typeof props.positions[0] === 'object' && Object.keys(props.positions).length === 1 && Object.keys(props.positions)[0] === 'id'
647
+ ? { connect: props.positions.map((item) => ({
648
+ id: item.id
649
+ }))
650
+ }
651
+ : { connectOrCreate: props.positions.map((item) => ({
652
+ where: {
653
+ id: item.id !== undefined ? item.id : undefined,
654
+ },
655
+ create: {
656
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
657
+ qty: item.qty !== undefined ? item.qty : undefined,
658
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
659
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
660
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
661
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
662
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
663
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
664
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
665
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
666
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
667
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
668
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
669
+ asset: item.asset ?
670
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
671
+ ? { connect: {
672
+ id: item.asset.id
673
+ }
674
+ }
675
+ : { connectOrCreate: {
676
+ where: {
677
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
678
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
679
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
680
+ },
681
+ create: {
682
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
683
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
684
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
685
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
686
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
687
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
688
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
689
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
690
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
691
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
692
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
693
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
694
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
695
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
696
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
697
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
698
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
699
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
700
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
701
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
702
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
703
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
704
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
705
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
706
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
707
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
708
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
709
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
710
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
711
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
712
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
713
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
714
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
715
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
716
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
717
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
718
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
719
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
720
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
721
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
722
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
723
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
724
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
725
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
726
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
727
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
728
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
729
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
730
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
731
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
732
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
733
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
734
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
735
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
736
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
737
+ },
738
+ }
739
+ } : undefined,
740
+ },
741
+ }))
742
+ } : undefined,
743
+ alerts: props.alerts ?
744
+ typeof props.alerts[0] === 'object' && Object.keys(props.alerts).length === 1 && Object.keys(props.alerts)[0] === 'id'
745
+ ? { connect: props.alerts.map((item) => ({
746
+ id: item.id
747
+ }))
748
+ }
749
+ : { connectOrCreate: props.alerts.map((item) => ({
750
+ where: {
751
+ id: item.id !== undefined ? item.id : undefined,
752
+ },
753
+ create: {
754
+ message: item.message !== undefined ? item.message : undefined,
755
+ type: item.type !== undefined ? item.type : undefined,
756
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
757
+ },
758
+ }))
759
+ } : undefined,
690
760
  },
691
761
  };
692
762
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);
@@ -1260,67 +1330,87 @@ exports.AlpacaAccount = {
1260
1330
  jobTitle: props.user.jobTitle !== undefined ? props.user.jobTitle : undefined,
1261
1331
  currentAccount: props.user.currentAccount !== undefined ? props.user.currentAccount : undefined,
1262
1332
  plan: props.user.plan !== undefined ? props.user.plan : undefined,
1263
- customer: props.user.customer ? {
1264
- connectOrCreate: {
1265
- where: {
1266
- id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
1267
- name: props.user.customer.name !== undefined ? {
1268
- equals: props.user.customer.name
1269
- } : undefined,
1270
- },
1271
- create: {
1272
- authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
1273
- name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
1274
- plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
1275
- stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
1276
- stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
1277
- stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
1278
- stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
1279
- },
1280
- }
1281
- } : undefined,
1282
- accounts: props.user.accounts ? {
1283
- connectOrCreate: props.user.accounts.map((item) => ({
1284
- where: {
1285
- id: item.id !== undefined ? item.id : undefined,
1286
- },
1287
- create: {
1288
- type: item.type !== undefined ? item.type : undefined,
1289
- provider: item.provider !== undefined ? item.provider : undefined,
1290
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
1291
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
1292
- access_token: item.access_token !== undefined ? item.access_token : undefined,
1293
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
1294
- token_type: item.token_type !== undefined ? item.token_type : undefined,
1295
- scope: item.scope !== undefined ? item.scope : undefined,
1296
- id_token: item.id_token !== undefined ? item.id_token : undefined,
1297
- session_state: item.session_state !== undefined ? item.session_state : undefined,
1298
- },
1299
- }))
1300
- } : undefined,
1301
- sessions: props.user.sessions ? {
1302
- connectOrCreate: props.user.sessions.map((item) => ({
1303
- where: {
1304
- id: item.id !== undefined ? item.id : undefined,
1305
- },
1306
- create: {
1307
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
1308
- expires: item.expires !== undefined ? item.expires : undefined,
1309
- },
1310
- }))
1311
- } : undefined,
1312
- authenticators: props.user.authenticators ? {
1313
- connectOrCreate: props.user.authenticators.map((item) => ({
1314
- where: {
1315
- id: item.id !== undefined ? item.id : undefined,
1316
- },
1317
- create: {
1318
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
1319
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
1320
- counter: item.counter !== undefined ? item.counter : undefined,
1321
- },
1322
- }))
1323
- } : undefined,
1333
+ customer: props.user.customer ?
1334
+ typeof props.user.customer === 'object' && Object.keys(props.user.customer).length === 1 && Object.keys(props.user.customer)[0] === 'id'
1335
+ ? { connect: {
1336
+ id: props.user.customer.id
1337
+ }
1338
+ }
1339
+ : { connectOrCreate: {
1340
+ where: {
1341
+ id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
1342
+ name: props.user.customer.name !== undefined ? {
1343
+ equals: props.user.customer.name
1344
+ } : undefined,
1345
+ },
1346
+ create: {
1347
+ authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
1348
+ name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
1349
+ plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
1350
+ stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
1351
+ stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
1352
+ stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
1353
+ stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
1354
+ },
1355
+ }
1356
+ } : undefined,
1357
+ accounts: props.user.accounts ?
1358
+ typeof props.user.accounts[0] === 'object' && Object.keys(props.user.accounts).length === 1 && Object.keys(props.user.accounts)[0] === 'id'
1359
+ ? { connect: props.user.accounts.map((item) => ({
1360
+ id: item.id
1361
+ }))
1362
+ }
1363
+ : { connectOrCreate: props.user.accounts.map((item) => ({
1364
+ where: {
1365
+ id: item.id !== undefined ? item.id : undefined,
1366
+ },
1367
+ create: {
1368
+ type: item.type !== undefined ? item.type : undefined,
1369
+ provider: item.provider !== undefined ? item.provider : undefined,
1370
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
1371
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
1372
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
1373
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
1374
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
1375
+ scope: item.scope !== undefined ? item.scope : undefined,
1376
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
1377
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
1378
+ },
1379
+ }))
1380
+ } : undefined,
1381
+ sessions: props.user.sessions ?
1382
+ typeof props.user.sessions[0] === 'object' && Object.keys(props.user.sessions).length === 1 && Object.keys(props.user.sessions)[0] === 'id'
1383
+ ? { connect: props.user.sessions.map((item) => ({
1384
+ id: item.id
1385
+ }))
1386
+ }
1387
+ : { connectOrCreate: props.user.sessions.map((item) => ({
1388
+ where: {
1389
+ id: item.id !== undefined ? item.id : undefined,
1390
+ },
1391
+ create: {
1392
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
1393
+ expires: item.expires !== undefined ? item.expires : undefined,
1394
+ },
1395
+ }))
1396
+ } : undefined,
1397
+ authenticators: props.user.authenticators ?
1398
+ typeof props.user.authenticators[0] === 'object' && Object.keys(props.user.authenticators).length === 1 && Object.keys(props.user.authenticators)[0] === 'id'
1399
+ ? { connect: props.user.authenticators.map((item) => ({
1400
+ id: item.id
1401
+ }))
1402
+ }
1403
+ : { connectOrCreate: props.user.authenticators.map((item) => ({
1404
+ where: {
1405
+ id: item.id !== undefined ? item.id : undefined,
1406
+ },
1407
+ create: {
1408
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
1409
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
1410
+ counter: item.counter !== undefined ? item.counter : undefined,
1411
+ },
1412
+ }))
1413
+ } : undefined,
1324
1414
  },
1325
1415
  }
1326
1416
  } : undefined,
@@ -1620,107 +1710,15 @@ exports.AlpacaAccount = {
1620
1710
  type: item.type !== undefined ? {
1621
1711
  set: item.type
1622
1712
  } : undefined,
1623
- note: item.note !== undefined ? {
1624
- set: item.note
1625
- } : undefined,
1626
- status: item.status !== undefined ? {
1627
- set: item.status
1628
- } : undefined,
1629
- fee: item.fee !== undefined ? {
1630
- set: item.fee
1631
- } : undefined,
1632
- },
1633
- create: {
1634
- sequence: item.sequence !== undefined ? item.sequence : undefined,
1635
- type: item.type !== undefined ? item.type : undefined,
1636
- note: item.note !== undefined ? item.note : undefined,
1637
- status: item.status !== undefined ? item.status : undefined,
1638
- fee: item.fee !== undefined ? item.fee : undefined,
1639
- },
1640
- }))
1641
- } : undefined,
1642
- },
1643
- create: {
1644
- qty: item.qty !== undefined ? item.qty : undefined,
1645
- price: item.price !== undefined ? item.price : undefined,
1646
- total: item.total !== undefined ? item.total : undefined,
1647
- signal: item.signal !== undefined ? item.signal : undefined,
1648
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1649
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1650
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1651
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1652
- status: item.status !== undefined ? item.status : undefined,
1653
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1654
- asset: item.asset ? {
1655
- connectOrCreate: {
1656
- where: {
1657
- id: item.asset.id !== undefined ? item.asset.id : undefined,
1658
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1659
- name: item.asset.name !== undefined ? item.asset.name : undefined,
1660
- },
1661
- create: {
1662
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1663
- name: item.asset.name !== undefined ? item.asset.name : undefined,
1664
- type: item.asset.type !== undefined ? item.asset.type : undefined,
1665
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
1666
- description: item.asset.description !== undefined ? item.asset.description : undefined,
1667
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
1668
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
1669
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
1670
- country: item.asset.country !== undefined ? item.asset.country : undefined,
1671
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
1672
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
1673
- address: item.asset.address !== undefined ? item.asset.address : undefined,
1674
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
1675
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
1676
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
1677
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
1678
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
1679
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
1680
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
1681
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
1682
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
1683
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
1684
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
1685
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
1686
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
1687
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
1688
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
1689
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
1690
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
1691
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
1692
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
1693
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
1694
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
1695
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
1696
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
1697
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
1698
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
1699
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
1700
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
1701
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
1702
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
1703
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
1704
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
1705
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
1706
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
1707
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
1708
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
1709
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
1710
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
1711
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
1712
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
1713
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
1714
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
1715
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
1716
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
1717
- },
1718
- }
1719
- } : undefined,
1720
- actions: item.actions ? {
1721
- connectOrCreate: item.actions.map((item) => ({
1722
- where: {
1723
- id: item.id !== undefined ? item.id : undefined,
1713
+ note: item.note !== undefined ? {
1714
+ set: item.note
1715
+ } : undefined,
1716
+ status: item.status !== undefined ? {
1717
+ set: item.status
1718
+ } : undefined,
1719
+ fee: item.fee !== undefined ? {
1720
+ set: item.fee
1721
+ } : undefined,
1724
1722
  },
1725
1723
  create: {
1726
1724
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1732,6 +1730,108 @@ exports.AlpacaAccount = {
1732
1730
  }))
1733
1731
  } : undefined,
1734
1732
  },
1733
+ create: {
1734
+ qty: item.qty !== undefined ? item.qty : undefined,
1735
+ price: item.price !== undefined ? item.price : undefined,
1736
+ total: item.total !== undefined ? item.total : undefined,
1737
+ signal: item.signal !== undefined ? item.signal : undefined,
1738
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1739
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1740
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1741
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1742
+ status: item.status !== undefined ? item.status : undefined,
1743
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1744
+ asset: item.asset ?
1745
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
1746
+ ? { connect: {
1747
+ id: item.asset.id
1748
+ }
1749
+ }
1750
+ : { connectOrCreate: {
1751
+ where: {
1752
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
1753
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1754
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
1755
+ },
1756
+ create: {
1757
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1758
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
1759
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
1760
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
1761
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
1762
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
1763
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
1764
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
1765
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
1766
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
1767
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
1768
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
1769
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
1770
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
1771
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
1772
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
1773
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
1774
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
1775
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
1776
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
1777
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
1778
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
1779
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
1780
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
1781
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
1782
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
1783
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
1784
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
1785
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
1786
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
1787
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
1788
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
1789
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
1790
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
1791
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
1792
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
1793
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
1794
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
1795
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
1796
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
1797
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
1798
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
1799
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
1800
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
1801
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
1802
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
1803
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
1804
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
1805
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
1806
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
1807
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
1808
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
1809
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
1810
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
1811
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
1812
+ },
1813
+ }
1814
+ } : undefined,
1815
+ actions: item.actions ?
1816
+ typeof item.actions[0] === 'object' && Object.keys(item.actions).length === 1 && Object.keys(item.actions)[0] === 'id'
1817
+ ? { connect: item.actions.map((item) => ({
1818
+ id: item.id
1819
+ }))
1820
+ }
1821
+ : { connectOrCreate: item.actions.map((item) => ({
1822
+ where: {
1823
+ id: item.id !== undefined ? item.id : undefined,
1824
+ },
1825
+ create: {
1826
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1827
+ type: item.type !== undefined ? item.type : undefined,
1828
+ note: item.note !== undefined ? item.note : undefined,
1829
+ status: item.status !== undefined ? item.status : undefined,
1830
+ fee: item.fee !== undefined ? item.fee : undefined,
1831
+ },
1832
+ }))
1833
+ } : undefined,
1834
+ },
1735
1835
  }))
1736
1836
  } : undefined,
1737
1837
  orders: props.orders ? {
@@ -2087,86 +2187,96 @@ exports.AlpacaAccount = {
2087
2187
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2088
2188
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2089
2189
  fee: item.fee !== undefined ? item.fee : undefined,
2090
- action: item.action ? {
2091
- connectOrCreate: {
2092
- where: {
2093
- id: item.action.id !== undefined ? item.action.id : undefined,
2094
- },
2095
- create: {
2096
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2097
- type: item.action.type !== undefined ? item.action.type : undefined,
2098
- note: item.action.note !== undefined ? item.action.note : undefined,
2099
- status: item.action.status !== undefined ? item.action.status : undefined,
2100
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
2101
- },
2102
- }
2103
- } : undefined,
2104
- asset: item.asset ? {
2105
- connectOrCreate: {
2106
- where: {
2107
- id: item.asset.id !== undefined ? item.asset.id : undefined,
2108
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2109
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2110
- },
2111
- create: {
2112
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2113
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2114
- type: item.asset.type !== undefined ? item.asset.type : undefined,
2115
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2116
- description: item.asset.description !== undefined ? item.asset.description : undefined,
2117
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2118
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2119
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2120
- country: item.asset.country !== undefined ? item.asset.country : undefined,
2121
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2122
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2123
- address: item.asset.address !== undefined ? item.asset.address : undefined,
2124
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2125
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2126
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2127
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2128
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2129
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2130
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2131
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2132
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2133
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2134
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2135
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2136
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2137
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2138
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2139
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2140
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2141
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2142
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2143
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2144
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2145
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2146
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2147
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2148
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2149
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2150
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2151
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2152
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2153
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2154
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2155
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2156
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2157
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2158
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2159
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2160
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2161
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2162
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2163
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2164
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2165
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2166
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2167
- },
2168
- }
2169
- } : undefined,
2190
+ action: item.action ?
2191
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2192
+ ? { connect: {
2193
+ id: item.action.id
2194
+ }
2195
+ }
2196
+ : { connectOrCreate: {
2197
+ where: {
2198
+ id: item.action.id !== undefined ? item.action.id : undefined,
2199
+ },
2200
+ create: {
2201
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2202
+ type: item.action.type !== undefined ? item.action.type : undefined,
2203
+ note: item.action.note !== undefined ? item.action.note : undefined,
2204
+ status: item.action.status !== undefined ? item.action.status : undefined,
2205
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2206
+ },
2207
+ }
2208
+ } : undefined,
2209
+ asset: item.asset ?
2210
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
2211
+ ? { connect: {
2212
+ id: item.asset.id
2213
+ }
2214
+ }
2215
+ : { connectOrCreate: {
2216
+ where: {
2217
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
2218
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2219
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2220
+ },
2221
+ create: {
2222
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2223
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2224
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
2225
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2226
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
2227
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2228
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2229
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2230
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
2231
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2232
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2233
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
2234
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2235
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2236
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2237
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2238
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2239
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2240
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2241
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2242
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2243
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2244
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2245
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2246
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2247
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2248
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2249
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2250
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2251
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2252
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2253
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2254
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2255
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2256
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2257
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2258
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2259
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2260
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2261
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2262
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2263
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2264
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2265
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2266
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2267
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2268
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2269
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2270
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2271
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2272
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2273
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2274
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2275
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2276
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2277
+ },
2278
+ }
2279
+ } : undefined,
2170
2280
  },
2171
2281
  }))
2172
2282
  } : undefined,
@@ -2475,72 +2585,77 @@ exports.AlpacaAccount = {
2475
2585
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2476
2586
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2477
2587
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2478
- asset: item.asset ? {
2479
- connectOrCreate: {
2480
- where: {
2481
- id: item.asset.id !== undefined ? item.asset.id : undefined,
2482
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2483
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2484
- },
2485
- create: {
2486
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2487
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2488
- type: item.asset.type !== undefined ? item.asset.type : undefined,
2489
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2490
- description: item.asset.description !== undefined ? item.asset.description : undefined,
2491
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2492
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2493
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2494
- country: item.asset.country !== undefined ? item.asset.country : undefined,
2495
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2496
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2497
- address: item.asset.address !== undefined ? item.asset.address : undefined,
2498
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2499
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2500
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2501
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2502
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2503
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2504
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2505
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2506
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2507
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2508
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2509
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2510
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2511
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2512
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2513
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2514
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2515
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2516
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2517
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2518
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2519
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2520
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2521
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2522
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2523
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2524
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2525
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2526
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2527
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2528
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2529
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2530
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2531
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2532
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2533
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2534
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2535
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2536
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2537
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2538
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2539
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2540
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2541
- },
2542
- }
2543
- } : undefined,
2588
+ asset: item.asset ?
2589
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
2590
+ ? { connect: {
2591
+ id: item.asset.id
2592
+ }
2593
+ }
2594
+ : { connectOrCreate: {
2595
+ where: {
2596
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
2597
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2598
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2599
+ },
2600
+ create: {
2601
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2602
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2603
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
2604
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2605
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
2606
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2607
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2608
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2609
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
2610
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2611
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2612
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
2613
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2614
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2615
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2616
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2617
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2618
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2619
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2620
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2621
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2622
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2623
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2624
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2625
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2626
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2627
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2628
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2629
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2630
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2631
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2632
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2633
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2634
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2635
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2636
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2637
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2638
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2639
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2640
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2641
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2642
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2643
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2644
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2645
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2646
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2647
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2648
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2649
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2650
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2651
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2652
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2653
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2654
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2655
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2656
+ },
2657
+ }
2658
+ } : undefined,
2544
2659
  },
2545
2660
  }))
2546
2661
  } : undefined,
@@ -2757,104 +2872,7 @@ exports.AlpacaAccount = {
2757
2872
  } : undefined,
2758
2873
  session_state: item.session_state !== undefined ? {
2759
2874
  set: item.session_state
2760
- } : undefined,
2761
- },
2762
- create: {
2763
- type: item.type !== undefined ? item.type : undefined,
2764
- provider: item.provider !== undefined ? item.provider : undefined,
2765
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
2766
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
2767
- access_token: item.access_token !== undefined ? item.access_token : undefined,
2768
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
2769
- token_type: item.token_type !== undefined ? item.token_type : undefined,
2770
- scope: item.scope !== undefined ? item.scope : undefined,
2771
- id_token: item.id_token !== undefined ? item.id_token : undefined,
2772
- session_state: item.session_state !== undefined ? item.session_state : undefined,
2773
- },
2774
- }))
2775
- } : undefined,
2776
- sessions: prop.user.sessions ? {
2777
- upsert: prop.user.sessions.map((item) => ({
2778
- where: {
2779
- id: item.id !== undefined ? item.id : undefined,
2780
- },
2781
- update: {
2782
- id: item.id !== undefined ? {
2783
- set: item.id
2784
- } : undefined,
2785
- sessionToken: item.sessionToken !== undefined ? {
2786
- set: item.sessionToken
2787
- } : undefined,
2788
- expires: item.expires !== undefined ? {
2789
- set: item.expires
2790
- } : undefined,
2791
- },
2792
- create: {
2793
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
2794
- expires: item.expires !== undefined ? item.expires : undefined,
2795
- },
2796
- }))
2797
- } : undefined,
2798
- authenticators: prop.user.authenticators ? {
2799
- upsert: prop.user.authenticators.map((item) => ({
2800
- where: {
2801
- id: item.id !== undefined ? item.id : undefined,
2802
- },
2803
- update: {
2804
- id: item.id !== undefined ? {
2805
- set: item.id
2806
- } : undefined,
2807
- credentialID: item.credentialID !== undefined ? {
2808
- set: item.credentialID
2809
- } : undefined,
2810
- publicKey: item.publicKey !== undefined ? {
2811
- set: item.publicKey
2812
- } : undefined,
2813
- counter: item.counter !== undefined ? {
2814
- set: item.counter
2815
- } : undefined,
2816
- },
2817
- create: {
2818
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
2819
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
2820
- counter: item.counter !== undefined ? item.counter : undefined,
2821
- },
2822
- }))
2823
- } : undefined,
2824
- },
2825
- create: {
2826
- name: prop.user.name !== undefined ? prop.user.name : undefined,
2827
- email: prop.user.email !== undefined ? prop.user.email : undefined,
2828
- emailVerified: prop.user.emailVerified !== undefined ? prop.user.emailVerified : undefined,
2829
- image: prop.user.image !== undefined ? prop.user.image : undefined,
2830
- role: prop.user.role !== undefined ? prop.user.role : undefined,
2831
- bio: prop.user.bio !== undefined ? prop.user.bio : undefined,
2832
- jobTitle: prop.user.jobTitle !== undefined ? prop.user.jobTitle : undefined,
2833
- currentAccount: prop.user.currentAccount !== undefined ? prop.user.currentAccount : undefined,
2834
- plan: prop.user.plan !== undefined ? prop.user.plan : undefined,
2835
- customer: prop.user.customer ? {
2836
- connectOrCreate: {
2837
- where: {
2838
- id: prop.user.customer.id !== undefined ? prop.user.customer.id : undefined,
2839
- name: prop.user.customer.name !== undefined ? {
2840
- equals: prop.user.customer.name
2841
- } : undefined,
2842
- },
2843
- create: {
2844
- authUserId: prop.user.customer.authUserId !== undefined ? prop.user.customer.authUserId : undefined,
2845
- name: prop.user.customer.name !== undefined ? prop.user.customer.name : undefined,
2846
- plan: prop.user.customer.plan !== undefined ? prop.user.customer.plan : undefined,
2847
- stripeCustomerId: prop.user.customer.stripeCustomerId !== undefined ? prop.user.customer.stripeCustomerId : undefined,
2848
- stripeSubscriptionId: prop.user.customer.stripeSubscriptionId !== undefined ? prop.user.customer.stripeSubscriptionId : undefined,
2849
- stripePriceId: prop.user.customer.stripePriceId !== undefined ? prop.user.customer.stripePriceId : undefined,
2850
- stripeCurrentPeriodEnd: prop.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.user.customer.stripeCurrentPeriodEnd : undefined,
2851
- },
2852
- }
2853
- } : undefined,
2854
- accounts: prop.user.accounts ? {
2855
- connectOrCreate: prop.user.accounts.map((item) => ({
2856
- where: {
2857
- id: item.id !== undefined ? item.id : undefined,
2875
+ } : undefined,
2858
2876
  },
2859
2877
  create: {
2860
2878
  type: item.type !== undefined ? item.type : undefined,
@@ -2871,10 +2889,21 @@ exports.AlpacaAccount = {
2871
2889
  }))
2872
2890
  } : undefined,
2873
2891
  sessions: prop.user.sessions ? {
2874
- connectOrCreate: prop.user.sessions.map((item) => ({
2892
+ upsert: prop.user.sessions.map((item) => ({
2875
2893
  where: {
2876
2894
  id: item.id !== undefined ? item.id : undefined,
2877
2895
  },
2896
+ update: {
2897
+ id: item.id !== undefined ? {
2898
+ set: item.id
2899
+ } : undefined,
2900
+ sessionToken: item.sessionToken !== undefined ? {
2901
+ set: item.sessionToken
2902
+ } : undefined,
2903
+ expires: item.expires !== undefined ? {
2904
+ set: item.expires
2905
+ } : undefined,
2906
+ },
2878
2907
  create: {
2879
2908
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
2880
2909
  expires: item.expires !== undefined ? item.expires : undefined,
@@ -2882,10 +2911,24 @@ exports.AlpacaAccount = {
2882
2911
  }))
2883
2912
  } : undefined,
2884
2913
  authenticators: prop.user.authenticators ? {
2885
- connectOrCreate: prop.user.authenticators.map((item) => ({
2914
+ upsert: prop.user.authenticators.map((item) => ({
2886
2915
  where: {
2887
2916
  id: item.id !== undefined ? item.id : undefined,
2888
2917
  },
2918
+ update: {
2919
+ id: item.id !== undefined ? {
2920
+ set: item.id
2921
+ } : undefined,
2922
+ credentialID: item.credentialID !== undefined ? {
2923
+ set: item.credentialID
2924
+ } : undefined,
2925
+ publicKey: item.publicKey !== undefined ? {
2926
+ set: item.publicKey
2927
+ } : undefined,
2928
+ counter: item.counter !== undefined ? {
2929
+ set: item.counter
2930
+ } : undefined,
2931
+ },
2889
2932
  create: {
2890
2933
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
2891
2934
  publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
@@ -2894,6 +2937,98 @@ exports.AlpacaAccount = {
2894
2937
  }))
2895
2938
  } : undefined,
2896
2939
  },
2940
+ create: {
2941
+ name: prop.user.name !== undefined ? prop.user.name : undefined,
2942
+ email: prop.user.email !== undefined ? prop.user.email : undefined,
2943
+ emailVerified: prop.user.emailVerified !== undefined ? prop.user.emailVerified : undefined,
2944
+ image: prop.user.image !== undefined ? prop.user.image : undefined,
2945
+ role: prop.user.role !== undefined ? prop.user.role : undefined,
2946
+ bio: prop.user.bio !== undefined ? prop.user.bio : undefined,
2947
+ jobTitle: prop.user.jobTitle !== undefined ? prop.user.jobTitle : undefined,
2948
+ currentAccount: prop.user.currentAccount !== undefined ? prop.user.currentAccount : undefined,
2949
+ plan: prop.user.plan !== undefined ? prop.user.plan : undefined,
2950
+ customer: prop.user.customer ?
2951
+ typeof prop.user.customer === 'object' && Object.keys(prop.user.customer).length === 1 && Object.keys(prop.user.customer)[0] === 'id'
2952
+ ? { connect: {
2953
+ id: prop.user.customer.id
2954
+ }
2955
+ }
2956
+ : { connectOrCreate: {
2957
+ where: {
2958
+ id: prop.user.customer.id !== undefined ? prop.user.customer.id : undefined,
2959
+ name: prop.user.customer.name !== undefined ? {
2960
+ equals: prop.user.customer.name
2961
+ } : undefined,
2962
+ },
2963
+ create: {
2964
+ authUserId: prop.user.customer.authUserId !== undefined ? prop.user.customer.authUserId : undefined,
2965
+ name: prop.user.customer.name !== undefined ? prop.user.customer.name : undefined,
2966
+ plan: prop.user.customer.plan !== undefined ? prop.user.customer.plan : undefined,
2967
+ stripeCustomerId: prop.user.customer.stripeCustomerId !== undefined ? prop.user.customer.stripeCustomerId : undefined,
2968
+ stripeSubscriptionId: prop.user.customer.stripeSubscriptionId !== undefined ? prop.user.customer.stripeSubscriptionId : undefined,
2969
+ stripePriceId: prop.user.customer.stripePriceId !== undefined ? prop.user.customer.stripePriceId : undefined,
2970
+ stripeCurrentPeriodEnd: prop.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.user.customer.stripeCurrentPeriodEnd : undefined,
2971
+ },
2972
+ }
2973
+ } : undefined,
2974
+ accounts: prop.user.accounts ?
2975
+ typeof prop.user.accounts[0] === 'object' && Object.keys(prop.user.accounts).length === 1 && Object.keys(prop.user.accounts)[0] === 'id'
2976
+ ? { connect: prop.user.accounts.map((item) => ({
2977
+ id: item.id
2978
+ }))
2979
+ }
2980
+ : { connectOrCreate: prop.user.accounts.map((item) => ({
2981
+ where: {
2982
+ id: item.id !== undefined ? item.id : undefined,
2983
+ },
2984
+ create: {
2985
+ type: item.type !== undefined ? item.type : undefined,
2986
+ provider: item.provider !== undefined ? item.provider : undefined,
2987
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
2988
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
2989
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
2990
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
2991
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
2992
+ scope: item.scope !== undefined ? item.scope : undefined,
2993
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
2994
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
2995
+ },
2996
+ }))
2997
+ } : undefined,
2998
+ sessions: prop.user.sessions ?
2999
+ typeof prop.user.sessions[0] === 'object' && Object.keys(prop.user.sessions).length === 1 && Object.keys(prop.user.sessions)[0] === 'id'
3000
+ ? { connect: prop.user.sessions.map((item) => ({
3001
+ id: item.id
3002
+ }))
3003
+ }
3004
+ : { connectOrCreate: prop.user.sessions.map((item) => ({
3005
+ where: {
3006
+ id: item.id !== undefined ? item.id : undefined,
3007
+ },
3008
+ create: {
3009
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
3010
+ expires: item.expires !== undefined ? item.expires : undefined,
3011
+ },
3012
+ }))
3013
+ } : undefined,
3014
+ authenticators: prop.user.authenticators ?
3015
+ typeof prop.user.authenticators[0] === 'object' && Object.keys(prop.user.authenticators).length === 1 && Object.keys(prop.user.authenticators)[0] === 'id'
3016
+ ? { connect: prop.user.authenticators.map((item) => ({
3017
+ id: item.id
3018
+ }))
3019
+ }
3020
+ : { connectOrCreate: prop.user.authenticators.map((item) => ({
3021
+ where: {
3022
+ id: item.id !== undefined ? item.id : undefined,
3023
+ },
3024
+ create: {
3025
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
3026
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
3027
+ counter: item.counter !== undefined ? item.counter : undefined,
3028
+ },
3029
+ }))
3030
+ } : undefined,
3031
+ },
2897
3032
  }
2898
3033
  } : undefined,
2899
3034
  trades: prop.trades ? {
@@ -3223,86 +3358,96 @@ exports.AlpacaAccount = {
3223
3358
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3224
3359
  status: item.status !== undefined ? item.status : undefined,
3225
3360
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3226
- asset: item.asset ? {
3227
- connectOrCreate: {
3228
- where: {
3229
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3230
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3231
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3232
- },
3233
- create: {
3234
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3235
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3236
- type: item.asset.type !== undefined ? item.asset.type : undefined,
3237
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3238
- description: item.asset.description !== undefined ? item.asset.description : undefined,
3239
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3240
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3241
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3242
- country: item.asset.country !== undefined ? item.asset.country : undefined,
3243
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3244
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3245
- address: item.asset.address !== undefined ? item.asset.address : undefined,
3246
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3247
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3248
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3249
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3250
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3251
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3252
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3253
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3254
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3255
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3256
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3257
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3258
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3259
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3260
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3261
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3262
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3263
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3264
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3265
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3266
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3267
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3268
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3269
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3270
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3271
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3272
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3273
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3274
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3275
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3276
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3277
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3278
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3279
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3280
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3281
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3282
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3283
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3284
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3285
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3286
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3287
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3288
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3289
- },
3290
- }
3291
- } : undefined,
3292
- actions: item.actions ? {
3293
- connectOrCreate: item.actions.map((item) => ({
3294
- where: {
3295
- id: item.id !== undefined ? item.id : undefined,
3296
- },
3297
- create: {
3298
- sequence: item.sequence !== undefined ? item.sequence : undefined,
3299
- type: item.type !== undefined ? item.type : undefined,
3300
- note: item.note !== undefined ? item.note : undefined,
3301
- status: item.status !== undefined ? item.status : undefined,
3302
- fee: item.fee !== undefined ? item.fee : undefined,
3303
- },
3304
- }))
3305
- } : undefined,
3361
+ asset: item.asset ?
3362
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3363
+ ? { connect: {
3364
+ id: item.asset.id
3365
+ }
3366
+ }
3367
+ : { connectOrCreate: {
3368
+ where: {
3369
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3370
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3371
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3372
+ },
3373
+ create: {
3374
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3375
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3376
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3377
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3378
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3379
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3380
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3381
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3382
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3383
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3384
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3385
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3386
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3387
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3388
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3389
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3390
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3391
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3392
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3393
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3394
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3395
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3396
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3397
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3398
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3399
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3400
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3401
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3402
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3403
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3404
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3405
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3406
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3407
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3408
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3409
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3410
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3411
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3412
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3413
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3414
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3415
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3416
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3417
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3418
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3419
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3420
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3421
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3422
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3423
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3424
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3425
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3426
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3427
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3428
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3429
+ },
3430
+ }
3431
+ } : undefined,
3432
+ actions: item.actions ?
3433
+ typeof item.actions[0] === 'object' && Object.keys(item.actions).length === 1 && Object.keys(item.actions)[0] === 'id'
3434
+ ? { connect: item.actions.map((item) => ({
3435
+ id: item.id
3436
+ }))
3437
+ }
3438
+ : { connectOrCreate: item.actions.map((item) => ({
3439
+ where: {
3440
+ id: item.id !== undefined ? item.id : undefined,
3441
+ },
3442
+ create: {
3443
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
3444
+ type: item.type !== undefined ? item.type : undefined,
3445
+ note: item.note !== undefined ? item.note : undefined,
3446
+ status: item.status !== undefined ? item.status : undefined,
3447
+ fee: item.fee !== undefined ? item.fee : undefined,
3448
+ },
3449
+ }))
3450
+ } : undefined,
3306
3451
  },
3307
3452
  }))
3308
3453
  } : undefined,
@@ -3659,86 +3804,96 @@ exports.AlpacaAccount = {
3659
3804
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3660
3805
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3661
3806
  fee: item.fee !== undefined ? item.fee : undefined,
3662
- action: item.action ? {
3663
- connectOrCreate: {
3664
- where: {
3665
- id: item.action.id !== undefined ? item.action.id : undefined,
3666
- },
3667
- create: {
3668
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
3669
- type: item.action.type !== undefined ? item.action.type : undefined,
3670
- note: item.action.note !== undefined ? item.action.note : undefined,
3671
- status: item.action.status !== undefined ? item.action.status : undefined,
3672
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
3673
- },
3674
- }
3675
- } : undefined,
3676
- asset: item.asset ? {
3677
- connectOrCreate: {
3678
- where: {
3679
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3680
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3681
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3682
- },
3683
- create: {
3684
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3685
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3686
- type: item.asset.type !== undefined ? item.asset.type : undefined,
3687
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3688
- description: item.asset.description !== undefined ? item.asset.description : undefined,
3689
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3690
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3691
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3692
- country: item.asset.country !== undefined ? item.asset.country : undefined,
3693
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3694
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3695
- address: item.asset.address !== undefined ? item.asset.address : undefined,
3696
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3697
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3698
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3699
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3700
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3701
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3702
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3703
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3704
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3705
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3706
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3707
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3708
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3709
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3710
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3711
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3712
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3713
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3714
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3715
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3716
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3717
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3718
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3719
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3720
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3721
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3722
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3723
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3724
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3725
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3726
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3727
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3728
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3729
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3730
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3731
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3732
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3733
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3734
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3735
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3736
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3737
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3738
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3739
- },
3740
- }
3741
- } : undefined,
3807
+ action: item.action ?
3808
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
3809
+ ? { connect: {
3810
+ id: item.action.id
3811
+ }
3812
+ }
3813
+ : { connectOrCreate: {
3814
+ where: {
3815
+ id: item.action.id !== undefined ? item.action.id : undefined,
3816
+ },
3817
+ create: {
3818
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
3819
+ type: item.action.type !== undefined ? item.action.type : undefined,
3820
+ note: item.action.note !== undefined ? item.action.note : undefined,
3821
+ status: item.action.status !== undefined ? item.action.status : undefined,
3822
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
3823
+ },
3824
+ }
3825
+ } : undefined,
3826
+ asset: item.asset ?
3827
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3828
+ ? { connect: {
3829
+ id: item.asset.id
3830
+ }
3831
+ }
3832
+ : { connectOrCreate: {
3833
+ where: {
3834
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3835
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3836
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3837
+ },
3838
+ create: {
3839
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3840
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3841
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3842
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3843
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3844
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3845
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3846
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3847
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3848
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3849
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3850
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3851
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3852
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3853
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3854
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3855
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3856
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3857
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3858
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3859
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3860
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3861
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3862
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3863
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3864
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3865
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3866
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3867
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3868
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3869
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3870
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3871
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3872
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3873
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3874
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3875
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3876
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3877
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3878
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3879
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3880
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3881
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3882
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3883
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3884
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3885
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3886
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3887
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3888
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3889
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3890
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3891
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3892
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3893
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3894
+ },
3895
+ }
3896
+ } : undefined,
3742
3897
  },
3743
3898
  }))
3744
3899
  } : undefined,
@@ -4047,72 +4202,77 @@ exports.AlpacaAccount = {
4047
4202
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4048
4203
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4049
4204
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4050
- asset: item.asset ? {
4051
- connectOrCreate: {
4052
- where: {
4053
- id: item.asset.id !== undefined ? item.asset.id : undefined,
4054
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4055
- name: item.asset.name !== undefined ? item.asset.name : undefined,
4056
- },
4057
- create: {
4058
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4059
- name: item.asset.name !== undefined ? item.asset.name : undefined,
4060
- type: item.asset.type !== undefined ? item.asset.type : undefined,
4061
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
4062
- description: item.asset.description !== undefined ? item.asset.description : undefined,
4063
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
4064
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
4065
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
4066
- country: item.asset.country !== undefined ? item.asset.country : undefined,
4067
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
4068
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
4069
- address: item.asset.address !== undefined ? item.asset.address : undefined,
4070
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
4071
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
4072
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
4073
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
4074
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
4075
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
4076
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
4077
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
4078
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
4079
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
4080
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
4081
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
4082
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
4083
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
4084
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
4085
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
4086
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
4087
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
4088
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
4089
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
4090
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
4091
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
4092
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
4093
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
4094
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
4095
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
4096
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
4097
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
4098
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
4099
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
4100
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
4101
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
4102
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
4103
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
4104
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
4105
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
4106
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
4107
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
4108
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
4109
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
4110
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
4111
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
4112
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
4113
- },
4114
- }
4115
- } : undefined,
4205
+ asset: item.asset ?
4206
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
4207
+ ? { connect: {
4208
+ id: item.asset.id
4209
+ }
4210
+ }
4211
+ : { connectOrCreate: {
4212
+ where: {
4213
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
4214
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4215
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
4216
+ },
4217
+ create: {
4218
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4219
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
4220
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
4221
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
4222
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
4223
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
4224
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
4225
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
4226
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
4227
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
4228
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
4229
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
4230
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
4231
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
4232
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
4233
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
4234
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
4235
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
4236
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
4237
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
4238
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
4239
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
4240
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
4241
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
4242
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
4243
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
4244
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
4245
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
4246
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
4247
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
4248
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
4249
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
4250
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
4251
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
4252
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
4253
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
4254
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
4255
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
4256
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
4257
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
4258
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
4259
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
4260
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
4261
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
4262
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
4263
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
4264
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
4265
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
4266
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
4267
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
4268
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
4269
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
4270
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
4271
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
4272
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
4273
+ },
4274
+ }
4275
+ } : undefined,
4116
4276
  },
4117
4277
  }))
4118
4278
  } : undefined,