@firela/api-types 0.0.0-canary.32edff08 → 0.0.0-canary.52154bb3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +751 -9
- package/dist/index.d.ts +751 -9
- package/dist/index.js +28 -1
- package/dist/index.mjs +28 -1
- package/package.json +1 -1
- package/src/generated/schemas.gen.ts +739 -3
- package/src/generated/services.gen.ts +303 -2
- package/src/generated/types.gen.ts +881 -82
|
@@ -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']
|
|
@@ -841,6 +928,85 @@ export const $BatchTransactionResponseDto = {
|
|
|
841
928
|
required: ['succeeded', 'failed']
|
|
842
929
|
} as const;
|
|
843
930
|
|
|
931
|
+
export const $CorrectTransactionDto = {
|
|
932
|
+
type: 'object',
|
|
933
|
+
properties: {
|
|
934
|
+
date: {
|
|
935
|
+
type: 'string',
|
|
936
|
+
description: 'Transaction date (ISO 8601 format)',
|
|
937
|
+
example: '2024-11-28'
|
|
938
|
+
},
|
|
939
|
+
flag: {
|
|
940
|
+
type: 'string',
|
|
941
|
+
description: 'Transaction flag: * (cleared), ! (pending)',
|
|
942
|
+
enum: ['*', '!'],
|
|
943
|
+
example: '*'
|
|
944
|
+
},
|
|
945
|
+
payee: {
|
|
946
|
+
type: 'string',
|
|
947
|
+
description: 'Payee name',
|
|
948
|
+
example: 'Whole Foods Market'
|
|
949
|
+
},
|
|
950
|
+
narration: {
|
|
951
|
+
type: 'string',
|
|
952
|
+
description: 'Transaction narration/description',
|
|
953
|
+
example: 'Grocery shopping'
|
|
954
|
+
},
|
|
955
|
+
tags: {
|
|
956
|
+
description: 'Transaction tags (without # prefix)',
|
|
957
|
+
example: ['vacation', 'personal'],
|
|
958
|
+
type: 'array',
|
|
959
|
+
items: {
|
|
960
|
+
type: 'string'
|
|
961
|
+
}
|
|
962
|
+
},
|
|
963
|
+
links: {
|
|
964
|
+
description: 'Transaction links (without ^ prefix)',
|
|
965
|
+
example: ['invoice-123'],
|
|
966
|
+
type: 'array',
|
|
967
|
+
items: {
|
|
968
|
+
type: 'string'
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
postings: {
|
|
972
|
+
description:
|
|
973
|
+
'Transaction postings (minimum 1, typically 2 for double-entry)',
|
|
974
|
+
type: 'array',
|
|
975
|
+
items: {
|
|
976
|
+
$ref: '#/components/schemas/CreatePostingDto'
|
|
977
|
+
}
|
|
978
|
+
},
|
|
979
|
+
meta: {
|
|
980
|
+
type: 'object',
|
|
981
|
+
description: 'Transaction-level metadata',
|
|
982
|
+
example: {
|
|
983
|
+
invoice: '12345'
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
idempotencyKey: {
|
|
987
|
+
type: 'string',
|
|
988
|
+
description:
|
|
989
|
+
'Unique key for idempotent transaction creation. If provided, duplicate requests with the same key will return the existing transaction.',
|
|
990
|
+
example: 'import-2024-01-15-batch-001',
|
|
991
|
+
maxLength: 128
|
|
992
|
+
},
|
|
993
|
+
autoCreateAccounts: {
|
|
994
|
+
type: 'boolean',
|
|
995
|
+
description:
|
|
996
|
+
'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.',
|
|
997
|
+
default: true,
|
|
998
|
+
example: true
|
|
999
|
+
},
|
|
1000
|
+
correctionReason: {
|
|
1001
|
+
type: 'string',
|
|
1002
|
+
description: 'Reason for correcting/superseding the original transaction',
|
|
1003
|
+
example: 'Wrong amount — corrected from receipt',
|
|
1004
|
+
maxLength: 500
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
required: ['date', 'narration', 'postings']
|
|
1008
|
+
} as const;
|
|
1009
|
+
|
|
844
1010
|
export const $PostingDetailDto = {
|
|
845
1011
|
type: 'object',
|
|
846
1012
|
properties: {
|
|
@@ -854,9 +1020,9 @@ export const $PostingDetailDto = {
|
|
|
854
1020
|
description: 'Account ID',
|
|
855
1021
|
example: 'clh1234567890abcdef'
|
|
856
1022
|
},
|
|
857
|
-
|
|
1023
|
+
account: {
|
|
858
1024
|
type: 'string',
|
|
859
|
-
description: '
|
|
1025
|
+
description: 'Fully-qualified Beancount account path',
|
|
860
1026
|
example: 'Assets:Bank:Checking'
|
|
861
1027
|
},
|
|
862
1028
|
units: {
|
|
@@ -905,7 +1071,7 @@ export const $PostingDetailDto = {
|
|
|
905
1071
|
description: 'Posting metadata'
|
|
906
1072
|
}
|
|
907
1073
|
},
|
|
908
|
-
required: ['id', 'accountId', '
|
|
1074
|
+
required: ['id', 'accountId', 'account']
|
|
909
1075
|
} as const;
|
|
910
1076
|
|
|
911
1077
|
export const $TransactionDetailDto = {
|
|
@@ -1011,6 +1177,18 @@ export const $TransactionDetailDto = {
|
|
|
1011
1177
|
type: 'string',
|
|
1012
1178
|
description: 'Correction reason (if voided or superseded)',
|
|
1013
1179
|
example: 'Duplicate entry'
|
|
1180
|
+
},
|
|
1181
|
+
supersededBy: {
|
|
1182
|
+
type: 'string',
|
|
1183
|
+
description:
|
|
1184
|
+
'ID of the transaction that supersedes this one (set when status=SUPERSEDED)',
|
|
1185
|
+
example: 'clh1234567890abcdef'
|
|
1186
|
+
},
|
|
1187
|
+
originalTxn: {
|
|
1188
|
+
type: 'string',
|
|
1189
|
+
description:
|
|
1190
|
+
'ID of the transaction this one corrected/replaced (back-link on the replacement)',
|
|
1191
|
+
example: 'clh1234567890abcdef'
|
|
1014
1192
|
}
|
|
1015
1193
|
},
|
|
1016
1194
|
required: [
|
|
@@ -4761,6 +4939,11 @@ export const $ParserTelemetryReportDto = {
|
|
|
4761
4939
|
properties: {}
|
|
4762
4940
|
} as const;
|
|
4763
4941
|
|
|
4942
|
+
export const $UncoveredFormatMissDto = {
|
|
4943
|
+
type: 'object',
|
|
4944
|
+
properties: {}
|
|
4945
|
+
} as const;
|
|
4946
|
+
|
|
4764
4947
|
export const $ProcessNlpDto = {
|
|
4765
4948
|
type: 'object',
|
|
4766
4949
|
properties: {
|
|
@@ -5888,6 +6071,12 @@ export const $AccountItemWithAssetClassDto = {
|
|
|
5888
6071
|
type: 'string',
|
|
5889
6072
|
description: 'Risk level',
|
|
5890
6073
|
example: 'LOW'
|
|
6074
|
+
},
|
|
6075
|
+
source: {
|
|
6076
|
+
type: 'string',
|
|
6077
|
+
description:
|
|
6078
|
+
'ADR-0105 classification provenance (holding level always; account level only on FALLBACK)',
|
|
6079
|
+
enum: ['USER_META', 'FIAT_CURRENCY', 'OPENBB_MAPPING', 'FALLBACK']
|
|
5891
6080
|
}
|
|
5892
6081
|
},
|
|
5893
6082
|
required: ['id', 'name', 'displayName', 'balance', 'currency', 'assetClass']
|
|
@@ -5993,6 +6182,11 @@ export const $AssetClassSummaryDto = {
|
|
|
5993
6182
|
items: {
|
|
5994
6183
|
$ref: '#/components/schemas/AccountExchangeRateWarningDto'
|
|
5995
6184
|
}
|
|
6185
|
+
},
|
|
6186
|
+
fallback: {
|
|
6187
|
+
type: 'object',
|
|
6188
|
+
description:
|
|
6189
|
+
'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
6190
|
}
|
|
5997
6191
|
},
|
|
5998
6192
|
required: ['totalAccounts', 'totalAssetClasses', 'baseCurrency']
|
|
@@ -6015,11 +6209,107 @@ export const $AssetClassAccountsResponseDto = {
|
|
|
6015
6209
|
$ref: '#/components/schemas/AssetClassSummaryDto'
|
|
6016
6210
|
}
|
|
6017
6211
|
]
|
|
6212
|
+
},
|
|
6213
|
+
uncategorized: {
|
|
6214
|
+
description:
|
|
6215
|
+
'ADR-0105 §6 holding-level grey-area bucket (source=FALLBACK holdings peeled out of groups). Present only for groupBy=holdingAssetClass when FALLBACK holdings exist.',
|
|
6216
|
+
allOf: [
|
|
6217
|
+
{
|
|
6218
|
+
$ref: '#/components/schemas/AssetClassGroupDto'
|
|
6219
|
+
}
|
|
6220
|
+
]
|
|
6018
6221
|
}
|
|
6019
6222
|
},
|
|
6020
6223
|
required: ['groups', 'summary']
|
|
6021
6224
|
} as const;
|
|
6022
6225
|
|
|
6226
|
+
export const $HoldingAssetClassAccountSliceDto = {
|
|
6227
|
+
type: 'object',
|
|
6228
|
+
properties: {
|
|
6229
|
+
accountId: {
|
|
6230
|
+
type: 'string',
|
|
6231
|
+
description: 'Account ID'
|
|
6232
|
+
},
|
|
6233
|
+
accountPath: {
|
|
6234
|
+
type: 'string',
|
|
6235
|
+
description: 'Full account path',
|
|
6236
|
+
example: 'Assets:US:Investments:Brokerage'
|
|
6237
|
+
},
|
|
6238
|
+
accountCurrency: {
|
|
6239
|
+
type: 'string',
|
|
6240
|
+
description:
|
|
6241
|
+
'Currency of the holding with the largest converted base value; undefined when no holding is convertible',
|
|
6242
|
+
example: 'USD'
|
|
6243
|
+
},
|
|
6244
|
+
marketValueBase: {
|
|
6245
|
+
type: 'string',
|
|
6246
|
+
description:
|
|
6247
|
+
"Account's market value in base currency (Σ converted holdings; grey bucket included)",
|
|
6248
|
+
example: '50000.00'
|
|
6249
|
+
},
|
|
6250
|
+
shareOfTotalPct: {
|
|
6251
|
+
type: 'number',
|
|
6252
|
+
description:
|
|
6253
|
+
'Share of the global total (0-100). 0 when globalTotal is zero (no NaN/Infinity).',
|
|
6254
|
+
example: 42.5
|
|
6255
|
+
},
|
|
6256
|
+
groups: {
|
|
6257
|
+
description: 'Per-account asset-class breakdown',
|
|
6258
|
+
type: 'array',
|
|
6259
|
+
items: {
|
|
6260
|
+
$ref: '#/components/schemas/AssetClassGroupDto'
|
|
6261
|
+
}
|
|
6262
|
+
},
|
|
6263
|
+
uncategorized: {
|
|
6264
|
+
description:
|
|
6265
|
+
'Per-account grey bucket (source=FALLBACK holdings, incl. broker cash)',
|
|
6266
|
+
allOf: [
|
|
6267
|
+
{
|
|
6268
|
+
$ref: '#/components/schemas/AssetClassGroupDto'
|
|
6269
|
+
}
|
|
6270
|
+
]
|
|
6271
|
+
},
|
|
6272
|
+
holdings: {
|
|
6273
|
+
description:
|
|
6274
|
+
'Every holding row for this account (account ID in each row’s `id` field)',
|
|
6275
|
+
type: 'array',
|
|
6276
|
+
items: {
|
|
6277
|
+
$ref: '#/components/schemas/AccountItemWithAssetClassDto'
|
|
6278
|
+
}
|
|
6279
|
+
}
|
|
6280
|
+
},
|
|
6281
|
+
required: [
|
|
6282
|
+
'accountId',
|
|
6283
|
+
'accountPath',
|
|
6284
|
+
'marketValueBase',
|
|
6285
|
+
'shareOfTotalPct',
|
|
6286
|
+
'groups',
|
|
6287
|
+
'holdings'
|
|
6288
|
+
]
|
|
6289
|
+
} as const;
|
|
6290
|
+
|
|
6291
|
+
export const $HoldingAssetClassCrossAccountResponseDto = {
|
|
6292
|
+
type: 'object',
|
|
6293
|
+
properties: {
|
|
6294
|
+
global: {
|
|
6295
|
+
description: 'Merged cross-account holding aggregation',
|
|
6296
|
+
allOf: [
|
|
6297
|
+
{
|
|
6298
|
+
$ref: '#/components/schemas/AssetClassAccountsResponseDto'
|
|
6299
|
+
}
|
|
6300
|
+
]
|
|
6301
|
+
},
|
|
6302
|
+
byAccount: {
|
|
6303
|
+
description: 'Per-account slices',
|
|
6304
|
+
type: 'array',
|
|
6305
|
+
items: {
|
|
6306
|
+
$ref: '#/components/schemas/HoldingAssetClassAccountSliceDto'
|
|
6307
|
+
}
|
|
6308
|
+
}
|
|
6309
|
+
},
|
|
6310
|
+
required: ['global', 'byAccount']
|
|
6311
|
+
} as const;
|
|
6312
|
+
|
|
6023
6313
|
export const $CashFlowByCurrencyDto = {
|
|
6024
6314
|
type: 'object',
|
|
6025
6315
|
properties: {
|
|
@@ -6149,6 +6439,452 @@ export const $CashFlowResponseDto = {
|
|
|
6149
6439
|
]
|
|
6150
6440
|
} as const;
|
|
6151
6441
|
|
|
6442
|
+
export const $MonetaryDto = {
|
|
6443
|
+
type: 'object',
|
|
6444
|
+
properties: {
|
|
6445
|
+
amount: {
|
|
6446
|
+
type: 'string',
|
|
6447
|
+
description: 'Amount (Decimal string)',
|
|
6448
|
+
example: '3000'
|
|
6449
|
+
},
|
|
6450
|
+
currency: {
|
|
6451
|
+
type: 'string',
|
|
6452
|
+
description: 'ISO 4217 currency',
|
|
6453
|
+
example: 'USD'
|
|
6454
|
+
},
|
|
6455
|
+
baseCcyEquivalent: {
|
|
6456
|
+
type: 'object',
|
|
6457
|
+
description: 'Converted to user base currency (Decimal string)',
|
|
6458
|
+
example: '21600',
|
|
6459
|
+
nullable: true
|
|
6460
|
+
}
|
|
6461
|
+
},
|
|
6462
|
+
required: ['amount', 'currency']
|
|
6463
|
+
} as const;
|
|
6464
|
+
|
|
6465
|
+
export const $CurrentPriceDto = {
|
|
6466
|
+
type: 'object',
|
|
6467
|
+
properties: {
|
|
6468
|
+
amount: {
|
|
6469
|
+
type: 'string',
|
|
6470
|
+
description: 'Price amount (Decimal string)',
|
|
6471
|
+
example: '250'
|
|
6472
|
+
},
|
|
6473
|
+
currency: {
|
|
6474
|
+
type: 'string',
|
|
6475
|
+
description: 'Price currency (ISO 4217)',
|
|
6476
|
+
example: 'USD'
|
|
6477
|
+
},
|
|
6478
|
+
date: {
|
|
6479
|
+
type: 'string',
|
|
6480
|
+
description: 'Price date (ISO 8601)',
|
|
6481
|
+
example: '2024-06-01'
|
|
6482
|
+
},
|
|
6483
|
+
source: {
|
|
6484
|
+
type: 'string',
|
|
6485
|
+
description: 'Price source',
|
|
6486
|
+
example: 'USER_OVERRIDE',
|
|
6487
|
+
enum: ['USER_OVERRIDE', 'OPENBB_EQUITY', 'OPENBB_CURRENCY']
|
|
6488
|
+
}
|
|
6489
|
+
},
|
|
6490
|
+
required: ['amount', 'currency', 'date', 'source']
|
|
6491
|
+
} as const;
|
|
6492
|
+
|
|
6493
|
+
export const $FxRateDto = {
|
|
6494
|
+
type: 'object',
|
|
6495
|
+
properties: {
|
|
6496
|
+
from: {
|
|
6497
|
+
type: 'string',
|
|
6498
|
+
example: 'USD'
|
|
6499
|
+
},
|
|
6500
|
+
to: {
|
|
6501
|
+
type: 'string',
|
|
6502
|
+
example: 'CNY'
|
|
6503
|
+
},
|
|
6504
|
+
rate: {
|
|
6505
|
+
type: 'string',
|
|
6506
|
+
description: 'FX rate (Decimal string)',
|
|
6507
|
+
example: '7.2'
|
|
6508
|
+
},
|
|
6509
|
+
date: {
|
|
6510
|
+
type: 'string',
|
|
6511
|
+
description: 'Rate date (ISO 8601)',
|
|
6512
|
+
example: '2024-01-15'
|
|
6513
|
+
}
|
|
6514
|
+
},
|
|
6515
|
+
required: ['from', 'to', 'rate', 'date']
|
|
6516
|
+
} as const;
|
|
6517
|
+
|
|
6518
|
+
export const $HoldingPnlRowDto = {
|
|
6519
|
+
type: 'object',
|
|
6520
|
+
properties: {
|
|
6521
|
+
accountId: {
|
|
6522
|
+
type: 'string',
|
|
6523
|
+
description: 'Account UUID',
|
|
6524
|
+
example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890'
|
|
6525
|
+
},
|
|
6526
|
+
accountPath: {
|
|
6527
|
+
type: 'string',
|
|
6528
|
+
description: 'Full account path',
|
|
6529
|
+
example: 'Assets:US:Broker:AAPL'
|
|
6530
|
+
},
|
|
6531
|
+
accountCcy: {
|
|
6532
|
+
type: 'object',
|
|
6533
|
+
description: 'Account settlement currency (ISO 4217), from cost currency',
|
|
6534
|
+
nullable: true,
|
|
6535
|
+
example: 'USD'
|
|
6536
|
+
},
|
|
6537
|
+
brokerType: {
|
|
6538
|
+
type: 'object',
|
|
6539
|
+
description: 'Broker type derived from Platform.type',
|
|
6540
|
+
nullable: true,
|
|
6541
|
+
example: 'broker'
|
|
6542
|
+
},
|
|
6543
|
+
symbol: {
|
|
6544
|
+
type: 'string',
|
|
6545
|
+
description: 'Commodity symbol',
|
|
6546
|
+
example: 'AAPL'
|
|
6547
|
+
},
|
|
6548
|
+
chartToken: {
|
|
6549
|
+
type: 'string',
|
|
6550
|
+
description: 'Chart segment token (libs/common resolver)',
|
|
6551
|
+
example: 'equity',
|
|
6552
|
+
enum: ['equity', 'fund', 'bond', 'cash', 'other']
|
|
6553
|
+
},
|
|
6554
|
+
assetClass: {
|
|
6555
|
+
type: 'string',
|
|
6556
|
+
example: 'EQUITY'
|
|
6557
|
+
},
|
|
6558
|
+
assetSubClass: {
|
|
6559
|
+
type: 'object',
|
|
6560
|
+
nullable: true,
|
|
6561
|
+
example: 'STOCK'
|
|
6562
|
+
},
|
|
6563
|
+
units: {
|
|
6564
|
+
type: 'string',
|
|
6565
|
+
description: 'Net held units (Decimal string)',
|
|
6566
|
+
example: '12'
|
|
6567
|
+
},
|
|
6568
|
+
averageCostPerUnit: {
|
|
6569
|
+
description:
|
|
6570
|
+
'Average cost per unit; null when cost currency conflicts or no cost',
|
|
6571
|
+
nullable: true,
|
|
6572
|
+
allOf: [
|
|
6573
|
+
{
|
|
6574
|
+
$ref: '#/components/schemas/MonetaryDto'
|
|
6575
|
+
}
|
|
6576
|
+
]
|
|
6577
|
+
},
|
|
6578
|
+
costBasis: {
|
|
6579
|
+
description: 'Cost basis of held units',
|
|
6580
|
+
nullable: true,
|
|
6581
|
+
allOf: [
|
|
6582
|
+
{
|
|
6583
|
+
$ref: '#/components/schemas/MonetaryDto'
|
|
6584
|
+
}
|
|
6585
|
+
]
|
|
6586
|
+
},
|
|
6587
|
+
marketValue: {
|
|
6588
|
+
description: 'Market value at asOf price',
|
|
6589
|
+
nullable: true,
|
|
6590
|
+
allOf: [
|
|
6591
|
+
{
|
|
6592
|
+
$ref: '#/components/schemas/MonetaryDto'
|
|
6593
|
+
}
|
|
6594
|
+
]
|
|
6595
|
+
},
|
|
6596
|
+
currentPrice: {
|
|
6597
|
+
description: 'Price used for market value',
|
|
6598
|
+
nullable: true,
|
|
6599
|
+
allOf: [
|
|
6600
|
+
{
|
|
6601
|
+
$ref: '#/components/schemas/CurrentPriceDto'
|
|
6602
|
+
}
|
|
6603
|
+
]
|
|
6604
|
+
},
|
|
6605
|
+
unrealizedPnlBase: {
|
|
6606
|
+
type: 'object',
|
|
6607
|
+
description:
|
|
6608
|
+
'Unrealized P&L in base currency (Decimal string); null when any FX/price missing',
|
|
6609
|
+
nullable: true,
|
|
6610
|
+
example: '6000'
|
|
6611
|
+
},
|
|
6612
|
+
unrealizedPnlPct: {
|
|
6613
|
+
type: 'object',
|
|
6614
|
+
description: 'Unrealized P&L % (Decimal string)',
|
|
6615
|
+
nullable: true,
|
|
6616
|
+
example: '25'
|
|
6617
|
+
},
|
|
6618
|
+
costFxRate: {
|
|
6619
|
+
description: 'Historical FX rate applied to cost basis',
|
|
6620
|
+
nullable: true,
|
|
6621
|
+
allOf: [
|
|
6622
|
+
{
|
|
6623
|
+
$ref: '#/components/schemas/FxRateDto'
|
|
6624
|
+
}
|
|
6625
|
+
]
|
|
6626
|
+
},
|
|
6627
|
+
marketFxRate: {
|
|
6628
|
+
description: 'FX rate applied to market value',
|
|
6629
|
+
nullable: true,
|
|
6630
|
+
allOf: [
|
|
6631
|
+
{
|
|
6632
|
+
$ref: '#/components/schemas/FxRateDto'
|
|
6633
|
+
}
|
|
6634
|
+
]
|
|
6635
|
+
},
|
|
6636
|
+
pctOfInvestedAssets: {
|
|
6637
|
+
type: 'object',
|
|
6638
|
+
description:
|
|
6639
|
+
'Share of invested assets % (Decimal string); only for invested chartTokens',
|
|
6640
|
+
nullable: true,
|
|
6641
|
+
example: '40'
|
|
6642
|
+
},
|
|
6643
|
+
realizedPnl: {
|
|
6644
|
+
description:
|
|
6645
|
+
'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',
|
|
6646
|
+
nullable: true,
|
|
6647
|
+
allOf: [
|
|
6648
|
+
{
|
|
6649
|
+
$ref: '#/components/schemas/MonetaryDto'
|
|
6650
|
+
}
|
|
6651
|
+
]
|
|
6652
|
+
}
|
|
6653
|
+
},
|
|
6654
|
+
required: [
|
|
6655
|
+
'accountId',
|
|
6656
|
+
'accountPath',
|
|
6657
|
+
'symbol',
|
|
6658
|
+
'chartToken',
|
|
6659
|
+
'assetClass',
|
|
6660
|
+
'units'
|
|
6661
|
+
]
|
|
6662
|
+
} as const;
|
|
6663
|
+
|
|
6664
|
+
export const $HoldingPnlWarningDto = {
|
|
6665
|
+
type: 'object',
|
|
6666
|
+
properties: {
|
|
6667
|
+
type: {
|
|
6668
|
+
type: 'string',
|
|
6669
|
+
description: 'Warning type',
|
|
6670
|
+
example: 'MISSING_COST_FX_RATE',
|
|
6671
|
+
enum: [
|
|
6672
|
+
'MISSING_COST_FX_RATE',
|
|
6673
|
+
'MISSING_MARKET_FX_RATE',
|
|
6674
|
+
'MISSING_SALE_PRICE',
|
|
6675
|
+
'MISSING_REALIZED_FX_RATE',
|
|
6676
|
+
'OVERSOLD_LOTS',
|
|
6677
|
+
'NO_PRICE',
|
|
6678
|
+
'MIXED_COST_CURRENCY'
|
|
6679
|
+
]
|
|
6680
|
+
},
|
|
6681
|
+
symbol: {
|
|
6682
|
+
type: 'object',
|
|
6683
|
+
nullable: true
|
|
6684
|
+
},
|
|
6685
|
+
accountId: {
|
|
6686
|
+
type: 'object',
|
|
6687
|
+
nullable: true
|
|
6688
|
+
},
|
|
6689
|
+
currency: {
|
|
6690
|
+
type: 'object',
|
|
6691
|
+
nullable: true
|
|
6692
|
+
}
|
|
6693
|
+
},
|
|
6694
|
+
required: ['type']
|
|
6695
|
+
} as const;
|
|
6696
|
+
|
|
6697
|
+
export const $HoldingPnlResponseDto = {
|
|
6698
|
+
type: 'object',
|
|
6699
|
+
properties: {
|
|
6700
|
+
asOfDate: {
|
|
6701
|
+
type: 'string',
|
|
6702
|
+
example: '2026-07-08'
|
|
6703
|
+
},
|
|
6704
|
+
baseCurrency: {
|
|
6705
|
+
type: 'string',
|
|
6706
|
+
example: 'CNY'
|
|
6707
|
+
},
|
|
6708
|
+
method: {
|
|
6709
|
+
type: 'string',
|
|
6710
|
+
description:
|
|
6711
|
+
'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
|
|
6712
|
+
enum: ['average', 'FIFO'],
|
|
6713
|
+
example: 'average'
|
|
6714
|
+
},
|
|
6715
|
+
rows: {
|
|
6716
|
+
type: 'array',
|
|
6717
|
+
items: {
|
|
6718
|
+
$ref: '#/components/schemas/HoldingPnlRowDto'
|
|
6719
|
+
}
|
|
6720
|
+
},
|
|
6721
|
+
warnings: {
|
|
6722
|
+
type: 'array',
|
|
6723
|
+
items: {
|
|
6724
|
+
$ref: '#/components/schemas/HoldingPnlWarningDto'
|
|
6725
|
+
}
|
|
6726
|
+
}
|
|
6727
|
+
},
|
|
6728
|
+
required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
|
|
6729
|
+
} as const;
|
|
6730
|
+
|
|
6731
|
+
export const $CreateBeanPriceDto = {
|
|
6732
|
+
type: 'object',
|
|
6733
|
+
properties: {
|
|
6734
|
+
currency: {
|
|
6735
|
+
type: 'string',
|
|
6736
|
+
description: 'Currency being priced (e.g., USD, AAPL, BTC)',
|
|
6737
|
+
example: 'USD'
|
|
6738
|
+
},
|
|
6739
|
+
quoteCurrency: {
|
|
6740
|
+
type: 'string',
|
|
6741
|
+
description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
|
|
6742
|
+
example: 'CNY'
|
|
6743
|
+
},
|
|
6744
|
+
amount: {
|
|
6745
|
+
type: 'number',
|
|
6746
|
+
description:
|
|
6747
|
+
'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
|
|
6748
|
+
example: 175.5,
|
|
6749
|
+
minimum: 0
|
|
6750
|
+
},
|
|
6751
|
+
date: {
|
|
6752
|
+
type: 'string',
|
|
6753
|
+
description: 'Price date (ISO 8601 format)',
|
|
6754
|
+
example: '2024-11-05'
|
|
6755
|
+
},
|
|
6756
|
+
metadata: {
|
|
6757
|
+
type: 'object',
|
|
6758
|
+
description:
|
|
6759
|
+
'Metadata (validated by Zod schema, max field lengths enforced)',
|
|
6760
|
+
example: {
|
|
6761
|
+
source: 'MANUAL',
|
|
6762
|
+
note: 'Bank valuation report',
|
|
6763
|
+
confidence: 0.95
|
|
6764
|
+
}
|
|
6765
|
+
}
|
|
6766
|
+
},
|
|
6767
|
+
required: ['currency', 'quoteCurrency', 'amount', 'date']
|
|
6768
|
+
} as const;
|
|
6769
|
+
|
|
6770
|
+
export const $PriceResponseDto = {
|
|
6771
|
+
type: 'object',
|
|
6772
|
+
properties: {
|
|
6773
|
+
id: {
|
|
6774
|
+
type: 'string',
|
|
6775
|
+
description: 'Unique identifier',
|
|
6776
|
+
example: 'uuid-123-456'
|
|
6777
|
+
},
|
|
6778
|
+
userId: {
|
|
6779
|
+
type: 'string',
|
|
6780
|
+
description: 'User ID (owner of the price)',
|
|
6781
|
+
example: 'user-123'
|
|
6782
|
+
},
|
|
6783
|
+
currency: {
|
|
6784
|
+
type: 'string',
|
|
6785
|
+
description: 'Currency being priced (e.g., USD, AAPL, BTC)',
|
|
6786
|
+
example: 'BTC'
|
|
6787
|
+
},
|
|
6788
|
+
quoteCurrency: {
|
|
6789
|
+
type: 'string',
|
|
6790
|
+
description: 'Quote currency (pricing currency, e.g., USD, CNY)',
|
|
6791
|
+
example: 'USD'
|
|
6792
|
+
},
|
|
6793
|
+
amount: {
|
|
6794
|
+
type: 'number',
|
|
6795
|
+
description:
|
|
6796
|
+
'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
|
|
6797
|
+
example: 50000
|
|
6798
|
+
},
|
|
6799
|
+
date: {
|
|
6800
|
+
type: 'string',
|
|
6801
|
+
description:
|
|
6802
|
+
'Price date (ISO 8601 format). Represents the date this price was valid.',
|
|
6803
|
+
example: '2024-01-01',
|
|
6804
|
+
format: 'date'
|
|
6805
|
+
},
|
|
6806
|
+
meta: {
|
|
6807
|
+
type: 'object',
|
|
6808
|
+
description:
|
|
6809
|
+
'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
|
|
6810
|
+
example: {
|
|
6811
|
+
source: 'MANUAL',
|
|
6812
|
+
note: 'User-defined price',
|
|
6813
|
+
confidence: 1
|
|
6814
|
+
}
|
|
6815
|
+
},
|
|
6816
|
+
createdAt: {
|
|
6817
|
+
format: 'date-time',
|
|
6818
|
+
type: 'string',
|
|
6819
|
+
description: 'Creation timestamp',
|
|
6820
|
+
example: '2024-11-03T10:00:00Z'
|
|
6821
|
+
},
|
|
6822
|
+
updatedAt: {
|
|
6823
|
+
format: 'date-time',
|
|
6824
|
+
type: 'string',
|
|
6825
|
+
description: 'Last update timestamp',
|
|
6826
|
+
example: '2024-11-03T10:00:00Z'
|
|
6827
|
+
}
|
|
6828
|
+
},
|
|
6829
|
+
required: [
|
|
6830
|
+
'id',
|
|
6831
|
+
'userId',
|
|
6832
|
+
'currency',
|
|
6833
|
+
'quoteCurrency',
|
|
6834
|
+
'amount',
|
|
6835
|
+
'date',
|
|
6836
|
+
'meta',
|
|
6837
|
+
'createdAt',
|
|
6838
|
+
'updatedAt'
|
|
6839
|
+
]
|
|
6840
|
+
} as const;
|
|
6841
|
+
|
|
6842
|
+
export const $PriceListResponseDto = {
|
|
6843
|
+
type: 'object',
|
|
6844
|
+
properties: {
|
|
6845
|
+
items: {
|
|
6846
|
+
description: 'List of prices',
|
|
6847
|
+
type: 'array',
|
|
6848
|
+
items: {
|
|
6849
|
+
$ref: '#/components/schemas/PriceResponseDto'
|
|
6850
|
+
}
|
|
6851
|
+
},
|
|
6852
|
+
total: {
|
|
6853
|
+
type: 'number',
|
|
6854
|
+
description: 'Total number of prices',
|
|
6855
|
+
example: 42
|
|
6856
|
+
}
|
|
6857
|
+
},
|
|
6858
|
+
required: ['items', 'total']
|
|
6859
|
+
} as const;
|
|
6860
|
+
|
|
6861
|
+
export const $UpdateBeanPriceDto = {
|
|
6862
|
+
type: 'object',
|
|
6863
|
+
properties: {
|
|
6864
|
+
currency: {
|
|
6865
|
+
type: 'string',
|
|
6866
|
+
description: 'Currency being priced'
|
|
6867
|
+
},
|
|
6868
|
+
quoteCurrency: {
|
|
6869
|
+
type: 'string',
|
|
6870
|
+
description: 'Quote currency (pricing currency)'
|
|
6871
|
+
},
|
|
6872
|
+
amount: {
|
|
6873
|
+
type: 'number',
|
|
6874
|
+
description: 'Price amount (MUST be >= 0 per Beancount spec)',
|
|
6875
|
+
minimum: 0
|
|
6876
|
+
},
|
|
6877
|
+
date: {
|
|
6878
|
+
type: 'string',
|
|
6879
|
+
description: 'Price date (ISO 8601 format)'
|
|
6880
|
+
},
|
|
6881
|
+
metadata: {
|
|
6882
|
+
type: 'object',
|
|
6883
|
+
description: 'Metadata'
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
} as const;
|
|
6887
|
+
|
|
6152
6888
|
export const $CurrencyBalanceDto = {
|
|
6153
6889
|
type: 'object',
|
|
6154
6890
|
properties: {
|