adaptic-backend 1.0.79 → 1.0.80

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 +938 -0
  2. package/Action.cjs +3226 -0
  3. package/Alert.cjs +3544 -0
  4. package/AlpacaAccount.cjs +2615 -0
  5. package/Asset.cjs +3308 -0
  6. package/Authenticator.cjs +938 -0
  7. package/Customer.cjs +938 -0
  8. package/NewsArticle.cjs +801 -0
  9. package/NewsArticleAssetSentiment.cjs +831 -0
  10. package/Order.cjs +4344 -0
  11. package/Position.cjs +3672 -0
  12. package/Session.cjs +938 -0
  13. package/Trade.cjs +4352 -0
  14. package/User.cjs +2847 -0
  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 +938 -0
  19. package/server/Action.d.ts.map +1 -1
  20. package/server/Action.js.map +1 -1
  21. package/server/Action.mjs +3226 -0
  22. package/server/Alert.d.ts.map +1 -1
  23. package/server/Alert.js.map +1 -1
  24. package/server/Alert.mjs +3544 -0
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +2615 -0
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +3308 -0
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +938 -0
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +938 -0
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +801 -0
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +831 -0
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +4344 -0
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +3672 -0
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +938 -0
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +4352 -0
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +2847 -0
@@ -332,6 +332,44 @@ export const Position = {
332
332
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
333
333
  status: item.status !== undefined ? item.status : undefined,
334
334
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
335
+ alpacaAccount: item.alpacaAccount ?
336
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
337
+ ? { connect: {
338
+ id: item.alpacaAccount.id
339
+ }
340
+ }
341
+ : { connectOrCreate: {
342
+ where: {
343
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
344
+ },
345
+ create: {
346
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
347
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
348
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
349
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
350
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
351
+ },
352
+ }
353
+ } : undefined,
354
+ actions: item.actions ?
355
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
356
+ connect: item.actions.map((item) => ({
357
+ id: item.id
358
+ }))
359
+ }
360
+ : { connectOrCreate: item.actions.map((item) => ({
361
+ where: {
362
+ id: item.id !== undefined ? item.id : undefined,
363
+ },
364
+ create: {
365
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
366
+ type: item.type !== undefined ? item.type : undefined,
367
+ note: item.note !== undefined ? item.note : undefined,
368
+ status: item.status !== undefined ? item.status : undefined,
369
+ fee: item.fee !== undefined ? item.fee : undefined,
370
+ },
371
+ }))
372
+ } : undefined,
335
373
  },
336
374
  }))
337
375
  } : undefined,
@@ -362,6 +400,44 @@ export const Position = {
362
400
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
363
401
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
364
402
  fee: item.fee !== undefined ? item.fee : undefined,
403
+ alpacaAccount: item.alpacaAccount ?
404
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
405
+ ? { connect: {
406
+ id: item.alpacaAccount.id
407
+ }
408
+ }
409
+ : { connectOrCreate: {
410
+ where: {
411
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
412
+ },
413
+ create: {
414
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
415
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
416
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
417
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
418
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
419
+ },
420
+ }
421
+ } : undefined,
422
+ action: item.action ?
423
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
424
+ ? { connect: {
425
+ id: item.action.id
426
+ }
427
+ }
428
+ : { connectOrCreate: {
429
+ where: {
430
+ id: item.action.id !== undefined ? item.action.id : undefined,
431
+ },
432
+ create: {
433
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
434
+ type: item.action.type !== undefined ? item.action.type : undefined,
435
+ note: item.action.note !== undefined ? item.action.note : undefined,
436
+ status: item.action.status !== undefined ? item.action.status : undefined,
437
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
438
+ },
439
+ }
440
+ } : undefined,
365
441
  },
366
442
  }))
367
443
  } : undefined,
@@ -381,6 +457,37 @@ export const Position = {
381
457
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
382
458
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
383
459
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
460
+ news: item.news ?
461
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
462
+ ? { connect: {
463
+ id: item.news.id
464
+ }
465
+ }
466
+ : { connectOrCreate: {
467
+ where: {
468
+ id: item.news.id !== undefined ? item.news.id : undefined,
469
+ url: item.news.url !== undefined ? item.news.url : undefined,
470
+ title: item.news.title !== undefined ? {
471
+ equals: item.news.title
472
+ } : undefined,
473
+ },
474
+ create: {
475
+ title: item.news.title !== undefined ? item.news.title : undefined,
476
+ content: item.news.content !== undefined ? item.news.content : undefined,
477
+ source: item.news.source !== undefined ? item.news.source : undefined,
478
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
479
+ url: item.news.url !== undefined ? item.news.url : undefined,
480
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
481
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
482
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
483
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
484
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
485
+ category: item.news.category !== undefined ? item.news.category : undefined,
486
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
487
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
488
+ },
489
+ }
490
+ } : undefined,
384
491
  },
385
492
  }))
386
493
  } : undefined,
@@ -427,6 +534,87 @@ export const Position = {
427
534
  jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
428
535
  currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
429
536
  plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
537
+ customer: props.alpacaAccount.user.customer ?
538
+ typeof props.alpacaAccount.user.customer === 'object' && Object.keys(props.alpacaAccount.user.customer).length === 1 && Object.keys(props.alpacaAccount.user.customer)[0] === 'id'
539
+ ? { connect: {
540
+ id: props.alpacaAccount.user.customer.id
541
+ }
542
+ }
543
+ : { connectOrCreate: {
544
+ where: {
545
+ id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
546
+ name: props.alpacaAccount.user.customer.name !== undefined ? {
547
+ equals: props.alpacaAccount.user.customer.name
548
+ } : undefined,
549
+ },
550
+ create: {
551
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
552
+ name: props.alpacaAccount.user.customer.name !== undefined ? props.alpacaAccount.user.customer.name : undefined,
553
+ plan: props.alpacaAccount.user.customer.plan !== undefined ? props.alpacaAccount.user.customer.plan : undefined,
554
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
555
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
556
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? props.alpacaAccount.user.customer.stripePriceId : undefined,
557
+ stripeCurrentPeriodEnd: props.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? props.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
558
+ },
559
+ }
560
+ } : undefined,
561
+ accounts: props.alpacaAccount.user.accounts ?
562
+ Array.isArray(props.alpacaAccount.user.accounts) && props.alpacaAccount.user.accounts.length > 0 && props.alpacaAccount.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
563
+ connect: props.alpacaAccount.user.accounts.map((item) => ({
564
+ id: item.id
565
+ }))
566
+ }
567
+ : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
568
+ where: {
569
+ id: item.id !== undefined ? item.id : undefined,
570
+ },
571
+ create: {
572
+ type: item.type !== undefined ? item.type : undefined,
573
+ provider: item.provider !== undefined ? item.provider : undefined,
574
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
575
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
576
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
577
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
578
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
579
+ scope: item.scope !== undefined ? item.scope : undefined,
580
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
581
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
582
+ },
583
+ }))
584
+ } : undefined,
585
+ sessions: props.alpacaAccount.user.sessions ?
586
+ Array.isArray(props.alpacaAccount.user.sessions) && props.alpacaAccount.user.sessions.length > 0 && props.alpacaAccount.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
587
+ connect: props.alpacaAccount.user.sessions.map((item) => ({
588
+ id: item.id
589
+ }))
590
+ }
591
+ : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
592
+ where: {
593
+ id: item.id !== undefined ? item.id : undefined,
594
+ },
595
+ create: {
596
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
597
+ expires: item.expires !== undefined ? item.expires : undefined,
598
+ },
599
+ }))
600
+ } : undefined,
601
+ authenticators: props.alpacaAccount.user.authenticators ?
602
+ Array.isArray(props.alpacaAccount.user.authenticators) && props.alpacaAccount.user.authenticators.length > 0 && props.alpacaAccount.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
603
+ connect: props.alpacaAccount.user.authenticators.map((item) => ({
604
+ id: item.id
605
+ }))
606
+ }
607
+ : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
608
+ where: {
609
+ id: item.id !== undefined ? item.id : undefined,
610
+ },
611
+ create: {
612
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
613
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
614
+ counter: item.counter !== undefined ? item.counter : undefined,
615
+ },
616
+ }))
617
+ } : undefined,
430
618
  },
431
619
  }
432
620
  } : undefined,
@@ -451,6 +639,96 @@ export const Position = {
451
639
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
452
640
  status: item.status !== undefined ? item.status : undefined,
453
641
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
642
+ asset: item.asset ?
643
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
644
+ ? { connect: {
645
+ id: item.asset.id
646
+ }
647
+ }
648
+ : { connectOrCreate: {
649
+ where: {
650
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
651
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
652
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
653
+ },
654
+ create: {
655
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
656
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
657
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
658
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
659
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
660
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
661
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
662
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
663
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
664
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
665
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
666
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
667
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
668
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
669
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
670
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
671
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
672
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
673
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
674
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
675
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
676
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
677
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
678
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
679
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
680
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
681
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
682
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
683
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
684
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
685
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
686
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
687
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
688
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
689
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
690
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
691
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
692
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
693
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
694
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
695
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
696
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
697
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
698
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
699
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
700
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
701
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
702
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
703
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
704
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
705
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
706
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
707
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
708
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
709
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
710
+ },
711
+ }
712
+ } : undefined,
713
+ actions: item.actions ?
714
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
715
+ connect: item.actions.map((item) => ({
716
+ id: item.id
717
+ }))
718
+ }
719
+ : { connectOrCreate: item.actions.map((item) => ({
720
+ where: {
721
+ id: item.id !== undefined ? item.id : undefined,
722
+ },
723
+ create: {
724
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
725
+ type: item.type !== undefined ? item.type : undefined,
726
+ note: item.note !== undefined ? item.note : undefined,
727
+ status: item.status !== undefined ? item.status : undefined,
728
+ fee: item.fee !== undefined ? item.fee : undefined,
729
+ },
730
+ }))
731
+ } : undefined,
454
732
  },
455
733
  }))
456
734
  } : undefined,
@@ -481,6 +759,96 @@ export const Position = {
481
759
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
482
760
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
483
761
  fee: item.fee !== undefined ? item.fee : undefined,
762
+ action: item.action ?
763
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
764
+ ? { connect: {
765
+ id: item.action.id
766
+ }
767
+ }
768
+ : { connectOrCreate: {
769
+ where: {
770
+ id: item.action.id !== undefined ? item.action.id : undefined,
771
+ },
772
+ create: {
773
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
774
+ type: item.action.type !== undefined ? item.action.type : undefined,
775
+ note: item.action.note !== undefined ? item.action.note : undefined,
776
+ status: item.action.status !== undefined ? item.action.status : undefined,
777
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
778
+ },
779
+ }
780
+ } : undefined,
781
+ asset: item.asset ?
782
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
783
+ ? { connect: {
784
+ id: item.asset.id
785
+ }
786
+ }
787
+ : { connectOrCreate: {
788
+ where: {
789
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
790
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
791
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
792
+ },
793
+ create: {
794
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
795
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
796
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
797
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
798
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
799
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
800
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
801
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
802
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
803
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
804
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
805
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
806
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
807
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
808
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
809
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
810
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
811
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
812
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
813
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
814
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
815
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
816
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
817
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
818
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
819
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
820
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
821
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
822
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
823
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
824
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
825
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
826
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
827
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
828
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
829
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
830
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
831
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
832
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
833
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
834
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
835
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
836
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
837
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
838
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
839
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
840
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
841
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
842
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
843
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
844
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
845
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
846
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
847
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
848
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
849
+ },
850
+ }
851
+ } : undefined,
484
852
  },
485
853
  }))
486
854
  } : undefined,
@@ -1061,6 +1429,76 @@ export const Position = {
1061
1429
  optionContractType: item.optionContractType !== undefined ? {
1062
1430
  set: item.optionContractType
1063
1431
  } : undefined,
1432
+ alpacaAccount: item.alpacaAccount ? {
1433
+ upsert: {
1434
+ where: {
1435
+ id: item.alpacaAccount.id !== undefined ? {
1436
+ equals: item.alpacaAccount.id
1437
+ } : undefined,
1438
+ },
1439
+ update: {
1440
+ id: item.alpacaAccount.id !== undefined ? {
1441
+ set: item.alpacaAccount.id
1442
+ } : undefined,
1443
+ type: item.alpacaAccount.type !== undefined ? {
1444
+ set: item.alpacaAccount.type
1445
+ } : undefined,
1446
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1447
+ set: item.alpacaAccount.APIKey
1448
+ } : undefined,
1449
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1450
+ set: item.alpacaAccount.APISecret
1451
+ } : undefined,
1452
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1453
+ set: item.alpacaAccount.configuration
1454
+ } : undefined,
1455
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1456
+ set: item.alpacaAccount.marketOpen
1457
+ } : undefined,
1458
+ },
1459
+ create: {
1460
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1461
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1462
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1463
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1464
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1465
+ },
1466
+ }
1467
+ } : undefined,
1468
+ actions: item.actions ? {
1469
+ upsert: item.actions.map((item) => ({
1470
+ where: {
1471
+ id: item.id !== undefined ? item.id : undefined,
1472
+ },
1473
+ update: {
1474
+ id: item.id !== undefined ? {
1475
+ set: item.id
1476
+ } : undefined,
1477
+ sequence: item.sequence !== undefined ? {
1478
+ set: item.sequence
1479
+ } : undefined,
1480
+ type: item.type !== undefined ? {
1481
+ set: item.type
1482
+ } : undefined,
1483
+ note: item.note !== undefined ? {
1484
+ set: item.note
1485
+ } : undefined,
1486
+ status: item.status !== undefined ? {
1487
+ set: item.status
1488
+ } : undefined,
1489
+ fee: item.fee !== undefined ? {
1490
+ set: item.fee
1491
+ } : undefined,
1492
+ },
1493
+ create: {
1494
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1495
+ type: item.type !== undefined ? item.type : undefined,
1496
+ note: item.note !== undefined ? item.note : undefined,
1497
+ status: item.status !== undefined ? item.status : undefined,
1498
+ fee: item.fee !== undefined ? item.fee : undefined,
1499
+ },
1500
+ }))
1501
+ } : undefined,
1064
1502
  },
1065
1503
  create: {
1066
1504
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1073,6 +1511,44 @@ export const Position = {
1073
1511
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1074
1512
  status: item.status !== undefined ? item.status : undefined,
1075
1513
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1514
+ alpacaAccount: item.alpacaAccount ?
1515
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1516
+ ? { connect: {
1517
+ id: item.alpacaAccount.id
1518
+ }
1519
+ }
1520
+ : { connectOrCreate: {
1521
+ where: {
1522
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1523
+ },
1524
+ create: {
1525
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1526
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1527
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1528
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1529
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1530
+ },
1531
+ }
1532
+ } : undefined,
1533
+ actions: item.actions ?
1534
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1535
+ connect: item.actions.map((item) => ({
1536
+ id: item.id
1537
+ }))
1538
+ }
1539
+ : { connectOrCreate: item.actions.map((item) => ({
1540
+ where: {
1541
+ id: item.id !== undefined ? item.id : undefined,
1542
+ },
1543
+ create: {
1544
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1545
+ type: item.type !== undefined ? item.type : undefined,
1546
+ note: item.note !== undefined ? item.note : undefined,
1547
+ status: item.status !== undefined ? item.status : undefined,
1548
+ fee: item.fee !== undefined ? item.fee : undefined,
1549
+ },
1550
+ }))
1551
+ } : undefined,
1076
1552
  },
1077
1553
  }))
1078
1554
  } : undefined,
@@ -1133,6 +1609,78 @@ export const Position = {
1133
1609
  fee: item.fee !== undefined ? {
1134
1610
  set: item.fee
1135
1611
  } : undefined,
1612
+ alpacaAccount: item.alpacaAccount ? {
1613
+ upsert: {
1614
+ where: {
1615
+ id: item.alpacaAccount.id !== undefined ? {
1616
+ equals: item.alpacaAccount.id
1617
+ } : undefined,
1618
+ },
1619
+ update: {
1620
+ id: item.alpacaAccount.id !== undefined ? {
1621
+ set: item.alpacaAccount.id
1622
+ } : undefined,
1623
+ type: item.alpacaAccount.type !== undefined ? {
1624
+ set: item.alpacaAccount.type
1625
+ } : undefined,
1626
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1627
+ set: item.alpacaAccount.APIKey
1628
+ } : undefined,
1629
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1630
+ set: item.alpacaAccount.APISecret
1631
+ } : undefined,
1632
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1633
+ set: item.alpacaAccount.configuration
1634
+ } : undefined,
1635
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1636
+ set: item.alpacaAccount.marketOpen
1637
+ } : undefined,
1638
+ },
1639
+ create: {
1640
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1641
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1642
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1643
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1644
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1645
+ },
1646
+ }
1647
+ } : undefined,
1648
+ action: item.action ? {
1649
+ upsert: {
1650
+ where: {
1651
+ id: item.action.id !== undefined ? {
1652
+ equals: item.action.id
1653
+ } : undefined,
1654
+ },
1655
+ update: {
1656
+ id: item.action.id !== undefined ? {
1657
+ set: item.action.id
1658
+ } : undefined,
1659
+ sequence: item.action.sequence !== undefined ? {
1660
+ set: item.action.sequence
1661
+ } : undefined,
1662
+ type: item.action.type !== undefined ? {
1663
+ set: item.action.type
1664
+ } : undefined,
1665
+ note: item.action.note !== undefined ? {
1666
+ set: item.action.note
1667
+ } : undefined,
1668
+ status: item.action.status !== undefined ? {
1669
+ set: item.action.status
1670
+ } : undefined,
1671
+ fee: item.action.fee !== undefined ? {
1672
+ set: item.action.fee
1673
+ } : undefined,
1674
+ },
1675
+ create: {
1676
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1677
+ type: item.action.type !== undefined ? item.action.type : undefined,
1678
+ note: item.action.note !== undefined ? item.action.note : undefined,
1679
+ status: item.action.status !== undefined ? item.action.status : undefined,
1680
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1681
+ },
1682
+ }
1683
+ } : undefined,
1136
1684
  },
1137
1685
  create: {
1138
1686
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1151,6 +1699,44 @@ export const Position = {
1151
1699
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1152
1700
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1153
1701
  fee: item.fee !== undefined ? item.fee : undefined,
1702
+ alpacaAccount: item.alpacaAccount ?
1703
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1704
+ ? { connect: {
1705
+ id: item.alpacaAccount.id
1706
+ }
1707
+ }
1708
+ : { connectOrCreate: {
1709
+ where: {
1710
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1711
+ },
1712
+ create: {
1713
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1714
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1715
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1716
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1717
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1718
+ },
1719
+ }
1720
+ } : undefined,
1721
+ action: item.action ?
1722
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1723
+ ? { connect: {
1724
+ id: item.action.id
1725
+ }
1726
+ }
1727
+ : { connectOrCreate: {
1728
+ where: {
1729
+ id: item.action.id !== undefined ? item.action.id : undefined,
1730
+ },
1731
+ create: {
1732
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1733
+ type: item.action.type !== undefined ? item.action.type : undefined,
1734
+ note: item.action.note !== undefined ? item.action.note : undefined,
1735
+ status: item.action.status !== undefined ? item.action.status : undefined,
1736
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1737
+ },
1738
+ }
1739
+ } : undefined,
1154
1740
  },
1155
1741
  }))
1156
1742
  } : undefined,
@@ -1176,12 +1762,117 @@ export const Position = {
1176
1762
  sentimentLabel: item.sentimentLabel !== undefined ? {
1177
1763
  set: item.sentimentLabel
1178
1764
  } : undefined,
1765
+ news: item.news ? {
1766
+ upsert: {
1767
+ where: {
1768
+ id: item.news.id !== undefined ? {
1769
+ equals: item.news.id
1770
+ } : undefined,
1771
+ title: item.news.title !== undefined ? {
1772
+ equals: item.news.title
1773
+ } : undefined,
1774
+ url: item.news.url !== undefined ? {
1775
+ equals: item.news.url
1776
+ } : undefined,
1777
+ },
1778
+ update: {
1779
+ id: item.news.id !== undefined ? {
1780
+ set: item.news.id
1781
+ } : undefined,
1782
+ title: item.news.title !== undefined ? {
1783
+ set: item.news.title
1784
+ } : undefined,
1785
+ content: item.news.content !== undefined ? {
1786
+ set: item.news.content
1787
+ } : undefined,
1788
+ source: item.news.source !== undefined ? {
1789
+ set: item.news.source
1790
+ } : undefined,
1791
+ sourceDomain: item.news.sourceDomain !== undefined ? {
1792
+ set: item.news.sourceDomain
1793
+ } : undefined,
1794
+ url: item.news.url !== undefined ? {
1795
+ set: item.news.url
1796
+ } : undefined,
1797
+ sentiment: item.news.sentiment !== undefined ? {
1798
+ set: item.news.sentiment
1799
+ } : undefined,
1800
+ authors: item.news.authors !== undefined ? {
1801
+ set: item.news.authors
1802
+ } : undefined,
1803
+ summary: item.news.summary !== undefined ? {
1804
+ set: item.news.summary
1805
+ } : undefined,
1806
+ bannerImage: item.news.bannerImage !== undefined ? {
1807
+ set: item.news.bannerImage
1808
+ } : undefined,
1809
+ timePublished: item.news.timePublished !== undefined ? {
1810
+ set: item.news.timePublished
1811
+ } : undefined,
1812
+ category: item.news.category !== undefined ? {
1813
+ set: item.news.category
1814
+ } : undefined,
1815
+ topics: item.news.topics !== undefined ? {
1816
+ set: item.news.topics
1817
+ } : undefined,
1818
+ logo: item.news.logo !== undefined ? {
1819
+ set: item.news.logo
1820
+ } : undefined,
1821
+ },
1822
+ create: {
1823
+ title: item.news.title !== undefined ? item.news.title : undefined,
1824
+ content: item.news.content !== undefined ? item.news.content : undefined,
1825
+ source: item.news.source !== undefined ? item.news.source : undefined,
1826
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
1827
+ url: item.news.url !== undefined ? item.news.url : undefined,
1828
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
1829
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
1830
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
1831
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
1832
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
1833
+ category: item.news.category !== undefined ? item.news.category : undefined,
1834
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
1835
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
1836
+ },
1837
+ }
1838
+ } : undefined,
1179
1839
  },
1180
1840
  create: {
1181
1841
  url: item.url !== undefined ? item.url : undefined,
1182
1842
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
1183
1843
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
1184
1844
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
1845
+ news: item.news ?
1846
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
1847
+ ? { connect: {
1848
+ id: item.news.id
1849
+ }
1850
+ }
1851
+ : { connectOrCreate: {
1852
+ where: {
1853
+ id: item.news.id !== undefined ? item.news.id : undefined,
1854
+ url: item.news.url !== undefined ? item.news.url : undefined,
1855
+ title: item.news.title !== undefined ? {
1856
+ equals: item.news.title
1857
+ } : undefined,
1858
+ },
1859
+ create: {
1860
+ title: item.news.title !== undefined ? item.news.title : undefined,
1861
+ content: item.news.content !== undefined ? item.news.content : undefined,
1862
+ source: item.news.source !== undefined ? item.news.source : undefined,
1863
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
1864
+ url: item.news.url !== undefined ? item.news.url : undefined,
1865
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
1866
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
1867
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
1868
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
1869
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
1870
+ category: item.news.category !== undefined ? item.news.category : undefined,
1871
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
1872
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
1873
+ },
1874
+ }
1875
+ } : undefined,
1185
1876
  },
1186
1877
  }))
1187
1878
  } : undefined,
@@ -1263,6 +1954,44 @@ export const Position = {
1263
1954
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1264
1955
  status: item.status !== undefined ? item.status : undefined,
1265
1956
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1957
+ alpacaAccount: item.alpacaAccount ?
1958
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1959
+ ? { connect: {
1960
+ id: item.alpacaAccount.id
1961
+ }
1962
+ }
1963
+ : { connectOrCreate: {
1964
+ where: {
1965
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1966
+ },
1967
+ create: {
1968
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1969
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1970
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1971
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1972
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1973
+ },
1974
+ }
1975
+ } : undefined,
1976
+ actions: item.actions ?
1977
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1978
+ connect: item.actions.map((item) => ({
1979
+ id: item.id
1980
+ }))
1981
+ }
1982
+ : { connectOrCreate: item.actions.map((item) => ({
1983
+ where: {
1984
+ id: item.id !== undefined ? item.id : undefined,
1985
+ },
1986
+ create: {
1987
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1988
+ type: item.type !== undefined ? item.type : undefined,
1989
+ note: item.note !== undefined ? item.note : undefined,
1990
+ status: item.status !== undefined ? item.status : undefined,
1991
+ fee: item.fee !== undefined ? item.fee : undefined,
1992
+ },
1993
+ }))
1994
+ } : undefined,
1266
1995
  },
1267
1996
  }))
1268
1997
  } : undefined,
@@ -1293,6 +2022,44 @@ export const Position = {
1293
2022
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1294
2023
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1295
2024
  fee: item.fee !== undefined ? item.fee : undefined,
2025
+ alpacaAccount: item.alpacaAccount ?
2026
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2027
+ ? { connect: {
2028
+ id: item.alpacaAccount.id
2029
+ }
2030
+ }
2031
+ : { connectOrCreate: {
2032
+ where: {
2033
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2034
+ },
2035
+ create: {
2036
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2037
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2038
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2039
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2040
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2041
+ },
2042
+ }
2043
+ } : undefined,
2044
+ action: item.action ?
2045
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2046
+ ? { connect: {
2047
+ id: item.action.id
2048
+ }
2049
+ }
2050
+ : { connectOrCreate: {
2051
+ where: {
2052
+ id: item.action.id !== undefined ? item.action.id : undefined,
2053
+ },
2054
+ create: {
2055
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2056
+ type: item.action.type !== undefined ? item.action.type : undefined,
2057
+ note: item.action.note !== undefined ? item.action.note : undefined,
2058
+ status: item.action.status !== undefined ? item.action.status : undefined,
2059
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2060
+ },
2061
+ }
2062
+ } : undefined,
1296
2063
  },
1297
2064
  }))
1298
2065
  } : undefined,
@@ -1312,6 +2079,37 @@ export const Position = {
1312
2079
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
1313
2080
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
1314
2081
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
2082
+ news: item.news ?
2083
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
2084
+ ? { connect: {
2085
+ id: item.news.id
2086
+ }
2087
+ }
2088
+ : { connectOrCreate: {
2089
+ where: {
2090
+ id: item.news.id !== undefined ? item.news.id : undefined,
2091
+ url: item.news.url !== undefined ? item.news.url : undefined,
2092
+ title: item.news.title !== undefined ? {
2093
+ equals: item.news.title
2094
+ } : undefined,
2095
+ },
2096
+ create: {
2097
+ title: item.news.title !== undefined ? item.news.title : undefined,
2098
+ content: item.news.content !== undefined ? item.news.content : undefined,
2099
+ source: item.news.source !== undefined ? item.news.source : undefined,
2100
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
2101
+ url: item.news.url !== undefined ? item.news.url : undefined,
2102
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
2103
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
2104
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
2105
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
2106
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
2107
+ category: item.news.category !== undefined ? item.news.category : undefined,
2108
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
2109
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
2110
+ },
2111
+ }
2112
+ } : undefined,
1315
2113
  },
1316
2114
  }))
1317
2115
  } : undefined,
@@ -1388,6 +2186,152 @@ export const Position = {
1388
2186
  plan: props.alpacaAccount.user.plan !== undefined ? {
1389
2187
  set: props.alpacaAccount.user.plan
1390
2188
  } : undefined,
2189
+ customer: props.alpacaAccount.user.customer ? {
2190
+ upsert: {
2191
+ where: {
2192
+ id: props.alpacaAccount.user.customer.id !== undefined ? {
2193
+ equals: props.alpacaAccount.user.customer.id
2194
+ } : undefined,
2195
+ name: props.alpacaAccount.user.customer.name !== undefined ? {
2196
+ equals: props.alpacaAccount.user.customer.name
2197
+ } : undefined,
2198
+ },
2199
+ update: {
2200
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2201
+ set: props.alpacaAccount.user.customer.authUserId
2202
+ } : undefined,
2203
+ name: props.alpacaAccount.user.customer.name !== undefined ? {
2204
+ set: props.alpacaAccount.user.customer.name
2205
+ } : undefined,
2206
+ plan: props.alpacaAccount.user.customer.plan !== undefined ? {
2207
+ set: props.alpacaAccount.user.customer.plan
2208
+ } : undefined,
2209
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
2210
+ set: props.alpacaAccount.user.customer.stripeCustomerId
2211
+ } : undefined,
2212
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
2213
+ set: props.alpacaAccount.user.customer.stripeSubscriptionId
2214
+ } : undefined,
2215
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2216
+ set: props.alpacaAccount.user.customer.stripePriceId
2217
+ } : undefined,
2218
+ stripeCurrentPeriodEnd: props.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? {
2219
+ set: props.alpacaAccount.user.customer.stripeCurrentPeriodEnd
2220
+ } : undefined,
2221
+ },
2222
+ create: {
2223
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
2224
+ name: props.alpacaAccount.user.customer.name !== undefined ? props.alpacaAccount.user.customer.name : undefined,
2225
+ plan: props.alpacaAccount.user.customer.plan !== undefined ? props.alpacaAccount.user.customer.plan : undefined,
2226
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2227
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2228
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? props.alpacaAccount.user.customer.stripePriceId : undefined,
2229
+ stripeCurrentPeriodEnd: props.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? props.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
2230
+ },
2231
+ }
2232
+ } : undefined,
2233
+ accounts: props.alpacaAccount.user.accounts ? {
2234
+ upsert: props.alpacaAccount.user.accounts.map((item) => ({
2235
+ where: {
2236
+ id: item.id !== undefined ? item.id : undefined,
2237
+ },
2238
+ update: {
2239
+ id: item.id !== undefined ? {
2240
+ set: item.id
2241
+ } : undefined,
2242
+ type: item.type !== undefined ? {
2243
+ set: item.type
2244
+ } : undefined,
2245
+ provider: item.provider !== undefined ? {
2246
+ set: item.provider
2247
+ } : undefined,
2248
+ providerAccountId: item.providerAccountId !== undefined ? {
2249
+ set: item.providerAccountId
2250
+ } : undefined,
2251
+ refresh_token: item.refresh_token !== undefined ? {
2252
+ set: item.refresh_token
2253
+ } : undefined,
2254
+ access_token: item.access_token !== undefined ? {
2255
+ set: item.access_token
2256
+ } : undefined,
2257
+ expires_at: item.expires_at !== undefined ? {
2258
+ set: item.expires_at
2259
+ } : undefined,
2260
+ token_type: item.token_type !== undefined ? {
2261
+ set: item.token_type
2262
+ } : undefined,
2263
+ scope: item.scope !== undefined ? {
2264
+ set: item.scope
2265
+ } : undefined,
2266
+ id_token: item.id_token !== undefined ? {
2267
+ set: item.id_token
2268
+ } : undefined,
2269
+ session_state: item.session_state !== undefined ? {
2270
+ set: item.session_state
2271
+ } : undefined,
2272
+ },
2273
+ create: {
2274
+ type: item.type !== undefined ? item.type : undefined,
2275
+ provider: item.provider !== undefined ? item.provider : undefined,
2276
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
2277
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
2278
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
2279
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
2280
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
2281
+ scope: item.scope !== undefined ? item.scope : undefined,
2282
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
2283
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
2284
+ },
2285
+ }))
2286
+ } : undefined,
2287
+ sessions: props.alpacaAccount.user.sessions ? {
2288
+ upsert: props.alpacaAccount.user.sessions.map((item) => ({
2289
+ where: {
2290
+ id: item.id !== undefined ? item.id : undefined,
2291
+ },
2292
+ update: {
2293
+ id: item.id !== undefined ? {
2294
+ set: item.id
2295
+ } : undefined,
2296
+ sessionToken: item.sessionToken !== undefined ? {
2297
+ set: item.sessionToken
2298
+ } : undefined,
2299
+ expires: item.expires !== undefined ? {
2300
+ set: item.expires
2301
+ } : undefined,
2302
+ },
2303
+ create: {
2304
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
2305
+ expires: item.expires !== undefined ? item.expires : undefined,
2306
+ },
2307
+ }))
2308
+ } : undefined,
2309
+ authenticators: props.alpacaAccount.user.authenticators ? {
2310
+ upsert: props.alpacaAccount.user.authenticators.map((item) => ({
2311
+ where: {
2312
+ id: item.id !== undefined ? item.id : undefined,
2313
+ },
2314
+ update: {
2315
+ id: item.id !== undefined ? {
2316
+ set: item.id
2317
+ } : undefined,
2318
+ credentialID: item.credentialID !== undefined ? {
2319
+ set: item.credentialID
2320
+ } : undefined,
2321
+ publicKey: item.publicKey !== undefined ? {
2322
+ set: item.publicKey
2323
+ } : undefined,
2324
+ counter: item.counter !== undefined ? {
2325
+ set: item.counter
2326
+ } : undefined,
2327
+ },
2328
+ create: {
2329
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
2330
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
2331
+ counter: item.counter !== undefined ? item.counter : undefined,
2332
+ },
2333
+ }))
2334
+ } : undefined,
1391
2335
  },
1392
2336
  create: {
1393
2337
  name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
@@ -1399,6 +2343,87 @@ export const Position = {
1399
2343
  jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1400
2344
  currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1401
2345
  plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
2346
+ customer: props.alpacaAccount.user.customer ?
2347
+ typeof props.alpacaAccount.user.customer === 'object' && Object.keys(props.alpacaAccount.user.customer).length === 1 && Object.keys(props.alpacaAccount.user.customer)[0] === 'id'
2348
+ ? { connect: {
2349
+ id: props.alpacaAccount.user.customer.id
2350
+ }
2351
+ }
2352
+ : { connectOrCreate: {
2353
+ where: {
2354
+ id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
2355
+ name: props.alpacaAccount.user.customer.name !== undefined ? {
2356
+ equals: props.alpacaAccount.user.customer.name
2357
+ } : undefined,
2358
+ },
2359
+ create: {
2360
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
2361
+ name: props.alpacaAccount.user.customer.name !== undefined ? props.alpacaAccount.user.customer.name : undefined,
2362
+ plan: props.alpacaAccount.user.customer.plan !== undefined ? props.alpacaAccount.user.customer.plan : undefined,
2363
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2364
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2365
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? props.alpacaAccount.user.customer.stripePriceId : undefined,
2366
+ stripeCurrentPeriodEnd: props.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? props.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
2367
+ },
2368
+ }
2369
+ } : undefined,
2370
+ accounts: props.alpacaAccount.user.accounts ?
2371
+ Array.isArray(props.alpacaAccount.user.accounts) && props.alpacaAccount.user.accounts.length > 0 && props.alpacaAccount.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2372
+ connect: props.alpacaAccount.user.accounts.map((item) => ({
2373
+ id: item.id
2374
+ }))
2375
+ }
2376
+ : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
2377
+ where: {
2378
+ id: item.id !== undefined ? item.id : undefined,
2379
+ },
2380
+ create: {
2381
+ type: item.type !== undefined ? item.type : undefined,
2382
+ provider: item.provider !== undefined ? item.provider : undefined,
2383
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
2384
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
2385
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
2386
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
2387
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
2388
+ scope: item.scope !== undefined ? item.scope : undefined,
2389
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
2390
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
2391
+ },
2392
+ }))
2393
+ } : undefined,
2394
+ sessions: props.alpacaAccount.user.sessions ?
2395
+ Array.isArray(props.alpacaAccount.user.sessions) && props.alpacaAccount.user.sessions.length > 0 && props.alpacaAccount.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2396
+ connect: props.alpacaAccount.user.sessions.map((item) => ({
2397
+ id: item.id
2398
+ }))
2399
+ }
2400
+ : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
2401
+ where: {
2402
+ id: item.id !== undefined ? item.id : undefined,
2403
+ },
2404
+ create: {
2405
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
2406
+ expires: item.expires !== undefined ? item.expires : undefined,
2407
+ },
2408
+ }))
2409
+ } : undefined,
2410
+ authenticators: props.alpacaAccount.user.authenticators ?
2411
+ Array.isArray(props.alpacaAccount.user.authenticators) && props.alpacaAccount.user.authenticators.length > 0 && props.alpacaAccount.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2412
+ connect: props.alpacaAccount.user.authenticators.map((item) => ({
2413
+ id: item.id
2414
+ }))
2415
+ }
2416
+ : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
2417
+ where: {
2418
+ id: item.id !== undefined ? item.id : undefined,
2419
+ },
2420
+ create: {
2421
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
2422
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
2423
+ counter: item.counter !== undefined ? item.counter : undefined,
2424
+ },
2425
+ }))
2426
+ } : undefined,
1402
2427
  },
1403
2428
  }
1404
2429
  } : undefined,
@@ -1441,6 +2466,282 @@ export const Position = {
1441
2466
  optionContractType: item.optionContractType !== undefined ? {
1442
2467
  set: item.optionContractType
1443
2468
  } : undefined,
2469
+ asset: item.asset ? {
2470
+ upsert: {
2471
+ where: {
2472
+ id: item.asset.id !== undefined ? {
2473
+ equals: item.asset.id
2474
+ } : undefined,
2475
+ symbol: item.asset.symbol !== undefined ? {
2476
+ equals: item.asset.symbol
2477
+ } : undefined,
2478
+ name: item.asset.name !== undefined ? {
2479
+ equals: item.asset.name
2480
+ } : undefined,
2481
+ },
2482
+ update: {
2483
+ id: item.asset.id !== undefined ? {
2484
+ set: item.asset.id
2485
+ } : undefined,
2486
+ symbol: item.asset.symbol !== undefined ? {
2487
+ set: item.asset.symbol
2488
+ } : undefined,
2489
+ name: item.asset.name !== undefined ? {
2490
+ set: item.asset.name
2491
+ } : undefined,
2492
+ type: item.asset.type !== undefined ? {
2493
+ set: item.asset.type
2494
+ } : undefined,
2495
+ logoUrl: item.asset.logoUrl !== undefined ? {
2496
+ set: item.asset.logoUrl
2497
+ } : undefined,
2498
+ description: item.asset.description !== undefined ? {
2499
+ set: item.asset.description
2500
+ } : undefined,
2501
+ cik: item.asset.cik !== undefined ? {
2502
+ set: item.asset.cik
2503
+ } : undefined,
2504
+ exchange: item.asset.exchange !== undefined ? {
2505
+ set: item.asset.exchange
2506
+ } : undefined,
2507
+ currency: item.asset.currency !== undefined ? {
2508
+ set: item.asset.currency
2509
+ } : undefined,
2510
+ country: item.asset.country !== undefined ? {
2511
+ set: item.asset.country
2512
+ } : undefined,
2513
+ sector: item.asset.sector !== undefined ? {
2514
+ set: item.asset.sector
2515
+ } : undefined,
2516
+ industry: item.asset.industry !== undefined ? {
2517
+ set: item.asset.industry
2518
+ } : undefined,
2519
+ address: item.asset.address !== undefined ? {
2520
+ set: item.asset.address
2521
+ } : undefined,
2522
+ officialSite: item.asset.officialSite !== undefined ? {
2523
+ set: item.asset.officialSite
2524
+ } : undefined,
2525
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? {
2526
+ set: item.asset.fiscalYearEnd
2527
+ } : undefined,
2528
+ latestQuarter: item.asset.latestQuarter !== undefined ? {
2529
+ set: item.asset.latestQuarter
2530
+ } : undefined,
2531
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? {
2532
+ set: item.asset.marketCapitalization
2533
+ } : undefined,
2534
+ ebitda: item.asset.ebitda !== undefined ? {
2535
+ set: item.asset.ebitda
2536
+ } : undefined,
2537
+ peRatio: item.asset.peRatio !== undefined ? {
2538
+ set: item.asset.peRatio
2539
+ } : undefined,
2540
+ pegRatio: item.asset.pegRatio !== undefined ? {
2541
+ set: item.asset.pegRatio
2542
+ } : undefined,
2543
+ bookValue: item.asset.bookValue !== undefined ? {
2544
+ set: item.asset.bookValue
2545
+ } : undefined,
2546
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? {
2547
+ set: item.asset.dividendPerShare
2548
+ } : undefined,
2549
+ dividendYield: item.asset.dividendYield !== undefined ? {
2550
+ set: item.asset.dividendYield
2551
+ } : undefined,
2552
+ eps: item.asset.eps !== undefined ? {
2553
+ set: item.asset.eps
2554
+ } : undefined,
2555
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? {
2556
+ set: item.asset.revenuePerShareTTM
2557
+ } : undefined,
2558
+ profitMargin: item.asset.profitMargin !== undefined ? {
2559
+ set: item.asset.profitMargin
2560
+ } : undefined,
2561
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? {
2562
+ set: item.asset.operatingMarginTTM
2563
+ } : undefined,
2564
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? {
2565
+ set: item.asset.returnOnAssetsTTM
2566
+ } : undefined,
2567
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? {
2568
+ set: item.asset.returnOnEquityTTM
2569
+ } : undefined,
2570
+ revenueTTM: item.asset.revenueTTM !== undefined ? {
2571
+ set: item.asset.revenueTTM
2572
+ } : undefined,
2573
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? {
2574
+ set: item.asset.grossProfitTTM
2575
+ } : undefined,
2576
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? {
2577
+ set: item.asset.dilutedEPSTTM
2578
+ } : undefined,
2579
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? {
2580
+ set: item.asset.quarterlyEarningsGrowthYOY
2581
+ } : undefined,
2582
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? {
2583
+ set: item.asset.quarterlyRevenueGrowthYOY
2584
+ } : undefined,
2585
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? {
2586
+ set: item.asset.analystTargetPrice
2587
+ } : undefined,
2588
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? {
2589
+ set: item.asset.analystRatingStrongBuy
2590
+ } : undefined,
2591
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? {
2592
+ set: item.asset.analystRatingBuy
2593
+ } : undefined,
2594
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? {
2595
+ set: item.asset.analystRatingHold
2596
+ } : undefined,
2597
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? {
2598
+ set: item.asset.analystRatingSell
2599
+ } : undefined,
2600
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? {
2601
+ set: item.asset.analystRatingStrongSell
2602
+ } : undefined,
2603
+ trailingPE: item.asset.trailingPE !== undefined ? {
2604
+ set: item.asset.trailingPE
2605
+ } : undefined,
2606
+ forwardPE: item.asset.forwardPE !== undefined ? {
2607
+ set: item.asset.forwardPE
2608
+ } : undefined,
2609
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? {
2610
+ set: item.asset.priceToSalesRatioTTM
2611
+ } : undefined,
2612
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? {
2613
+ set: item.asset.priceToBookRatio
2614
+ } : undefined,
2615
+ evToRevenue: item.asset.evToRevenue !== undefined ? {
2616
+ set: item.asset.evToRevenue
2617
+ } : undefined,
2618
+ evToEbitda: item.asset.evToEbitda !== undefined ? {
2619
+ set: item.asset.evToEbitda
2620
+ } : undefined,
2621
+ beta: item.asset.beta !== undefined ? {
2622
+ set: item.asset.beta
2623
+ } : undefined,
2624
+ week52High: item.asset.week52High !== undefined ? {
2625
+ set: item.asset.week52High
2626
+ } : undefined,
2627
+ week52Low: item.asset.week52Low !== undefined ? {
2628
+ set: item.asset.week52Low
2629
+ } : undefined,
2630
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? {
2631
+ set: item.asset.day50MovingAverage
2632
+ } : undefined,
2633
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? {
2634
+ set: item.asset.day200MovingAverage
2635
+ } : undefined,
2636
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? {
2637
+ set: item.asset.sharesOutstanding
2638
+ } : undefined,
2639
+ dividendDate: item.asset.dividendDate !== undefined ? {
2640
+ set: item.asset.dividendDate
2641
+ } : undefined,
2642
+ exDividendDate: item.asset.exDividendDate !== undefined ? {
2643
+ set: item.asset.exDividendDate
2644
+ } : undefined,
2645
+ sellPrice: item.asset.sellPrice !== undefined ? {
2646
+ set: item.asset.sellPrice
2647
+ } : undefined,
2648
+ buyPrice: item.asset.buyPrice !== undefined ? {
2649
+ set: item.asset.buyPrice
2650
+ } : undefined,
2651
+ },
2652
+ create: {
2653
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2654
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2655
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
2656
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2657
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
2658
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2659
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2660
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2661
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
2662
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2663
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2664
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
2665
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2666
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2667
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2668
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2669
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2670
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2671
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2672
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2673
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2674
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2675
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2676
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2677
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2678
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2679
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2680
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2681
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2682
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2683
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2684
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2685
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2686
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2687
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2688
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2689
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2690
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2691
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2692
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2693
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2694
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2695
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2696
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2697
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2698
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2699
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2700
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2701
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2702
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2703
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2704
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2705
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2706
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2707
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2708
+ },
2709
+ }
2710
+ } : undefined,
2711
+ actions: item.actions ? {
2712
+ upsert: item.actions.map((item) => ({
2713
+ where: {
2714
+ id: item.id !== undefined ? item.id : undefined,
2715
+ },
2716
+ update: {
2717
+ id: item.id !== undefined ? {
2718
+ set: item.id
2719
+ } : undefined,
2720
+ sequence: item.sequence !== undefined ? {
2721
+ set: item.sequence
2722
+ } : undefined,
2723
+ type: item.type !== undefined ? {
2724
+ set: item.type
2725
+ } : undefined,
2726
+ note: item.note !== undefined ? {
2727
+ set: item.note
2728
+ } : undefined,
2729
+ status: item.status !== undefined ? {
2730
+ set: item.status
2731
+ } : undefined,
2732
+ fee: item.fee !== undefined ? {
2733
+ set: item.fee
2734
+ } : undefined,
2735
+ },
2736
+ create: {
2737
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2738
+ type: item.type !== undefined ? item.type : undefined,
2739
+ note: item.note !== undefined ? item.note : undefined,
2740
+ status: item.status !== undefined ? item.status : undefined,
2741
+ fee: item.fee !== undefined ? item.fee : undefined,
2742
+ },
2743
+ }))
2744
+ } : undefined,
1444
2745
  },
1445
2746
  create: {
1446
2747
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1453,6 +2754,96 @@ export const Position = {
1453
2754
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1454
2755
  status: item.status !== undefined ? item.status : undefined,
1455
2756
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2757
+ asset: item.asset ?
2758
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
2759
+ ? { connect: {
2760
+ id: item.asset.id
2761
+ }
2762
+ }
2763
+ : { connectOrCreate: {
2764
+ where: {
2765
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
2766
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2767
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2768
+ },
2769
+ create: {
2770
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2771
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2772
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
2773
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2774
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
2775
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2776
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2777
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2778
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
2779
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2780
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2781
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
2782
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2783
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2784
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2785
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2786
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2787
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2788
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2789
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2790
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2791
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2792
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2793
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2794
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2795
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2796
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2797
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2798
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2799
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2800
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2801
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2802
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2803
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2804
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2805
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2806
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2807
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2808
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2809
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2810
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2811
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2812
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2813
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2814
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2815
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2816
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2817
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2818
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2819
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2820
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2821
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2822
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2823
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2824
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2825
+ },
2826
+ }
2827
+ } : undefined,
2828
+ actions: item.actions ?
2829
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2830
+ connect: item.actions.map((item) => ({
2831
+ id: item.id
2832
+ }))
2833
+ }
2834
+ : { connectOrCreate: item.actions.map((item) => ({
2835
+ where: {
2836
+ id: item.id !== undefined ? item.id : undefined,
2837
+ },
2838
+ create: {
2839
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2840
+ type: item.type !== undefined ? item.type : undefined,
2841
+ note: item.note !== undefined ? item.note : undefined,
2842
+ status: item.status !== undefined ? item.status : undefined,
2843
+ fee: item.fee !== undefined ? item.fee : undefined,
2844
+ },
2845
+ }))
2846
+ } : undefined,
1456
2847
  },
1457
2848
  }))
1458
2849
  } : undefined,
@@ -1513,6 +2904,284 @@ export const Position = {
1513
2904
  fee: item.fee !== undefined ? {
1514
2905
  set: item.fee
1515
2906
  } : undefined,
2907
+ action: item.action ? {
2908
+ upsert: {
2909
+ where: {
2910
+ id: item.action.id !== undefined ? {
2911
+ equals: item.action.id
2912
+ } : undefined,
2913
+ },
2914
+ update: {
2915
+ id: item.action.id !== undefined ? {
2916
+ set: item.action.id
2917
+ } : undefined,
2918
+ sequence: item.action.sequence !== undefined ? {
2919
+ set: item.action.sequence
2920
+ } : undefined,
2921
+ type: item.action.type !== undefined ? {
2922
+ set: item.action.type
2923
+ } : undefined,
2924
+ note: item.action.note !== undefined ? {
2925
+ set: item.action.note
2926
+ } : undefined,
2927
+ status: item.action.status !== undefined ? {
2928
+ set: item.action.status
2929
+ } : undefined,
2930
+ fee: item.action.fee !== undefined ? {
2931
+ set: item.action.fee
2932
+ } : undefined,
2933
+ },
2934
+ create: {
2935
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2936
+ type: item.action.type !== undefined ? item.action.type : undefined,
2937
+ note: item.action.note !== undefined ? item.action.note : undefined,
2938
+ status: item.action.status !== undefined ? item.action.status : undefined,
2939
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2940
+ },
2941
+ }
2942
+ } : undefined,
2943
+ asset: item.asset ? {
2944
+ upsert: {
2945
+ where: {
2946
+ id: item.asset.id !== undefined ? {
2947
+ equals: item.asset.id
2948
+ } : undefined,
2949
+ symbol: item.asset.symbol !== undefined ? {
2950
+ equals: item.asset.symbol
2951
+ } : undefined,
2952
+ name: item.asset.name !== undefined ? {
2953
+ equals: item.asset.name
2954
+ } : undefined,
2955
+ },
2956
+ update: {
2957
+ id: item.asset.id !== undefined ? {
2958
+ set: item.asset.id
2959
+ } : undefined,
2960
+ symbol: item.asset.symbol !== undefined ? {
2961
+ set: item.asset.symbol
2962
+ } : undefined,
2963
+ name: item.asset.name !== undefined ? {
2964
+ set: item.asset.name
2965
+ } : undefined,
2966
+ type: item.asset.type !== undefined ? {
2967
+ set: item.asset.type
2968
+ } : undefined,
2969
+ logoUrl: item.asset.logoUrl !== undefined ? {
2970
+ set: item.asset.logoUrl
2971
+ } : undefined,
2972
+ description: item.asset.description !== undefined ? {
2973
+ set: item.asset.description
2974
+ } : undefined,
2975
+ cik: item.asset.cik !== undefined ? {
2976
+ set: item.asset.cik
2977
+ } : undefined,
2978
+ exchange: item.asset.exchange !== undefined ? {
2979
+ set: item.asset.exchange
2980
+ } : undefined,
2981
+ currency: item.asset.currency !== undefined ? {
2982
+ set: item.asset.currency
2983
+ } : undefined,
2984
+ country: item.asset.country !== undefined ? {
2985
+ set: item.asset.country
2986
+ } : undefined,
2987
+ sector: item.asset.sector !== undefined ? {
2988
+ set: item.asset.sector
2989
+ } : undefined,
2990
+ industry: item.asset.industry !== undefined ? {
2991
+ set: item.asset.industry
2992
+ } : undefined,
2993
+ address: item.asset.address !== undefined ? {
2994
+ set: item.asset.address
2995
+ } : undefined,
2996
+ officialSite: item.asset.officialSite !== undefined ? {
2997
+ set: item.asset.officialSite
2998
+ } : undefined,
2999
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? {
3000
+ set: item.asset.fiscalYearEnd
3001
+ } : undefined,
3002
+ latestQuarter: item.asset.latestQuarter !== undefined ? {
3003
+ set: item.asset.latestQuarter
3004
+ } : undefined,
3005
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? {
3006
+ set: item.asset.marketCapitalization
3007
+ } : undefined,
3008
+ ebitda: item.asset.ebitda !== undefined ? {
3009
+ set: item.asset.ebitda
3010
+ } : undefined,
3011
+ peRatio: item.asset.peRatio !== undefined ? {
3012
+ set: item.asset.peRatio
3013
+ } : undefined,
3014
+ pegRatio: item.asset.pegRatio !== undefined ? {
3015
+ set: item.asset.pegRatio
3016
+ } : undefined,
3017
+ bookValue: item.asset.bookValue !== undefined ? {
3018
+ set: item.asset.bookValue
3019
+ } : undefined,
3020
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? {
3021
+ set: item.asset.dividendPerShare
3022
+ } : undefined,
3023
+ dividendYield: item.asset.dividendYield !== undefined ? {
3024
+ set: item.asset.dividendYield
3025
+ } : undefined,
3026
+ eps: item.asset.eps !== undefined ? {
3027
+ set: item.asset.eps
3028
+ } : undefined,
3029
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? {
3030
+ set: item.asset.revenuePerShareTTM
3031
+ } : undefined,
3032
+ profitMargin: item.asset.profitMargin !== undefined ? {
3033
+ set: item.asset.profitMargin
3034
+ } : undefined,
3035
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? {
3036
+ set: item.asset.operatingMarginTTM
3037
+ } : undefined,
3038
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? {
3039
+ set: item.asset.returnOnAssetsTTM
3040
+ } : undefined,
3041
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? {
3042
+ set: item.asset.returnOnEquityTTM
3043
+ } : undefined,
3044
+ revenueTTM: item.asset.revenueTTM !== undefined ? {
3045
+ set: item.asset.revenueTTM
3046
+ } : undefined,
3047
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? {
3048
+ set: item.asset.grossProfitTTM
3049
+ } : undefined,
3050
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? {
3051
+ set: item.asset.dilutedEPSTTM
3052
+ } : undefined,
3053
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? {
3054
+ set: item.asset.quarterlyEarningsGrowthYOY
3055
+ } : undefined,
3056
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? {
3057
+ set: item.asset.quarterlyRevenueGrowthYOY
3058
+ } : undefined,
3059
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? {
3060
+ set: item.asset.analystTargetPrice
3061
+ } : undefined,
3062
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? {
3063
+ set: item.asset.analystRatingStrongBuy
3064
+ } : undefined,
3065
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? {
3066
+ set: item.asset.analystRatingBuy
3067
+ } : undefined,
3068
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? {
3069
+ set: item.asset.analystRatingHold
3070
+ } : undefined,
3071
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? {
3072
+ set: item.asset.analystRatingSell
3073
+ } : undefined,
3074
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? {
3075
+ set: item.asset.analystRatingStrongSell
3076
+ } : undefined,
3077
+ trailingPE: item.asset.trailingPE !== undefined ? {
3078
+ set: item.asset.trailingPE
3079
+ } : undefined,
3080
+ forwardPE: item.asset.forwardPE !== undefined ? {
3081
+ set: item.asset.forwardPE
3082
+ } : undefined,
3083
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? {
3084
+ set: item.asset.priceToSalesRatioTTM
3085
+ } : undefined,
3086
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? {
3087
+ set: item.asset.priceToBookRatio
3088
+ } : undefined,
3089
+ evToRevenue: item.asset.evToRevenue !== undefined ? {
3090
+ set: item.asset.evToRevenue
3091
+ } : undefined,
3092
+ evToEbitda: item.asset.evToEbitda !== undefined ? {
3093
+ set: item.asset.evToEbitda
3094
+ } : undefined,
3095
+ beta: item.asset.beta !== undefined ? {
3096
+ set: item.asset.beta
3097
+ } : undefined,
3098
+ week52High: item.asset.week52High !== undefined ? {
3099
+ set: item.asset.week52High
3100
+ } : undefined,
3101
+ week52Low: item.asset.week52Low !== undefined ? {
3102
+ set: item.asset.week52Low
3103
+ } : undefined,
3104
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? {
3105
+ set: item.asset.day50MovingAverage
3106
+ } : undefined,
3107
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? {
3108
+ set: item.asset.day200MovingAverage
3109
+ } : undefined,
3110
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? {
3111
+ set: item.asset.sharesOutstanding
3112
+ } : undefined,
3113
+ dividendDate: item.asset.dividendDate !== undefined ? {
3114
+ set: item.asset.dividendDate
3115
+ } : undefined,
3116
+ exDividendDate: item.asset.exDividendDate !== undefined ? {
3117
+ set: item.asset.exDividendDate
3118
+ } : undefined,
3119
+ sellPrice: item.asset.sellPrice !== undefined ? {
3120
+ set: item.asset.sellPrice
3121
+ } : undefined,
3122
+ buyPrice: item.asset.buyPrice !== undefined ? {
3123
+ set: item.asset.buyPrice
3124
+ } : undefined,
3125
+ },
3126
+ create: {
3127
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3128
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3129
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3130
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3131
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3132
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3133
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3134
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3135
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3136
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3137
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3138
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3139
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3140
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3141
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3142
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3143
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3144
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3145
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3146
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3147
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3148
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3149
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3150
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3151
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3152
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3153
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3154
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3155
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3156
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3157
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3158
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3159
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3160
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3161
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3162
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3163
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3164
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3165
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3166
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3167
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3168
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3169
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3170
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3171
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3172
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3173
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3174
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3175
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3176
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3177
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3178
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3179
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3180
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3181
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3182
+ },
3183
+ }
3184
+ } : undefined,
1516
3185
  },
1517
3186
  create: {
1518
3187
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1531,6 +3200,96 @@ export const Position = {
1531
3200
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1532
3201
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1533
3202
  fee: item.fee !== undefined ? item.fee : undefined,
3203
+ action: item.action ?
3204
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
3205
+ ? { connect: {
3206
+ id: item.action.id
3207
+ }
3208
+ }
3209
+ : { connectOrCreate: {
3210
+ where: {
3211
+ id: item.action.id !== undefined ? item.action.id : undefined,
3212
+ },
3213
+ create: {
3214
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
3215
+ type: item.action.type !== undefined ? item.action.type : undefined,
3216
+ note: item.action.note !== undefined ? item.action.note : undefined,
3217
+ status: item.action.status !== undefined ? item.action.status : undefined,
3218
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
3219
+ },
3220
+ }
3221
+ } : undefined,
3222
+ asset: item.asset ?
3223
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3224
+ ? { connect: {
3225
+ id: item.asset.id
3226
+ }
3227
+ }
3228
+ : { connectOrCreate: {
3229
+ where: {
3230
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3231
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3232
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3233
+ },
3234
+ create: {
3235
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3236
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3237
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3238
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3239
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3240
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3241
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3242
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3243
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3244
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3245
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3246
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3247
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3248
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3249
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3250
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3251
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3252
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3253
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3254
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3255
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3256
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3257
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3258
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3259
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3260
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3261
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3262
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3263
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3264
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3265
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3266
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3267
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3268
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3269
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3270
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3271
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3272
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3273
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3274
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3275
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3276
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3277
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3278
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3279
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3280
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3281
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3282
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3283
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3284
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3285
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3286
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3287
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3288
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3289
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3290
+ },
3291
+ }
3292
+ } : undefined,
1534
3293
  },
1535
3294
  }))
1536
3295
  } : undefined,
@@ -1591,6 +3350,87 @@ export const Position = {
1591
3350
  jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1592
3351
  currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1593
3352
  plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
3353
+ customer: props.alpacaAccount.user.customer ?
3354
+ typeof props.alpacaAccount.user.customer === 'object' && Object.keys(props.alpacaAccount.user.customer).length === 1 && Object.keys(props.alpacaAccount.user.customer)[0] === 'id'
3355
+ ? { connect: {
3356
+ id: props.alpacaAccount.user.customer.id
3357
+ }
3358
+ }
3359
+ : { connectOrCreate: {
3360
+ where: {
3361
+ id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
3362
+ name: props.alpacaAccount.user.customer.name !== undefined ? {
3363
+ equals: props.alpacaAccount.user.customer.name
3364
+ } : undefined,
3365
+ },
3366
+ create: {
3367
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
3368
+ name: props.alpacaAccount.user.customer.name !== undefined ? props.alpacaAccount.user.customer.name : undefined,
3369
+ plan: props.alpacaAccount.user.customer.plan !== undefined ? props.alpacaAccount.user.customer.plan : undefined,
3370
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
3371
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
3372
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? props.alpacaAccount.user.customer.stripePriceId : undefined,
3373
+ stripeCurrentPeriodEnd: props.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? props.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
3374
+ },
3375
+ }
3376
+ } : undefined,
3377
+ accounts: props.alpacaAccount.user.accounts ?
3378
+ Array.isArray(props.alpacaAccount.user.accounts) && props.alpacaAccount.user.accounts.length > 0 && props.alpacaAccount.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3379
+ connect: props.alpacaAccount.user.accounts.map((item) => ({
3380
+ id: item.id
3381
+ }))
3382
+ }
3383
+ : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
3384
+ where: {
3385
+ id: item.id !== undefined ? item.id : undefined,
3386
+ },
3387
+ create: {
3388
+ type: item.type !== undefined ? item.type : undefined,
3389
+ provider: item.provider !== undefined ? item.provider : undefined,
3390
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
3391
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
3392
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
3393
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
3394
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
3395
+ scope: item.scope !== undefined ? item.scope : undefined,
3396
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
3397
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
3398
+ },
3399
+ }))
3400
+ } : undefined,
3401
+ sessions: props.alpacaAccount.user.sessions ?
3402
+ Array.isArray(props.alpacaAccount.user.sessions) && props.alpacaAccount.user.sessions.length > 0 && props.alpacaAccount.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3403
+ connect: props.alpacaAccount.user.sessions.map((item) => ({
3404
+ id: item.id
3405
+ }))
3406
+ }
3407
+ : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
3408
+ where: {
3409
+ id: item.id !== undefined ? item.id : undefined,
3410
+ },
3411
+ create: {
3412
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
3413
+ expires: item.expires !== undefined ? item.expires : undefined,
3414
+ },
3415
+ }))
3416
+ } : undefined,
3417
+ authenticators: props.alpacaAccount.user.authenticators ?
3418
+ Array.isArray(props.alpacaAccount.user.authenticators) && props.alpacaAccount.user.authenticators.length > 0 && props.alpacaAccount.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3419
+ connect: props.alpacaAccount.user.authenticators.map((item) => ({
3420
+ id: item.id
3421
+ }))
3422
+ }
3423
+ : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
3424
+ where: {
3425
+ id: item.id !== undefined ? item.id : undefined,
3426
+ },
3427
+ create: {
3428
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
3429
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
3430
+ counter: item.counter !== undefined ? item.counter : undefined,
3431
+ },
3432
+ }))
3433
+ } : undefined,
1594
3434
  },
1595
3435
  }
1596
3436
  } : undefined,
@@ -1615,6 +3455,96 @@ export const Position = {
1615
3455
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1616
3456
  status: item.status !== undefined ? item.status : undefined,
1617
3457
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3458
+ asset: item.asset ?
3459
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3460
+ ? { connect: {
3461
+ id: item.asset.id
3462
+ }
3463
+ }
3464
+ : { connectOrCreate: {
3465
+ where: {
3466
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3467
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3468
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3469
+ },
3470
+ create: {
3471
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3472
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3473
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3474
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3475
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3476
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3477
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3478
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3479
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3480
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3481
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3482
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3483
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3484
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3485
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3486
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3487
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3488
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3489
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3490
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3491
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3492
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3493
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3494
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3495
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3496
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3497
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3498
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3499
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3500
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3501
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3502
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3503
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3504
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3505
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3506
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3507
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3508
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3509
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3510
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3511
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3512
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3513
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3514
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3515
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3516
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3517
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3518
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3519
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3520
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3521
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3522
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3523
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3524
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3525
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3526
+ },
3527
+ }
3528
+ } : undefined,
3529
+ actions: item.actions ?
3530
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3531
+ connect: item.actions.map((item) => ({
3532
+ id: item.id
3533
+ }))
3534
+ }
3535
+ : { connectOrCreate: item.actions.map((item) => ({
3536
+ where: {
3537
+ id: item.id !== undefined ? item.id : undefined,
3538
+ },
3539
+ create: {
3540
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
3541
+ type: item.type !== undefined ? item.type : undefined,
3542
+ note: item.note !== undefined ? item.note : undefined,
3543
+ status: item.status !== undefined ? item.status : undefined,
3544
+ fee: item.fee !== undefined ? item.fee : undefined,
3545
+ },
3546
+ }))
3547
+ } : undefined,
1618
3548
  },
1619
3549
  }))
1620
3550
  } : undefined,
@@ -1645,6 +3575,96 @@ export const Position = {
1645
3575
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1646
3576
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1647
3577
  fee: item.fee !== undefined ? item.fee : undefined,
3578
+ action: item.action ?
3579
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
3580
+ ? { connect: {
3581
+ id: item.action.id
3582
+ }
3583
+ }
3584
+ : { connectOrCreate: {
3585
+ where: {
3586
+ id: item.action.id !== undefined ? item.action.id : undefined,
3587
+ },
3588
+ create: {
3589
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
3590
+ type: item.action.type !== undefined ? item.action.type : undefined,
3591
+ note: item.action.note !== undefined ? item.action.note : undefined,
3592
+ status: item.action.status !== undefined ? item.action.status : undefined,
3593
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
3594
+ },
3595
+ }
3596
+ } : undefined,
3597
+ asset: item.asset ?
3598
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3599
+ ? { connect: {
3600
+ id: item.asset.id
3601
+ }
3602
+ }
3603
+ : { connectOrCreate: {
3604
+ where: {
3605
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3606
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3607
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3608
+ },
3609
+ create: {
3610
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3611
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3612
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3613
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3614
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3615
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3616
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3617
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3618
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3619
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3620
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3621
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3622
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3623
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3624
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3625
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3626
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3627
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3628
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3629
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3630
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3631
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3632
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3633
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3634
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3635
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3636
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3637
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3638
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3639
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3640
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3641
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3642
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3643
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3644
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3645
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3646
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3647
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3648
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3649
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3650
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3651
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3652
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3653
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3654
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3655
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3656
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3657
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3658
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3659
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3660
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3661
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3662
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3663
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3664
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3665
+ },
3666
+ }
3667
+ } : undefined,
1648
3668
  },
1649
3669
  }))
1650
3670
  } : undefined,
@@ -1968,6 +3988,76 @@ export const Position = {
1968
3988
  optionContractType: item.optionContractType !== undefined ? {
1969
3989
  set: item.optionContractType
1970
3990
  } : undefined,
3991
+ alpacaAccount: item.alpacaAccount ? {
3992
+ upsert: {
3993
+ where: {
3994
+ id: item.alpacaAccount.id !== undefined ? {
3995
+ equals: item.alpacaAccount.id
3996
+ } : undefined,
3997
+ },
3998
+ update: {
3999
+ id: item.alpacaAccount.id !== undefined ? {
4000
+ set: item.alpacaAccount.id
4001
+ } : undefined,
4002
+ type: item.alpacaAccount.type !== undefined ? {
4003
+ set: item.alpacaAccount.type
4004
+ } : undefined,
4005
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
4006
+ set: item.alpacaAccount.APIKey
4007
+ } : undefined,
4008
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
4009
+ set: item.alpacaAccount.APISecret
4010
+ } : undefined,
4011
+ configuration: item.alpacaAccount.configuration !== undefined ? {
4012
+ set: item.alpacaAccount.configuration
4013
+ } : undefined,
4014
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
4015
+ set: item.alpacaAccount.marketOpen
4016
+ } : undefined,
4017
+ },
4018
+ create: {
4019
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
4020
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
4021
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
4022
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
4023
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4024
+ },
4025
+ }
4026
+ } : undefined,
4027
+ actions: item.actions ? {
4028
+ upsert: item.actions.map((item) => ({
4029
+ where: {
4030
+ id: item.id !== undefined ? item.id : undefined,
4031
+ },
4032
+ update: {
4033
+ id: item.id !== undefined ? {
4034
+ set: item.id
4035
+ } : undefined,
4036
+ sequence: item.sequence !== undefined ? {
4037
+ set: item.sequence
4038
+ } : undefined,
4039
+ type: item.type !== undefined ? {
4040
+ set: item.type
4041
+ } : undefined,
4042
+ note: item.note !== undefined ? {
4043
+ set: item.note
4044
+ } : undefined,
4045
+ status: item.status !== undefined ? {
4046
+ set: item.status
4047
+ } : undefined,
4048
+ fee: item.fee !== undefined ? {
4049
+ set: item.fee
4050
+ } : undefined,
4051
+ },
4052
+ create: {
4053
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
4054
+ type: item.type !== undefined ? item.type : undefined,
4055
+ note: item.note !== undefined ? item.note : undefined,
4056
+ status: item.status !== undefined ? item.status : undefined,
4057
+ fee: item.fee !== undefined ? item.fee : undefined,
4058
+ },
4059
+ }))
4060
+ } : undefined,
1971
4061
  },
1972
4062
  create: {
1973
4063
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1980,6 +4070,44 @@ export const Position = {
1980
4070
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1981
4071
  status: item.status !== undefined ? item.status : undefined,
1982
4072
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
4073
+ alpacaAccount: item.alpacaAccount ?
4074
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
4075
+ ? { connect: {
4076
+ id: item.alpacaAccount.id
4077
+ }
4078
+ }
4079
+ : { connectOrCreate: {
4080
+ where: {
4081
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4082
+ },
4083
+ create: {
4084
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
4085
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
4086
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
4087
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
4088
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4089
+ },
4090
+ }
4091
+ } : undefined,
4092
+ actions: item.actions ?
4093
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4094
+ connect: item.actions.map((item) => ({
4095
+ id: item.id
4096
+ }))
4097
+ }
4098
+ : { connectOrCreate: item.actions.map((item) => ({
4099
+ where: {
4100
+ id: item.id !== undefined ? item.id : undefined,
4101
+ },
4102
+ create: {
4103
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
4104
+ type: item.type !== undefined ? item.type : undefined,
4105
+ note: item.note !== undefined ? item.note : undefined,
4106
+ status: item.status !== undefined ? item.status : undefined,
4107
+ fee: item.fee !== undefined ? item.fee : undefined,
4108
+ },
4109
+ }))
4110
+ } : undefined,
1983
4111
  },
1984
4112
  }))
1985
4113
  } : undefined,
@@ -2040,6 +4168,78 @@ export const Position = {
2040
4168
  fee: item.fee !== undefined ? {
2041
4169
  set: item.fee
2042
4170
  } : undefined,
4171
+ alpacaAccount: item.alpacaAccount ? {
4172
+ upsert: {
4173
+ where: {
4174
+ id: item.alpacaAccount.id !== undefined ? {
4175
+ equals: item.alpacaAccount.id
4176
+ } : undefined,
4177
+ },
4178
+ update: {
4179
+ id: item.alpacaAccount.id !== undefined ? {
4180
+ set: item.alpacaAccount.id
4181
+ } : undefined,
4182
+ type: item.alpacaAccount.type !== undefined ? {
4183
+ set: item.alpacaAccount.type
4184
+ } : undefined,
4185
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
4186
+ set: item.alpacaAccount.APIKey
4187
+ } : undefined,
4188
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
4189
+ set: item.alpacaAccount.APISecret
4190
+ } : undefined,
4191
+ configuration: item.alpacaAccount.configuration !== undefined ? {
4192
+ set: item.alpacaAccount.configuration
4193
+ } : undefined,
4194
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
4195
+ set: item.alpacaAccount.marketOpen
4196
+ } : undefined,
4197
+ },
4198
+ create: {
4199
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
4200
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
4201
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
4202
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
4203
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4204
+ },
4205
+ }
4206
+ } : undefined,
4207
+ action: item.action ? {
4208
+ upsert: {
4209
+ where: {
4210
+ id: item.action.id !== undefined ? {
4211
+ equals: item.action.id
4212
+ } : undefined,
4213
+ },
4214
+ update: {
4215
+ id: item.action.id !== undefined ? {
4216
+ set: item.action.id
4217
+ } : undefined,
4218
+ sequence: item.action.sequence !== undefined ? {
4219
+ set: item.action.sequence
4220
+ } : undefined,
4221
+ type: item.action.type !== undefined ? {
4222
+ set: item.action.type
4223
+ } : undefined,
4224
+ note: item.action.note !== undefined ? {
4225
+ set: item.action.note
4226
+ } : undefined,
4227
+ status: item.action.status !== undefined ? {
4228
+ set: item.action.status
4229
+ } : undefined,
4230
+ fee: item.action.fee !== undefined ? {
4231
+ set: item.action.fee
4232
+ } : undefined,
4233
+ },
4234
+ create: {
4235
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
4236
+ type: item.action.type !== undefined ? item.action.type : undefined,
4237
+ note: item.action.note !== undefined ? item.action.note : undefined,
4238
+ status: item.action.status !== undefined ? item.action.status : undefined,
4239
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
4240
+ },
4241
+ }
4242
+ } : undefined,
2043
4243
  },
2044
4244
  create: {
2045
4245
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -2058,6 +4258,44 @@ export const Position = {
2058
4258
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2059
4259
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2060
4260
  fee: item.fee !== undefined ? item.fee : undefined,
4261
+ alpacaAccount: item.alpacaAccount ?
4262
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
4263
+ ? { connect: {
4264
+ id: item.alpacaAccount.id
4265
+ }
4266
+ }
4267
+ : { connectOrCreate: {
4268
+ where: {
4269
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4270
+ },
4271
+ create: {
4272
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
4273
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
4274
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
4275
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
4276
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4277
+ },
4278
+ }
4279
+ } : undefined,
4280
+ action: item.action ?
4281
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
4282
+ ? { connect: {
4283
+ id: item.action.id
4284
+ }
4285
+ }
4286
+ : { connectOrCreate: {
4287
+ where: {
4288
+ id: item.action.id !== undefined ? item.action.id : undefined,
4289
+ },
4290
+ create: {
4291
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
4292
+ type: item.action.type !== undefined ? item.action.type : undefined,
4293
+ note: item.action.note !== undefined ? item.action.note : undefined,
4294
+ status: item.action.status !== undefined ? item.action.status : undefined,
4295
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
4296
+ },
4297
+ }
4298
+ } : undefined,
2061
4299
  },
2062
4300
  }))
2063
4301
  } : undefined,
@@ -2083,12 +4321,117 @@ export const Position = {
2083
4321
  sentimentLabel: item.sentimentLabel !== undefined ? {
2084
4322
  set: item.sentimentLabel
2085
4323
  } : undefined,
4324
+ news: item.news ? {
4325
+ upsert: {
4326
+ where: {
4327
+ id: item.news.id !== undefined ? {
4328
+ equals: item.news.id
4329
+ } : undefined,
4330
+ title: item.news.title !== undefined ? {
4331
+ equals: item.news.title
4332
+ } : undefined,
4333
+ url: item.news.url !== undefined ? {
4334
+ equals: item.news.url
4335
+ } : undefined,
4336
+ },
4337
+ update: {
4338
+ id: item.news.id !== undefined ? {
4339
+ set: item.news.id
4340
+ } : undefined,
4341
+ title: item.news.title !== undefined ? {
4342
+ set: item.news.title
4343
+ } : undefined,
4344
+ content: item.news.content !== undefined ? {
4345
+ set: item.news.content
4346
+ } : undefined,
4347
+ source: item.news.source !== undefined ? {
4348
+ set: item.news.source
4349
+ } : undefined,
4350
+ sourceDomain: item.news.sourceDomain !== undefined ? {
4351
+ set: item.news.sourceDomain
4352
+ } : undefined,
4353
+ url: item.news.url !== undefined ? {
4354
+ set: item.news.url
4355
+ } : undefined,
4356
+ sentiment: item.news.sentiment !== undefined ? {
4357
+ set: item.news.sentiment
4358
+ } : undefined,
4359
+ authors: item.news.authors !== undefined ? {
4360
+ set: item.news.authors
4361
+ } : undefined,
4362
+ summary: item.news.summary !== undefined ? {
4363
+ set: item.news.summary
4364
+ } : undefined,
4365
+ bannerImage: item.news.bannerImage !== undefined ? {
4366
+ set: item.news.bannerImage
4367
+ } : undefined,
4368
+ timePublished: item.news.timePublished !== undefined ? {
4369
+ set: item.news.timePublished
4370
+ } : undefined,
4371
+ category: item.news.category !== undefined ? {
4372
+ set: item.news.category
4373
+ } : undefined,
4374
+ topics: item.news.topics !== undefined ? {
4375
+ set: item.news.topics
4376
+ } : undefined,
4377
+ logo: item.news.logo !== undefined ? {
4378
+ set: item.news.logo
4379
+ } : undefined,
4380
+ },
4381
+ create: {
4382
+ title: item.news.title !== undefined ? item.news.title : undefined,
4383
+ content: item.news.content !== undefined ? item.news.content : undefined,
4384
+ source: item.news.source !== undefined ? item.news.source : undefined,
4385
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
4386
+ url: item.news.url !== undefined ? item.news.url : undefined,
4387
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
4388
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
4389
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
4390
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
4391
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
4392
+ category: item.news.category !== undefined ? item.news.category : undefined,
4393
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
4394
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
4395
+ },
4396
+ }
4397
+ } : undefined,
2086
4398
  },
2087
4399
  create: {
2088
4400
  url: item.url !== undefined ? item.url : undefined,
2089
4401
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
2090
4402
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
2091
4403
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
4404
+ news: item.news ?
4405
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
4406
+ ? { connect: {
4407
+ id: item.news.id
4408
+ }
4409
+ }
4410
+ : { connectOrCreate: {
4411
+ where: {
4412
+ id: item.news.id !== undefined ? item.news.id : undefined,
4413
+ url: item.news.url !== undefined ? item.news.url : undefined,
4414
+ title: item.news.title !== undefined ? {
4415
+ equals: item.news.title
4416
+ } : undefined,
4417
+ },
4418
+ create: {
4419
+ title: item.news.title !== undefined ? item.news.title : undefined,
4420
+ content: item.news.content !== undefined ? item.news.content : undefined,
4421
+ source: item.news.source !== undefined ? item.news.source : undefined,
4422
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
4423
+ url: item.news.url !== undefined ? item.news.url : undefined,
4424
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
4425
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
4426
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
4427
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
4428
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
4429
+ category: item.news.category !== undefined ? item.news.category : undefined,
4430
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
4431
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
4432
+ },
4433
+ }
4434
+ } : undefined,
2092
4435
  },
2093
4436
  }))
2094
4437
  } : undefined,
@@ -2170,6 +4513,44 @@ export const Position = {
2170
4513
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2171
4514
  status: item.status !== undefined ? item.status : undefined,
2172
4515
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
4516
+ alpacaAccount: item.alpacaAccount ?
4517
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
4518
+ ? { connect: {
4519
+ id: item.alpacaAccount.id
4520
+ }
4521
+ }
4522
+ : { connectOrCreate: {
4523
+ where: {
4524
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4525
+ },
4526
+ create: {
4527
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
4528
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
4529
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
4530
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
4531
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4532
+ },
4533
+ }
4534
+ } : undefined,
4535
+ actions: item.actions ?
4536
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4537
+ connect: item.actions.map((item) => ({
4538
+ id: item.id
4539
+ }))
4540
+ }
4541
+ : { connectOrCreate: item.actions.map((item) => ({
4542
+ where: {
4543
+ id: item.id !== undefined ? item.id : undefined,
4544
+ },
4545
+ create: {
4546
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
4547
+ type: item.type !== undefined ? item.type : undefined,
4548
+ note: item.note !== undefined ? item.note : undefined,
4549
+ status: item.status !== undefined ? item.status : undefined,
4550
+ fee: item.fee !== undefined ? item.fee : undefined,
4551
+ },
4552
+ }))
4553
+ } : undefined,
2173
4554
  },
2174
4555
  }))
2175
4556
  } : undefined,
@@ -2200,6 +4581,44 @@ export const Position = {
2200
4581
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2201
4582
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2202
4583
  fee: item.fee !== undefined ? item.fee : undefined,
4584
+ alpacaAccount: item.alpacaAccount ?
4585
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
4586
+ ? { connect: {
4587
+ id: item.alpacaAccount.id
4588
+ }
4589
+ }
4590
+ : { connectOrCreate: {
4591
+ where: {
4592
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4593
+ },
4594
+ create: {
4595
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
4596
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
4597
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
4598
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
4599
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4600
+ },
4601
+ }
4602
+ } : undefined,
4603
+ action: item.action ?
4604
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
4605
+ ? { connect: {
4606
+ id: item.action.id
4607
+ }
4608
+ }
4609
+ : { connectOrCreate: {
4610
+ where: {
4611
+ id: item.action.id !== undefined ? item.action.id : undefined,
4612
+ },
4613
+ create: {
4614
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
4615
+ type: item.action.type !== undefined ? item.action.type : undefined,
4616
+ note: item.action.note !== undefined ? item.action.note : undefined,
4617
+ status: item.action.status !== undefined ? item.action.status : undefined,
4618
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
4619
+ },
4620
+ }
4621
+ } : undefined,
2203
4622
  },
2204
4623
  }))
2205
4624
  } : undefined,
@@ -2219,6 +4638,37 @@ export const Position = {
2219
4638
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
2220
4639
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
2221
4640
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
4641
+ news: item.news ?
4642
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
4643
+ ? { connect: {
4644
+ id: item.news.id
4645
+ }
4646
+ }
4647
+ : { connectOrCreate: {
4648
+ where: {
4649
+ id: item.news.id !== undefined ? item.news.id : undefined,
4650
+ url: item.news.url !== undefined ? item.news.url : undefined,
4651
+ title: item.news.title !== undefined ? {
4652
+ equals: item.news.title
4653
+ } : undefined,
4654
+ },
4655
+ create: {
4656
+ title: item.news.title !== undefined ? item.news.title : undefined,
4657
+ content: item.news.content !== undefined ? item.news.content : undefined,
4658
+ source: item.news.source !== undefined ? item.news.source : undefined,
4659
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
4660
+ url: item.news.url !== undefined ? item.news.url : undefined,
4661
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
4662
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
4663
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
4664
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
4665
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
4666
+ category: item.news.category !== undefined ? item.news.category : undefined,
4667
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
4668
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
4669
+ },
4670
+ }
4671
+ } : undefined,
2222
4672
  },
2223
4673
  }))
2224
4674
  } : undefined,
@@ -2295,6 +4745,152 @@ export const Position = {
2295
4745
  plan: prop.alpacaAccount.user.plan !== undefined ? {
2296
4746
  set: prop.alpacaAccount.user.plan
2297
4747
  } : undefined,
4748
+ customer: prop.alpacaAccount.user.customer ? {
4749
+ upsert: {
4750
+ where: {
4751
+ id: prop.alpacaAccount.user.customer.id !== undefined ? {
4752
+ equals: prop.alpacaAccount.user.customer.id
4753
+ } : undefined,
4754
+ name: prop.alpacaAccount.user.customer.name !== undefined ? {
4755
+ equals: prop.alpacaAccount.user.customer.name
4756
+ } : undefined,
4757
+ },
4758
+ update: {
4759
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
4760
+ set: prop.alpacaAccount.user.customer.authUserId
4761
+ } : undefined,
4762
+ name: prop.alpacaAccount.user.customer.name !== undefined ? {
4763
+ set: prop.alpacaAccount.user.customer.name
4764
+ } : undefined,
4765
+ plan: prop.alpacaAccount.user.customer.plan !== undefined ? {
4766
+ set: prop.alpacaAccount.user.customer.plan
4767
+ } : undefined,
4768
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
4769
+ set: prop.alpacaAccount.user.customer.stripeCustomerId
4770
+ } : undefined,
4771
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
4772
+ set: prop.alpacaAccount.user.customer.stripeSubscriptionId
4773
+ } : undefined,
4774
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
4775
+ set: prop.alpacaAccount.user.customer.stripePriceId
4776
+ } : undefined,
4777
+ stripeCurrentPeriodEnd: prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? {
4778
+ set: prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd
4779
+ } : undefined,
4780
+ },
4781
+ create: {
4782
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
4783
+ name: prop.alpacaAccount.user.customer.name !== undefined ? prop.alpacaAccount.user.customer.name : undefined,
4784
+ plan: prop.alpacaAccount.user.customer.plan !== undefined ? prop.alpacaAccount.user.customer.plan : undefined,
4785
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
4786
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
4787
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? prop.alpacaAccount.user.customer.stripePriceId : undefined,
4788
+ stripeCurrentPeriodEnd: prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
4789
+ },
4790
+ }
4791
+ } : undefined,
4792
+ accounts: prop.alpacaAccount.user.accounts ? {
4793
+ upsert: prop.alpacaAccount.user.accounts.map((item) => ({
4794
+ where: {
4795
+ id: item.id !== undefined ? item.id : undefined,
4796
+ },
4797
+ update: {
4798
+ id: item.id !== undefined ? {
4799
+ set: item.id
4800
+ } : undefined,
4801
+ type: item.type !== undefined ? {
4802
+ set: item.type
4803
+ } : undefined,
4804
+ provider: item.provider !== undefined ? {
4805
+ set: item.provider
4806
+ } : undefined,
4807
+ providerAccountId: item.providerAccountId !== undefined ? {
4808
+ set: item.providerAccountId
4809
+ } : undefined,
4810
+ refresh_token: item.refresh_token !== undefined ? {
4811
+ set: item.refresh_token
4812
+ } : undefined,
4813
+ access_token: item.access_token !== undefined ? {
4814
+ set: item.access_token
4815
+ } : undefined,
4816
+ expires_at: item.expires_at !== undefined ? {
4817
+ set: item.expires_at
4818
+ } : undefined,
4819
+ token_type: item.token_type !== undefined ? {
4820
+ set: item.token_type
4821
+ } : undefined,
4822
+ scope: item.scope !== undefined ? {
4823
+ set: item.scope
4824
+ } : undefined,
4825
+ id_token: item.id_token !== undefined ? {
4826
+ set: item.id_token
4827
+ } : undefined,
4828
+ session_state: item.session_state !== undefined ? {
4829
+ set: item.session_state
4830
+ } : undefined,
4831
+ },
4832
+ create: {
4833
+ type: item.type !== undefined ? item.type : undefined,
4834
+ provider: item.provider !== undefined ? item.provider : undefined,
4835
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
4836
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
4837
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
4838
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
4839
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
4840
+ scope: item.scope !== undefined ? item.scope : undefined,
4841
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
4842
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
4843
+ },
4844
+ }))
4845
+ } : undefined,
4846
+ sessions: prop.alpacaAccount.user.sessions ? {
4847
+ upsert: prop.alpacaAccount.user.sessions.map((item) => ({
4848
+ where: {
4849
+ id: item.id !== undefined ? item.id : undefined,
4850
+ },
4851
+ update: {
4852
+ id: item.id !== undefined ? {
4853
+ set: item.id
4854
+ } : undefined,
4855
+ sessionToken: item.sessionToken !== undefined ? {
4856
+ set: item.sessionToken
4857
+ } : undefined,
4858
+ expires: item.expires !== undefined ? {
4859
+ set: item.expires
4860
+ } : undefined,
4861
+ },
4862
+ create: {
4863
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
4864
+ expires: item.expires !== undefined ? item.expires : undefined,
4865
+ },
4866
+ }))
4867
+ } : undefined,
4868
+ authenticators: prop.alpacaAccount.user.authenticators ? {
4869
+ upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
4870
+ where: {
4871
+ id: item.id !== undefined ? item.id : undefined,
4872
+ },
4873
+ update: {
4874
+ id: item.id !== undefined ? {
4875
+ set: item.id
4876
+ } : undefined,
4877
+ credentialID: item.credentialID !== undefined ? {
4878
+ set: item.credentialID
4879
+ } : undefined,
4880
+ publicKey: item.publicKey !== undefined ? {
4881
+ set: item.publicKey
4882
+ } : undefined,
4883
+ counter: item.counter !== undefined ? {
4884
+ set: item.counter
4885
+ } : undefined,
4886
+ },
4887
+ create: {
4888
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
4889
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
4890
+ counter: item.counter !== undefined ? item.counter : undefined,
4891
+ },
4892
+ }))
4893
+ } : undefined,
2298
4894
  },
2299
4895
  create: {
2300
4896
  name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
@@ -2306,6 +4902,87 @@ export const Position = {
2306
4902
  jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
2307
4903
  currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
2308
4904
  plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
4905
+ customer: prop.alpacaAccount.user.customer ?
4906
+ typeof prop.alpacaAccount.user.customer === 'object' && Object.keys(prop.alpacaAccount.user.customer).length === 1 && Object.keys(prop.alpacaAccount.user.customer)[0] === 'id'
4907
+ ? { connect: {
4908
+ id: prop.alpacaAccount.user.customer.id
4909
+ }
4910
+ }
4911
+ : { connectOrCreate: {
4912
+ where: {
4913
+ id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
4914
+ name: prop.alpacaAccount.user.customer.name !== undefined ? {
4915
+ equals: prop.alpacaAccount.user.customer.name
4916
+ } : undefined,
4917
+ },
4918
+ create: {
4919
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
4920
+ name: prop.alpacaAccount.user.customer.name !== undefined ? prop.alpacaAccount.user.customer.name : undefined,
4921
+ plan: prop.alpacaAccount.user.customer.plan !== undefined ? prop.alpacaAccount.user.customer.plan : undefined,
4922
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
4923
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
4924
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? prop.alpacaAccount.user.customer.stripePriceId : undefined,
4925
+ stripeCurrentPeriodEnd: prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
4926
+ },
4927
+ }
4928
+ } : undefined,
4929
+ accounts: prop.alpacaAccount.user.accounts ?
4930
+ Array.isArray(prop.alpacaAccount.user.accounts) && prop.alpacaAccount.user.accounts.length > 0 && prop.alpacaAccount.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4931
+ connect: prop.alpacaAccount.user.accounts.map((item) => ({
4932
+ id: item.id
4933
+ }))
4934
+ }
4935
+ : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
4936
+ where: {
4937
+ id: item.id !== undefined ? item.id : undefined,
4938
+ },
4939
+ create: {
4940
+ type: item.type !== undefined ? item.type : undefined,
4941
+ provider: item.provider !== undefined ? item.provider : undefined,
4942
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
4943
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
4944
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
4945
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
4946
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
4947
+ scope: item.scope !== undefined ? item.scope : undefined,
4948
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
4949
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
4950
+ },
4951
+ }))
4952
+ } : undefined,
4953
+ sessions: prop.alpacaAccount.user.sessions ?
4954
+ Array.isArray(prop.alpacaAccount.user.sessions) && prop.alpacaAccount.user.sessions.length > 0 && prop.alpacaAccount.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4955
+ connect: prop.alpacaAccount.user.sessions.map((item) => ({
4956
+ id: item.id
4957
+ }))
4958
+ }
4959
+ : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
4960
+ where: {
4961
+ id: item.id !== undefined ? item.id : undefined,
4962
+ },
4963
+ create: {
4964
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
4965
+ expires: item.expires !== undefined ? item.expires : undefined,
4966
+ },
4967
+ }))
4968
+ } : undefined,
4969
+ authenticators: prop.alpacaAccount.user.authenticators ?
4970
+ Array.isArray(prop.alpacaAccount.user.authenticators) && prop.alpacaAccount.user.authenticators.length > 0 && prop.alpacaAccount.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4971
+ connect: prop.alpacaAccount.user.authenticators.map((item) => ({
4972
+ id: item.id
4973
+ }))
4974
+ }
4975
+ : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
4976
+ where: {
4977
+ id: item.id !== undefined ? item.id : undefined,
4978
+ },
4979
+ create: {
4980
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
4981
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
4982
+ counter: item.counter !== undefined ? item.counter : undefined,
4983
+ },
4984
+ }))
4985
+ } : undefined,
2309
4986
  },
2310
4987
  }
2311
4988
  } : undefined,
@@ -2348,6 +5025,282 @@ export const Position = {
2348
5025
  optionContractType: item.optionContractType !== undefined ? {
2349
5026
  set: item.optionContractType
2350
5027
  } : undefined,
5028
+ asset: item.asset ? {
5029
+ upsert: {
5030
+ where: {
5031
+ id: item.asset.id !== undefined ? {
5032
+ equals: item.asset.id
5033
+ } : undefined,
5034
+ symbol: item.asset.symbol !== undefined ? {
5035
+ equals: item.asset.symbol
5036
+ } : undefined,
5037
+ name: item.asset.name !== undefined ? {
5038
+ equals: item.asset.name
5039
+ } : undefined,
5040
+ },
5041
+ update: {
5042
+ id: item.asset.id !== undefined ? {
5043
+ set: item.asset.id
5044
+ } : undefined,
5045
+ symbol: item.asset.symbol !== undefined ? {
5046
+ set: item.asset.symbol
5047
+ } : undefined,
5048
+ name: item.asset.name !== undefined ? {
5049
+ set: item.asset.name
5050
+ } : undefined,
5051
+ type: item.asset.type !== undefined ? {
5052
+ set: item.asset.type
5053
+ } : undefined,
5054
+ logoUrl: item.asset.logoUrl !== undefined ? {
5055
+ set: item.asset.logoUrl
5056
+ } : undefined,
5057
+ description: item.asset.description !== undefined ? {
5058
+ set: item.asset.description
5059
+ } : undefined,
5060
+ cik: item.asset.cik !== undefined ? {
5061
+ set: item.asset.cik
5062
+ } : undefined,
5063
+ exchange: item.asset.exchange !== undefined ? {
5064
+ set: item.asset.exchange
5065
+ } : undefined,
5066
+ currency: item.asset.currency !== undefined ? {
5067
+ set: item.asset.currency
5068
+ } : undefined,
5069
+ country: item.asset.country !== undefined ? {
5070
+ set: item.asset.country
5071
+ } : undefined,
5072
+ sector: item.asset.sector !== undefined ? {
5073
+ set: item.asset.sector
5074
+ } : undefined,
5075
+ industry: item.asset.industry !== undefined ? {
5076
+ set: item.asset.industry
5077
+ } : undefined,
5078
+ address: item.asset.address !== undefined ? {
5079
+ set: item.asset.address
5080
+ } : undefined,
5081
+ officialSite: item.asset.officialSite !== undefined ? {
5082
+ set: item.asset.officialSite
5083
+ } : undefined,
5084
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? {
5085
+ set: item.asset.fiscalYearEnd
5086
+ } : undefined,
5087
+ latestQuarter: item.asset.latestQuarter !== undefined ? {
5088
+ set: item.asset.latestQuarter
5089
+ } : undefined,
5090
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? {
5091
+ set: item.asset.marketCapitalization
5092
+ } : undefined,
5093
+ ebitda: item.asset.ebitda !== undefined ? {
5094
+ set: item.asset.ebitda
5095
+ } : undefined,
5096
+ peRatio: item.asset.peRatio !== undefined ? {
5097
+ set: item.asset.peRatio
5098
+ } : undefined,
5099
+ pegRatio: item.asset.pegRatio !== undefined ? {
5100
+ set: item.asset.pegRatio
5101
+ } : undefined,
5102
+ bookValue: item.asset.bookValue !== undefined ? {
5103
+ set: item.asset.bookValue
5104
+ } : undefined,
5105
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? {
5106
+ set: item.asset.dividendPerShare
5107
+ } : undefined,
5108
+ dividendYield: item.asset.dividendYield !== undefined ? {
5109
+ set: item.asset.dividendYield
5110
+ } : undefined,
5111
+ eps: item.asset.eps !== undefined ? {
5112
+ set: item.asset.eps
5113
+ } : undefined,
5114
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? {
5115
+ set: item.asset.revenuePerShareTTM
5116
+ } : undefined,
5117
+ profitMargin: item.asset.profitMargin !== undefined ? {
5118
+ set: item.asset.profitMargin
5119
+ } : undefined,
5120
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? {
5121
+ set: item.asset.operatingMarginTTM
5122
+ } : undefined,
5123
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? {
5124
+ set: item.asset.returnOnAssetsTTM
5125
+ } : undefined,
5126
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? {
5127
+ set: item.asset.returnOnEquityTTM
5128
+ } : undefined,
5129
+ revenueTTM: item.asset.revenueTTM !== undefined ? {
5130
+ set: item.asset.revenueTTM
5131
+ } : undefined,
5132
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? {
5133
+ set: item.asset.grossProfitTTM
5134
+ } : undefined,
5135
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? {
5136
+ set: item.asset.dilutedEPSTTM
5137
+ } : undefined,
5138
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? {
5139
+ set: item.asset.quarterlyEarningsGrowthYOY
5140
+ } : undefined,
5141
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? {
5142
+ set: item.asset.quarterlyRevenueGrowthYOY
5143
+ } : undefined,
5144
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? {
5145
+ set: item.asset.analystTargetPrice
5146
+ } : undefined,
5147
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? {
5148
+ set: item.asset.analystRatingStrongBuy
5149
+ } : undefined,
5150
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? {
5151
+ set: item.asset.analystRatingBuy
5152
+ } : undefined,
5153
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? {
5154
+ set: item.asset.analystRatingHold
5155
+ } : undefined,
5156
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? {
5157
+ set: item.asset.analystRatingSell
5158
+ } : undefined,
5159
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? {
5160
+ set: item.asset.analystRatingStrongSell
5161
+ } : undefined,
5162
+ trailingPE: item.asset.trailingPE !== undefined ? {
5163
+ set: item.asset.trailingPE
5164
+ } : undefined,
5165
+ forwardPE: item.asset.forwardPE !== undefined ? {
5166
+ set: item.asset.forwardPE
5167
+ } : undefined,
5168
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? {
5169
+ set: item.asset.priceToSalesRatioTTM
5170
+ } : undefined,
5171
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? {
5172
+ set: item.asset.priceToBookRatio
5173
+ } : undefined,
5174
+ evToRevenue: item.asset.evToRevenue !== undefined ? {
5175
+ set: item.asset.evToRevenue
5176
+ } : undefined,
5177
+ evToEbitda: item.asset.evToEbitda !== undefined ? {
5178
+ set: item.asset.evToEbitda
5179
+ } : undefined,
5180
+ beta: item.asset.beta !== undefined ? {
5181
+ set: item.asset.beta
5182
+ } : undefined,
5183
+ week52High: item.asset.week52High !== undefined ? {
5184
+ set: item.asset.week52High
5185
+ } : undefined,
5186
+ week52Low: item.asset.week52Low !== undefined ? {
5187
+ set: item.asset.week52Low
5188
+ } : undefined,
5189
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? {
5190
+ set: item.asset.day50MovingAverage
5191
+ } : undefined,
5192
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? {
5193
+ set: item.asset.day200MovingAverage
5194
+ } : undefined,
5195
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? {
5196
+ set: item.asset.sharesOutstanding
5197
+ } : undefined,
5198
+ dividendDate: item.asset.dividendDate !== undefined ? {
5199
+ set: item.asset.dividendDate
5200
+ } : undefined,
5201
+ exDividendDate: item.asset.exDividendDate !== undefined ? {
5202
+ set: item.asset.exDividendDate
5203
+ } : undefined,
5204
+ sellPrice: item.asset.sellPrice !== undefined ? {
5205
+ set: item.asset.sellPrice
5206
+ } : undefined,
5207
+ buyPrice: item.asset.buyPrice !== undefined ? {
5208
+ set: item.asset.buyPrice
5209
+ } : undefined,
5210
+ },
5211
+ create: {
5212
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5213
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
5214
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
5215
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
5216
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
5217
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
5218
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
5219
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
5220
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
5221
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
5222
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
5223
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
5224
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
5225
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
5226
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
5227
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
5228
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
5229
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
5230
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
5231
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
5232
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
5233
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
5234
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
5235
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
5236
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
5237
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
5238
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
5239
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
5240
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
5241
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
5242
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
5243
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
5244
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
5245
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
5246
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
5247
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
5248
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
5249
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
5250
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
5251
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
5252
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
5253
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
5254
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
5255
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
5256
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
5257
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
5258
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
5259
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
5260
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
5261
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
5262
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
5263
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
5264
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
5265
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
5266
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
5267
+ },
5268
+ }
5269
+ } : undefined,
5270
+ actions: item.actions ? {
5271
+ upsert: item.actions.map((item) => ({
5272
+ where: {
5273
+ id: item.id !== undefined ? item.id : undefined,
5274
+ },
5275
+ update: {
5276
+ id: item.id !== undefined ? {
5277
+ set: item.id
5278
+ } : undefined,
5279
+ sequence: item.sequence !== undefined ? {
5280
+ set: item.sequence
5281
+ } : undefined,
5282
+ type: item.type !== undefined ? {
5283
+ set: item.type
5284
+ } : undefined,
5285
+ note: item.note !== undefined ? {
5286
+ set: item.note
5287
+ } : undefined,
5288
+ status: item.status !== undefined ? {
5289
+ set: item.status
5290
+ } : undefined,
5291
+ fee: item.fee !== undefined ? {
5292
+ set: item.fee
5293
+ } : undefined,
5294
+ },
5295
+ create: {
5296
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
5297
+ type: item.type !== undefined ? item.type : undefined,
5298
+ note: item.note !== undefined ? item.note : undefined,
5299
+ status: item.status !== undefined ? item.status : undefined,
5300
+ fee: item.fee !== undefined ? item.fee : undefined,
5301
+ },
5302
+ }))
5303
+ } : undefined,
2351
5304
  },
2352
5305
  create: {
2353
5306
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -2360,6 +5313,96 @@ export const Position = {
2360
5313
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2361
5314
  status: item.status !== undefined ? item.status : undefined,
2362
5315
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5316
+ asset: item.asset ?
5317
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
5318
+ ? { connect: {
5319
+ id: item.asset.id
5320
+ }
5321
+ }
5322
+ : { connectOrCreate: {
5323
+ where: {
5324
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
5325
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5326
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
5327
+ },
5328
+ create: {
5329
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5330
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
5331
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
5332
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
5333
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
5334
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
5335
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
5336
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
5337
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
5338
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
5339
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
5340
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
5341
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
5342
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
5343
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
5344
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
5345
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
5346
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
5347
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
5348
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
5349
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
5350
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
5351
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
5352
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
5353
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
5354
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
5355
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
5356
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
5357
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
5358
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
5359
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
5360
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
5361
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
5362
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
5363
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
5364
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
5365
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
5366
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
5367
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
5368
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
5369
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
5370
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
5371
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
5372
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
5373
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
5374
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
5375
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
5376
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
5377
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
5378
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
5379
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
5380
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
5381
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
5382
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
5383
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
5384
+ },
5385
+ }
5386
+ } : undefined,
5387
+ actions: item.actions ?
5388
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5389
+ connect: item.actions.map((item) => ({
5390
+ id: item.id
5391
+ }))
5392
+ }
5393
+ : { connectOrCreate: item.actions.map((item) => ({
5394
+ where: {
5395
+ id: item.id !== undefined ? item.id : undefined,
5396
+ },
5397
+ create: {
5398
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
5399
+ type: item.type !== undefined ? item.type : undefined,
5400
+ note: item.note !== undefined ? item.note : undefined,
5401
+ status: item.status !== undefined ? item.status : undefined,
5402
+ fee: item.fee !== undefined ? item.fee : undefined,
5403
+ },
5404
+ }))
5405
+ } : undefined,
2363
5406
  },
2364
5407
  }))
2365
5408
  } : undefined,
@@ -2420,6 +5463,284 @@ export const Position = {
2420
5463
  fee: item.fee !== undefined ? {
2421
5464
  set: item.fee
2422
5465
  } : undefined,
5466
+ action: item.action ? {
5467
+ upsert: {
5468
+ where: {
5469
+ id: item.action.id !== undefined ? {
5470
+ equals: item.action.id
5471
+ } : undefined,
5472
+ },
5473
+ update: {
5474
+ id: item.action.id !== undefined ? {
5475
+ set: item.action.id
5476
+ } : undefined,
5477
+ sequence: item.action.sequence !== undefined ? {
5478
+ set: item.action.sequence
5479
+ } : undefined,
5480
+ type: item.action.type !== undefined ? {
5481
+ set: item.action.type
5482
+ } : undefined,
5483
+ note: item.action.note !== undefined ? {
5484
+ set: item.action.note
5485
+ } : undefined,
5486
+ status: item.action.status !== undefined ? {
5487
+ set: item.action.status
5488
+ } : undefined,
5489
+ fee: item.action.fee !== undefined ? {
5490
+ set: item.action.fee
5491
+ } : undefined,
5492
+ },
5493
+ create: {
5494
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
5495
+ type: item.action.type !== undefined ? item.action.type : undefined,
5496
+ note: item.action.note !== undefined ? item.action.note : undefined,
5497
+ status: item.action.status !== undefined ? item.action.status : undefined,
5498
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
5499
+ },
5500
+ }
5501
+ } : undefined,
5502
+ asset: item.asset ? {
5503
+ upsert: {
5504
+ where: {
5505
+ id: item.asset.id !== undefined ? {
5506
+ equals: item.asset.id
5507
+ } : undefined,
5508
+ symbol: item.asset.symbol !== undefined ? {
5509
+ equals: item.asset.symbol
5510
+ } : undefined,
5511
+ name: item.asset.name !== undefined ? {
5512
+ equals: item.asset.name
5513
+ } : undefined,
5514
+ },
5515
+ update: {
5516
+ id: item.asset.id !== undefined ? {
5517
+ set: item.asset.id
5518
+ } : undefined,
5519
+ symbol: item.asset.symbol !== undefined ? {
5520
+ set: item.asset.symbol
5521
+ } : undefined,
5522
+ name: item.asset.name !== undefined ? {
5523
+ set: item.asset.name
5524
+ } : undefined,
5525
+ type: item.asset.type !== undefined ? {
5526
+ set: item.asset.type
5527
+ } : undefined,
5528
+ logoUrl: item.asset.logoUrl !== undefined ? {
5529
+ set: item.asset.logoUrl
5530
+ } : undefined,
5531
+ description: item.asset.description !== undefined ? {
5532
+ set: item.asset.description
5533
+ } : undefined,
5534
+ cik: item.asset.cik !== undefined ? {
5535
+ set: item.asset.cik
5536
+ } : undefined,
5537
+ exchange: item.asset.exchange !== undefined ? {
5538
+ set: item.asset.exchange
5539
+ } : undefined,
5540
+ currency: item.asset.currency !== undefined ? {
5541
+ set: item.asset.currency
5542
+ } : undefined,
5543
+ country: item.asset.country !== undefined ? {
5544
+ set: item.asset.country
5545
+ } : undefined,
5546
+ sector: item.asset.sector !== undefined ? {
5547
+ set: item.asset.sector
5548
+ } : undefined,
5549
+ industry: item.asset.industry !== undefined ? {
5550
+ set: item.asset.industry
5551
+ } : undefined,
5552
+ address: item.asset.address !== undefined ? {
5553
+ set: item.asset.address
5554
+ } : undefined,
5555
+ officialSite: item.asset.officialSite !== undefined ? {
5556
+ set: item.asset.officialSite
5557
+ } : undefined,
5558
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? {
5559
+ set: item.asset.fiscalYearEnd
5560
+ } : undefined,
5561
+ latestQuarter: item.asset.latestQuarter !== undefined ? {
5562
+ set: item.asset.latestQuarter
5563
+ } : undefined,
5564
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? {
5565
+ set: item.asset.marketCapitalization
5566
+ } : undefined,
5567
+ ebitda: item.asset.ebitda !== undefined ? {
5568
+ set: item.asset.ebitda
5569
+ } : undefined,
5570
+ peRatio: item.asset.peRatio !== undefined ? {
5571
+ set: item.asset.peRatio
5572
+ } : undefined,
5573
+ pegRatio: item.asset.pegRatio !== undefined ? {
5574
+ set: item.asset.pegRatio
5575
+ } : undefined,
5576
+ bookValue: item.asset.bookValue !== undefined ? {
5577
+ set: item.asset.bookValue
5578
+ } : undefined,
5579
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? {
5580
+ set: item.asset.dividendPerShare
5581
+ } : undefined,
5582
+ dividendYield: item.asset.dividendYield !== undefined ? {
5583
+ set: item.asset.dividendYield
5584
+ } : undefined,
5585
+ eps: item.asset.eps !== undefined ? {
5586
+ set: item.asset.eps
5587
+ } : undefined,
5588
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? {
5589
+ set: item.asset.revenuePerShareTTM
5590
+ } : undefined,
5591
+ profitMargin: item.asset.profitMargin !== undefined ? {
5592
+ set: item.asset.profitMargin
5593
+ } : undefined,
5594
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? {
5595
+ set: item.asset.operatingMarginTTM
5596
+ } : undefined,
5597
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? {
5598
+ set: item.asset.returnOnAssetsTTM
5599
+ } : undefined,
5600
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? {
5601
+ set: item.asset.returnOnEquityTTM
5602
+ } : undefined,
5603
+ revenueTTM: item.asset.revenueTTM !== undefined ? {
5604
+ set: item.asset.revenueTTM
5605
+ } : undefined,
5606
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? {
5607
+ set: item.asset.grossProfitTTM
5608
+ } : undefined,
5609
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? {
5610
+ set: item.asset.dilutedEPSTTM
5611
+ } : undefined,
5612
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? {
5613
+ set: item.asset.quarterlyEarningsGrowthYOY
5614
+ } : undefined,
5615
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? {
5616
+ set: item.asset.quarterlyRevenueGrowthYOY
5617
+ } : undefined,
5618
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? {
5619
+ set: item.asset.analystTargetPrice
5620
+ } : undefined,
5621
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? {
5622
+ set: item.asset.analystRatingStrongBuy
5623
+ } : undefined,
5624
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? {
5625
+ set: item.asset.analystRatingBuy
5626
+ } : undefined,
5627
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? {
5628
+ set: item.asset.analystRatingHold
5629
+ } : undefined,
5630
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? {
5631
+ set: item.asset.analystRatingSell
5632
+ } : undefined,
5633
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? {
5634
+ set: item.asset.analystRatingStrongSell
5635
+ } : undefined,
5636
+ trailingPE: item.asset.trailingPE !== undefined ? {
5637
+ set: item.asset.trailingPE
5638
+ } : undefined,
5639
+ forwardPE: item.asset.forwardPE !== undefined ? {
5640
+ set: item.asset.forwardPE
5641
+ } : undefined,
5642
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? {
5643
+ set: item.asset.priceToSalesRatioTTM
5644
+ } : undefined,
5645
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? {
5646
+ set: item.asset.priceToBookRatio
5647
+ } : undefined,
5648
+ evToRevenue: item.asset.evToRevenue !== undefined ? {
5649
+ set: item.asset.evToRevenue
5650
+ } : undefined,
5651
+ evToEbitda: item.asset.evToEbitda !== undefined ? {
5652
+ set: item.asset.evToEbitda
5653
+ } : undefined,
5654
+ beta: item.asset.beta !== undefined ? {
5655
+ set: item.asset.beta
5656
+ } : undefined,
5657
+ week52High: item.asset.week52High !== undefined ? {
5658
+ set: item.asset.week52High
5659
+ } : undefined,
5660
+ week52Low: item.asset.week52Low !== undefined ? {
5661
+ set: item.asset.week52Low
5662
+ } : undefined,
5663
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? {
5664
+ set: item.asset.day50MovingAverage
5665
+ } : undefined,
5666
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? {
5667
+ set: item.asset.day200MovingAverage
5668
+ } : undefined,
5669
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? {
5670
+ set: item.asset.sharesOutstanding
5671
+ } : undefined,
5672
+ dividendDate: item.asset.dividendDate !== undefined ? {
5673
+ set: item.asset.dividendDate
5674
+ } : undefined,
5675
+ exDividendDate: item.asset.exDividendDate !== undefined ? {
5676
+ set: item.asset.exDividendDate
5677
+ } : undefined,
5678
+ sellPrice: item.asset.sellPrice !== undefined ? {
5679
+ set: item.asset.sellPrice
5680
+ } : undefined,
5681
+ buyPrice: item.asset.buyPrice !== undefined ? {
5682
+ set: item.asset.buyPrice
5683
+ } : undefined,
5684
+ },
5685
+ create: {
5686
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5687
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
5688
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
5689
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
5690
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
5691
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
5692
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
5693
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
5694
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
5695
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
5696
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
5697
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
5698
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
5699
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
5700
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
5701
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
5702
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
5703
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
5704
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
5705
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
5706
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
5707
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
5708
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
5709
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
5710
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
5711
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
5712
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
5713
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
5714
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
5715
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
5716
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
5717
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
5718
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
5719
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
5720
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
5721
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
5722
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
5723
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
5724
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
5725
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
5726
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
5727
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
5728
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
5729
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
5730
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
5731
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
5732
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
5733
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
5734
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
5735
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
5736
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
5737
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
5738
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
5739
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
5740
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
5741
+ },
5742
+ }
5743
+ } : undefined,
2423
5744
  },
2424
5745
  create: {
2425
5746
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -2438,6 +5759,96 @@ export const Position = {
2438
5759
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2439
5760
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2440
5761
  fee: item.fee !== undefined ? item.fee : undefined,
5762
+ action: item.action ?
5763
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
5764
+ ? { connect: {
5765
+ id: item.action.id
5766
+ }
5767
+ }
5768
+ : { connectOrCreate: {
5769
+ where: {
5770
+ id: item.action.id !== undefined ? item.action.id : undefined,
5771
+ },
5772
+ create: {
5773
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
5774
+ type: item.action.type !== undefined ? item.action.type : undefined,
5775
+ note: item.action.note !== undefined ? item.action.note : undefined,
5776
+ status: item.action.status !== undefined ? item.action.status : undefined,
5777
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
5778
+ },
5779
+ }
5780
+ } : undefined,
5781
+ asset: item.asset ?
5782
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
5783
+ ? { connect: {
5784
+ id: item.asset.id
5785
+ }
5786
+ }
5787
+ : { connectOrCreate: {
5788
+ where: {
5789
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
5790
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5791
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
5792
+ },
5793
+ create: {
5794
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
5795
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
5796
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
5797
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
5798
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
5799
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
5800
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
5801
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
5802
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
5803
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
5804
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
5805
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
5806
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
5807
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
5808
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
5809
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
5810
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
5811
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
5812
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
5813
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
5814
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
5815
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
5816
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
5817
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
5818
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
5819
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
5820
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
5821
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
5822
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
5823
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
5824
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
5825
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
5826
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
5827
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
5828
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
5829
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
5830
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
5831
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
5832
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
5833
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
5834
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
5835
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
5836
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
5837
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
5838
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
5839
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
5840
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
5841
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
5842
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
5843
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
5844
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
5845
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
5846
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
5847
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
5848
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
5849
+ },
5850
+ }
5851
+ } : undefined,
2441
5852
  },
2442
5853
  }))
2443
5854
  } : undefined,
@@ -2498,6 +5909,87 @@ export const Position = {
2498
5909
  jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
2499
5910
  currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
2500
5911
  plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
5912
+ customer: prop.alpacaAccount.user.customer ?
5913
+ typeof prop.alpacaAccount.user.customer === 'object' && Object.keys(prop.alpacaAccount.user.customer).length === 1 && Object.keys(prop.alpacaAccount.user.customer)[0] === 'id'
5914
+ ? { connect: {
5915
+ id: prop.alpacaAccount.user.customer.id
5916
+ }
5917
+ }
5918
+ : { connectOrCreate: {
5919
+ where: {
5920
+ id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
5921
+ name: prop.alpacaAccount.user.customer.name !== undefined ? {
5922
+ equals: prop.alpacaAccount.user.customer.name
5923
+ } : undefined,
5924
+ },
5925
+ create: {
5926
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
5927
+ name: prop.alpacaAccount.user.customer.name !== undefined ? prop.alpacaAccount.user.customer.name : undefined,
5928
+ plan: prop.alpacaAccount.user.customer.plan !== undefined ? prop.alpacaAccount.user.customer.plan : undefined,
5929
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
5930
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
5931
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? prop.alpacaAccount.user.customer.stripePriceId : undefined,
5932
+ stripeCurrentPeriodEnd: prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.alpacaAccount.user.customer.stripeCurrentPeriodEnd : undefined,
5933
+ },
5934
+ }
5935
+ } : undefined,
5936
+ accounts: prop.alpacaAccount.user.accounts ?
5937
+ Array.isArray(prop.alpacaAccount.user.accounts) && prop.alpacaAccount.user.accounts.length > 0 && prop.alpacaAccount.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5938
+ connect: prop.alpacaAccount.user.accounts.map((item) => ({
5939
+ id: item.id
5940
+ }))
5941
+ }
5942
+ : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
5943
+ where: {
5944
+ id: item.id !== undefined ? item.id : undefined,
5945
+ },
5946
+ create: {
5947
+ type: item.type !== undefined ? item.type : undefined,
5948
+ provider: item.provider !== undefined ? item.provider : undefined,
5949
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
5950
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
5951
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
5952
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
5953
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
5954
+ scope: item.scope !== undefined ? item.scope : undefined,
5955
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
5956
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
5957
+ },
5958
+ }))
5959
+ } : undefined,
5960
+ sessions: prop.alpacaAccount.user.sessions ?
5961
+ Array.isArray(prop.alpacaAccount.user.sessions) && prop.alpacaAccount.user.sessions.length > 0 && prop.alpacaAccount.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5962
+ connect: prop.alpacaAccount.user.sessions.map((item) => ({
5963
+ id: item.id
5964
+ }))
5965
+ }
5966
+ : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
5967
+ where: {
5968
+ id: item.id !== undefined ? item.id : undefined,
5969
+ },
5970
+ create: {
5971
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
5972
+ expires: item.expires !== undefined ? item.expires : undefined,
5973
+ },
5974
+ }))
5975
+ } : undefined,
5976
+ authenticators: prop.alpacaAccount.user.authenticators ?
5977
+ Array.isArray(prop.alpacaAccount.user.authenticators) && prop.alpacaAccount.user.authenticators.length > 0 && prop.alpacaAccount.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5978
+ connect: prop.alpacaAccount.user.authenticators.map((item) => ({
5979
+ id: item.id
5980
+ }))
5981
+ }
5982
+ : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
5983
+ where: {
5984
+ id: item.id !== undefined ? item.id : undefined,
5985
+ },
5986
+ create: {
5987
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
5988
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
5989
+ counter: item.counter !== undefined ? item.counter : undefined,
5990
+ },
5991
+ }))
5992
+ } : undefined,
2501
5993
  },
2502
5994
  }
2503
5995
  } : undefined,
@@ -2522,6 +6014,96 @@ export const Position = {
2522
6014
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2523
6015
  status: item.status !== undefined ? item.status : undefined,
2524
6016
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
6017
+ asset: item.asset ?
6018
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
6019
+ ? { connect: {
6020
+ id: item.asset.id
6021
+ }
6022
+ }
6023
+ : { connectOrCreate: {
6024
+ where: {
6025
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
6026
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6027
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
6028
+ },
6029
+ create: {
6030
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6031
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
6032
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
6033
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
6034
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
6035
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
6036
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
6037
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
6038
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
6039
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
6040
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
6041
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
6042
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
6043
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
6044
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
6045
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
6046
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
6047
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
6048
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
6049
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
6050
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
6051
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
6052
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
6053
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
6054
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
6055
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
6056
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
6057
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
6058
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
6059
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
6060
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
6061
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
6062
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
6063
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
6064
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
6065
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
6066
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
6067
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
6068
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
6069
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
6070
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
6071
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
6072
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
6073
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
6074
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
6075
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
6076
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
6077
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
6078
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
6079
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
6080
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
6081
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
6082
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
6083
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
6084
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
6085
+ },
6086
+ }
6087
+ } : undefined,
6088
+ actions: item.actions ?
6089
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
6090
+ connect: item.actions.map((item) => ({
6091
+ id: item.id
6092
+ }))
6093
+ }
6094
+ : { connectOrCreate: item.actions.map((item) => ({
6095
+ where: {
6096
+ id: item.id !== undefined ? item.id : undefined,
6097
+ },
6098
+ create: {
6099
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
6100
+ type: item.type !== undefined ? item.type : undefined,
6101
+ note: item.note !== undefined ? item.note : undefined,
6102
+ status: item.status !== undefined ? item.status : undefined,
6103
+ fee: item.fee !== undefined ? item.fee : undefined,
6104
+ },
6105
+ }))
6106
+ } : undefined,
2525
6107
  },
2526
6108
  }))
2527
6109
  } : undefined,
@@ -2552,6 +6134,96 @@ export const Position = {
2552
6134
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2553
6135
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2554
6136
  fee: item.fee !== undefined ? item.fee : undefined,
6137
+ action: item.action ?
6138
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
6139
+ ? { connect: {
6140
+ id: item.action.id
6141
+ }
6142
+ }
6143
+ : { connectOrCreate: {
6144
+ where: {
6145
+ id: item.action.id !== undefined ? item.action.id : undefined,
6146
+ },
6147
+ create: {
6148
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
6149
+ type: item.action.type !== undefined ? item.action.type : undefined,
6150
+ note: item.action.note !== undefined ? item.action.note : undefined,
6151
+ status: item.action.status !== undefined ? item.action.status : undefined,
6152
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
6153
+ },
6154
+ }
6155
+ } : undefined,
6156
+ asset: item.asset ?
6157
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
6158
+ ? { connect: {
6159
+ id: item.asset.id
6160
+ }
6161
+ }
6162
+ : { connectOrCreate: {
6163
+ where: {
6164
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
6165
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6166
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
6167
+ },
6168
+ create: {
6169
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
6170
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
6171
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
6172
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
6173
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
6174
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
6175
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
6176
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
6177
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
6178
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
6179
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
6180
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
6181
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
6182
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
6183
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
6184
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
6185
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
6186
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
6187
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
6188
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
6189
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
6190
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
6191
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
6192
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
6193
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
6194
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
6195
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
6196
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
6197
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
6198
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
6199
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
6200
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
6201
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
6202
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
6203
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
6204
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
6205
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
6206
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
6207
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
6208
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
6209
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
6210
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
6211
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
6212
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
6213
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
6214
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
6215
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
6216
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
6217
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
6218
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
6219
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
6220
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
6221
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
6222
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
6223
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
6224
+ },
6225
+ }
6226
+ } : undefined,
2555
6227
  },
2556
6228
  }))
2557
6229
  } : undefined,