@firela/api-types 0.0.0-canary.32edff08 → 0.0.0-canary.3ed455fd

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.
@@ -466,6 +466,66 @@ export const $RegionsMetadataResponseDto = {
466
466
  required: ['regions']
467
467
  } as const;
468
468
 
469
+ export const $CostSpecDto = {
470
+ type: 'object',
471
+ properties: {
472
+ mode: {
473
+ type: 'string',
474
+ enum: ['per-unit', 'total', 'date', 'label', 'auto'],
475
+ description: 'Cost specification mode (mirrors engine CostSpec)'
476
+ },
477
+ numberPerUnit: {
478
+ type: 'string',
479
+ description: 'Per-unit cost (required when mode is "per-unit")',
480
+ example: '240'
481
+ },
482
+ totalNumber: {
483
+ type: 'string',
484
+ description: 'Total cost for all units (required when mode is "total")',
485
+ example: '12000'
486
+ },
487
+ currency: {
488
+ type: 'string',
489
+ description: 'Cost currency (required in all modes)',
490
+ example: 'USD'
491
+ },
492
+ date: {
493
+ type: 'string',
494
+ description:
495
+ 'Lot acquisition date, ISO 8601 (required when mode is "date")',
496
+ example: '2024-01-15'
497
+ },
498
+ label: {
499
+ type: 'string',
500
+ description:
501
+ 'Lot label (required when mode is "label"; optional tag in buy modes)'
502
+ },
503
+ merge: {
504
+ type: 'boolean',
505
+ description: 'Merge lots for AVERAGE booking (mode: auto)'
506
+ }
507
+ },
508
+ required: ['mode', 'currency']
509
+ } as const;
510
+
511
+ export const $AmountDto = {
512
+ type: 'object',
513
+ properties: {
514
+ number: {
515
+ type: 'string',
516
+ description:
517
+ 'Amount as decimal string (max 15 integer + 15 decimal digits)',
518
+ example: '170.50'
519
+ },
520
+ currency: {
521
+ type: 'string',
522
+ description: 'Currency/commodity code',
523
+ example: 'USD'
524
+ }
525
+ },
526
+ required: ['number', 'currency']
527
+ } as const;
528
+
469
529
  export const $CreatePostingDto = {
470
530
  type: 'object',
471
531
  properties: {
@@ -495,6 +555,33 @@ export const $CreatePostingDto = {
495
555
  example: {
496
556
  'tax-lot': 'Q1-2024'
497
557
  }
558
+ },
559
+ cost: {
560
+ description:
561
+ 'Cost basis (Beancount `{...}`). Maps to engine costSpec. Required for commodity holdings so they carry a monetary weight that can balance.',
562
+ example: {
563
+ mode: 'per-unit',
564
+ numberPerUnit: '240',
565
+ currency: 'USD'
566
+ },
567
+ allOf: [
568
+ {
569
+ $ref: '#/components/schemas/CostSpecDto'
570
+ }
571
+ ]
572
+ },
573
+ price: {
574
+ description:
575
+ 'Price annotation (Beancount `@...`). Maps to engine price. Used for valuation; cost takes priority for balance weight.',
576
+ example: {
577
+ number: '170',
578
+ currency: 'USD'
579
+ },
580
+ allOf: [
581
+ {
582
+ $ref: '#/components/schemas/AmountDto'
583
+ }
584
+ ]
498
585
  }
499
586
  },
500
587
  required: ['account']
@@ -573,6 +660,32 @@ export const $CreateTransactionDto = {
573
660
  required: ['date', 'narration', 'postings']
574
661
  } as const;
575
662
 
663
+ export const $CostDetailDto = {
664
+ type: 'object',
665
+ properties: {
666
+ number: {
667
+ type: 'string',
668
+ description: 'Per-unit cost basis (mirrors engine Cost.number)',
669
+ example: '240'
670
+ },
671
+ currency: {
672
+ type: 'string',
673
+ description: 'Cost currency',
674
+ example: 'USD'
675
+ },
676
+ date: {
677
+ type: 'string',
678
+ description: 'Lot acquisition date (ISO yyyy-mm-dd)',
679
+ example: '2024-01-15'
680
+ },
681
+ label: {
682
+ type: 'string',
683
+ description: 'Lot label',
684
+ example: 'lot-2024-01'
685
+ }
686
+ }
687
+ } as const;
688
+
576
689
  export const $PostingResponseDto = {
577
690
  type: 'object',
578
691
  properties: {
@@ -591,6 +704,15 @@ export const $PostingResponseDto = {
591
704
  type: 'string',
592
705
  description: 'Currency',
593
706
  example: 'USD'
707
+ },
708
+ cost: {
709
+ description:
710
+ 'Booking-resolved cost (mirrors engine Cost). Undefined when the posting has no cost basis.',
711
+ allOf: [
712
+ {
713
+ $ref: '#/components/schemas/CostDetailDto'
714
+ }
715
+ ]
594
716
  }
595
717
  },
596
718
  required: ['account']
@@ -841,6 +963,85 @@ export const $BatchTransactionResponseDto = {
841
963
  required: ['succeeded', 'failed']
842
964
  } as const;
843
965
 
966
+ export const $CorrectTransactionDto = {
967
+ type: 'object',
968
+ properties: {
969
+ date: {
970
+ type: 'string',
971
+ description: 'Transaction date (ISO 8601 format)',
972
+ example: '2024-11-28'
973
+ },
974
+ flag: {
975
+ type: 'string',
976
+ description: 'Transaction flag: * (cleared), ! (pending)',
977
+ enum: ['*', '!'],
978
+ example: '*'
979
+ },
980
+ payee: {
981
+ type: 'string',
982
+ description: 'Payee name',
983
+ example: 'Whole Foods Market'
984
+ },
985
+ narration: {
986
+ type: 'string',
987
+ description: 'Transaction narration/description',
988
+ example: 'Grocery shopping'
989
+ },
990
+ tags: {
991
+ description: 'Transaction tags (without # prefix)',
992
+ example: ['vacation', 'personal'],
993
+ type: 'array',
994
+ items: {
995
+ type: 'string'
996
+ }
997
+ },
998
+ links: {
999
+ description: 'Transaction links (without ^ prefix)',
1000
+ example: ['invoice-123'],
1001
+ type: 'array',
1002
+ items: {
1003
+ type: 'string'
1004
+ }
1005
+ },
1006
+ postings: {
1007
+ description:
1008
+ 'Transaction postings (minimum 1, typically 2 for double-entry)',
1009
+ type: 'array',
1010
+ items: {
1011
+ $ref: '#/components/schemas/CreatePostingDto'
1012
+ }
1013
+ },
1014
+ meta: {
1015
+ type: 'object',
1016
+ description: 'Transaction-level metadata',
1017
+ example: {
1018
+ invoice: '12345'
1019
+ }
1020
+ },
1021
+ idempotencyKey: {
1022
+ type: 'string',
1023
+ description:
1024
+ 'Unique key for idempotent transaction creation. If provided, duplicate requests with the same key will return the existing transaction.',
1025
+ example: 'import-2024-01-15-batch-001',
1026
+ maxLength: 128
1027
+ },
1028
+ autoCreateAccounts: {
1029
+ type: 'boolean',
1030
+ description:
1031
+ 'Auto-create accounts if not found. When true, missing accounts will be automatically created. When false (default for API), missing accounts will cause a validation error. Set to true for quick entry scenarios where you want to create accounts on-the-fly.',
1032
+ default: true,
1033
+ example: true
1034
+ },
1035
+ correctionReason: {
1036
+ type: 'string',
1037
+ description: 'Reason for correcting/superseding the original transaction',
1038
+ example: 'Wrong amount — corrected from receipt',
1039
+ maxLength: 500
1040
+ }
1041
+ },
1042
+ required: ['date', 'narration', 'postings']
1043
+ } as const;
1044
+
844
1045
  export const $PostingDetailDto = {
845
1046
  type: 'object',
846
1047
  properties: {
@@ -854,9 +1055,9 @@ export const $PostingDetailDto = {
854
1055
  description: 'Account ID',
855
1056
  example: 'clh1234567890abcdef'
856
1057
  },
857
- accountName: {
1058
+ account: {
858
1059
  type: 'string',
859
- description: 'Account name',
1060
+ description: 'Fully-qualified Beancount account path',
860
1061
  example: 'Assets:Bank:Checking'
861
1062
  },
862
1063
  units: {
@@ -885,6 +1086,15 @@ export const $PostingDetailDto = {
885
1086
  description: 'Cost date',
886
1087
  example: '2024-01-15'
887
1088
  },
1089
+ cost: {
1090
+ description:
1091
+ 'Booking-resolved cost (mirrors engine Cost). Undefined when the posting has no cost basis.',
1092
+ allOf: [
1093
+ {
1094
+ $ref: '#/components/schemas/CostDetailDto'
1095
+ }
1096
+ ]
1097
+ },
888
1098
  priceAmount: {
889
1099
  type: 'string',
890
1100
  description: 'Price amount',
@@ -905,7 +1115,7 @@ export const $PostingDetailDto = {
905
1115
  description: 'Posting metadata'
906
1116
  }
907
1117
  },
908
- required: ['id', 'accountId', 'accountName']
1118
+ required: ['id', 'accountId', 'account']
909
1119
  } as const;
910
1120
 
911
1121
  export const $TransactionDetailDto = {
@@ -1011,6 +1221,18 @@ export const $TransactionDetailDto = {
1011
1221
  type: 'string',
1012
1222
  description: 'Correction reason (if voided or superseded)',
1013
1223
  example: 'Duplicate entry'
1224
+ },
1225
+ supersededBy: {
1226
+ type: 'string',
1227
+ description:
1228
+ 'ID of the transaction that supersedes this one (set when status=SUPERSEDED)',
1229
+ example: 'clh1234567890abcdef'
1230
+ },
1231
+ originalTxn: {
1232
+ type: 'string',
1233
+ description:
1234
+ 'ID of the transaction this one corrected/replaced (back-link on the replacement)',
1235
+ example: 'clh1234567890abcdef'
1014
1236
  }
1015
1237
  },
1016
1238
  required: [
@@ -4761,6 +4983,11 @@ export const $ParserTelemetryReportDto = {
4761
4983
  properties: {}
4762
4984
  } as const;
4763
4985
 
4986
+ export const $UncoveredFormatMissDto = {
4987
+ type: 'object',
4988
+ properties: {}
4989
+ } as const;
4990
+
4764
4991
  export const $ProcessNlpDto = {
4765
4992
  type: 'object',
4766
4993
  properties: {
@@ -5888,6 +6115,12 @@ export const $AccountItemWithAssetClassDto = {
5888
6115
  type: 'string',
5889
6116
  description: 'Risk level',
5890
6117
  example: 'LOW'
6118
+ },
6119
+ source: {
6120
+ type: 'string',
6121
+ description:
6122
+ 'ADR-0105 classification provenance (holding level always; account level only on FALLBACK)',
6123
+ enum: ['USER_META', 'FIAT_CURRENCY', 'OPENBB_MAPPING', 'FALLBACK']
5891
6124
  }
5892
6125
  },
5893
6126
  required: ['id', 'name', 'displayName', 'balance', 'currency', 'assetClass']
@@ -5993,6 +6226,11 @@ export const $AssetClassSummaryDto = {
5993
6226
  items: {
5994
6227
  $ref: '#/components/schemas/AccountExchangeRateWarningDto'
5995
6228
  }
6229
+ },
6230
+ fallback: {
6231
+ type: 'object',
6232
+ description:
6233
+ 'ADR-0105 §4 fallback provenance stats (holding level only). valueRatio is the grey-area share of total converted value; count is the number of source=FALLBACK holdings.'
5996
6234
  }
5997
6235
  },
5998
6236
  required: ['totalAccounts', 'totalAssetClasses', 'baseCurrency']
@@ -6015,11 +6253,107 @@ export const $AssetClassAccountsResponseDto = {
6015
6253
  $ref: '#/components/schemas/AssetClassSummaryDto'
6016
6254
  }
6017
6255
  ]
6256
+ },
6257
+ uncategorized: {
6258
+ description:
6259
+ 'ADR-0105 §6 holding-level grey-area bucket (source=FALLBACK holdings peeled out of groups). Present only for groupBy=holdingAssetClass when FALLBACK holdings exist.',
6260
+ allOf: [
6261
+ {
6262
+ $ref: '#/components/schemas/AssetClassGroupDto'
6263
+ }
6264
+ ]
6018
6265
  }
6019
6266
  },
6020
6267
  required: ['groups', 'summary']
6021
6268
  } as const;
6022
6269
 
6270
+ export const $HoldingAssetClassAccountSliceDto = {
6271
+ type: 'object',
6272
+ properties: {
6273
+ accountId: {
6274
+ type: 'string',
6275
+ description: 'Account ID'
6276
+ },
6277
+ accountPath: {
6278
+ type: 'string',
6279
+ description: 'Full account path',
6280
+ example: 'Assets:US:Investments:Brokerage'
6281
+ },
6282
+ accountCurrency: {
6283
+ type: 'string',
6284
+ description:
6285
+ 'Currency of the holding with the largest converted base value; undefined when no holding is convertible',
6286
+ example: 'USD'
6287
+ },
6288
+ marketValueBase: {
6289
+ type: 'string',
6290
+ description:
6291
+ "Account's market value in base currency (Σ converted holdings; grey bucket included)",
6292
+ example: '50000.00'
6293
+ },
6294
+ shareOfTotalPct: {
6295
+ type: 'number',
6296
+ description:
6297
+ 'Share of the global total (0-100). 0 when globalTotal is zero (no NaN/Infinity).',
6298
+ example: 42.5
6299
+ },
6300
+ groups: {
6301
+ description: 'Per-account asset-class breakdown',
6302
+ type: 'array',
6303
+ items: {
6304
+ $ref: '#/components/schemas/AssetClassGroupDto'
6305
+ }
6306
+ },
6307
+ uncategorized: {
6308
+ description:
6309
+ 'Per-account grey bucket (source=FALLBACK holdings, incl. broker cash)',
6310
+ allOf: [
6311
+ {
6312
+ $ref: '#/components/schemas/AssetClassGroupDto'
6313
+ }
6314
+ ]
6315
+ },
6316
+ holdings: {
6317
+ description:
6318
+ 'Every holding row for this account (account ID in each row’s `id` field)',
6319
+ type: 'array',
6320
+ items: {
6321
+ $ref: '#/components/schemas/AccountItemWithAssetClassDto'
6322
+ }
6323
+ }
6324
+ },
6325
+ required: [
6326
+ 'accountId',
6327
+ 'accountPath',
6328
+ 'marketValueBase',
6329
+ 'shareOfTotalPct',
6330
+ 'groups',
6331
+ 'holdings'
6332
+ ]
6333
+ } as const;
6334
+
6335
+ export const $HoldingAssetClassCrossAccountResponseDto = {
6336
+ type: 'object',
6337
+ properties: {
6338
+ global: {
6339
+ description: 'Merged cross-account holding aggregation',
6340
+ allOf: [
6341
+ {
6342
+ $ref: '#/components/schemas/AssetClassAccountsResponseDto'
6343
+ }
6344
+ ]
6345
+ },
6346
+ byAccount: {
6347
+ description: 'Per-account slices',
6348
+ type: 'array',
6349
+ items: {
6350
+ $ref: '#/components/schemas/HoldingAssetClassAccountSliceDto'
6351
+ }
6352
+ }
6353
+ },
6354
+ required: ['global', 'byAccount']
6355
+ } as const;
6356
+
6023
6357
  export const $CashFlowByCurrencyDto = {
6024
6358
  type: 'object',
6025
6359
  properties: {
@@ -6149,6 +6483,452 @@ export const $CashFlowResponseDto = {
6149
6483
  ]
6150
6484
  } as const;
6151
6485
 
6486
+ export const $MonetaryDto = {
6487
+ type: 'object',
6488
+ properties: {
6489
+ amount: {
6490
+ type: 'string',
6491
+ description: 'Amount (Decimal string)',
6492
+ example: '3000'
6493
+ },
6494
+ currency: {
6495
+ type: 'string',
6496
+ description: 'ISO 4217 currency',
6497
+ example: 'USD'
6498
+ },
6499
+ baseCcyEquivalent: {
6500
+ type: 'object',
6501
+ description: 'Converted to user base currency (Decimal string)',
6502
+ example: '21600',
6503
+ nullable: true
6504
+ }
6505
+ },
6506
+ required: ['amount', 'currency']
6507
+ } as const;
6508
+
6509
+ export const $CurrentPriceDto = {
6510
+ type: 'object',
6511
+ properties: {
6512
+ amount: {
6513
+ type: 'string',
6514
+ description: 'Price amount (Decimal string)',
6515
+ example: '250'
6516
+ },
6517
+ currency: {
6518
+ type: 'string',
6519
+ description: 'Price currency (ISO 4217)',
6520
+ example: 'USD'
6521
+ },
6522
+ date: {
6523
+ type: 'string',
6524
+ description: 'Price date (ISO 8601)',
6525
+ example: '2024-06-01'
6526
+ },
6527
+ source: {
6528
+ type: 'string',
6529
+ description: 'Price source',
6530
+ example: 'USER_OVERRIDE',
6531
+ enum: ['USER_OVERRIDE', 'OPENBB_EQUITY', 'OPENBB_CURRENCY']
6532
+ }
6533
+ },
6534
+ required: ['amount', 'currency', 'date', 'source']
6535
+ } as const;
6536
+
6537
+ export const $FxRateDto = {
6538
+ type: 'object',
6539
+ properties: {
6540
+ from: {
6541
+ type: 'string',
6542
+ example: 'USD'
6543
+ },
6544
+ to: {
6545
+ type: 'string',
6546
+ example: 'CNY'
6547
+ },
6548
+ rate: {
6549
+ type: 'string',
6550
+ description: 'FX rate (Decimal string)',
6551
+ example: '7.2'
6552
+ },
6553
+ date: {
6554
+ type: 'string',
6555
+ description: 'Rate date (ISO 8601)',
6556
+ example: '2024-01-15'
6557
+ }
6558
+ },
6559
+ required: ['from', 'to', 'rate', 'date']
6560
+ } as const;
6561
+
6562
+ export const $HoldingPnlRowDto = {
6563
+ type: 'object',
6564
+ properties: {
6565
+ accountId: {
6566
+ type: 'string',
6567
+ description: 'Account UUID',
6568
+ example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
6569
+ },
6570
+ accountPath: {
6571
+ type: 'string',
6572
+ description: 'Full account path',
6573
+ example: 'Assets:US:Broker:AAPL'
6574
+ },
6575
+ accountCcy: {
6576
+ type: 'object',
6577
+ description: 'Account settlement currency (ISO 4217), from cost currency',
6578
+ nullable: true,
6579
+ example: 'USD'
6580
+ },
6581
+ brokerType: {
6582
+ type: 'object',
6583
+ description: 'Broker type derived from Platform.type',
6584
+ nullable: true,
6585
+ example: 'broker'
6586
+ },
6587
+ symbol: {
6588
+ type: 'string',
6589
+ description: 'Commodity symbol',
6590
+ example: 'AAPL'
6591
+ },
6592
+ chartToken: {
6593
+ type: 'string',
6594
+ description: 'Chart segment token (libs/common resolver)',
6595
+ example: 'equity',
6596
+ enum: ['equity', 'fund', 'bond', 'cash', 'other']
6597
+ },
6598
+ assetClass: {
6599
+ type: 'string',
6600
+ example: 'EQUITY'
6601
+ },
6602
+ assetSubClass: {
6603
+ type: 'object',
6604
+ nullable: true,
6605
+ example: 'STOCK'
6606
+ },
6607
+ units: {
6608
+ type: 'string',
6609
+ description: 'Net held units (Decimal string)',
6610
+ example: '12'
6611
+ },
6612
+ averageCostPerUnit: {
6613
+ description:
6614
+ 'Average cost per unit; null when cost currency conflicts or no cost',
6615
+ nullable: true,
6616
+ allOf: [
6617
+ {
6618
+ $ref: '#/components/schemas/MonetaryDto'
6619
+ }
6620
+ ]
6621
+ },
6622
+ costBasis: {
6623
+ description: 'Cost basis of held units',
6624
+ nullable: true,
6625
+ allOf: [
6626
+ {
6627
+ $ref: '#/components/schemas/MonetaryDto'
6628
+ }
6629
+ ]
6630
+ },
6631
+ marketValue: {
6632
+ description: 'Market value at asOf price',
6633
+ nullable: true,
6634
+ allOf: [
6635
+ {
6636
+ $ref: '#/components/schemas/MonetaryDto'
6637
+ }
6638
+ ]
6639
+ },
6640
+ currentPrice: {
6641
+ description: 'Price used for market value',
6642
+ nullable: true,
6643
+ allOf: [
6644
+ {
6645
+ $ref: '#/components/schemas/CurrentPriceDto'
6646
+ }
6647
+ ]
6648
+ },
6649
+ unrealizedPnlBase: {
6650
+ type: 'object',
6651
+ description:
6652
+ 'Unrealized P&L in base currency (Decimal string); null when any FX/price missing',
6653
+ nullable: true,
6654
+ example: '6000'
6655
+ },
6656
+ unrealizedPnlPct: {
6657
+ type: 'object',
6658
+ description: 'Unrealized P&L % (Decimal string)',
6659
+ nullable: true,
6660
+ example: '25'
6661
+ },
6662
+ costFxRate: {
6663
+ description: 'Historical FX rate applied to cost basis',
6664
+ nullable: true,
6665
+ allOf: [
6666
+ {
6667
+ $ref: '#/components/schemas/FxRateDto'
6668
+ }
6669
+ ]
6670
+ },
6671
+ marketFxRate: {
6672
+ description: 'FX rate applied to market value',
6673
+ nullable: true,
6674
+ allOf: [
6675
+ {
6676
+ $ref: '#/components/schemas/FxRateDto'
6677
+ }
6678
+ ]
6679
+ },
6680
+ pctOfInvestedAssets: {
6681
+ type: 'object',
6682
+ description:
6683
+ 'Share of invested assets % (Decimal string); only for invested chartTokens',
6684
+ nullable: true,
6685
+ example: '40'
6686
+ },
6687
+ realizedPnl: {
6688
+ description:
6689
+ 'Cumulative realized P&L on sold lots (asOf-date cutoff); null when the method has no applicable sells, a sell lacks a price, or any required FX rate is missing (never-mix). When a sell spans multiple currencies (cross-currency sale), amount and currency reflect the base currency; baseCcyEquivalent is always the authoritative dual-FX figure',
6690
+ nullable: true,
6691
+ allOf: [
6692
+ {
6693
+ $ref: '#/components/schemas/MonetaryDto'
6694
+ }
6695
+ ]
6696
+ }
6697
+ },
6698
+ required: [
6699
+ 'accountId',
6700
+ 'accountPath',
6701
+ 'symbol',
6702
+ 'chartToken',
6703
+ 'assetClass',
6704
+ 'units'
6705
+ ]
6706
+ } as const;
6707
+
6708
+ export const $HoldingPnlWarningDto = {
6709
+ type: 'object',
6710
+ properties: {
6711
+ type: {
6712
+ type: 'string',
6713
+ description: 'Warning type',
6714
+ example: 'MISSING_COST_FX_RATE',
6715
+ enum: [
6716
+ 'MISSING_COST_FX_RATE',
6717
+ 'MISSING_MARKET_FX_RATE',
6718
+ 'MISSING_SALE_PRICE',
6719
+ 'MISSING_REALIZED_FX_RATE',
6720
+ 'OVERSOLD_LOTS',
6721
+ 'NO_PRICE',
6722
+ 'MIXED_COST_CURRENCY'
6723
+ ]
6724
+ },
6725
+ symbol: {
6726
+ type: 'object',
6727
+ nullable: true
6728
+ },
6729
+ accountId: {
6730
+ type: 'object',
6731
+ nullable: true
6732
+ },
6733
+ currency: {
6734
+ type: 'object',
6735
+ nullable: true
6736
+ }
6737
+ },
6738
+ required: ['type']
6739
+ } as const;
6740
+
6741
+ export const $HoldingPnlResponseDto = {
6742
+ type: 'object',
6743
+ properties: {
6744
+ asOfDate: {
6745
+ type: 'string',
6746
+ example: '2026-07-08'
6747
+ },
6748
+ baseCurrency: {
6749
+ type: 'string',
6750
+ example: 'CNY'
6751
+ },
6752
+ method: {
6753
+ type: 'string',
6754
+ description:
6755
+ 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
6756
+ enum: ['average', 'FIFO'],
6757
+ example: 'average'
6758
+ },
6759
+ rows: {
6760
+ type: 'array',
6761
+ items: {
6762
+ $ref: '#/components/schemas/HoldingPnlRowDto'
6763
+ }
6764
+ },
6765
+ warnings: {
6766
+ type: 'array',
6767
+ items: {
6768
+ $ref: '#/components/schemas/HoldingPnlWarningDto'
6769
+ }
6770
+ }
6771
+ },
6772
+ required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
6773
+ } as const;
6774
+
6775
+ export const $CreateBeanPriceDto = {
6776
+ type: 'object',
6777
+ properties: {
6778
+ currency: {
6779
+ type: 'string',
6780
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
6781
+ example: 'USD'
6782
+ },
6783
+ quoteCurrency: {
6784
+ type: 'string',
6785
+ description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
6786
+ example: 'CNY'
6787
+ },
6788
+ amount: {
6789
+ type: 'number',
6790
+ description:
6791
+ 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
6792
+ example: 175.5,
6793
+ minimum: 0
6794
+ },
6795
+ date: {
6796
+ type: 'string',
6797
+ description: 'Price date (ISO 8601 format)',
6798
+ example: '2024-11-05'
6799
+ },
6800
+ metadata: {
6801
+ type: 'object',
6802
+ description:
6803
+ 'Metadata (validated by Zod schema, max field lengths enforced)',
6804
+ example: {
6805
+ source: 'MANUAL',
6806
+ note: 'Bank valuation report',
6807
+ confidence: 0.95
6808
+ }
6809
+ }
6810
+ },
6811
+ required: ['currency', 'quoteCurrency', 'amount', 'date']
6812
+ } as const;
6813
+
6814
+ export const $PriceResponseDto = {
6815
+ type: 'object',
6816
+ properties: {
6817
+ id: {
6818
+ type: 'string',
6819
+ description: 'Unique identifier',
6820
+ example: 'uuid-123-456'
6821
+ },
6822
+ userId: {
6823
+ type: 'string',
6824
+ description: 'User ID (owner of the price)',
6825
+ example: 'user-123'
6826
+ },
6827
+ currency: {
6828
+ type: 'string',
6829
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
6830
+ example: 'BTC'
6831
+ },
6832
+ quoteCurrency: {
6833
+ type: 'string',
6834
+ description: 'Quote currency (pricing currency, e.g., USD, CNY)',
6835
+ example: 'USD'
6836
+ },
6837
+ amount: {
6838
+ type: 'number',
6839
+ description:
6840
+ 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
6841
+ example: 50000
6842
+ },
6843
+ date: {
6844
+ type: 'string',
6845
+ description:
6846
+ 'Price date (ISO 8601 format). Represents the date this price was valid.',
6847
+ example: '2024-01-01',
6848
+ format: 'date'
6849
+ },
6850
+ meta: {
6851
+ type: 'object',
6852
+ description:
6853
+ 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
6854
+ example: {
6855
+ source: 'MANUAL',
6856
+ note: 'User-defined price',
6857
+ confidence: 1
6858
+ }
6859
+ },
6860
+ createdAt: {
6861
+ format: 'date-time',
6862
+ type: 'string',
6863
+ description: 'Creation timestamp',
6864
+ example: '2024-11-03T10:00:00Z'
6865
+ },
6866
+ updatedAt: {
6867
+ format: 'date-time',
6868
+ type: 'string',
6869
+ description: 'Last update timestamp',
6870
+ example: '2024-11-03T10:00:00Z'
6871
+ }
6872
+ },
6873
+ required: [
6874
+ 'id',
6875
+ 'userId',
6876
+ 'currency',
6877
+ 'quoteCurrency',
6878
+ 'amount',
6879
+ 'date',
6880
+ 'meta',
6881
+ 'createdAt',
6882
+ 'updatedAt'
6883
+ ]
6884
+ } as const;
6885
+
6886
+ export const $PriceListResponseDto = {
6887
+ type: 'object',
6888
+ properties: {
6889
+ items: {
6890
+ description: 'List of prices',
6891
+ type: 'array',
6892
+ items: {
6893
+ $ref: '#/components/schemas/PriceResponseDto'
6894
+ }
6895
+ },
6896
+ total: {
6897
+ type: 'number',
6898
+ description: 'Total number of prices',
6899
+ example: 42
6900
+ }
6901
+ },
6902
+ required: ['items', 'total']
6903
+ } as const;
6904
+
6905
+ export const $UpdateBeanPriceDto = {
6906
+ type: 'object',
6907
+ properties: {
6908
+ currency: {
6909
+ type: 'string',
6910
+ description: 'Currency being priced'
6911
+ },
6912
+ quoteCurrency: {
6913
+ type: 'string',
6914
+ description: 'Quote currency (pricing currency)'
6915
+ },
6916
+ amount: {
6917
+ type: 'number',
6918
+ description: 'Price amount (MUST be >= 0 per Beancount spec)',
6919
+ minimum: 0
6920
+ },
6921
+ date: {
6922
+ type: 'string',
6923
+ description: 'Price date (ISO 8601 format)'
6924
+ },
6925
+ metadata: {
6926
+ type: 'object',
6927
+ description: 'Metadata'
6928
+ }
6929
+ }
6930
+ } as const;
6931
+
6152
6932
  export const $CurrencyBalanceDto = {
6153
6933
  type: 'object',
6154
6934
  properties: {