@firela/api-types 0.0.0-canary.efc869e1 → 0.0.0-canary.fb3ac1dd

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.
@@ -6,18 +6,12 @@ export const $CreateAccountDto = {
6
6
  path: {
7
7
  type: 'string',
8
8
  description: 'Account path (hierarchical, colon-separated)',
9
- example: 'Assets:CN:Bank:ICBC:Checking'
10
- },
11
- displayName: {
12
- type: 'string',
13
- description:
14
- 'Display name to distinguish accounts at the same path (default: "")',
15
- example: '工资卡'
9
+ example: 'Assets:CN:ICBC:Checking'
16
10
  },
17
11
  openDate: {
18
12
  format: 'date-time',
19
13
  type: 'string',
20
- description: 'Account open date',
14
+ description: 'Account open date (server defaults to today)',
21
15
  example: '2024-01-01'
22
16
  },
23
17
  currencies: {
@@ -45,26 +39,22 @@ export const $CreateAccountDto = {
45
39
  templatePath: {
46
40
  type: 'string',
47
41
  description: 'Reference to account-standards template path',
48
- example: 'Assets:CN:Bank:ICBC:Checking'
42
+ example: 'Assets:CN:Checking'
49
43
  },
50
44
  isCustom: {
51
45
  type: 'boolean',
52
46
  description: 'Whether this is a custom (user-created) account',
53
47
  default: false
54
48
  },
55
- i18nKey: {
56
- type: 'string',
57
- description: 'i18n key for display name (overrides template)',
58
- example: 'account.custom.mybank'
59
- },
60
49
  icon: {
61
50
  type: 'string',
62
51
  description: 'Icon identifier (overrides template)',
63
52
  example: 'bank-custom'
64
53
  },
65
- openMeta: {
54
+ openDirectiveMeta: {
66
55
  type: 'object',
67
- description: 'Additional metadata',
56
+ description:
57
+ 'Open directive metadata (NOT an opening-balance amount — use the opening-balance endpoint)',
68
58
  example: {
69
59
  branch: 'Downtown',
70
60
  accountNumber: '1234'
@@ -76,7 +66,7 @@ export const $CreateAccountDto = {
76
66
  example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
77
67
  }
78
68
  },
79
- required: ['path', 'openDate']
69
+ required: ['path']
80
70
  } as const;
81
71
 
82
72
  export const $AccountResponseDto = {
@@ -90,13 +80,7 @@ export const $AccountResponseDto = {
90
80
  path: {
91
81
  type: 'string',
92
82
  description: 'Account path (hierarchical, colon-separated)',
93
- example: 'Assets:CN:Bank:ICBC:Checking'
94
- },
95
- displayName: {
96
- type: 'string',
97
- description:
98
- 'Display name distinguishing multiple accounts at the same path',
99
- example: '工资卡'
83
+ example: 'Assets:CN:ICBC:Checking'
100
84
  },
101
85
  type: {
102
86
  type: 'string',
@@ -104,6 +88,49 @@ export const $AccountResponseDto = {
104
88
  enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
105
89
  example: 'Assets'
106
90
  },
91
+ assetSubClass: {
92
+ type: 'string',
93
+ description:
94
+ 'Account-level asset sub-class (product type, e.g. STOCK/DEPOSIT/CREDIT_CARD/PERSONAL_LOAN). Computed from the account path via the asset-classifier (ADR-0077). Null for non-asset accounts (Income/Expenses/Equity) or unmatched paths.',
95
+ enum: [
96
+ 'DEPOSIT',
97
+ 'CASH',
98
+ 'MONEY_MARKET_FUND',
99
+ 'STOCK',
100
+ 'ETF',
101
+ 'MUTUAL_FUND',
102
+ 'EQUITY_COMPENSATION',
103
+ 'GOVERNMENT_BOND',
104
+ 'CORPORATE_BOND',
105
+ 'BOND_FUND',
106
+ 'PRIMARY_RESIDENCE',
107
+ 'INVESTMENT_PROPERTY',
108
+ 'REIT',
109
+ 'GOLD',
110
+ 'SILVER',
111
+ 'PRECIOUS_METAL',
112
+ 'PRECIOUS_METAL_FUND',
113
+ 'COMMODITY',
114
+ 'COMMODITY_FUND',
115
+ 'CRYPTOCURRENCY',
116
+ 'RETIREMENT_ACCOUNT',
117
+ 'HEALTH_ACCOUNT',
118
+ 'EDUCATION_ACCOUNT',
119
+ 'INSURANCE',
120
+ 'PRIVATE_EQUITY',
121
+ 'HEDGE_FUND',
122
+ 'COLLECTIBLES',
123
+ 'MORTGAGE',
124
+ 'STUDENT_LOAN',
125
+ 'CREDIT_CARD',
126
+ 'PERSONAL_LOAN',
127
+ 'ACCOUNTS_PAYABLE',
128
+ 'TAX_PAYABLE',
129
+ 'OTHER'
130
+ ],
131
+ nullable: true,
132
+ example: 'STOCK'
133
+ },
107
134
  status: {
108
135
  type: 'string',
109
136
  description: 'Account status',
@@ -145,26 +172,26 @@ export const $AccountResponseDto = {
145
172
  templatePath: {
146
173
  type: 'string',
147
174
  description: 'Template path reference',
148
- example: 'Assets:CN:Bank:ICBC:Checking'
175
+ example: 'Assets:CN:Checking'
149
176
  },
150
177
  isCustom: {
151
178
  type: 'boolean',
152
179
  description: 'Whether this is a custom (user-created) account',
153
180
  example: false
154
181
  },
155
- i18nKey: {
182
+ displayName: {
156
183
  type: 'string',
157
- description: 'i18n key for display name',
158
- example: 'account.assets.cn.bank.icbc.checking'
184
+ description: 'Localized display name (ADR-0114, read-time projection)',
185
+ example: 'Checking'
159
186
  },
160
187
  icon: {
161
188
  type: 'string',
162
189
  description: 'Icon identifier',
163
190
  example: 'bank-icbc'
164
191
  },
165
- openMeta: {
192
+ openDirectiveMeta: {
166
193
  type: 'object',
167
- description: 'Account metadata',
194
+ description: 'Open directive metadata (ADR-0115 Decision 9)',
168
195
  example: {
169
196
  branch: 'Downtown'
170
197
  }
@@ -192,7 +219,6 @@ export const $AccountResponseDto = {
192
219
  required: [
193
220
  'id',
194
221
  'path',
195
- 'displayName',
196
222
  'type',
197
223
  'status',
198
224
  'openDate',
@@ -225,11 +251,6 @@ export const $AccountListResponseDto = {
225
251
  export const $UpdateAccountDto = {
226
252
  type: 'object',
227
253
  properties: {
228
- displayName: {
229
- type: 'string',
230
- description: 'Display name to distinguish accounts at the same path',
231
- example: '招行工资卡'
232
- },
233
254
  currencies: {
234
255
  description: 'Allowed currencies (null = no restriction)',
235
256
  example: ['CNY', 'USD'],
@@ -251,19 +272,15 @@ export const $UpdateAccountDto = {
251
272
  'NONE'
252
273
  ]
253
274
  },
254
- i18nKey: {
255
- type: 'string',
256
- description: 'i18n key for display name',
257
- example: 'account.custom.mybank'
258
- },
259
275
  icon: {
260
276
  type: 'string',
261
277
  description: 'Icon identifier',
262
278
  example: 'bank-custom'
263
279
  },
264
- openMeta: {
280
+ openDirectiveMeta: {
265
281
  type: 'object',
266
- description: 'Additional metadata (merged with existing)',
282
+ description:
283
+ 'Open directive metadata (merged with existing; NOT an opening-balance amount)',
267
284
  example: {
268
285
  branch: 'Uptown'
269
286
  }
@@ -310,13 +327,47 @@ export const $ReopenAccountDto = {
310
327
  }
311
328
  } as const;
312
329
 
330
+ export const $CreateOpeningBalanceDto = {
331
+ type: 'object',
332
+ properties: {
333
+ amount: {
334
+ type: 'number',
335
+ description: 'Opening balance amount (non-negative)',
336
+ example: 1000
337
+ },
338
+ currency: {
339
+ type: 'string',
340
+ description: 'Currency code',
341
+ example: 'CNY'
342
+ },
343
+ date: {
344
+ format: 'date-time',
345
+ type: 'string',
346
+ description: 'Opening-balance date (defaults to now)',
347
+ example: '2024-01-01'
348
+ }
349
+ },
350
+ required: ['amount', 'currency']
351
+ } as const;
352
+
353
+ export const $OpeningBalanceResultDto = {
354
+ type: 'object',
355
+ properties: {
356
+ transactionId: {
357
+ type: 'string',
358
+ description: 'Created opening-balance transaction id.'
359
+ }
360
+ },
361
+ required: ['transactionId']
362
+ } as const;
363
+
313
364
  export const $AccountStandardResponseDto = {
314
365
  type: 'object',
315
366
  properties: {
316
367
  path: {
317
368
  type: 'string',
318
369
  description: 'Account path (hierarchical, colon-separated)',
319
- example: 'Assets:CN:Bank:ICBC:Checking'
370
+ example: 'Assets:CN:Checking'
320
371
  },
321
372
  type: {
322
373
  type: 'string',
@@ -324,11 +375,6 @@ export const $AccountStandardResponseDto = {
324
375
  enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
325
376
  example: 'Assets'
326
377
  },
327
- i18nKey: {
328
- type: 'string',
329
- description: 'i18n key for localized display name',
330
- example: 'account.assets.cn.bank.icbc.checking'
331
- },
332
378
  name: {
333
379
  type: 'string',
334
380
  description: 'Short localized display name',
@@ -351,9 +397,47 @@ export const $AccountStandardResponseDto = {
351
397
  type: 'string',
352
398
  description: 'Icon identifier for UI display',
353
399
  example: 'bank-icbc'
400
+ },
401
+ productCategory: {
402
+ type: 'string',
403
+ description:
404
+ 'Onboarding product category (coarse grouping derived from assetSubClass)',
405
+ enum: [
406
+ 'cash',
407
+ 'investment',
408
+ 'credit_card',
409
+ 'loan',
410
+ 'payable_tax',
411
+ 'other'
412
+ ],
413
+ example: 'investment'
414
+ },
415
+ assetClass: {
416
+ type: 'string',
417
+ description:
418
+ 'Asset class (LIQUIDITY/EQUITY/.../LIABILITY), derived at read time from classification rules',
419
+ enum: [
420
+ 'LIQUIDITY',
421
+ 'EQUITY',
422
+ 'FIXED_INCOME',
423
+ 'PRECIOUS_METALS',
424
+ 'COMMODITY',
425
+ 'INSURANCE',
426
+ 'ALTERNATIVE_INVESTMENT',
427
+ 'PERSONAL_ASSETS',
428
+ 'LIABILITY',
429
+ 'REAL_ESTATE',
430
+ 'INDEX'
431
+ ]
432
+ },
433
+ assetSubClass: {
434
+ type: 'string',
435
+ description:
436
+ 'Asset sub-class (product type, derived at read time from classification rules)',
437
+ example: 'STOCK'
354
438
  }
355
439
  },
356
- required: ['path', 'type', 'i18nKey', 'description', 'tags', 'icon']
440
+ required: ['path', 'type', 'description', 'tags', 'icon', 'productCategory']
357
441
  } as const;
358
442
 
359
443
  export const $AccountStandardListResponseDto = {
@@ -383,18 +467,13 @@ export const $AccountStandardListResponseDto = {
383
467
  export const $TemplateMetadataDto = {
384
468
  type: 'object',
385
469
  properties: {
386
- extendable: {
387
- type: 'boolean',
388
- description: 'Whether this path can be extended',
389
- example: true
390
- },
391
470
  rootType: {
392
471
  type: 'string',
393
472
  description: 'Root account type',
394
473
  example: 'Assets'
395
474
  }
396
475
  },
397
- required: ['extendable', 'rootType']
476
+ required: ['rootType']
398
477
  } as const;
399
478
 
400
479
  export const $TemplateMetadataResponseDto = {
@@ -533,7 +612,7 @@ export const $CreatePostingDto = {
533
612
  type: 'string',
534
613
  description:
535
614
  'Account name in Beancount format (must start with uppercase, colon-separated)',
536
- example: 'Assets:Bank:Checking'
615
+ example: 'Assets:Checking'
537
616
  },
538
617
  units: {
539
618
  type: 'string',
@@ -692,7 +771,7 @@ export const $PostingResponseDto = {
692
771
  account: {
693
772
  type: 'string',
694
773
  description: 'Account name',
695
- example: 'Assets:Bank:Checking'
774
+ example: 'Assets:Checking'
696
775
  },
697
776
  units: {
698
777
  type: 'string',
@@ -1058,7 +1137,7 @@ export const $PostingDetailDto = {
1058
1137
  account: {
1059
1138
  type: 'string',
1060
1139
  description: 'Fully-qualified Beancount account path',
1061
- example: 'Assets:Bank:Checking'
1140
+ example: 'Assets:Checking'
1062
1141
  },
1063
1142
  units: {
1064
1143
  type: 'string',
@@ -1247,6 +1326,77 @@ export const $TransactionDetailDto = {
1247
1326
  ]
1248
1327
  } as const;
1249
1328
 
1329
+ export const $BalanceByCurrencyDto = {
1330
+ type: 'object',
1331
+ properties: {
1332
+ currency: {
1333
+ type: 'string',
1334
+ description: 'ISO 4217 currency code',
1335
+ example: 'CNY'
1336
+ },
1337
+ balance: {
1338
+ type: 'string',
1339
+ description: 'Balance amount',
1340
+ example: '50000.00'
1341
+ }
1342
+ },
1343
+ required: ['currency', 'balance']
1344
+ } as const;
1345
+
1346
+ export const $ExchangeRateWarningDto = {
1347
+ type: 'object',
1348
+ properties: {
1349
+ type: {
1350
+ type: 'string',
1351
+ description: 'Warning type',
1352
+ example: 'MISSING_EXCHANGE_RATE'
1353
+ },
1354
+ currency: {
1355
+ type: 'string',
1356
+ description: 'Currency without exchange rate',
1357
+ example: 'EUR'
1358
+ },
1359
+ totalAmount: {
1360
+ type: 'string',
1361
+ description: 'Total amount affected',
1362
+ example: '1000.00'
1363
+ }
1364
+ },
1365
+ required: ['type', 'currency', 'totalAmount']
1366
+ } as const;
1367
+
1368
+ export const $TransactionListSummaryDto = {
1369
+ type: 'object',
1370
+ properties: {
1371
+ totalAmount: {
1372
+ type: 'string',
1373
+ description:
1374
+ 'Partial converted total in base currency (rated currencies only, raw Beancount sign). When warnings is non-empty this excludes currencies missing an FX rate; may be "0.00" if ALL non-base currencies lack a rate. Converted at the dateTo (or current) available rate.',
1375
+ example: '-6000.00'
1376
+ },
1377
+ currency: {
1378
+ type: 'string',
1379
+ description: 'Base currency (ISO 4217)',
1380
+ example: 'CNY'
1381
+ },
1382
+ balanceByCurrency: {
1383
+ description: 'Raw (unconverted) balance per currency',
1384
+ type: 'array',
1385
+ items: {
1386
+ $ref: '#/components/schemas/BalanceByCurrencyDto'
1387
+ }
1388
+ },
1389
+ warnings: {
1390
+ description: 'Currencies missing an FX rate (omitted when empty)',
1391
+ type: 'array',
1392
+ items: {
1393
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
1394
+ }
1395
+ }
1396
+ },
1397
+ required: ['totalAmount', 'currency', 'balanceByCurrency']
1398
+ } as const;
1399
+
1250
1400
  export const $TransactionListResponseDto = {
1251
1401
  type: 'object',
1252
1402
  properties: {
@@ -1271,6 +1421,15 @@ export const $TransactionListResponseDto = {
1271
1421
  type: 'number',
1272
1422
  description: 'Number of items skipped',
1273
1423
  example: 0
1424
+ },
1425
+ summary: {
1426
+ description:
1427
+ 'Amount summary for the full filtered set (#514). Present only when the request has a single account OR category viewpoint; omitted for search-only / plain-list / dual-perspective requests.',
1428
+ allOf: [
1429
+ {
1430
+ $ref: '#/components/schemas/TransactionListSummaryDto'
1431
+ }
1432
+ ]
1274
1433
  }
1275
1434
  },
1276
1435
  required: ['data', 'total', 'limit', 'offset']
@@ -1370,7 +1529,7 @@ export const $BalanceResponseDto = {
1370
1529
  account: {
1371
1530
  type: 'string',
1372
1531
  description: 'Account name',
1373
- example: 'Assets:Bank:Checking'
1532
+ example: 'Assets:Checking'
1374
1533
  },
1375
1534
  balance: {
1376
1535
  type: 'string',
@@ -1397,7 +1556,7 @@ export const $MultiCurrencyBalanceResponseDto = {
1397
1556
  account: {
1398
1557
  type: 'string',
1399
1558
  description: 'Account name',
1400
- example: 'Assets:Bank:Checking'
1559
+ example: 'Assets:Checking'
1401
1560
  },
1402
1561
  balances: {
1403
1562
  type: 'object',
@@ -1453,7 +1612,7 @@ export const $TransactionSummaryDto = {
1453
1612
  accountName: {
1454
1613
  type: 'string',
1455
1614
  description: 'Source account name (first posting)',
1456
- example: 'Assets:Bank:Checking'
1615
+ example: 'Assets:Checking'
1457
1616
  },
1458
1617
  sourceType: {
1459
1618
  type: 'string',
@@ -2745,65 +2904,222 @@ export const $UpdateCommodityDto = {
2745
2904
  }
2746
2905
  } as const;
2747
2906
 
2748
- export const $CreateRecurringRuleDto = {
2907
+ export const $CreateBeanPriceDto = {
2749
2908
  type: 'object',
2750
2909
  properties: {
2751
- name: {
2752
- type: 'string',
2753
- description: 'Rule name (unique per user)',
2754
- maxLength: 100
2755
- },
2756
- icon: {
2910
+ currency: {
2757
2911
  type: 'string',
2758
- description: 'Icon emoji',
2759
- maxLength: 10
2912
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
2913
+ example: 'USD'
2760
2914
  },
2761
- frequency: {
2915
+ quoteCurrency: {
2762
2916
  type: 'string',
2763
- description: 'Recurring frequency',
2764
- enum: [
2765
- 'WEEKLY',
2766
- 'BIWEEKLY',
2767
- 'MONTHLY',
2768
- 'BIMONTHLY',
2769
- 'QUARTERLY',
2770
- 'YEARLY',
2771
- 'CUSTOM'
2772
- ]
2917
+ description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
2918
+ example: 'CNY'
2773
2919
  },
2774
- expectedAmount: {
2920
+ amount: {
2775
2921
  type: 'number',
2776
- description: 'Expected amount (positive number)',
2922
+ description:
2923
+ 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
2924
+ example: 175.5,
2777
2925
  minimum: 0
2778
2926
  },
2779
- expectedDay: {
2780
- type: 'number',
2781
- description: 'Expected day of month (1-31)',
2782
- minimum: 1,
2783
- maximum: 31
2927
+ date: {
2928
+ type: 'string',
2929
+ description: 'Price date (ISO 8601 format)',
2930
+ example: '2024-11-05'
2784
2931
  },
2785
- customIntervalDays: {
2786
- type: 'number',
2787
- description: 'Custom interval in days (required for CUSTOM frequency)',
2788
- minimum: 1
2932
+ metadata: {
2933
+ type: 'object',
2934
+ description:
2935
+ 'Metadata (validated by Zod schema, max field lengths enforced)',
2936
+ example: {
2937
+ source: 'MANUAL',
2938
+ note: 'Bank valuation report',
2939
+ confidence: 0.95
2940
+ }
2941
+ }
2942
+ },
2943
+ required: ['currency', 'quoteCurrency', 'amount', 'date']
2944
+ } as const;
2945
+
2946
+ export const $PriceResponseDto = {
2947
+ type: 'object',
2948
+ properties: {
2949
+ id: {
2950
+ type: 'string',
2951
+ description: 'Unique identifier',
2952
+ example: 'uuid-123-456'
2953
+ },
2954
+ userId: {
2955
+ type: 'string',
2956
+ description: 'User ID (owner of the price)',
2957
+ example: 'user-123'
2789
2958
  },
2790
2959
  currency: {
2791
2960
  type: 'string',
2792
- description: 'Currency code',
2793
- default: 'CNY',
2794
- maxLength: 10
2961
+ description: 'Currency being priced (e.g., USD, AAPL, BTC)',
2962
+ example: 'BTC'
2795
2963
  },
2796
- matchPayeePattern: {
2964
+ quoteCurrency: {
2797
2965
  type: 'string',
2798
- description: 'Payee matching pattern (supports wildcards)',
2799
- maxLength: 200
2966
+ description: 'Quote currency (pricing currency, e.g., USD, CNY)',
2967
+ example: 'USD'
2800
2968
  },
2801
- matchAmountTolerance: {
2969
+ amount: {
2802
2970
  type: 'number',
2803
- description: 'Amount tolerance percentage (0-1)',
2804
- default: 0.075,
2805
- minimum: 0,
2806
- maximum: 1
2971
+ description:
2972
+ 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
2973
+ example: 50000
2974
+ },
2975
+ date: {
2976
+ type: 'string',
2977
+ description:
2978
+ 'Price date (ISO 8601 format). Represents the date this price was valid.',
2979
+ example: '2024-01-01',
2980
+ format: 'date'
2981
+ },
2982
+ meta: {
2983
+ type: 'object',
2984
+ description:
2985
+ 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
2986
+ example: {
2987
+ source: 'MANUAL',
2988
+ note: 'User-defined price',
2989
+ confidence: 1
2990
+ }
2991
+ },
2992
+ createdAt: {
2993
+ format: 'date-time',
2994
+ type: 'string',
2995
+ description: 'Creation timestamp',
2996
+ example: '2024-11-03T10:00:00Z'
2997
+ },
2998
+ updatedAt: {
2999
+ format: 'date-time',
3000
+ type: 'string',
3001
+ description: 'Last update timestamp',
3002
+ example: '2024-11-03T10:00:00Z'
3003
+ }
3004
+ },
3005
+ required: [
3006
+ 'id',
3007
+ 'userId',
3008
+ 'currency',
3009
+ 'quoteCurrency',
3010
+ 'amount',
3011
+ 'date',
3012
+ 'meta',
3013
+ 'createdAt',
3014
+ 'updatedAt'
3015
+ ]
3016
+ } as const;
3017
+
3018
+ export const $PriceListResponseDto = {
3019
+ type: 'object',
3020
+ properties: {
3021
+ items: {
3022
+ description: 'List of prices',
3023
+ type: 'array',
3024
+ items: {
3025
+ $ref: '#/components/schemas/PriceResponseDto'
3026
+ }
3027
+ },
3028
+ total: {
3029
+ type: 'number',
3030
+ description: 'Total number of prices',
3031
+ example: 42
3032
+ }
3033
+ },
3034
+ required: ['items', 'total']
3035
+ } as const;
3036
+
3037
+ export const $UpdateBeanPriceDto = {
3038
+ type: 'object',
3039
+ properties: {
3040
+ currency: {
3041
+ type: 'string',
3042
+ description: 'Currency being priced'
3043
+ },
3044
+ quoteCurrency: {
3045
+ type: 'string',
3046
+ description: 'Quote currency (pricing currency)'
3047
+ },
3048
+ amount: {
3049
+ type: 'number',
3050
+ description: 'Price amount (MUST be >= 0 per Beancount spec)',
3051
+ minimum: 0
3052
+ },
3053
+ date: {
3054
+ type: 'string',
3055
+ description: 'Price date (ISO 8601 format)'
3056
+ },
3057
+ metadata: {
3058
+ type: 'object',
3059
+ description: 'Metadata'
3060
+ }
3061
+ }
3062
+ } as const;
3063
+
3064
+ export const $CreateRecurringRuleDto = {
3065
+ type: 'object',
3066
+ properties: {
3067
+ name: {
3068
+ type: 'string',
3069
+ description: 'Rule name (unique per user)',
3070
+ maxLength: 100
3071
+ },
3072
+ icon: {
3073
+ type: 'string',
3074
+ description: 'Icon emoji',
3075
+ maxLength: 10
3076
+ },
3077
+ frequency: {
3078
+ type: 'string',
3079
+ description: 'Recurring frequency',
3080
+ enum: [
3081
+ 'WEEKLY',
3082
+ 'BIWEEKLY',
3083
+ 'MONTHLY',
3084
+ 'BIMONTHLY',
3085
+ 'QUARTERLY',
3086
+ 'YEARLY',
3087
+ 'CUSTOM'
3088
+ ]
3089
+ },
3090
+ expectedAmount: {
3091
+ type: 'number',
3092
+ description: 'Expected amount (positive number)',
3093
+ minimum: 0
3094
+ },
3095
+ expectedDay: {
3096
+ type: 'number',
3097
+ description: 'Expected day of month (1-31)',
3098
+ minimum: 1,
3099
+ maximum: 31
3100
+ },
3101
+ customIntervalDays: {
3102
+ type: 'number',
3103
+ description: 'Custom interval in days (required for CUSTOM frequency)',
3104
+ minimum: 1
3105
+ },
3106
+ currency: {
3107
+ type: 'string',
3108
+ description: 'Currency code',
3109
+ default: 'CNY',
3110
+ maxLength: 10
3111
+ },
3112
+ matchPayeePattern: {
3113
+ type: 'string',
3114
+ description: 'Payee matching pattern (supports wildcards)',
3115
+ maxLength: 200
3116
+ },
3117
+ matchAmountTolerance: {
3118
+ type: 'number',
3119
+ description: 'Amount tolerance percentage (0-1)',
3120
+ default: 0.075,
3121
+ minimum: 0,
3122
+ maximum: 1
2807
3123
  },
2808
3124
  defaultExpenseAccount: {
2809
3125
  type: 'string',
@@ -3516,305 +3832,752 @@ export const $ForecastResponseDto = {
3516
3832
  ]
3517
3833
  } as const;
3518
3834
 
3519
- export const $CreateTransactionRuleDto = {
3835
+ export const $CurrencyBalanceDto = {
3520
3836
  type: 'object',
3521
3837
  properties: {
3522
- name: {
3838
+ currency: {
3523
3839
  type: 'string',
3524
- minLength: 1,
3525
- maxLength: 100
3840
+ description: 'ISO 4217 currency code',
3841
+ example: 'CNY'
3526
3842
  },
3527
- description: {
3843
+ balance: {
3528
3844
  type: 'string',
3529
- maxLength: 500
3530
- },
3531
- narrationKeywords: {
3532
- items: {
3533
- type: 'array'
3534
- },
3535
- maxItems: 50,
3536
- type: 'array'
3537
- },
3538
- payeeKeywords: {
3539
- items: {
3540
- type: 'array'
3541
- },
3542
- maxItems: 50,
3543
- type: 'array'
3544
- },
3545
- categoryKeywords: {
3546
- items: {
3547
- type: 'array'
3548
- },
3549
- maxItems: 50,
3550
- type: 'array'
3551
- },
3552
- methodKeywords: {
3553
- items: {
3554
- type: 'array'
3555
- },
3556
- maxItems: 50,
3557
- description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3558
- type: 'array'
3559
- },
3560
- categoryAccount: {
3845
+ description: 'Balance amount',
3846
+ example: '500000.00'
3847
+ }
3848
+ },
3849
+ required: ['currency', 'balance']
3850
+ } as const;
3851
+
3852
+ export const $TimeSeriesPointDto = {
3853
+ type: 'object',
3854
+ properties: {
3855
+ date: {
3561
3856
  type: 'string',
3562
- maxLength: 200,
3563
- description:
3564
- 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3857
+ description: 'Date in YYYY-MM-DD format',
3858
+ example: '2024-06-15'
3565
3859
  },
3566
- matchLogic: {
3860
+ value: {
3567
3861
  type: 'string',
3568
- enum: ['OR', 'AND'],
3569
- default: 'OR'
3862
+ description: 'Value at this date (in base currency)',
3863
+ example: '500000.00'
3570
3864
  },
3571
- amountMin: {
3572
- type: 'number',
3573
- minimum: 0,
3574
- description: 'Minimum transaction amount (inclusive)'
3865
+ change: {
3866
+ type: 'object',
3867
+ description: 'Change from previous point',
3868
+ example: '5000.00'
3575
3869
  },
3576
- amountMax: {
3577
- type: 'number',
3578
- minimum: 0,
3579
- description: 'Maximum transaction amount (inclusive)'
3870
+ assets: {
3871
+ type: 'string',
3872
+ description: 'Total assets at this date (in base currency)',
3873
+ example: '494338.00'
3580
3874
  },
3581
- priority: {
3582
- type: 'number',
3583
- default: 50,
3584
- minimum: 0,
3585
- maximum: 1000
3875
+ liabilities: {
3876
+ type: 'string',
3877
+ description: 'Total liabilities at this date (in base currency)',
3878
+ example: '310098.00'
3586
3879
  },
3587
- additionalTags: {
3880
+ byCurrency: {
3881
+ description: 'Multi-currency breakdown for this point',
3882
+ type: 'array',
3588
3883
  items: {
3589
- type: 'array'
3590
- },
3591
- maxItems: 20,
3592
- type: 'array'
3593
- },
3594
- additionalMetadata: {
3595
- type: 'object'
3596
- },
3597
- upsertByPayee: {
3598
- type: 'boolean',
3599
- description:
3600
- 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
3884
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3885
+ }
3601
3886
  }
3602
3887
  },
3603
- required: ['name', 'matchLogic', 'priority']
3888
+ required: ['date', 'value']
3604
3889
  } as const;
3605
3890
 
3606
- export const $AmountRangeDto = {
3891
+ export const $TrendSummaryDto = {
3607
3892
  type: 'object',
3608
3893
  properties: {
3609
- min: {
3610
- type: 'number',
3611
- description: 'Minimum amount'
3894
+ startValue: {
3895
+ type: 'string',
3896
+ description: 'Value at start of period',
3897
+ example: '450000.00'
3612
3898
  },
3613
- max: {
3614
- type: 'number',
3615
- description: 'Maximum amount'
3899
+ endValue: {
3900
+ type: 'string',
3901
+ description: 'Value at end of period',
3902
+ example: '500000.00'
3903
+ },
3904
+ totalChange: {
3905
+ type: 'string',
3906
+ description: 'Total change over period',
3907
+ example: '50000.00'
3908
+ },
3909
+ totalChangePercentage: {
3910
+ type: 'string',
3911
+ description: 'Total change percentage',
3912
+ example: '+11.11%'
3616
3913
  }
3617
- }
3914
+ },
3915
+ required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
3618
3916
  } as const;
3619
3917
 
3620
- export const $TransactionRuleResponseDto = {
3918
+ export const $MultiCurrencyPointDto = {
3621
3919
  type: 'object',
3622
3920
  properties: {
3623
- id: {
3624
- type: 'string',
3625
- description: 'Rule ID'
3626
- },
3627
- name: {
3628
- type: 'string',
3629
- description: 'Rule name'
3630
- },
3631
- description: {
3921
+ date: {
3632
3922
  type: 'string',
3633
- description: 'Rule description'
3634
- },
3635
- narrationKeywords: {
3636
- description: 'Keywords to match in transaction narration',
3637
- type: 'array',
3638
- items: {
3639
- type: 'string'
3640
- }
3641
- },
3642
- payeeKeywords: {
3643
- description: 'Keywords to match in payee name',
3644
- type: 'array',
3645
- items: {
3646
- type: 'string'
3647
- }
3923
+ description: 'Date in YYYY-MM-DD format',
3924
+ example: '2024-06-15'
3648
3925
  },
3649
- categoryKeywords: {
3650
- description: 'Keywords to match in category',
3926
+ byCurrency: {
3927
+ description: 'Balances by currency',
3651
3928
  type: 'array',
3652
3929
  items: {
3653
- type: 'string'
3930
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3654
3931
  }
3655
- },
3656
- methodKeywords: {
3657
- description: 'Keywords to match in payment method',
3932
+ }
3933
+ },
3934
+ required: ['date', 'byCurrency']
3935
+ } as const;
3936
+
3937
+ export const $PortfolioTrendsResponseDto = {
3938
+ type: 'object',
3939
+ properties: {
3940
+ series: {
3941
+ description: 'Time series data points',
3658
3942
  type: 'array',
3659
3943
  items: {
3660
- type: 'string'
3944
+ $ref: '#/components/schemas/TimeSeriesPointDto'
3661
3945
  }
3662
3946
  },
3663
- categoryAccount: {
3664
- type: 'string',
3665
- description: 'Destination account for categorization'
3666
- },
3667
- matchLogic: {
3668
- type: 'string',
3669
- description: 'Keyword matching logic',
3670
- enum: ['OR', 'AND'],
3671
- example: 'OR'
3672
- },
3673
- amountRange: {
3674
- description: 'Amount range for matching',
3947
+ summary: {
3948
+ description: 'Period summary',
3675
3949
  allOf: [
3676
3950
  {
3677
- $ref: '#/components/schemas/AmountRangeDto'
3951
+ $ref: '#/components/schemas/TrendSummaryDto'
3678
3952
  }
3679
3953
  ]
3680
3954
  },
3681
- priority: {
3682
- type: 'number',
3683
- description: 'Rule priority (0-1000, higher = first match)',
3684
- example: 50
3685
- },
3686
- enabled: {
3687
- type: 'boolean',
3688
- description: 'Whether the rule is enabled'
3689
- },
3690
- learningSource: {
3955
+ period: {
3691
3956
  type: 'string',
3692
- description: 'Learning source: NLP, REVIEW_CENTER, or null for manual',
3693
- enum: ['NLP', 'REVIEW_CENTER'],
3694
- nullable: true,
3695
- example: 'REVIEW_CENTER'
3957
+ description: 'Period requested',
3958
+ example: '6m'
3696
3959
  },
3697
- autoApplyEnabled: {
3698
- type: 'boolean',
3699
- description: 'Whether auto-apply is enabled for this rule'
3960
+ granularity: {
3961
+ type: 'string',
3962
+ description: 'Data granularity',
3963
+ example: 'month'
3700
3964
  },
3701
- confirmationCount: {
3702
- type: 'number',
3703
- description: 'Number of confirmations for NLP-learned rules',
3704
- example: 3
3965
+ currency: {
3966
+ type: 'string',
3967
+ description: 'Base currency for converted values',
3968
+ example: 'CNY'
3705
3969
  },
3706
- additionalTags: {
3707
- description: 'Additional tags',
3970
+ byCurrency: {
3971
+ description:
3972
+ 'Multi-currency time series (each point has currency breakdown)',
3708
3973
  type: 'array',
3709
3974
  items: {
3710
- type: 'string'
3975
+ $ref: '#/components/schemas/MultiCurrencyPointDto'
3711
3976
  }
3712
3977
  },
3713
- additionalMetadata: {
3714
- type: 'object',
3715
- description: 'Additional metadata',
3716
- additionalProperties: {
3717
- type: 'string'
3978
+ warnings: {
3979
+ description: 'Exchange rate warnings',
3980
+ type: 'array',
3981
+ items: {
3982
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3718
3983
  }
3719
- },
3720
- createdAt: {
3721
- format: 'date-time',
3722
- type: 'string',
3723
- description: 'Created timestamp'
3724
- },
3725
- updatedAt: {
3726
- format: 'date-time',
3727
- type: 'string',
3728
- description: 'Updated timestamp'
3729
3984
  }
3730
3985
  },
3731
- required: [
3732
- 'id',
3733
- 'name',
3734
- 'narrationKeywords',
3735
- 'payeeKeywords',
3736
- 'categoryKeywords',
3737
- 'methodKeywords',
3738
- 'matchLogic',
3739
- 'priority',
3740
- 'enabled',
3741
- 'autoApplyEnabled',
3742
- 'confirmationCount',
3743
- 'additionalTags',
3744
- 'createdAt',
3745
- 'updatedAt'
3746
- ]
3986
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
3747
3987
  } as const;
3748
3988
 
3749
- export const $TransactionRuleListResponseDto = {
3989
+ export const $CashFlowPointDto = {
3750
3990
  type: 'object',
3751
3991
  properties: {
3752
- data: {
3753
- type: 'array',
3754
- items: {
3755
- $ref: '#/components/schemas/TransactionRuleResponseDto'
3756
- }
3992
+ month: {
3993
+ type: 'string',
3994
+ description: 'Month key (YYYY-MM)',
3995
+ example: '2024-03'
3757
3996
  },
3758
- total: {
3759
- type: 'number',
3760
- description: 'Total count of rules'
3997
+ income: {
3998
+ type: 'string',
3999
+ description: 'Income in base currency (absolute, converted)',
4000
+ example: '10000.00'
3761
4001
  },
3762
- limit: {
3763
- type: 'number',
3764
- description: 'Results per page'
4002
+ expense: {
4003
+ type: 'string',
4004
+ description: 'Expense in base currency (absolute, converted)',
4005
+ example: '5000.00'
3765
4006
  },
3766
- offset: {
3767
- type: 'number',
3768
- description: 'Pagination offset'
4007
+ netSavings: {
4008
+ type: 'string',
4009
+ description: 'netSavings = income − expense (savings positive)',
4010
+ example: '5000.00'
3769
4011
  }
3770
4012
  },
3771
- required: ['data', 'total', 'limit', 'offset']
4013
+ required: ['month', 'income', 'expense', 'netSavings']
3772
4014
  } as const;
3773
4015
 
3774
- export const $ValidateRuleDto = {
4016
+ export const $CashFlowTrendSummaryDto = {
3775
4017
  type: 'object',
3776
4018
  properties: {
3777
- name: {
4019
+ totalIncome: {
3778
4020
  type: 'string',
3779
- minLength: 1,
3780
- maxLength: 100
4021
+ description: 'Total income across the period',
4022
+ example: '60000.00'
3781
4023
  },
3782
- description: {
4024
+ totalExpense: {
3783
4025
  type: 'string',
3784
- maxLength: 500
4026
+ description: 'Total expense across the period',
4027
+ example: '30000.00'
3785
4028
  },
3786
- narrationKeywords: {
3787
- items: {
3788
- type: 'array'
3789
- },
3790
- maxItems: 50,
3791
- type: 'array'
4029
+ totalNetSavings: {
4030
+ type: 'string',
4031
+ description: 'income − expense across the period',
4032
+ example: '30000.00'
3792
4033
  },
3793
- payeeKeywords: {
4034
+ averageMonthlyNetSavings: {
4035
+ type: 'string',
4036
+ description:
4037
+ 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
4038
+ example: '5000.00'
4039
+ }
4040
+ },
4041
+ required: [
4042
+ 'totalIncome',
4043
+ 'totalExpense',
4044
+ 'totalNetSavings',
4045
+ 'averageMonthlyNetSavings'
4046
+ ]
4047
+ } as const;
4048
+
4049
+ export const $CashFlowTrendsResponseDto = {
4050
+ type: 'object',
4051
+ properties: {
4052
+ series: {
4053
+ description:
4054
+ 'Monthly cash-flow series (fixed N-month window, zero-filled)',
4055
+ type: 'array',
3794
4056
  items: {
3795
- type: 'array'
3796
- },
3797
- maxItems: 50,
3798
- type: 'array'
4057
+ $ref: '#/components/schemas/CashFlowPointDto'
4058
+ }
3799
4059
  },
3800
- categoryKeywords: {
3801
- items: {
3802
- type: 'array'
3803
- },
3804
- maxItems: 50,
3805
- type: 'array'
4060
+ summary: {
4061
+ description: 'Period totals',
4062
+ allOf: [
4063
+ {
4064
+ $ref: '#/components/schemas/CashFlowTrendSummaryDto'
4065
+ }
4066
+ ]
3806
4067
  },
3807
- methodKeywords: {
3808
- items: {
3809
- type: 'array'
3810
- },
3811
- maxItems: 50,
3812
- description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3813
- type: 'array'
4068
+ period: {
4069
+ type: 'string',
4070
+ description: 'Period requested',
4071
+ example: '6m'
3814
4072
  },
3815
- categoryAccount: {
4073
+ granularity: {
3816
4074
  type: 'string',
3817
- maxLength: 200,
4075
+ description: 'Data granularity (v1 returns month buckets)',
4076
+ example: 'month'
4077
+ },
4078
+ currency: {
4079
+ type: 'string',
4080
+ description: 'Base currency for converted values',
4081
+ example: 'CNY'
4082
+ },
4083
+ warnings: {
4084
+ description: 'Exchange rate warnings (e.g. missing rate for a currency)',
4085
+ type: 'array',
4086
+ items: {
4087
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
4088
+ }
4089
+ }
4090
+ },
4091
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
4092
+ } as const;
4093
+
4094
+ export const $GenerateSnapshotBody = {
4095
+ type: 'object',
4096
+ properties: {}
4097
+ } as const;
4098
+
4099
+ export const $GenerateSnapshotResponse = {
4100
+ type: 'object',
4101
+ properties: {}
4102
+ } as const;
4103
+
4104
+ export const $BackfillSnapshotsBody = {
4105
+ type: 'object',
4106
+ properties: {}
4107
+ } as const;
4108
+
4109
+ export const $BackfillSnapshotsResponse = {
4110
+ type: 'object',
4111
+ properties: {}
4112
+ } as const;
4113
+
4114
+ export const $DeleteOwnUserDto = {
4115
+ type: 'object',
4116
+ properties: {
4117
+ accessToken: {
4118
+ type: 'string',
4119
+ description: 'Access token for user verification',
4120
+ example: 'abc123xyz'
4121
+ }
4122
+ },
4123
+ required: ['accessToken']
4124
+ } as const;
4125
+
4126
+ export const $SignupDto = {
4127
+ type: 'object',
4128
+ properties: {
4129
+ turnstileToken: {
4130
+ type: 'string',
4131
+ description:
4132
+ 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4133
+ example: '0.abc123def456...'
4134
+ }
4135
+ }
4136
+ } as const;
4137
+
4138
+ export const $SignupResponseDto = {
4139
+ type: 'object',
4140
+ properties: {
4141
+ authToken: {
4142
+ type: 'string',
4143
+ description: 'JWT auth token',
4144
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
4145
+ },
4146
+ accessToken: {
4147
+ type: 'string',
4148
+ description: 'Auto-generated access token'
4149
+ },
4150
+ role: {
4151
+ type: 'string',
4152
+ description: 'Assigned user role',
4153
+ enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
4154
+ }
4155
+ },
4156
+ required: ['authToken', 'accessToken', 'role']
4157
+ } as const;
4158
+
4159
+ export const $UpdateUserSettingDto = {
4160
+ type: 'object',
4161
+ properties: {
4162
+ secId: {
4163
+ type: 'number',
4164
+ description: 'Security ID'
4165
+ },
4166
+ annualInterestRate: {
4167
+ type: 'number',
4168
+ description: 'Annual interest rate',
4169
+ example: 0.05
4170
+ },
4171
+ currency: {
4172
+ type: 'string',
4173
+ description: 'Currency code',
4174
+ example: 'USD'
4175
+ },
4176
+ baseCurrency: {
4177
+ type: 'string',
4178
+ description: 'Base currency code',
4179
+ example: 'USD'
4180
+ },
4181
+ benchmark: {
4182
+ type: 'string',
4183
+ description: 'Benchmark symbol',
4184
+ example: 'SPY'
4185
+ },
4186
+ colorScheme: {
4187
+ type: 'string',
4188
+ description: 'Color scheme',
4189
+ enum: ['DARK', 'LIGHT']
4190
+ },
4191
+ dateRange: {
4192
+ type: 'string',
4193
+ description: 'Date range filter',
4194
+ example: '1y'
4195
+ },
4196
+ emergencyFund: {
4197
+ type: 'number',
4198
+ description: 'Emergency fund amount',
4199
+ example: 10000
4200
+ },
4201
+ 'filters.accounts': {
4202
+ description: 'Account filter IDs',
4203
+ type: 'array',
4204
+ items: {
4205
+ type: 'string'
4206
+ }
4207
+ },
4208
+ 'filters.assetClasses': {
4209
+ description: 'Asset class filters',
4210
+ type: 'array',
4211
+ items: {
4212
+ type: 'string'
4213
+ }
4214
+ },
4215
+ 'filters.dataSource': {
4216
+ type: 'string',
4217
+ description: 'Data source filter'
4218
+ },
4219
+ 'filters.symbol': {
4220
+ type: 'string',
4221
+ description: 'Symbol filter'
4222
+ },
4223
+ 'filters.tags': {
4224
+ description: 'Tag filters',
4225
+ type: 'array',
4226
+ items: {
4227
+ type: 'string'
4228
+ }
4229
+ },
4230
+ isExperimentalFeatures: {
4231
+ type: 'boolean',
4232
+ description: 'Enable experimental features'
4233
+ },
4234
+ isRestrictedView: {
4235
+ type: 'boolean',
4236
+ description: 'Enable restricted view mode'
4237
+ },
4238
+ language: {
4239
+ type: 'string',
4240
+ description: 'Language code',
4241
+ example: 'en'
4242
+ },
4243
+ locale: {
4244
+ type: 'string',
4245
+ description: 'Locale code',
4246
+ example: 'en-US'
4247
+ },
4248
+ projectedTotalAmount: {
4249
+ type: 'number',
4250
+ description: 'Projected total amount',
4251
+ example: 1000000
4252
+ },
4253
+ retirementDate: {
4254
+ type: 'string',
4255
+ description: 'Retirement date in ISO 8601 format',
4256
+ example: '2050-01-01'
4257
+ },
4258
+ savingsRate: {
4259
+ type: 'number',
4260
+ description: 'Savings rate percentage',
4261
+ example: 0.2
4262
+ },
4263
+ viewMode: {
4264
+ type: 'string',
4265
+ description: 'View mode',
4266
+ enum: ['DEFAULT', 'ZEN']
4267
+ }
4268
+ }
4269
+ } as const;
4270
+
4271
+ export const $UpdatePropertyDto = {
4272
+ type: 'object',
4273
+ properties: {
4274
+ value: {
4275
+ type: 'string',
4276
+ description: 'Property value'
4277
+ }
4278
+ },
4279
+ required: ['value']
4280
+ } as const;
4281
+
4282
+ export const $CreateTransactionRuleDto = {
4283
+ type: 'object',
4284
+ properties: {
4285
+ name: {
4286
+ type: 'string',
4287
+ minLength: 1,
4288
+ maxLength: 100
4289
+ },
4290
+ description: {
4291
+ type: 'string',
4292
+ maxLength: 500
4293
+ },
4294
+ narrationKeywords: {
4295
+ items: {
4296
+ type: 'array'
4297
+ },
4298
+ maxItems: 50,
4299
+ type: 'array'
4300
+ },
4301
+ payeeKeywords: {
4302
+ items: {
4303
+ type: 'array'
4304
+ },
4305
+ maxItems: 50,
4306
+ type: 'array'
4307
+ },
4308
+ categoryKeywords: {
4309
+ items: {
4310
+ type: 'array'
4311
+ },
4312
+ maxItems: 50,
4313
+ type: 'array'
4314
+ },
4315
+ methodKeywords: {
4316
+ items: {
4317
+ type: 'array'
4318
+ },
4319
+ maxItems: 50,
4320
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
4321
+ type: 'array'
4322
+ },
4323
+ categoryAccount: {
4324
+ type: 'string',
4325
+ maxLength: 200,
4326
+ description:
4327
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
4328
+ },
4329
+ matchLogic: {
4330
+ type: 'string',
4331
+ enum: ['OR', 'AND'],
4332
+ default: 'OR'
4333
+ },
4334
+ amountMin: {
4335
+ type: 'number',
4336
+ minimum: 0,
4337
+ description: 'Minimum transaction amount (inclusive)'
4338
+ },
4339
+ amountMax: {
4340
+ type: 'number',
4341
+ minimum: 0,
4342
+ description: 'Maximum transaction amount (inclusive)'
4343
+ },
4344
+ priority: {
4345
+ type: 'number',
4346
+ default: 50,
4347
+ minimum: 0,
4348
+ maximum: 1000
4349
+ },
4350
+ additionalTags: {
4351
+ items: {
4352
+ type: 'array'
4353
+ },
4354
+ maxItems: 20,
4355
+ type: 'array'
4356
+ },
4357
+ additionalMetadata: {
4358
+ type: 'object'
4359
+ },
4360
+ upsertByPayee: {
4361
+ type: 'boolean',
4362
+ description:
4363
+ 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
4364
+ }
4365
+ },
4366
+ required: ['name', 'matchLogic', 'priority']
4367
+ } as const;
4368
+
4369
+ export const $AmountRangeDto = {
4370
+ type: 'object',
4371
+ properties: {
4372
+ min: {
4373
+ type: 'number',
4374
+ description: 'Minimum amount'
4375
+ },
4376
+ max: {
4377
+ type: 'number',
4378
+ description: 'Maximum amount'
4379
+ }
4380
+ }
4381
+ } as const;
4382
+
4383
+ export const $TransactionRuleResponseDto = {
4384
+ type: 'object',
4385
+ properties: {
4386
+ id: {
4387
+ type: 'string',
4388
+ description: 'Rule ID'
4389
+ },
4390
+ name: {
4391
+ type: 'string',
4392
+ description: 'Rule name'
4393
+ },
4394
+ description: {
4395
+ type: 'string',
4396
+ description: 'Rule description'
4397
+ },
4398
+ narrationKeywords: {
4399
+ description: 'Keywords to match in transaction narration',
4400
+ type: 'array',
4401
+ items: {
4402
+ type: 'string'
4403
+ }
4404
+ },
4405
+ payeeKeywords: {
4406
+ description: 'Keywords to match in payee name',
4407
+ type: 'array',
4408
+ items: {
4409
+ type: 'string'
4410
+ }
4411
+ },
4412
+ categoryKeywords: {
4413
+ description: 'Keywords to match in category',
4414
+ type: 'array',
4415
+ items: {
4416
+ type: 'string'
4417
+ }
4418
+ },
4419
+ methodKeywords: {
4420
+ description: 'Keywords to match in payment method',
4421
+ type: 'array',
4422
+ items: {
4423
+ type: 'string'
4424
+ }
4425
+ },
4426
+ categoryAccount: {
4427
+ type: 'string',
4428
+ description: 'Destination account for categorization'
4429
+ },
4430
+ matchLogic: {
4431
+ type: 'string',
4432
+ description: 'Keyword matching logic',
4433
+ enum: ['OR', 'AND'],
4434
+ example: 'OR'
4435
+ },
4436
+ amountRange: {
4437
+ description: 'Amount range for matching',
4438
+ allOf: [
4439
+ {
4440
+ $ref: '#/components/schemas/AmountRangeDto'
4441
+ }
4442
+ ]
4443
+ },
4444
+ priority: {
4445
+ type: 'number',
4446
+ description: 'Rule priority (0-1000, higher = first match)',
4447
+ example: 50
4448
+ },
4449
+ enabled: {
4450
+ type: 'boolean',
4451
+ description: 'Whether the rule is enabled'
4452
+ },
4453
+ learningSource: {
4454
+ type: 'string',
4455
+ description: 'Learning source: NLP, REVIEW_CENTER, or null for manual',
4456
+ enum: ['NLP', 'REVIEW_CENTER'],
4457
+ nullable: true,
4458
+ example: 'REVIEW_CENTER'
4459
+ },
4460
+ autoApplyEnabled: {
4461
+ type: 'boolean',
4462
+ description: 'Whether auto-apply is enabled for this rule'
4463
+ },
4464
+ confirmationCount: {
4465
+ type: 'number',
4466
+ description: 'Number of confirmations for NLP-learned rules',
4467
+ example: 3
4468
+ },
4469
+ additionalTags: {
4470
+ description: 'Additional tags',
4471
+ type: 'array',
4472
+ items: {
4473
+ type: 'string'
4474
+ }
4475
+ },
4476
+ additionalMetadata: {
4477
+ type: 'object',
4478
+ description: 'Additional metadata',
4479
+ additionalProperties: {
4480
+ type: 'string'
4481
+ }
4482
+ },
4483
+ createdAt: {
4484
+ format: 'date-time',
4485
+ type: 'string',
4486
+ description: 'Created timestamp'
4487
+ },
4488
+ updatedAt: {
4489
+ format: 'date-time',
4490
+ type: 'string',
4491
+ description: 'Updated timestamp'
4492
+ }
4493
+ },
4494
+ required: [
4495
+ 'id',
4496
+ 'name',
4497
+ 'narrationKeywords',
4498
+ 'payeeKeywords',
4499
+ 'categoryKeywords',
4500
+ 'methodKeywords',
4501
+ 'matchLogic',
4502
+ 'priority',
4503
+ 'enabled',
4504
+ 'autoApplyEnabled',
4505
+ 'confirmationCount',
4506
+ 'additionalTags',
4507
+ 'createdAt',
4508
+ 'updatedAt'
4509
+ ]
4510
+ } as const;
4511
+
4512
+ export const $TransactionRuleListResponseDto = {
4513
+ type: 'object',
4514
+ properties: {
4515
+ data: {
4516
+ type: 'array',
4517
+ items: {
4518
+ $ref: '#/components/schemas/TransactionRuleResponseDto'
4519
+ }
4520
+ },
4521
+ total: {
4522
+ type: 'number',
4523
+ description: 'Total count of rules'
4524
+ },
4525
+ limit: {
4526
+ type: 'number',
4527
+ description: 'Results per page'
4528
+ },
4529
+ offset: {
4530
+ type: 'number',
4531
+ description: 'Pagination offset'
4532
+ }
4533
+ },
4534
+ required: ['data', 'total', 'limit', 'offset']
4535
+ } as const;
4536
+
4537
+ export const $ValidateRuleDto = {
4538
+ type: 'object',
4539
+ properties: {
4540
+ name: {
4541
+ type: 'string',
4542
+ minLength: 1,
4543
+ maxLength: 100
4544
+ },
4545
+ description: {
4546
+ type: 'string',
4547
+ maxLength: 500
4548
+ },
4549
+ narrationKeywords: {
4550
+ items: {
4551
+ type: 'array'
4552
+ },
4553
+ maxItems: 50,
4554
+ type: 'array'
4555
+ },
4556
+ payeeKeywords: {
4557
+ items: {
4558
+ type: 'array'
4559
+ },
4560
+ maxItems: 50,
4561
+ type: 'array'
4562
+ },
4563
+ categoryKeywords: {
4564
+ items: {
4565
+ type: 'array'
4566
+ },
4567
+ maxItems: 50,
4568
+ type: 'array'
4569
+ },
4570
+ methodKeywords: {
4571
+ items: {
4572
+ type: 'array'
4573
+ },
4574
+ maxItems: 50,
4575
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
4576
+ type: 'array'
4577
+ },
4578
+ categoryAccount: {
4579
+ type: 'string',
4580
+ maxLength: 200,
3818
4581
  description:
3819
4582
  'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3820
4583
  },
@@ -4165,151 +4928,393 @@ export const $TestRuleResponseDto = {
4165
4928
  required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4166
4929
  } as const;
4167
4930
 
4168
- export const $DeleteOwnUserDto = {
4931
+ export const $CreateBeanEventDto = {
4169
4932
  type: 'object',
4170
4933
  properties: {
4171
- accessToken: {
4934
+ date: {
4172
4935
  type: 'string',
4173
- description: 'Access token for user verification',
4174
- example: 'abc123xyz'
4936
+ description: 'Life event date (ISO 8601)',
4937
+ example: '2024-03-15'
4938
+ },
4939
+ type: {
4940
+ type: 'string',
4941
+ description:
4942
+ 'Life event type (e.g., "employer", "location", "marital-status") — user-defined, no enum constraint at engine layer',
4943
+ example: 'employer'
4944
+ },
4945
+ description: {
4946
+ type: 'string',
4947
+ description:
4948
+ 'Life event description. Empty string is a VALID value (distinct from absence).',
4949
+ example: 'Acme Corp'
4950
+ },
4951
+ meta: {
4952
+ type: 'object',
4953
+ description:
4954
+ 'Product-side metadata (lives in BeanEvent.meta JSON, never in engine Event fields)',
4955
+ example: {
4956
+ note: 'Promotion'
4957
+ }
4175
4958
  }
4176
4959
  },
4177
- required: ['accessToken']
4960
+ required: ['date', 'type', 'description']
4178
4961
  } as const;
4179
4962
 
4180
- export const $SignupDto = {
4963
+ export const $EventResponseDto = {
4181
4964
  type: 'object',
4182
4965
  properties: {
4183
- turnstileToken: {
4966
+ id: {
4967
+ type: 'string',
4968
+ description: 'Unique identifier',
4969
+ example: 'uuid-123-456'
4970
+ },
4971
+ userId: {
4972
+ type: 'string',
4973
+ description: 'User ID (owner of the life event)',
4974
+ example: 'user-123'
4975
+ },
4976
+ date: {
4977
+ type: 'string',
4978
+ description: 'Life event date (ISO 8601 format)',
4979
+ example: '2024-03-15',
4980
+ format: 'date'
4981
+ },
4982
+ type: {
4184
4983
  type: 'string',
4185
4984
  description:
4186
- 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4187
- example: '0.abc123def456...'
4985
+ 'Life event type (user-defined, e.g., "employer", "location")',
4986
+ example: 'employer'
4987
+ },
4988
+ description: {
4989
+ type: 'string',
4990
+ description:
4991
+ 'Life event description. May be an empty string (a valid value distinct from absence).',
4992
+ example: 'Acme Corp'
4993
+ },
4994
+ meta: {
4995
+ type: 'object',
4996
+ description: 'Product-side metadata (free-form JSON)',
4997
+ example: {
4998
+ note: 'Promotion'
4999
+ }
5000
+ },
5001
+ createdAt: {
5002
+ format: 'date-time',
5003
+ type: 'string',
5004
+ description: 'Creation timestamp',
5005
+ example: '2024-03-15T10:00:00Z'
5006
+ },
5007
+ updatedAt: {
5008
+ format: 'date-time',
5009
+ type: 'string',
5010
+ description:
5011
+ 'Last update timestamp. Also emitted as the ETag response header for If-Match optimistic concurrency.',
5012
+ example: '2024-03-15T10:00:00Z'
4188
5013
  }
4189
- }
5014
+ },
5015
+ required: [
5016
+ 'id',
5017
+ 'userId',
5018
+ 'date',
5019
+ 'type',
5020
+ 'description',
5021
+ 'meta',
5022
+ 'createdAt',
5023
+ 'updatedAt'
5024
+ ]
4190
5025
  } as const;
4191
5026
 
4192
- export const $UpdateUserSettingDto = {
5027
+ export const $EventListResponseDto = {
4193
5028
  type: 'object',
4194
5029
  properties: {
4195
- secId: {
5030
+ items: {
5031
+ description: 'List of life events',
5032
+ type: 'array',
5033
+ items: {
5034
+ $ref: '#/components/schemas/EventResponseDto'
5035
+ }
5036
+ },
5037
+ total: {
4196
5038
  type: 'number',
4197
- description: 'Security ID'
5039
+ description: 'Total number of life events matching the query',
5040
+ example: 42
5041
+ }
5042
+ },
5043
+ required: ['items', 'total']
5044
+ } as const;
5045
+
5046
+ export const $UpdateBeanEventDto = {
5047
+ type: 'object',
5048
+ properties: {
5049
+ date: {
5050
+ type: 'string',
5051
+ description: 'Life event date (ISO 8601)'
5052
+ },
5053
+ type: {
5054
+ type: 'string',
5055
+ description: 'Life event type (user-defined)'
5056
+ },
5057
+ description: {
5058
+ type: 'string',
5059
+ description:
5060
+ 'Life event description. Empty string is a VALID value (distinct from absence).'
5061
+ },
5062
+ meta: {
5063
+ type: 'object',
5064
+ description: 'Product-side metadata (free-form JSON)'
5065
+ }
5066
+ }
5067
+ } as const;
5068
+
5069
+ export const $OnboardingAccountDto = {
5070
+ type: 'object',
5071
+ properties: {
5072
+ path: {
5073
+ type: 'string',
5074
+ description:
5075
+ 'Account path (Assets/Liabilities only; format validated by the account service)',
5076
+ example: 'Assets:Checking'
5077
+ },
5078
+ currency: {
5079
+ type: 'string',
5080
+ description: 'ISO 4217 currency code (3 letters)',
5081
+ example: 'USD'
5082
+ },
5083
+ openingBalance: {
5084
+ type: 'string',
5085
+ description:
5086
+ 'Opening balance as a non-negative Decimal string (e.g. "1000.00")',
5087
+ example: '1000.00'
5088
+ },
5089
+ platformId: {
5090
+ type: 'string',
5091
+ description:
5092
+ 'Platform ID to bind the account to (references Platform.id); omit for unbound',
5093
+ example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
5094
+ }
5095
+ },
5096
+ required: ['path', 'currency']
5097
+ } as const;
5098
+
5099
+ export const $OnboardingDto = {
5100
+ type: 'object',
5101
+ properties: {
5102
+ accounts: {
5103
+ description: 'Asset/Liability accounts to register with opening balances',
5104
+ type: 'array',
5105
+ items: {
5106
+ $ref: '#/components/schemas/OnboardingAccountDto'
5107
+ }
5108
+ },
5109
+ skipAssetRegistration: {
5110
+ type: 'boolean',
5111
+ description:
5112
+ 'Skip asset registration; only bootstrap the core account set',
5113
+ default: false
5114
+ }
5115
+ }
5116
+ } as const;
5117
+
5118
+ export const $ActualBalanceDto = {
5119
+ type: 'object',
5120
+ properties: {
5121
+ amount: {
5122
+ type: 'string',
5123
+ description:
5124
+ 'Actual balance amount as a decimal string (preserves precision for tolerance inference).',
5125
+ example: '1234.56'
5126
+ },
5127
+ ccy: {
5128
+ type: 'string',
5129
+ description: 'Currency code (ISO 4217 or commodity ticker).',
5130
+ example: 'CNY'
5131
+ }
5132
+ },
5133
+ required: ['amount', 'ccy']
5134
+ } as const;
5135
+
5136
+ export const $ComputeReconciliationDto = {
5137
+ type: 'object',
5138
+ properties: {
5139
+ accountId: {
5140
+ type: 'string',
5141
+ description: 'BeanAccount id to reconcile.'
5142
+ },
5143
+ asOfDate: {
5144
+ type: 'string',
5145
+ description: 'Assertion date (ISO 8601, e.g. "2026-07-24").',
5146
+ example: '2026-07-24'
5147
+ },
5148
+ actualBalance: {
5149
+ description: 'Actual balance from the external statement.',
5150
+ allOf: [
5151
+ {
5152
+ $ref: '#/components/schemas/ActualBalanceDto'
5153
+ }
5154
+ ]
5155
+ }
5156
+ },
5157
+ required: ['accountId', 'asOfDate', 'actualBalance']
5158
+ } as const;
5159
+
5160
+ export const $ReconciliationComputeResultDto = {
5161
+ type: 'object',
5162
+ properties: {
5163
+ accountId: {
5164
+ type: 'string'
5165
+ },
5166
+ asOfDate: {
5167
+ type: 'string'
4198
5168
  },
4199
- annualInterestRate: {
4200
- type: 'number',
4201
- description: 'Annual interest rate',
4202
- example: 0.05
5169
+ bookBalance: {
5170
+ type: 'string',
5171
+ description: 'System-computed book balance (decimal string).'
4203
5172
  },
4204
- currency: {
5173
+ actualBalance: {
4205
5174
  type: 'string',
4206
- description: 'Currency code',
4207
- example: 'USD'
5175
+ description: 'User-entered actual balance (decimal string).'
4208
5176
  },
4209
- baseCurrency: {
5177
+ currency: {
5178
+ type: 'string'
5179
+ },
5180
+ diff: {
4210
5181
  type: 'string',
4211
- description: 'Base currency code',
4212
- example: 'USD'
5182
+ description: 'Diff = book − actual (decimal string).'
4213
5183
  },
4214
- benchmark: {
5184
+ tolerance: {
4215
5185
  type: 'string',
4216
- description: 'Benchmark symbol',
4217
- example: 'SPY'
5186
+ description: 'Applied tolerance (decimal string).'
4218
5187
  },
4219
- colorScheme: {
5188
+ withinTolerance: {
5189
+ type: 'boolean',
5190
+ description: 'true when |diff| ≤ tolerance.'
5191
+ },
5192
+ suggestedAction: {
4220
5193
  type: 'string',
4221
- description: 'Color scheme',
4222
- enum: ['DARK', 'LIGHT']
5194
+ enum: ['assert', 'pad'],
5195
+ description:
5196
+ 'Suggested next action: assert when within tolerance, pad otherwise.'
5197
+ }
5198
+ },
5199
+ required: [
5200
+ 'accountId',
5201
+ 'asOfDate',
5202
+ 'bookBalance',
5203
+ 'actualBalance',
5204
+ 'currency',
5205
+ 'diff',
5206
+ 'tolerance',
5207
+ 'withinTolerance',
5208
+ 'suggestedAction'
5209
+ ]
5210
+ } as const;
5211
+
5212
+ export const $AssertReconciliationDto = {
5213
+ type: 'object',
5214
+ properties: {
5215
+ accountId: {
5216
+ type: 'string',
5217
+ description: 'BeanAccount id to reconcile.'
4223
5218
  },
4224
- dateRange: {
5219
+ asOfDate: {
4225
5220
  type: 'string',
4226
- description: 'Date range filter',
4227
- example: '1y'
5221
+ description: 'Assertion date (ISO 8601, e.g. "2026-07-24").',
5222
+ example: '2026-07-24'
4228
5223
  },
4229
- emergencyFund: {
4230
- type: 'number',
4231
- description: 'Emergency fund amount',
4232
- example: 10000
5224
+ actualBalance: {
5225
+ description: 'Actual balance from the external statement.',
5226
+ allOf: [
5227
+ {
5228
+ $ref: '#/components/schemas/ActualBalanceDto'
5229
+ }
5230
+ ]
4233
5231
  },
4234
- 'filters.accounts': {
4235
- description: 'Account filter IDs',
4236
- type: 'array',
4237
- items: {
4238
- type: 'string'
4239
- }
5232
+ tolerance: {
5233
+ type: 'string',
5234
+ description:
5235
+ 'Optional explicit tolerance override. Omit to infer from amount precision (Beancount default).',
5236
+ example: '0.01'
5237
+ }
5238
+ },
5239
+ required: ['accountId', 'asOfDate', 'actualBalance']
5240
+ } as const;
5241
+
5242
+ export const $ReconciliationRecordDto = {
5243
+ type: 'object',
5244
+ properties: {
5245
+ id: {
5246
+ type: 'string'
4240
5247
  },
4241
- 'filters.assetClasses': {
4242
- description: 'Asset class filters',
4243
- type: 'array',
4244
- items: {
4245
- type: 'string'
4246
- }
5248
+ accountId: {
5249
+ type: 'string'
4247
5250
  },
4248
- 'filters.dataSource': {
4249
- type: 'string',
4250
- description: 'Data source filter'
5251
+ date: {
5252
+ type: 'string'
4251
5253
  },
4252
- 'filters.symbol': {
5254
+ amount: {
4253
5255
  type: 'string',
4254
- description: 'Symbol filter'
5256
+ description: 'Asserted (actual) amount.'
4255
5257
  },
4256
- 'filters.tags': {
4257
- description: 'Tag filters',
4258
- type: 'array',
4259
- items: {
4260
- type: 'string'
4261
- }
4262
- },
4263
- isExperimentalFeatures: {
4264
- type: 'boolean',
4265
- description: 'Enable experimental features'
5258
+ currency: {
5259
+ type: 'string'
4266
5260
  },
4267
- isRestrictedView: {
4268
- type: 'boolean',
4269
- description: 'Enable restricted view mode'
5261
+ tolerance: {
5262
+ type: 'string'
4270
5263
  },
4271
- language: {
5264
+ diffAmount: {
4272
5265
  type: 'string',
4273
- description: 'Language code',
4274
- example: 'en'
5266
+ description: 'book − actual.'
4275
5267
  },
4276
- locale: {
4277
- type: 'string',
4278
- description: 'Locale code',
4279
- example: 'en-US'
5268
+ diffCurrency: {
5269
+ type: 'string'
4280
5270
  },
4281
- projectedTotalAmount: {
4282
- type: 'number',
4283
- description: 'Projected total amount',
4284
- example: 1000000
5271
+ createdAt: {
5272
+ type: 'string'
5273
+ }
5274
+ },
5275
+ required: ['id', 'accountId', 'date', 'amount', 'currency', 'createdAt']
5276
+ } as const;
5277
+
5278
+ export const $PadReconciliationDto = {
5279
+ type: 'object',
5280
+ properties: {
5281
+ accountId: {
5282
+ type: 'string',
5283
+ description: 'BeanAccount id to reconcile.'
4285
5284
  },
4286
- retirementDate: {
5285
+ asOfDate: {
4287
5286
  type: 'string',
4288
- description: 'Retirement date in ISO 8601 format',
4289
- example: '2050-01-01'
5287
+ description: 'Assertion date (ISO 8601, e.g. "2026-07-24").',
5288
+ example: '2026-07-24'
4290
5289
  },
4291
- savingsRate: {
4292
- type: 'number',
4293
- description: 'Savings rate percentage',
4294
- example: 0.2
5290
+ actualBalance: {
5291
+ description: 'Actual balance from the external statement.',
5292
+ allOf: [
5293
+ {
5294
+ $ref: '#/components/schemas/ActualBalanceDto'
5295
+ }
5296
+ ]
4295
5297
  },
4296
- viewMode: {
5298
+ sourceAccount: {
4297
5299
  type: 'string',
4298
- description: 'View mode',
4299
- enum: ['DEFAULT', 'ZEN']
5300
+ description:
5301
+ 'Pad source account. Defaults to Equity:Opening-Balances (official Beancount convention).',
5302
+ example: 'Equity:Opening-Balances',
5303
+ default: 'Equity:Opening-Balances'
4300
5304
  }
4301
- }
5305
+ },
5306
+ required: ['accountId', 'asOfDate', 'actualBalance']
4302
5307
  } as const;
4303
5308
 
4304
- export const $UpdatePropertyDto = {
5309
+ export const $PadResultDto = {
4305
5310
  type: 'object',
4306
5311
  properties: {
4307
- value: {
5312
+ transactionId: {
4308
5313
  type: 'string',
4309
- description: 'Property value'
5314
+ description: 'Created pad adjusting transaction id.'
4310
5315
  }
4311
5316
  },
4312
- required: ['value']
5317
+ required: ['transactionId']
4313
5318
  } as const;
4314
5319
 
4315
5320
  export const $FileImportDto = {
@@ -4478,7 +5483,7 @@ export const $IdentifyResultDto = {
4478
5483
  account: {
4479
5484
  type: 'string',
4480
5485
  description: 'Default account used by this importer',
4481
- example: 'Assets:Alipay:Balance'
5486
+ example: 'Assets:CN:Alipay:Balance'
4482
5487
  },
4483
5488
  message: {
4484
5489
  type: 'string',
@@ -4495,7 +5500,7 @@ export const $MapperDefaultsDto = {
4495
5500
  sourceAccount: {
4496
5501
  type: 'string',
4497
5502
  description: 'Source account for transactions (Beancount format)',
4498
- example: 'Assets:Alipay:Balance'
5503
+ example: 'Assets:CN:Alipay:Balance'
4499
5504
  },
4500
5505
  currency: {
4501
5506
  type: 'string',
@@ -4532,7 +5537,7 @@ export const $MapperDefaultsDto = {
4532
5537
  description:
4533
5538
  'Payment method to source account mapping. Maps payment method keywords to Beancount account paths. Used by Alipay/WeChat importers to determine sourceAccount based on payment method (e.g., HuaBei, CreditCard).',
4534
5539
  example: {
4535
- HuaBei: 'Liabilities:Alipay:Huabei',
5540
+ HuaBei: 'Liabilities:CN:CreditLine',
4536
5541
  CreditCard: 'Liabilities:CreditCard'
4537
5542
  }
4538
5543
  }
@@ -4664,7 +5669,7 @@ export const $UpdateMapperDefaultsDto = {
4664
5669
  sourceAccount: {
4665
5670
  type: 'string',
4666
5671
  description: 'Source account for transactions (Beancount format)',
4667
- example: 'Assets:Alipay:Balance',
5672
+ example: 'Assets:CN:Alipay:Balance',
4668
5673
  pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
4669
5674
  },
4670
5675
  currency: {
@@ -4692,7 +5697,7 @@ export const $UpdateMapperDefaultsDto = {
4692
5697
  description:
4693
5698
  'Payment method to source account mapping. Maps payment method keywords to Beancount account paths. Used by Alipay/WeChat importers to determine sourceAccount based on payment method (e.g., HuaBei, CreditCard).',
4694
5699
  example: {
4695
- HuaBei: 'Liabilities:Alipay:Huabei',
5700
+ HuaBei: 'Liabilities:CN:CreditLine',
4696
5701
  CreditCard: 'Liabilities:CreditCard'
4697
5702
  }
4698
5703
  }
@@ -4716,119 +5721,13 @@ export const $UpdateConfigDataDto = {
4716
5721
  export const $UpdateImporterConfigDto = {
4717
5722
  type: 'object',
4718
5723
  properties: {
4719
- data: {
4720
- description: 'Configuration data (v1 schema)',
4721
- allOf: [
4722
- {
4723
- $ref: '#/components/schemas/UpdateConfigDataDto'
4724
- }
4725
- ]
4726
- }
4727
- }
4728
- } as const;
4729
-
4730
- export const $CreatePlatformDto = {
4731
- type: 'object',
4732
- properties: {
4733
- name: {
4734
- type: 'string',
4735
- description: 'Platform name',
4736
- example: 'Binance'
4737
- },
4738
- canonical: {
4739
- type: 'string',
4740
- description: 'Platform canonical identifier (lowercase, kebab-case)',
4741
- example: 'binance'
4742
- },
4743
- aliases: {
4744
- description: 'Platform aliases (multi-language names for lookup)',
4745
- example: ['Binance', 'Binance Exchange', 'BNB'],
4746
- type: 'array',
4747
- items: {
4748
- type: 'string'
4749
- }
4750
- },
4751
- url: {
4752
- type: 'string',
4753
- description: 'Platform URL',
4754
- example: 'https://www.binance.com'
4755
- },
4756
- type: {
4757
- type: 'string',
4758
- description: 'Platform type',
4759
- enum: [
4760
- 'BANK',
4761
- 'BROKERAGE',
4762
- 'CRYPTO_EXCHANGE',
4763
- 'PAYMENT',
4764
- 'INVESTMENT',
4765
- 'INSURANCE',
4766
- 'OTHER'
4767
- ],
4768
- example: 'CRYPTO_EXCHANGE'
4769
- },
4770
- logoUrl: {
4771
- type: 'string',
4772
- description: 'Platform logo URL',
4773
- example: 'https://example.com/logos/binance.png'
4774
- },
4775
- isActive: {
4776
- type: 'boolean',
4777
- description: 'Whether the platform is active',
4778
- default: true
4779
- }
4780
- },
4781
- required: ['name', 'canonical', 'aliases', 'url', 'type']
4782
- } as const;
4783
-
4784
- export const $UpdatePlatformDto = {
4785
- type: 'object',
4786
- properties: {
4787
- name: {
4788
- type: 'string',
4789
- description: 'Platform name',
4790
- example: 'Binance'
4791
- },
4792
- canonical: {
4793
- type: 'string',
4794
- description: 'Platform canonical identifier (lowercase, kebab-case)',
4795
- example: 'binance'
4796
- },
4797
- aliases: {
4798
- description: 'Platform aliases (multi-language names for lookup)',
4799
- example: ['Binance', 'Binance Exchange', 'BNB'],
4800
- type: 'array',
4801
- items: {
4802
- type: 'string'
4803
- }
4804
- },
4805
- url: {
4806
- type: 'string',
4807
- description: 'Platform URL',
4808
- example: 'https://www.binance.com'
4809
- },
4810
- type: {
4811
- type: 'string',
4812
- description: 'Platform type',
4813
- enum: [
4814
- 'BANK',
4815
- 'BROKERAGE',
4816
- 'CRYPTO_EXCHANGE',
4817
- 'PAYMENT',
4818
- 'INVESTMENT',
4819
- 'INSURANCE',
4820
- 'OTHER'
4821
- ],
4822
- example: 'CRYPTO_EXCHANGE'
4823
- },
4824
- logoUrl: {
4825
- type: 'string',
4826
- description: 'Platform logo URL',
4827
- example: 'https://example.com/logos/binance.png'
4828
- },
4829
- isActive: {
4830
- type: 'boolean',
4831
- description: 'Whether the platform is active'
5724
+ data: {
5725
+ description: 'Configuration data (v1 schema)',
5726
+ allOf: [
5727
+ {
5728
+ $ref: '#/components/schemas/UpdateConfigDataDto'
5729
+ }
5730
+ ]
4832
5731
  }
4833
5732
  }
4834
5733
  } as const;
@@ -4839,7 +5738,7 @@ export const $ProviderSyncConfigDto = {
4839
5738
  sourceAccount: {
4840
5739
  type: 'string',
4841
5740
  description: 'Source account for the first posting',
4842
- example: 'Assets:Bank:Chase'
5741
+ example: 'Assets:US:Chase:Checking'
4843
5742
  },
4844
5743
  defaultCurrency: {
4845
5744
  type: 'string',
@@ -4860,6 +5759,12 @@ export const $ProviderSyncConfigDto = {
4860
5759
  type: 'boolean',
4861
5760
  description: 'Filter pending transactions',
4862
5761
  default: true
5762
+ },
5763
+ externalAccountId: {
5764
+ type: 'string',
5765
+ description:
5766
+ 'External account ID for per-batch providers (e.g. GoCardless). Overrides sourceAccount when an ExternalAccountLink mapping exists.',
5767
+ example: 'acc_gocardless_001'
4863
5768
  }
4864
5769
  },
4865
5770
  required: [
@@ -4979,6 +5884,94 @@ export const $SupportedProvidersResponseDto = {
4979
5884
  required: ['providers']
4980
5885
  } as const;
4981
5886
 
5887
+ export const $CreateExternalAccountLinkDto = {
5888
+ type: 'object',
5889
+ properties: {
5890
+ provider: {
5891
+ type: 'string',
5892
+ enum: [
5893
+ 'plaid',
5894
+ 'teller',
5895
+ 'truelayer',
5896
+ 'gocardless',
5897
+ 'simplefin',
5898
+ 'yodlee',
5899
+ 'beancount-direct',
5900
+ 'parsed-bill'
5901
+ ],
5902
+ example: 'plaid',
5903
+ description: 'Open Banking provider (whitelist)'
5904
+ },
5905
+ externalAccountId: {
5906
+ type: 'string',
5907
+ example: 'acc-plaid-001',
5908
+ description: 'External account ID from the provider'
5909
+ },
5910
+ beanAccountId: {
5911
+ type: 'string',
5912
+ example: '550e8400-e29b-41d4-a716-446655440000',
5913
+ description: 'Target BeanAccount ID (must belong to the JWT user)'
5914
+ }
5915
+ },
5916
+ required: ['provider', 'externalAccountId', 'beanAccountId']
5917
+ } as const;
5918
+
5919
+ export const $ExternalAccountLinkResponseDto = {
5920
+ type: 'object',
5921
+ properties: {
5922
+ id: {
5923
+ type: 'string'
5924
+ },
5925
+ provider: {
5926
+ type: 'string'
5927
+ },
5928
+ externalAccountId: {
5929
+ type: 'string'
5930
+ },
5931
+ beanAccountId: {
5932
+ type: 'string'
5933
+ },
5934
+ isActive: {
5935
+ type: 'boolean'
5936
+ },
5937
+ createdAt: {
5938
+ type: 'string'
5939
+ },
5940
+ updatedAt: {
5941
+ type: 'string'
5942
+ }
5943
+ },
5944
+ required: [
5945
+ 'id',
5946
+ 'provider',
5947
+ 'externalAccountId',
5948
+ 'beanAccountId',
5949
+ 'isActive',
5950
+ 'createdAt',
5951
+ 'updatedAt'
5952
+ ]
5953
+ } as const;
5954
+
5955
+ export const $ExternalAccountLinkListResponseDto = {
5956
+ type: 'object',
5957
+ properties: {
5958
+ items: {
5959
+ type: 'array',
5960
+ items: {
5961
+ $ref: '#/components/schemas/ExternalAccountLinkResponseDto'
5962
+ }
5963
+ },
5964
+ total: {
5965
+ type: 'number'
5966
+ },
5967
+ provider: {
5968
+ type: 'string',
5969
+ description: 'Filter by provider (query param)'
5970
+ }
5971
+ },
5972
+ required: ['items', 'total']
5973
+ } as const;
5974
+
4982
5975
  export const $ParserTelemetryReportDto = {
4983
5976
  type: 'object',
4984
5977
  properties: {}
@@ -5013,6 +6006,18 @@ export const $ProcessNlpDto = {
5013
6006
  currency: 'CNY',
5014
6007
  payee: 'Starbucks'
5015
6008
  }
6009
+ },
6010
+ selectedRuleId: {
6011
+ type: 'string',
6012
+ description:
6013
+ 'confirm_rule echo-back: rule id selected from the prior confirm_rule response (matchedRule.id or alternatives[i].ruleId). Applied directly when the session is confirming_rule — no NL re-parse.',
6014
+ example: 'rule_abc123'
6015
+ },
6016
+ selectedAccount: {
6017
+ type: 'string',
6018
+ description:
6019
+ 'confirm_account echo-back: account path selected from the prior confirm_account response (suggestedAccount, similarAccounts[i], or a typed path). Applied directly when the session is confirming_account — no NL re-parse.',
6020
+ example: 'Expenses:Food:Coffee'
5016
6021
  }
5017
6022
  },
5018
6023
  required: ['message']
@@ -5337,7 +6342,8 @@ export const $NlpAccountConfirmationDataDto = {
5337
6342
  },
5338
6343
  suggestedAccount: {
5339
6344
  type: 'string',
5340
- description: 'Suggested replacement account',
6345
+ description:
6346
+ 'Suggested replacement account (omitted when no clear candidate)',
5341
6347
  example: 'Expenses:Food:Drinks'
5342
6348
  },
5343
6349
  similarAccounts: {
@@ -5359,7 +6365,6 @@ export const $NlpAccountConfirmationDataDto = {
5359
6365
  },
5360
6366
  required: [
5361
6367
  'invalidAccount',
5362
- 'suggestedAccount',
5363
6368
  'similarAccounts',
5364
6369
  'errorMessage',
5365
6370
  'transactionContext'
@@ -5528,11 +6533,12 @@ export const $NlpSuggestedAccountDto = {
5528
6533
  account: {
5529
6534
  type: 'string',
5530
6535
  description: 'Suggested account path',
5531
- example: 'Assets:Bank:Checking'
6536
+ example: 'Assets:Checking'
5532
6537
  },
5533
6538
  confidence: {
5534
6539
  type: 'number',
5535
- description: 'Confidence score for this suggestion (0-1)',
6540
+ description:
6541
+ 'Confidence score for this suggestion (0-1). Present = predicted (confirm/confirm_rule/confirm_account); omitted = actual persisted account (created). (#586)',
5536
6542
  example: 0.9
5537
6543
  }
5538
6544
  },
@@ -5568,23 +6574,31 @@ export const $NlpDefaultAccountsDto = {
5568
6574
  properties: {
5569
6575
  asset: {
5570
6576
  type: 'string',
5571
- description: 'Default asset account',
5572
- example: 'Assets:Bank:Checking'
6577
+ description:
6578
+ 'Default OPEN asset account (MRU when multiple), or null when none/ambiguous',
6579
+ example: 'Assets:Checking',
6580
+ nullable: true
5573
6581
  },
5574
6582
  expense: {
5575
6583
  type: 'string',
5576
- description: 'Default expense account',
5577
- example: 'Expenses:Uncategorized'
6584
+ description:
6585
+ 'Default OPEN expense account (MRU when multiple), or null when none/ambiguous',
6586
+ example: 'Expenses:Food:Coffee',
6587
+ nullable: true
5578
6588
  },
5579
6589
  income: {
5580
6590
  type: 'string',
5581
- description: 'Default income account',
5582
- example: 'Income:Uncategorized'
6591
+ description:
6592
+ 'Default OPEN income account (MRU when multiple), or null when none/ambiguous',
6593
+ example: 'Income:Salary',
6594
+ nullable: true
5583
6595
  },
5584
6596
  liability: {
5585
6597
  type: 'string',
5586
- description: 'Default liability account',
5587
- example: 'Liabilities:CreditCard'
6598
+ description:
6599
+ 'Default OPEN liability account (MRU when multiple), or null when none/ambiguous',
6600
+ example: 'Liabilities:CreditCard',
6601
+ nullable: true
5588
6602
  }
5589
6603
  },
5590
6604
  required: ['asset', 'expense', 'income', 'liability']
@@ -5609,7 +6623,8 @@ export const $NlpResponseDto = {
5609
6623
  'confirm_rule',
5610
6624
  'confirm_account',
5611
6625
  'confirm_payee',
5612
- 'cancel'
6626
+ 'cancel',
6627
+ 'aborted'
5613
6628
  ]
5614
6629
  },
5615
6630
  intent: {
@@ -5771,7 +6786,7 @@ export const $NlpResponseDto = {
5771
6786
  },
5772
6787
  suggestedAccounts: {
5773
6788
  description:
5774
- 'Suggested accounts for this transaction. Contains recommended source and destination accounts based on the detected intent and rules.',
6789
+ 'Suggested accounts for this transaction (#586). confirm/confirm_rule/confirm_account: predicted (source/destination carry confidence); created: actual persisted accounts (confidence omitted). confirm_account destination is the suggested replacement, never the invalid account.',
5775
6790
  allOf: [
5776
6791
  {
5777
6792
  $ref: '#/components/schemas/NlpSuggestedAccountsDto'
@@ -5780,7 +6795,7 @@ export const $NlpResponseDto = {
5780
6795
  },
5781
6796
  defaultAccounts: {
5782
6797
  description:
5783
- 'Default accounts for the user/region. These are fallback accounts used when no specific suggestion is available.',
6798
+ 'Default fallback accounts for the user/region (#586). v1 returns universal constants; per-user personalization is planned.',
5784
6799
  allOf: [
5785
6800
  {
5786
6801
  $ref: '#/components/schemas/NlpDefaultAccountsDto'
@@ -5788,24 +6803,255 @@ export const $NlpResponseDto = {
5788
6803
  ]
5789
6804
  }
5790
6805
  },
5791
- required: ['status', 'action']
6806
+ required: ['status', 'action']
6807
+ } as const;
6808
+
6809
+ export const $PlatformListItemDto = {
6810
+ type: 'object',
6811
+ properties: {
6812
+ id: {
6813
+ type: 'string',
6814
+ description: 'Global platform ID'
6815
+ },
6816
+ name: {
6817
+ type: 'string',
6818
+ description: 'Platform name'
6819
+ },
6820
+ url: {
6821
+ type: 'string',
6822
+ description: 'Platform URL'
6823
+ },
6824
+ type: {
6825
+ type: 'string',
6826
+ description: 'Platform type',
6827
+ enum: [
6828
+ 'BANK',
6829
+ 'BROKERAGE',
6830
+ 'CRYPTO_EXCHANGE',
6831
+ 'PAYMENT',
6832
+ 'INVESTMENT',
6833
+ 'INSURANCE',
6834
+ 'OTHER'
6835
+ ]
6836
+ },
6837
+ canonical: {
6838
+ type: 'string',
6839
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
6840
+ },
6841
+ suggestedSegment: {
6842
+ type: 'string',
6843
+ description:
6844
+ 'Suggested path segment — canonical with first char uppercased (ACC_COMP_NAME_RE)'
6845
+ },
6846
+ logoUrl: {
6847
+ type: 'string',
6848
+ description: 'Logo URL',
6849
+ nullable: true
6850
+ },
6851
+ isBound: {
6852
+ type: 'boolean',
6853
+ description: 'Whether user has accounts using this platform'
6854
+ }
6855
+ },
6856
+ required: [
6857
+ 'id',
6858
+ 'name',
6859
+ 'url',
6860
+ 'type',
6861
+ 'canonical',
6862
+ 'suggestedSegment',
6863
+ 'logoUrl',
6864
+ 'isBound'
6865
+ ]
6866
+ } as const;
6867
+
6868
+ export const $PlatformMatchResultDto = {
6869
+ type: 'object',
6870
+ properties: {
6871
+ id: {
6872
+ type: 'string',
6873
+ description: 'Global platform ID'
6874
+ },
6875
+ name: {
6876
+ type: 'string',
6877
+ description: 'Platform name (e.g., "ICBC")'
6878
+ },
6879
+ canonical: {
6880
+ type: 'string',
6881
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
6882
+ },
6883
+ type: {
6884
+ type: 'string',
6885
+ description: 'Platform type',
6886
+ enum: [
6887
+ 'BANK',
6888
+ 'BROKERAGE',
6889
+ 'CRYPTO_EXCHANGE',
6890
+ 'PAYMENT',
6891
+ 'INVESTMENT',
6892
+ 'INSURANCE',
6893
+ 'OTHER'
6894
+ ]
6895
+ },
6896
+ suggestedSegment: {
6897
+ type: 'string',
6898
+ description:
6899
+ 'Suggested path segment — canonical, already in ACCOUNT_RE format'
6900
+ },
6901
+ logoUrl: {
6902
+ type: 'string',
6903
+ description: 'Logo URL',
6904
+ nullable: true
6905
+ },
6906
+ matchType: {
6907
+ type: 'string',
6908
+ description: "How this row matched: 'exact' > 'prefix' > 'substring'",
6909
+ enum: ['exact', 'prefix', 'substring']
6910
+ }
6911
+ },
6912
+ required: [
6913
+ 'id',
6914
+ 'name',
6915
+ 'canonical',
6916
+ 'type',
6917
+ 'suggestedSegment',
6918
+ 'logoUrl',
6919
+ 'matchType'
6920
+ ]
6921
+ } as const;
6922
+
6923
+ export const $PlatformMatchResponseDto = {
6924
+ type: 'object',
6925
+ properties: {
6926
+ platforms: {
6927
+ description: 'Ranked matches, best tier first (at most 10 rows)',
6928
+ type: 'array',
6929
+ items: {
6930
+ $ref: '#/components/schemas/PlatformMatchResultDto'
6931
+ }
6932
+ },
6933
+ matchType: {
6934
+ type: 'string',
6935
+ description:
6936
+ "Overall match quality — top row's tier, or 'none' when no hits",
6937
+ enum: ['none', 'exact', 'prefix', 'substring']
6938
+ },
6939
+ total: {
6940
+ type: 'number',
6941
+ description: 'Total matches before LIMIT (truncation transparency)'
6942
+ },
6943
+ hasMore: {
6944
+ type: 'boolean',
6945
+ description: 'true when total > platforms.length (more matches exist)'
6946
+ }
6947
+ },
6948
+ required: ['platforms', 'matchType', 'total', 'hasMore']
6949
+ } as const;
6950
+
6951
+ export const $CreatePlatformDto = {
6952
+ type: 'object',
6953
+ properties: {
6954
+ name: {
6955
+ type: 'string',
6956
+ description: 'Platform name',
6957
+ example: 'Binance'
6958
+ },
6959
+ canonical: {
6960
+ type: 'string',
6961
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
6962
+ example: 'binance'
6963
+ },
6964
+ aliases: {
6965
+ description: 'Platform aliases (multi-language names for lookup)',
6966
+ example: ['Binance', 'Binance Exchange', 'BNB'],
6967
+ type: 'array',
6968
+ items: {
6969
+ type: 'string'
6970
+ }
6971
+ },
6972
+ url: {
6973
+ type: 'string',
6974
+ description: 'Platform URL',
6975
+ example: 'https://www.binance.com'
6976
+ },
6977
+ type: {
6978
+ type: 'string',
6979
+ description: 'Platform type',
6980
+ enum: [
6981
+ 'BANK',
6982
+ 'BROKERAGE',
6983
+ 'CRYPTO_EXCHANGE',
6984
+ 'PAYMENT',
6985
+ 'INVESTMENT',
6986
+ 'INSURANCE',
6987
+ 'OTHER'
6988
+ ],
6989
+ example: 'CRYPTO_EXCHANGE'
6990
+ },
6991
+ logoUrl: {
6992
+ type: 'string',
6993
+ description: 'Platform logo URL',
6994
+ example: 'https://example.com/logos/binance.png'
6995
+ },
6996
+ isActive: {
6997
+ type: 'boolean',
6998
+ description: 'Whether the platform is active',
6999
+ default: true
7000
+ }
7001
+ },
7002
+ required: ['name', 'canonical', 'aliases', 'url', 'type']
5792
7003
  } as const;
5793
7004
 
5794
- export const $BalanceByCurrencyDto = {
7005
+ export const $UpdatePlatformDto = {
5795
7006
  type: 'object',
5796
7007
  properties: {
5797
- currency: {
7008
+ name: {
5798
7009
  type: 'string',
5799
- description: 'ISO 4217 currency code',
5800
- example: 'CNY'
7010
+ description: 'Platform name',
7011
+ example: 'Binance'
5801
7012
  },
5802
- balance: {
7013
+ canonical: {
5803
7014
  type: 'string',
5804
- description: 'Balance amount',
5805
- example: '50000.00'
7015
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
7016
+ example: 'binance'
7017
+ },
7018
+ aliases: {
7019
+ description: 'Platform aliases (multi-language names for lookup)',
7020
+ example: ['Binance', 'Binance Exchange', 'BNB'],
7021
+ type: 'array',
7022
+ items: {
7023
+ type: 'string'
7024
+ }
7025
+ },
7026
+ url: {
7027
+ type: 'string',
7028
+ description: 'Platform URL',
7029
+ example: 'https://www.binance.com'
7030
+ },
7031
+ type: {
7032
+ type: 'string',
7033
+ description: 'Platform type',
7034
+ enum: [
7035
+ 'BANK',
7036
+ 'BROKERAGE',
7037
+ 'CRYPTO_EXCHANGE',
7038
+ 'PAYMENT',
7039
+ 'INVESTMENT',
7040
+ 'INSURANCE',
7041
+ 'OTHER'
7042
+ ],
7043
+ example: 'CRYPTO_EXCHANGE'
7044
+ },
7045
+ logoUrl: {
7046
+ type: 'string',
7047
+ description: 'Platform logo URL',
7048
+ example: 'https://example.com/logos/binance.png'
7049
+ },
7050
+ isActive: {
7051
+ type: 'boolean',
7052
+ description: 'Whether the platform is active'
5806
7053
  }
5807
- },
5808
- required: ['currency', 'balance']
7054
+ }
5809
7055
  } as const;
5810
7056
 
5811
7057
  export const $NetWorthByCurrencyDto = {
@@ -5877,28 +7123,6 @@ export const $ConvertedNetWorthDto = {
5877
7123
  ]
5878
7124
  } as const;
5879
7125
 
5880
- export const $ExchangeRateWarningDto = {
5881
- type: 'object',
5882
- properties: {
5883
- type: {
5884
- type: 'string',
5885
- description: 'Warning type',
5886
- example: 'MISSING_EXCHANGE_RATE'
5887
- },
5888
- currency: {
5889
- type: 'string',
5890
- description: 'Currency without exchange rate',
5891
- example: 'EUR'
5892
- },
5893
- totalAmount: {
5894
- type: 'string',
5895
- description: 'Total amount affected',
5896
- example: '1000.00'
5897
- }
5898
- },
5899
- required: ['type', 'currency', 'totalAmount']
5900
- } as const;
5901
-
5902
7126
  export const $NetWorthResponseDto = {
5903
7127
  type: 'object',
5904
7128
  properties: {
@@ -5984,7 +7208,7 @@ export const $AccountItemDto = {
5984
7208
  name: {
5985
7209
  type: 'string',
5986
7210
  description: 'Full account name',
5987
- example: 'Assets:Bank:CMB:Savings'
7211
+ example: 'Assets:CN:CMB:Savings'
5988
7212
  },
5989
7213
  displayName: {
5990
7214
  type: 'string',
@@ -6000,6 +7224,12 @@ export const $AccountItemDto = {
6000
7224
  type: 'string',
6001
7225
  description: 'Currency code',
6002
7226
  example: 'CNY'
7227
+ },
7228
+ convertedBalance: {
7229
+ type: 'string',
7230
+ description:
7231
+ 'FX-converted balance in base currency; omitted when not convertible',
7232
+ example: '50000.00'
6003
7233
  }
6004
7234
  },
6005
7235
  required: ['id', 'name', 'displayName', 'balance', 'currency']
@@ -6026,11 +7256,66 @@ export const $PlatformGroupDto = {
6026
7256
  },
6027
7257
  totalBalance: {
6028
7258
  type: 'string',
6029
- description: 'Total balance across all accounts in platform',
7259
+ description: 'FX-converted total balance in base currency',
7260
+ example: '100000.00'
7261
+ },
7262
+ balanceByCurrency: {
7263
+ description: 'Raw (unconverted) balances grouped by currency',
7264
+ type: 'array',
7265
+ items: {
7266
+ $ref: '#/components/schemas/BalanceByCurrencyDto'
7267
+ }
7268
+ },
7269
+ convertedBalance: {
7270
+ type: 'string',
7271
+ description:
7272
+ 'Converted balance in base currency (omitted when no currency is convertible)',
6030
7273
  example: '100000.00'
7274
+ },
7275
+ sharePct: {
7276
+ type: 'number',
7277
+ description:
7278
+ 'Share of the grand converted total (0-100); 0 when grand total is 0',
7279
+ example: 42.5
7280
+ }
7281
+ },
7282
+ required: [
7283
+ 'platformId',
7284
+ 'platformName',
7285
+ 'accounts',
7286
+ 'totalBalance',
7287
+ 'balanceByCurrency',
7288
+ 'sharePct'
7289
+ ]
7290
+ } as const;
7291
+
7292
+ export const $AccountExchangeRateWarningDto = {
7293
+ type: 'object',
7294
+ properties: {
7295
+ type: {
7296
+ type: 'string',
7297
+ description: 'Warning type',
7298
+ example: 'MISSING_EXCHANGE_RATE'
7299
+ },
7300
+ currency: {
7301
+ type: 'string',
7302
+ description: 'Currency without exchange rate',
7303
+ example: 'USD'
7304
+ },
7305
+ accounts: {
7306
+ description: 'Affected account paths',
7307
+ type: 'array',
7308
+ items: {
7309
+ type: 'string'
7310
+ }
7311
+ },
7312
+ totalAmount: {
7313
+ type: 'string',
7314
+ description: 'Total amount in this currency',
7315
+ example: '5000.00'
6031
7316
  }
6032
7317
  },
6033
- required: ['platformId', 'platformName', 'accounts', 'totalBalance']
7318
+ required: ['type', 'currency', 'accounts', 'totalAmount']
6034
7319
  } as const;
6035
7320
 
6036
7321
  export const $AccountsSummaryDto = {
@@ -6043,9 +7328,21 @@ export const $AccountsSummaryDto = {
6043
7328
  totalPlatforms: {
6044
7329
  type: 'number',
6045
7330
  description: 'Total number of platforms'
7331
+ },
7332
+ baseCurrency: {
7333
+ type: 'string',
7334
+ description: 'Base currency for conversion',
7335
+ example: 'CNY'
7336
+ },
7337
+ warnings: {
7338
+ description: 'Per-account exchange rate warnings',
7339
+ type: 'array',
7340
+ items: {
7341
+ $ref: '#/components/schemas/AccountExchangeRateWarningDto'
7342
+ }
6046
7343
  }
6047
7344
  },
6048
- required: ['totalAccounts', 'totalPlatforms']
7345
+ required: ['totalAccounts', 'totalPlatforms', 'baseCurrency']
6049
7346
  } as const;
6050
7347
 
6051
7348
  export const $AccountsResponseDto = {
@@ -6080,7 +7377,7 @@ export const $AccountItemWithAssetClassDto = {
6080
7377
  name: {
6081
7378
  type: 'string',
6082
7379
  description: 'Full account name',
6083
- example: 'Assets:Bank:CMB:Savings'
7380
+ example: 'Assets:CN:CMB:Savings'
6084
7381
  },
6085
7382
  displayName: {
6086
7383
  type: 'string',
@@ -6097,6 +7394,12 @@ export const $AccountItemWithAssetClassDto = {
6097
7394
  description: 'Currency code',
6098
7395
  example: 'CNY'
6099
7396
  },
7397
+ convertedBalance: {
7398
+ type: 'string',
7399
+ description:
7400
+ 'FX-converted balance in base currency; omitted when not convertible',
7401
+ example: '50000.00'
7402
+ },
6100
7403
  assetClass: {
6101
7404
  type: 'string',
6102
7405
  description: 'Asset class',
@@ -6176,35 +7479,6 @@ export const $AssetClassGroupDto = {
6176
7479
  required: ['assetClass', 'accounts', 'balanceByCurrency']
6177
7480
  } as const;
6178
7481
 
6179
- export const $AccountExchangeRateWarningDto = {
6180
- type: 'object',
6181
- properties: {
6182
- type: {
6183
- type: 'string',
6184
- description: 'Warning type',
6185
- example: 'MISSING_EXCHANGE_RATE'
6186
- },
6187
- currency: {
6188
- type: 'string',
6189
- description: 'Currency without exchange rate',
6190
- example: 'USD'
6191
- },
6192
- accounts: {
6193
- description: 'Affected account paths',
6194
- type: 'array',
6195
- items: {
6196
- type: 'string'
6197
- }
6198
- },
6199
- totalAmount: {
6200
- type: 'string',
6201
- description: 'Total amount in this currency',
6202
- example: '5000.00'
6203
- }
6204
- },
6205
- required: ['type', 'currency', 'accounts', 'totalAmount']
6206
- } as const;
6207
-
6208
7482
  export const $AssetClassSummaryDto = {
6209
7483
  type: 'object',
6210
7484
  properties: {
@@ -6278,7 +7552,7 @@ export const $HoldingAssetClassAccountSliceDto = {
6278
7552
  accountPath: {
6279
7553
  type: 'string',
6280
7554
  description: 'Full account path',
6281
- example: 'Assets:US:Investments:Brokerage'
7555
+ example: 'Assets:US:Fidelity:Brokerage'
6282
7556
  },
6283
7557
  accountCurrency: {
6284
7558
  type: 'string',
@@ -6450,38 +7724,133 @@ export const $CashFlowResponseDto = {
6450
7724
  description: 'Base currency code',
6451
7725
  example: 'CNY'
6452
7726
  },
6453
- byCurrency: {
6454
- description: 'Cash flow grouped by original currency',
6455
- allOf: [
6456
- {
6457
- $ref: '#/components/schemas/CashFlowByCurrencyDto'
6458
- }
6459
- ]
7727
+ byCurrency: {
7728
+ description: 'Cash flow grouped by original currency',
7729
+ allOf: [
7730
+ {
7731
+ $ref: '#/components/schemas/CashFlowByCurrencyDto'
7732
+ }
7733
+ ]
7734
+ },
7735
+ converted: {
7736
+ description: 'Converted values in base currency',
7737
+ allOf: [
7738
+ {
7739
+ $ref: '#/components/schemas/ConvertedCashFlowDto'
7740
+ }
7741
+ ]
7742
+ },
7743
+ warnings: {
7744
+ description: 'Exchange rate warnings',
7745
+ type: 'array',
7746
+ items: {
7747
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
7748
+ }
7749
+ }
7750
+ },
7751
+ required: [
7752
+ 'period',
7753
+ 'income',
7754
+ 'expense',
7755
+ 'netSavings',
7756
+ 'savingsRate',
7757
+ 'currency'
7758
+ ]
7759
+ } as const;
7760
+
7761
+ export const $CategoryGroupDto = {
7762
+ type: 'object',
7763
+ properties: {
7764
+ category: {
7765
+ type: 'string',
7766
+ description:
7767
+ 'Functional category (account-path Group segment); regional and universal account paths merge under it',
7768
+ example: 'Food'
7769
+ },
7770
+ totalExpense: {
7771
+ type: 'string',
7772
+ description:
7773
+ 'Converted total for this category in base currency (expense amount when flow=expense, income amount when flow=income)',
7774
+ example: '1200.00'
7775
+ },
7776
+ sharePct: {
7777
+ type: 'number',
7778
+ description: 'Share of grand total (0-100); 0 when grand total is 0',
7779
+ example: 42.5
7780
+ },
7781
+ balanceByCurrency: {
7782
+ description: 'Raw (unconverted) expense per currency',
7783
+ type: 'array',
7784
+ items: {
7785
+ $ref: '#/components/schemas/BalanceByCurrencyDto'
7786
+ }
7787
+ },
7788
+ convertedBalance: {
7789
+ type: 'string',
7790
+ description:
7791
+ 'Converted total in base currency (omitted when FX missing for all currencies in this category)',
7792
+ example: '1200.00'
7793
+ }
7794
+ },
7795
+ required: ['category', 'totalExpense', 'sharePct', 'balanceByCurrency']
7796
+ } as const;
7797
+
7798
+ export const $ExpensesByCategorySummaryDto = {
7799
+ type: 'object',
7800
+ properties: {
7801
+ totalExpense: {
7802
+ type: 'string',
7803
+ description:
7804
+ 'Total across all categories, converted (convertible categories only); expense totals when flow=expense, income totals when flow=income',
7805
+ example: '5000.00'
7806
+ },
7807
+ categoryCount: {
7808
+ type: 'number',
7809
+ description: 'Number of categories',
7810
+ example: 8
7811
+ }
7812
+ },
7813
+ required: ['totalExpense', 'categoryCount']
7814
+ } as const;
7815
+
7816
+ export const $ExpensesByCategoryResponseDto = {
7817
+ type: 'object',
7818
+ properties: {
7819
+ period: {
7820
+ type: 'string',
7821
+ description: 'Period requested',
7822
+ example: '1m'
7823
+ },
7824
+ baseCurrency: {
7825
+ type: 'string',
7826
+ description: 'Base currency for converted values',
7827
+ example: 'CNY'
7828
+ },
7829
+ groups: {
7830
+ description:
7831
+ 'Expense groups by functional category, sorted by converted total desc',
7832
+ type: 'array',
7833
+ items: {
7834
+ $ref: '#/components/schemas/CategoryGroupDto'
7835
+ }
6460
7836
  },
6461
- converted: {
6462
- description: 'Converted values in base currency',
7837
+ summary: {
7838
+ description: 'Summary statistics',
6463
7839
  allOf: [
6464
7840
  {
6465
- $ref: '#/components/schemas/ConvertedCashFlowDto'
7841
+ $ref: '#/components/schemas/ExpensesByCategorySummaryDto'
6466
7842
  }
6467
7843
  ]
6468
7844
  },
6469
7845
  warnings: {
6470
- description: 'Exchange rate warnings',
7846
+ description: 'Exchange rate warnings (e.g. missing rate for a currency)',
6471
7847
  type: 'array',
6472
7848
  items: {
6473
7849
  $ref: '#/components/schemas/ExchangeRateWarningDto'
6474
7850
  }
6475
7851
  }
6476
7852
  },
6477
- required: [
6478
- 'period',
6479
- 'income',
6480
- 'expense',
6481
- 'netSavings',
6482
- 'savingsRate',
6483
- 'currency'
6484
- ]
7853
+ required: ['period', 'baseCurrency', 'groups', 'summary']
6485
7854
  } as const;
6486
7855
 
6487
7856
  export const $MonetaryDto = {
@@ -6698,409 +8067,243 @@ export const $HoldingPnlRowDto = {
6698
8067
  },
6699
8068
  required: [
6700
8069
  'accountId',
6701
- 'accountPath',
6702
- 'symbol',
6703
- 'chartToken',
6704
- 'assetClass',
6705
- 'units'
6706
- ]
6707
- } as const;
6708
-
6709
- export const $HoldingPnlWarningDto = {
6710
- type: 'object',
6711
- properties: {
6712
- type: {
6713
- type: 'string',
6714
- description: 'Warning type',
6715
- example: 'MISSING_COST_FX_RATE',
6716
- enum: [
6717
- 'MISSING_COST_FX_RATE',
6718
- 'MISSING_MARKET_FX_RATE',
6719
- 'MISSING_SALE_PRICE',
6720
- 'MISSING_REALIZED_FX_RATE',
6721
- 'OVERSOLD_LOTS',
6722
- 'NO_PRICE',
6723
- 'MIXED_COST_CURRENCY'
6724
- ]
6725
- },
6726
- symbol: {
6727
- type: 'object',
6728
- nullable: true
6729
- },
6730
- accountId: {
6731
- type: 'object',
6732
- nullable: true
6733
- },
6734
- currency: {
6735
- type: 'object',
6736
- nullable: true
6737
- }
6738
- },
6739
- required: ['type']
6740
- } as const;
6741
-
6742
- export const $HoldingPnlResponseDto = {
6743
- type: 'object',
6744
- properties: {
6745
- asOfDate: {
6746
- type: 'string',
6747
- example: '2026-07-08'
6748
- },
6749
- baseCurrency: {
6750
- type: 'string',
6751
- example: 'CNY'
6752
- },
6753
- method: {
6754
- type: 'string',
6755
- description:
6756
- 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
6757
- enum: ['average', 'FIFO'],
6758
- example: 'average'
6759
- },
6760
- rows: {
6761
- type: 'array',
6762
- items: {
6763
- $ref: '#/components/schemas/HoldingPnlRowDto'
6764
- }
6765
- },
6766
- warnings: {
6767
- type: 'array',
6768
- items: {
6769
- $ref: '#/components/schemas/HoldingPnlWarningDto'
6770
- }
6771
- }
6772
- },
6773
- required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
6774
- } as const;
6775
-
6776
- export const $CreateBeanPriceDto = {
6777
- type: 'object',
6778
- properties: {
6779
- currency: {
6780
- type: 'string',
6781
- description: 'Currency being priced (e.g., USD, AAPL, BTC)',
6782
- example: 'USD'
6783
- },
6784
- quoteCurrency: {
6785
- type: 'string',
6786
- description: 'Quote currency (pricing currency, e.g., CNY, EUR)',
6787
- example: 'CNY'
6788
- },
6789
- amount: {
6790
- type: 'number',
6791
- description:
6792
- 'Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.',
6793
- example: 175.5,
6794
- minimum: 0
6795
- },
6796
- date: {
6797
- type: 'string',
6798
- description: 'Price date (ISO 8601 format)',
6799
- example: '2024-11-05'
6800
- },
6801
- metadata: {
6802
- type: 'object',
6803
- description:
6804
- 'Metadata (validated by Zod schema, max field lengths enforced)',
6805
- example: {
6806
- source: 'MANUAL',
6807
- note: 'Bank valuation report',
6808
- confidence: 0.95
6809
- }
6810
- }
6811
- },
6812
- required: ['currency', 'quoteCurrency', 'amount', 'date']
6813
- } as const;
6814
-
6815
- export const $PriceResponseDto = {
6816
- type: 'object',
6817
- properties: {
6818
- id: {
6819
- type: 'string',
6820
- description: 'Unique identifier',
6821
- example: 'uuid-123-456'
6822
- },
6823
- userId: {
6824
- type: 'string',
6825
- description: 'User ID (owner of the price)',
6826
- example: 'user-123'
6827
- },
6828
- currency: {
6829
- type: 'string',
6830
- description: 'Currency being priced (e.g., USD, AAPL, BTC)',
6831
- example: 'BTC'
6832
- },
6833
- quoteCurrency: {
6834
- type: 'string',
6835
- description: 'Quote currency (pricing currency, e.g., USD, CNY)',
6836
- example: 'USD'
6837
- },
6838
- amount: {
6839
- type: 'number',
6840
- description:
6841
- 'Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.',
6842
- example: 50000
6843
- },
6844
- date: {
6845
- type: 'string',
6846
- description:
6847
- 'Price date (ISO 8601 format). Represents the date this price was valid.',
6848
- example: '2024-01-01',
6849
- format: 'date'
6850
- },
6851
- meta: {
6852
- type: 'object',
6853
- description:
6854
- 'Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.',
6855
- example: {
6856
- source: 'MANUAL',
6857
- note: 'User-defined price',
6858
- confidence: 1
6859
- }
6860
- },
6861
- createdAt: {
6862
- format: 'date-time',
6863
- type: 'string',
6864
- description: 'Creation timestamp',
6865
- example: '2024-11-03T10:00:00Z'
6866
- },
6867
- updatedAt: {
6868
- format: 'date-time',
6869
- type: 'string',
6870
- description: 'Last update timestamp',
6871
- example: '2024-11-03T10:00:00Z'
6872
- }
6873
- },
6874
- required: [
6875
- 'id',
6876
- 'userId',
6877
- 'currency',
6878
- 'quoteCurrency',
6879
- 'amount',
6880
- 'date',
6881
- 'meta',
6882
- 'createdAt',
6883
- 'updatedAt'
6884
- ]
6885
- } as const;
6886
-
6887
- export const $PriceListResponseDto = {
6888
- type: 'object',
6889
- properties: {
6890
- items: {
6891
- description: 'List of prices',
6892
- type: 'array',
6893
- items: {
6894
- $ref: '#/components/schemas/PriceResponseDto'
6895
- }
6896
- },
6897
- total: {
6898
- type: 'number',
6899
- description: 'Total number of prices',
6900
- example: 42
6901
- }
6902
- },
6903
- required: ['items', 'total']
6904
- } as const;
6905
-
6906
- export const $UpdateBeanPriceDto = {
6907
- type: 'object',
6908
- properties: {
6909
- currency: {
6910
- type: 'string',
6911
- description: 'Currency being priced'
6912
- },
6913
- quoteCurrency: {
6914
- type: 'string',
6915
- description: 'Quote currency (pricing currency)'
6916
- },
6917
- amount: {
6918
- type: 'number',
6919
- description: 'Price amount (MUST be >= 0 per Beancount spec)',
6920
- minimum: 0
6921
- },
6922
- date: {
6923
- type: 'string',
6924
- description: 'Price date (ISO 8601 format)'
6925
- },
6926
- metadata: {
6927
- type: 'object',
6928
- description: 'Metadata'
6929
- }
6930
- }
8070
+ 'accountPath',
8071
+ 'symbol',
8072
+ 'chartToken',
8073
+ 'assetClass',
8074
+ 'units'
8075
+ ]
6931
8076
  } as const;
6932
8077
 
6933
- export const $CurrencyBalanceDto = {
8078
+ export const $HoldingPnlWarningDto = {
6934
8079
  type: 'object',
6935
8080
  properties: {
6936
- currency: {
8081
+ type: {
6937
8082
  type: 'string',
6938
- description: 'ISO 4217 currency code',
6939
- example: 'CNY'
8083
+ description: 'Warning type',
8084
+ example: 'MISSING_COST_FX_RATE',
8085
+ enum: [
8086
+ 'MISSING_COST_FX_RATE',
8087
+ 'MISSING_MARKET_FX_RATE',
8088
+ 'MISSING_SALE_PRICE',
8089
+ 'MISSING_REALIZED_FX_RATE',
8090
+ 'OVERSOLD_LOTS',
8091
+ 'NO_PRICE',
8092
+ 'MIXED_COST_CURRENCY'
8093
+ ]
6940
8094
  },
6941
- balance: {
6942
- type: 'string',
6943
- description: 'Balance amount',
6944
- example: '500000.00'
8095
+ symbol: {
8096
+ type: 'object',
8097
+ nullable: true
8098
+ },
8099
+ accountId: {
8100
+ type: 'object',
8101
+ nullable: true
8102
+ },
8103
+ currency: {
8104
+ type: 'object',
8105
+ nullable: true
6945
8106
  }
6946
8107
  },
6947
- required: ['currency', 'balance']
8108
+ required: ['type']
6948
8109
  } as const;
6949
8110
 
6950
- export const $TimeSeriesPointDto = {
8111
+ export const $HoldingPnlResponseDto = {
6951
8112
  type: 'object',
6952
8113
  properties: {
6953
- date: {
8114
+ asOfDate: {
6954
8115
  type: 'string',
6955
- description: 'Date in YYYY-MM-DD format',
6956
- example: '2024-06-15'
8116
+ example: '2026-07-08'
6957
8117
  },
6958
- value: {
8118
+ baseCurrency: {
6959
8119
  type: 'string',
6960
- description: 'Value at this date (in base currency)',
6961
- example: '500000.00'
8120
+ example: 'CNY'
6962
8121
  },
6963
- change: {
6964
- type: 'object',
6965
- description: 'Change from previous point',
6966
- example: '5000.00'
8122
+ method: {
8123
+ type: 'string',
8124
+ description:
8125
+ 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
8126
+ enum: ['average', 'FIFO'],
8127
+ example: 'average'
6967
8128
  },
6968
- byCurrency: {
6969
- description: 'Multi-currency breakdown for this point',
8129
+ rows: {
6970
8130
  type: 'array',
6971
8131
  items: {
6972
- $ref: '#/components/schemas/CurrencyBalanceDto'
8132
+ $ref: '#/components/schemas/HoldingPnlRowDto'
8133
+ }
8134
+ },
8135
+ warnings: {
8136
+ type: 'array',
8137
+ items: {
8138
+ $ref: '#/components/schemas/HoldingPnlWarningDto'
6973
8139
  }
6974
8140
  }
6975
8141
  },
6976
- required: ['date', 'value']
8142
+ required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
6977
8143
  } as const;
6978
8144
 
6979
- export const $TrendSummaryDto = {
8145
+ export const $AnonymousLoginDto = {
6980
8146
  type: 'object',
6981
8147
  properties: {
6982
- startValue: {
6983
- type: 'string',
6984
- description: 'Value at start of period',
6985
- example: '450000.00'
6986
- },
6987
- endValue: {
6988
- type: 'string',
6989
- description: 'Value at end of period',
6990
- example: '500000.00'
6991
- },
6992
- totalChange: {
6993
- type: 'string',
6994
- description: 'Total change over period',
6995
- example: '50000.00'
6996
- },
6997
- totalChangePercentage: {
8148
+ accessToken: {
6998
8149
  type: 'string',
6999
- description: 'Total change percentage',
7000
- example: '+11.11%'
8150
+ description: 'Access token for anonymous login'
7001
8151
  }
7002
8152
  },
7003
- required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
8153
+ required: ['accessToken']
7004
8154
  } as const;
7005
8155
 
7006
- export const $MultiCurrencyPointDto = {
8156
+ export const $AnonymousLoginResponseDto = {
7007
8157
  type: 'object',
7008
8158
  properties: {
7009
- date: {
8159
+ authToken: {
7010
8160
  type: 'string',
7011
- description: 'Date in YYYY-MM-DD format',
7012
- example: '2024-06-15'
7013
- },
7014
- byCurrency: {
7015
- description: 'Balances by currency',
7016
- type: 'array',
7017
- items: {
7018
- $ref: '#/components/schemas/CurrencyBalanceDto'
7019
- }
8161
+ description: 'JWT auth token',
8162
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
7020
8163
  }
7021
8164
  },
7022
- required: ['date', 'byCurrency']
8165
+ required: ['authToken']
7023
8166
  } as const;
7024
8167
 
7025
- export const $PortfolioTrendsResponseDto = {
8168
+ export const $SymbolSearchResultDto = {
7026
8169
  type: 'object',
7027
8170
  properties: {
7028
- series: {
7029
- description: 'Time series data points',
7030
- type: 'array',
7031
- items: {
7032
- $ref: '#/components/schemas/TimeSeriesPointDto'
7033
- }
8171
+ symbol: {
8172
+ type: 'string',
8173
+ example: 'AAPL'
7034
8174
  },
7035
- summary: {
7036
- description: 'Period summary',
7037
- allOf: [
7038
- {
7039
- $ref: '#/components/schemas/TrendSummaryDto'
7040
- }
7041
- ]
8175
+ name: {
8176
+ type: 'object',
8177
+ example: 'Apple Inc.',
8178
+ nullable: true
7042
8179
  },
7043
- period: {
7044
- type: 'string',
7045
- description: 'Period requested',
7046
- example: '6m'
8180
+ exchange: {
8181
+ type: 'object',
8182
+ example: 'US',
8183
+ nullable: true
7047
8184
  },
7048
- granularity: {
7049
- type: 'string',
7050
- description: 'Data granularity',
7051
- example: 'month'
8185
+ assetType: {
8186
+ type: 'object',
8187
+ description: 'OpenBB asset_type (e.g. stock, etf)',
8188
+ example: 'stock',
8189
+ nullable: true
7052
8190
  },
7053
- currency: {
7054
- type: 'string',
7055
- description: 'Base currency for converted values',
7056
- example: 'CNY'
8191
+ assetClass: {
8192
+ type: 'object',
8193
+ description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8194
+ example: 'EQUITY',
8195
+ nullable: true
7057
8196
  },
7058
- byCurrency: {
7059
- description:
7060
- 'Multi-currency time series (each point has currency breakdown)',
7061
- type: 'array',
7062
- items: {
7063
- $ref: '#/components/schemas/MultiCurrencyPointDto'
7064
- }
8197
+ assetSubClass: {
8198
+ type: 'object',
8199
+ description: 'IGN asset sub-class (region.types.ts ASSET_SUB_CLASSES)',
8200
+ example: 'STOCK',
8201
+ nullable: true
7065
8202
  },
7066
- warnings: {
7067
- description: 'Exchange rate warnings',
7068
- type: 'array',
7069
- items: {
7070
- $ref: '#/components/schemas/ExchangeRateWarningDto'
7071
- }
8203
+ currency: {
8204
+ type: 'object',
8205
+ description: 'Trading currency (extra_data or inferred from exchange)',
8206
+ example: 'USD',
8207
+ nullable: true
7072
8208
  }
7073
8209
  },
7074
- required: ['series', 'summary', 'period', 'granularity', 'currency']
7075
- } as const;
7076
-
7077
- export const $GenerateSnapshotBody = {
7078
- type: 'object',
7079
- properties: {}
7080
- } as const;
7081
-
7082
- export const $GenerateSnapshotResponse = {
7083
- type: 'object',
7084
- properties: {}
7085
- } as const;
7086
-
7087
- export const $BackfillSnapshotsBody = {
7088
- type: 'object',
7089
- properties: {}
7090
- } as const;
7091
-
7092
- export const $BackfillSnapshotsResponse = {
7093
- type: 'object',
7094
- properties: {}
8210
+ required: ['symbol']
7095
8211
  } as const;
7096
8212
 
7097
- export const $AnonymousLoginDto = {
8213
+ export const $SymbolQuoteDto = {
7098
8214
  type: 'object',
7099
8215
  properties: {
7100
- accessToken: {
8216
+ symbol: {
7101
8217
  type: 'string',
7102
- description: 'Access token for anonymous login'
8218
+ example: 'AAPL'
8219
+ },
8220
+ name: {
8221
+ type: 'object',
8222
+ example: 'Apple Inc.',
8223
+ nullable: true
8224
+ },
8225
+ exchange: {
8226
+ type: 'object',
8227
+ example: 'US',
8228
+ nullable: true
8229
+ },
8230
+ assetType: {
8231
+ type: 'object',
8232
+ description: 'OpenBB asset_type',
8233
+ example: 'stock',
8234
+ nullable: true
8235
+ },
8236
+ assetClass: {
8237
+ type: 'object',
8238
+ description: 'IGN asset class',
8239
+ example: 'EQUITY',
8240
+ nullable: true
8241
+ },
8242
+ assetSubClass: {
8243
+ type: 'object',
8244
+ description: 'IGN asset sub-class',
8245
+ example: 'STOCK',
8246
+ nullable: true
8247
+ },
8248
+ currency: {
8249
+ type: 'object',
8250
+ description: 'Trading currency (extra_data or inferred from exchange)',
8251
+ example: 'USD',
8252
+ nullable: true
8253
+ },
8254
+ price: {
8255
+ type: 'object',
8256
+ description: 'Latest price (Decimal string)',
8257
+ example: '189.84',
8258
+ nullable: true
8259
+ },
8260
+ priceDate: {
8261
+ type: 'object',
8262
+ description: 'Date the price was observed (ISO yyyy-MM-dd)',
8263
+ example: '2026-08-05',
8264
+ nullable: true
8265
+ },
8266
+ changePercent: {
8267
+ type: 'object',
8268
+ description:
8269
+ 'Change vs previous close, in percentage points (1.7 == 1.7%). openbb stores change_percent as a normalized decimal; this exposes percentage points for frontend convenience.',
8270
+ example: 1.7,
8271
+ nullable: true
8272
+ },
8273
+ prevClose: {
8274
+ type: 'object',
8275
+ description: 'Previous close (Decimal string)',
8276
+ nullable: true
8277
+ },
8278
+ open: {
8279
+ type: 'object',
8280
+ description: 'Day open (Decimal string)',
8281
+ nullable: true
8282
+ },
8283
+ high: {
8284
+ type: 'object',
8285
+ description: 'Day high (Decimal string)',
8286
+ nullable: true
8287
+ },
8288
+ low: {
8289
+ type: 'object',
8290
+ description: 'Day low (Decimal string)',
8291
+ nullable: true
8292
+ },
8293
+ volume: {
8294
+ type: 'object',
8295
+ description: 'Day volume (Decimal string)',
8296
+ nullable: true
8297
+ },
8298
+ yearHigh: {
8299
+ type: 'object',
8300
+ description: '52-week high (Decimal string)',
8301
+ nullable: true
8302
+ },
8303
+ yearLow: {
8304
+ type: 'object',
8305
+ description: '52-week low (Decimal string)',
8306
+ nullable: true
7103
8307
  }
7104
- },
7105
- required: ['accessToken']
8308
+ }
7106
8309
  } as const;