@wealthfolio/addon-sdk 1.0.0 → 3.0.0

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.
@@ -0,0 +1,713 @@
1
+ /**
2
+ * Comprehensive data types for Wealthfolio addons
3
+ * These types mirror the main application types to ensure compatibility
4
+ */
5
+ export declare const ActivityType: {
6
+ readonly BUY: "BUY";
7
+ readonly SELL: "SELL";
8
+ readonly SPLIT: "SPLIT";
9
+ readonly DIVIDEND: "DIVIDEND";
10
+ readonly INTEREST: "INTEREST";
11
+ readonly DEPOSIT: "DEPOSIT";
12
+ readonly WITHDRAWAL: "WITHDRAWAL";
13
+ readonly TRANSFER_IN: "TRANSFER_IN";
14
+ readonly TRANSFER_OUT: "TRANSFER_OUT";
15
+ readonly FEE: "FEE";
16
+ readonly TAX: "TAX";
17
+ readonly CREDIT: "CREDIT";
18
+ readonly ADJUSTMENT: "ADJUSTMENT";
19
+ readonly UNKNOWN: "UNKNOWN";
20
+ };
21
+ export type ActivityType = (typeof ActivityType)[keyof typeof ActivityType];
22
+ export declare const ACTIVITY_TYPES: readonly ["BUY", "SELL", "SPLIT", "DIVIDEND", "INTEREST", "DEPOSIT", "WITHDRAWAL", "TRANSFER_IN", "TRANSFER_OUT", "FEE", "TAX", "CREDIT", "ADJUSTMENT", "UNKNOWN"];
23
+ export declare const ActivityStatus: {
24
+ readonly POSTED: "POSTED";
25
+ readonly PENDING: "PENDING";
26
+ readonly DRAFT: "DRAFT";
27
+ readonly VOID: "VOID";
28
+ };
29
+ export type ActivityStatus = (typeof ActivityStatus)[keyof typeof ActivityStatus];
30
+ export declare const ACTIVITY_SUBTYPES: {
31
+ readonly DRIP: "DRIP";
32
+ readonly QUALIFIED: "QUALIFIED";
33
+ readonly ORDINARY: "ORDINARY";
34
+ readonly RETURN_OF_CAPITAL: "RETURN_OF_CAPITAL";
35
+ readonly DIVIDEND_IN_KIND: "DIVIDEND_IN_KIND";
36
+ readonly STAKING_REWARD: "STAKING_REWARD";
37
+ readonly LENDING_INTEREST: "LENDING_INTEREST";
38
+ readonly COUPON: "COUPON";
39
+ readonly REVERSE_SPLIT: "REVERSE_SPLIT";
40
+ readonly OPTION_OPEN: "OPTION_OPEN";
41
+ readonly OPTION_CLOSE: "OPTION_CLOSE";
42
+ readonly OPTION_EXPIRE: "OPTION_EXPIRE";
43
+ readonly OPTION_ASSIGNMENT: "OPTION_ASSIGNMENT";
44
+ readonly OPTION_EXERCISE: "OPTION_EXERCISE";
45
+ readonly MANAGEMENT_FEE: "MANAGEMENT_FEE";
46
+ readonly ADR_FEE: "ADR_FEE";
47
+ readonly INTEREST_CHARGE: "INTEREST_CHARGE";
48
+ readonly WITHHOLDING: "WITHHOLDING";
49
+ readonly NRA_WITHHOLDING: "NRA_WITHHOLDING";
50
+ readonly FEE_REFUND: "FEE_REFUND";
51
+ readonly TAX_REFUND: "TAX_REFUND";
52
+ readonly BONUS: "BONUS";
53
+ readonly ADJUSTMENT: "ADJUSTMENT";
54
+ readonly REBATE: "REBATE";
55
+ readonly REVERSAL: "REVERSAL";
56
+ readonly LIABILITY_INTEREST_ACCRUAL: "LIABILITY_INTEREST_ACCRUAL";
57
+ readonly LIABILITY_PRINCIPAL_PAYMENT: "LIABILITY_PRINCIPAL_PAYMENT";
58
+ };
59
+ export type ActivitySubtype = (typeof ACTIVITY_SUBTYPES)[keyof typeof ACTIVITY_SUBTYPES];
60
+ export declare const AssetKind: {
61
+ readonly INVESTMENT: "INVESTMENT";
62
+ readonly PROPERTY: "PROPERTY";
63
+ readonly VEHICLE: "VEHICLE";
64
+ readonly COLLECTIBLE: "COLLECTIBLE";
65
+ readonly PRECIOUS_METAL: "PRECIOUS_METAL";
66
+ readonly PRIVATE_EQUITY: "PRIVATE_EQUITY";
67
+ readonly LIABILITY: "LIABILITY";
68
+ readonly OTHER: "OTHER";
69
+ readonly FX: "FX";
70
+ };
71
+ export type AssetKind = (typeof AssetKind)[keyof typeof AssetKind];
72
+ export declare const QuoteMode: {
73
+ readonly MARKET: "MARKET";
74
+ readonly MANUAL: "MANUAL";
75
+ };
76
+ export type QuoteMode = (typeof QuoteMode)[keyof typeof QuoteMode];
77
+ export declare const DataSource: {
78
+ readonly YAHOO: "YAHOO";
79
+ readonly MANUAL: "MANUAL";
80
+ };
81
+ export type DataSource = (typeof DataSource)[keyof typeof DataSource];
82
+ export declare const AccountType: {
83
+ readonly SECURITIES: "SECURITIES";
84
+ readonly CASH: "CASH";
85
+ readonly CRYPTOCURRENCY: "CRYPTOCURRENCY";
86
+ };
87
+ export type AccountType = (typeof AccountType)[keyof typeof AccountType];
88
+ export declare const HoldingType: {
89
+ readonly CASH: "cash";
90
+ readonly SECURITY: "security";
91
+ readonly ALTERNATIVE_ASSET: "AlternativeAsset";
92
+ };
93
+ export type HoldingType = (typeof HoldingType)[keyof typeof HoldingType];
94
+ export type ImportRequiredField = 'symbol' | 'quantity' | 'price' | 'date' | 'type';
95
+ export interface Account {
96
+ id: string;
97
+ name: string;
98
+ accountType: AccountType;
99
+ group?: string;
100
+ balance: number;
101
+ currency: string;
102
+ isDefault: boolean;
103
+ isActive: boolean;
104
+ isArchived: boolean;
105
+ trackingMode: 'TRANSACTIONS' | 'HOLDINGS' | 'NOT_SET';
106
+ createdAt: Date;
107
+ updatedAt: Date;
108
+ platformId?: string;
109
+ accountNumber?: string;
110
+ meta?: string;
111
+ provider?: string;
112
+ providerAccountId?: string;
113
+ }
114
+ /**
115
+ * Activity interface matching the v3 backend model
116
+ */
117
+ export interface Activity {
118
+ id: string;
119
+ accountId: string;
120
+ assetId?: string;
121
+ activityType: string;
122
+ activityTypeOverride?: string;
123
+ sourceType?: string;
124
+ subtype?: string;
125
+ status: ActivityStatus;
126
+ activityDate: string;
127
+ settlementDate?: string;
128
+ quantity?: string;
129
+ unitPrice?: string;
130
+ amount?: string;
131
+ fee?: string;
132
+ currency: string;
133
+ fxRate?: string;
134
+ notes?: string;
135
+ metadata?: Record<string, unknown>;
136
+ sourceSystem?: string;
137
+ sourceRecordId?: string;
138
+ sourceGroupId?: string;
139
+ idempotencyKey?: string;
140
+ importRunId?: string;
141
+ isUserModified: boolean;
142
+ needsReview: boolean;
143
+ createdAt: string;
144
+ updatedAt: string;
145
+ }
146
+ /**
147
+ * Helper to get effective type (respects user override)
148
+ */
149
+ export declare function getEffectiveType(activity: Activity): string;
150
+ /**
151
+ * Check if activity has user override
152
+ */
153
+ export declare function hasUserOverride(activity: Activity): boolean;
154
+ export interface ActivityDetails {
155
+ id: string;
156
+ activityType: ActivityType;
157
+ subtype?: string | null;
158
+ status?: ActivityStatus;
159
+ date: Date;
160
+ quantity: string | null;
161
+ unitPrice: string | null;
162
+ amount: string | null;
163
+ fee: string | null;
164
+ currency: string;
165
+ needsReview: boolean;
166
+ comment?: string;
167
+ fxRate?: string | null;
168
+ createdAt: Date;
169
+ assetId: string;
170
+ updatedAt: Date;
171
+ accountId: string;
172
+ accountName: string;
173
+ accountCurrency: string;
174
+ assetSymbol: string;
175
+ assetName?: string;
176
+ assetQuoteMode?: QuoteMode;
177
+ exchangeMic?: string;
178
+ sourceSystem?: string;
179
+ sourceRecordId?: string;
180
+ idempotencyKey?: string;
181
+ importRunId?: string;
182
+ isUserModified?: boolean;
183
+ metadata?: Record<string, unknown>;
184
+ subRows?: ActivityDetails[];
185
+ }
186
+ export interface ActivitySearchResponse {
187
+ data: ActivityDetails[];
188
+ meta: {
189
+ totalRowCount: number;
190
+ };
191
+ }
192
+ export interface SymbolInput {
193
+ id?: string;
194
+ symbol?: string;
195
+ exchangeMic?: string;
196
+ kind?: string;
197
+ name?: string;
198
+ quoteMode?: QuoteMode;
199
+ }
200
+ export interface ActivityCreate {
201
+ id?: string;
202
+ accountId: string;
203
+ activityType: string;
204
+ subtype?: string | null;
205
+ activityDate: string | Date;
206
+ sourceGroupId?: string;
207
+ symbol?: SymbolInput;
208
+ quantity?: string | number | null;
209
+ unitPrice?: string | number | null;
210
+ amount?: string | number | null;
211
+ currency?: string;
212
+ fee?: string | number | null;
213
+ comment?: string | null;
214
+ fxRate?: string | number | null;
215
+ metadata?: string | Record<string, unknown>;
216
+ }
217
+ export interface ActivityUpdate {
218
+ id: string;
219
+ accountId: string;
220
+ activityType: string;
221
+ subtype?: string | null;
222
+ activityDate: string | Date;
223
+ sourceGroupId?: string;
224
+ symbol?: SymbolInput;
225
+ quantity?: string | number | null;
226
+ unitPrice?: string | number | null;
227
+ amount?: string | number | null;
228
+ currency?: string;
229
+ fee?: string | number | null;
230
+ comment?: string | null;
231
+ fxRate?: string | number | null;
232
+ metadata?: string | Record<string, unknown>;
233
+ }
234
+ export interface ActivityBulkMutationRequest {
235
+ creates?: ActivityCreate[];
236
+ updates?: ActivityUpdate[];
237
+ deleteIds?: string[];
238
+ }
239
+ export interface ActivityBulkMutationError {
240
+ id?: string;
241
+ action: string;
242
+ message: string;
243
+ }
244
+ export interface ActivityBulkIdentifierMapping {
245
+ tempId?: string | null;
246
+ activityId: string;
247
+ }
248
+ export interface ActivityBulkMutationResult {
249
+ created: Activity[];
250
+ updated: Activity[];
251
+ deleted: Activity[];
252
+ createdMappings: ActivityBulkIdentifierMapping[];
253
+ errors: ActivityBulkMutationError[];
254
+ }
255
+ export interface ActivityImport {
256
+ id?: string;
257
+ accountId: string;
258
+ currency?: string;
259
+ activityType: ActivityType;
260
+ subtype?: string;
261
+ date?: Date | string;
262
+ symbol: string;
263
+ amount?: number;
264
+ quantity?: number;
265
+ unitPrice?: number;
266
+ fee?: number;
267
+ fxRate?: number;
268
+ accountName?: string;
269
+ symbolName?: string;
270
+ /** Resolved exchange MIC for the symbol (populated during validation) */
271
+ exchangeMic?: string;
272
+ errors?: Record<string, string[]>;
273
+ isValid: boolean;
274
+ lineNumber?: number;
275
+ isDraft: boolean;
276
+ comment?: string;
277
+ }
278
+ export interface ImportActivitiesSummary {
279
+ total: number;
280
+ imported: number;
281
+ skipped: number;
282
+ duplicates: number;
283
+ assetsCreated: number;
284
+ success: boolean;
285
+ }
286
+ export interface ImportActivitiesResult {
287
+ activities: ActivityImport[];
288
+ importRunId: string;
289
+ summary: ImportActivitiesSummary;
290
+ }
291
+ export interface ImportMappingData {
292
+ accountId: string;
293
+ fieldMappings: Record<string, string>;
294
+ activityMappings: Record<string, string[]>;
295
+ symbolMappings: Record<string, string>;
296
+ accountMappings: Record<string, string>;
297
+ }
298
+ export interface SymbolSearchResult {
299
+ exchange: string;
300
+ /** Canonical exchange MIC code (e.g., "XNAS", "XTSE") */
301
+ exchangeMic?: string;
302
+ /** Friendly exchange name (e.g., "NASDAQ" instead of "NMS" or "XNAS") */
303
+ exchangeName?: string;
304
+ /** Currency derived from exchange (e.g., "USD", "CAD") */
305
+ currency?: string;
306
+ shortName: string;
307
+ quoteType: string;
308
+ symbol: string;
309
+ index: string;
310
+ score: number;
311
+ typeDisplay: string;
312
+ longName: string;
313
+ dataSource?: string;
314
+ /** Asset kind for custom assets (e.g., "INVESTMENT", "OTHER") */
315
+ assetKind?: string;
316
+ /** True if this asset already exists in user's database */
317
+ isExisting?: boolean;
318
+ /** The existing asset ID if found */
319
+ existingAssetId?: string;
320
+ }
321
+ export interface MarketDataProviderInfo {
322
+ id: string;
323
+ name: string;
324
+ logoFilename: string;
325
+ lastSyncedDate: string | null;
326
+ }
327
+ export interface Tag {
328
+ id: string;
329
+ name: string;
330
+ activityId: string | null;
331
+ }
332
+ export interface ImportValidationResult {
333
+ activities: ActivityImport[];
334
+ validationSummary: {
335
+ totalRows: number;
336
+ validCount: number;
337
+ invalidCount: number;
338
+ };
339
+ }
340
+ export type ValidationResult = {
341
+ status: 'success';
342
+ } | {
343
+ status: 'error';
344
+ errors: string[];
345
+ };
346
+ export interface Instrument {
347
+ id: string;
348
+ symbol: string;
349
+ name?: string | null;
350
+ currency: string;
351
+ notes?: string | null;
352
+ quoteMode: QuoteMode;
353
+ preferredProvider?: string | null;
354
+ classifications?: AssetClassifications | null;
355
+ }
356
+ export interface AssetClassifications {
357
+ assetType?: TaxonomyCategory | null;
358
+ riskCategory?: TaxonomyCategory | null;
359
+ assetClasses: CategoryWithWeight[];
360
+ sectors: CategoryWithWeight[];
361
+ regions: CategoryWithWeight[];
362
+ customGroups: CategoryWithWeight[];
363
+ }
364
+ export interface TaxonomyCategory {
365
+ id: string;
366
+ taxonomyId: string;
367
+ parentId?: string | null;
368
+ name: string;
369
+ key: string;
370
+ color: string;
371
+ description?: string | null;
372
+ sortOrder: number;
373
+ createdAt: string;
374
+ updatedAt: string;
375
+ }
376
+ export interface CategoryRef {
377
+ id: string;
378
+ name: string;
379
+ }
380
+ export interface CategoryWithWeight {
381
+ category: TaxonomyCategory;
382
+ topLevelCategory: CategoryRef;
383
+ weight: number;
384
+ }
385
+ export interface MonetaryValue {
386
+ local: number;
387
+ base: number;
388
+ }
389
+ export interface Lot {
390
+ id: string;
391
+ positionId: string;
392
+ acquisitionDate: string;
393
+ quantity: number;
394
+ costBasis: number;
395
+ acquisitionPrice: number;
396
+ acquisitionFees: number;
397
+ }
398
+ export interface Position {
399
+ id: string;
400
+ accountId: string;
401
+ assetId: string;
402
+ quantity: number;
403
+ averageCost: number;
404
+ totalCostBasis: number;
405
+ currency: string;
406
+ inceptionDate: string;
407
+ lots: Lot[];
408
+ }
409
+ export interface CashHolding {
410
+ id: string;
411
+ accountId: string;
412
+ currency: string;
413
+ amount: number;
414
+ lastUpdated: string;
415
+ }
416
+ export interface Holding {
417
+ id: string;
418
+ holdingType: HoldingType;
419
+ accountId: string;
420
+ instrument?: Instrument | null;
421
+ assetKind?: AssetKind | null;
422
+ quantity: number;
423
+ openDate?: string | Date | null;
424
+ lots?: Lot[] | null;
425
+ localCurrency: string;
426
+ baseCurrency: string;
427
+ fxRate?: number | null;
428
+ marketValue: MonetaryValue;
429
+ costBasis?: MonetaryValue | null;
430
+ price?: number | null;
431
+ unrealizedGain?: MonetaryValue | null;
432
+ unrealizedGainPct?: number | null;
433
+ realizedGain?: MonetaryValue | null;
434
+ realizedGainPct?: number | null;
435
+ totalGain?: MonetaryValue | null;
436
+ totalGainPct?: number | null;
437
+ dayChange?: MonetaryValue | null;
438
+ dayChangePct?: number | null;
439
+ prevCloseValue?: MonetaryValue | null;
440
+ weight: number;
441
+ asOfDate: string;
442
+ }
443
+ /**
444
+ * Asset interface matching the v3 backend model.
445
+ * Identity is opaque (UUID). Classification is via `kind` and `instrumentType`.
446
+ */
447
+ export interface Asset {
448
+ id: string;
449
+ kind: AssetKind;
450
+ name?: string | null;
451
+ displayCode?: string | null;
452
+ notes?: string | null;
453
+ metadata?: Record<string, unknown>;
454
+ isActive?: boolean;
455
+ quoteMode: QuoteMode;
456
+ quoteCcy: string;
457
+ instrumentType?: string | null;
458
+ instrumentSymbol?: string | null;
459
+ instrumentExchangeMic?: string | null;
460
+ instrumentKey?: string | null;
461
+ providerConfig?: Record<string, unknown> | null;
462
+ exchangeName?: string | null;
463
+ createdAt: string;
464
+ updatedAt: string;
465
+ }
466
+ export interface Quote {
467
+ id: string;
468
+ createdAt: string;
469
+ dataSource: string;
470
+ timestamp: string;
471
+ assetId: string;
472
+ open: number;
473
+ high: number;
474
+ low: number;
475
+ volume: number;
476
+ close: number;
477
+ adjclose: number;
478
+ currency: string;
479
+ notes?: string | null;
480
+ }
481
+ export interface QuoteUpdate {
482
+ timestamp: string;
483
+ assetId: string;
484
+ open: number;
485
+ high: number;
486
+ low: number;
487
+ volume: number;
488
+ close: number;
489
+ dataSource: string;
490
+ }
491
+ export interface Settings {
492
+ theme: string;
493
+ font: string;
494
+ baseCurrency: string;
495
+ instanceId: string;
496
+ onboardingCompleted: boolean;
497
+ autoUpdateCheckEnabled: boolean;
498
+ menuBarVisible: boolean;
499
+ syncEnabled: boolean;
500
+ }
501
+ export interface Goal {
502
+ id: string;
503
+ title: string;
504
+ description?: string;
505
+ targetAmount: number;
506
+ isAchieved?: boolean;
507
+ allocations?: GoalAllocation[];
508
+ }
509
+ export interface GoalAllocation {
510
+ id: string;
511
+ goalId: string;
512
+ accountId: string;
513
+ percentAllocation: number;
514
+ }
515
+ export interface GoalProgress {
516
+ name: string;
517
+ targetValue: number;
518
+ currentValue: number;
519
+ progress: number;
520
+ currency: string;
521
+ }
522
+ export interface IncomeByAsset {
523
+ assetId: string;
524
+ kind: AssetKind;
525
+ symbol: string;
526
+ name: string;
527
+ income: number;
528
+ }
529
+ export interface IncomeSummary {
530
+ period: string;
531
+ byMonth: Record<string, number>;
532
+ byType: Record<string, number>;
533
+ byAsset: Record<string, IncomeByAsset>;
534
+ byCurrency: Record<string, number>;
535
+ totalIncome: number;
536
+ currency: string;
537
+ monthlyAverage: number;
538
+ yoyGrowth: number | null;
539
+ }
540
+ export interface DateRange {
541
+ from: Date | undefined;
542
+ to: Date | undefined;
543
+ }
544
+ export type TimePeriod = '1D' | '1W' | '1M' | '3M' | '6M' | 'YTD' | '1Y' | '5Y' | 'ALL';
545
+ export interface AccountValuation {
546
+ id: string;
547
+ accountId: string;
548
+ valuationDate: string;
549
+ accountCurrency: string;
550
+ baseCurrency: string;
551
+ fxRateToBase: number;
552
+ cashBalance: number;
553
+ investmentMarketValue: number;
554
+ totalValue: number;
555
+ costBasis: number;
556
+ netContribution: number;
557
+ calculatedAt: string;
558
+ }
559
+ export interface AccountSummaryView {
560
+ accountId: string;
561
+ accountName: string;
562
+ accountType: string;
563
+ accountGroup: string | null;
564
+ accountCurrency: string;
565
+ totalValueAccountCurrency: number;
566
+ totalValueBaseCurrency: number;
567
+ baseCurrency: string;
568
+ performance: SimplePerformanceMetrics;
569
+ }
570
+ export interface SimplePerformanceMetrics {
571
+ accountId: string;
572
+ totalValue?: number | null;
573
+ accountCurrency?: string | null;
574
+ baseCurrency?: string | null;
575
+ fxRateToBase?: number | null;
576
+ totalGainLossAmount?: number | null;
577
+ cumulativeReturnPercent?: number | null;
578
+ dayGainLossAmount?: number | null;
579
+ dayReturnPercentModDietz?: number | null;
580
+ portfolioWeight?: number | null;
581
+ }
582
+ export interface AccountGroup {
583
+ groupName: string;
584
+ accounts: AccountSummaryView[];
585
+ totalValueBaseCurrency: number;
586
+ baseCurrency: string;
587
+ performance: SimplePerformanceMetrics;
588
+ accountCount: number;
589
+ }
590
+ export interface ExchangeRate {
591
+ id: string;
592
+ fromCurrency: string;
593
+ toCurrency: string;
594
+ fromCurrencyName?: string;
595
+ toCurrencyName?: string;
596
+ rate: number;
597
+ source: string;
598
+ isLoading?: boolean;
599
+ timestamp: string;
600
+ }
601
+ export interface ContributionLimit {
602
+ id: string;
603
+ groupName: string;
604
+ contributionYear: number;
605
+ limitAmount: number;
606
+ accountIds?: string | null;
607
+ startDate?: string | null;
608
+ endDate?: string | null;
609
+ createdAt?: string;
610
+ updatedAt?: string;
611
+ }
612
+ export type NewContributionLimit = Omit<ContributionLimit, 'id' | 'createdAt' | 'updatedAt'>;
613
+ export interface AccountDeposit {
614
+ amount: number;
615
+ currency: string;
616
+ convertedAmount: number;
617
+ }
618
+ export interface DepositsCalculation {
619
+ total: number;
620
+ baseCurrency: string;
621
+ byAccount: Record<string, AccountDeposit>;
622
+ }
623
+ export declare const ACTIVITY_TYPE_PREFIX_LENGTH = 12;
624
+ export interface ReturnData {
625
+ date: string;
626
+ value: number;
627
+ }
628
+ export interface PerformanceMetrics {
629
+ id: string;
630
+ returns: ReturnData[];
631
+ periodStartDate?: string | null;
632
+ periodEndDate?: string | null;
633
+ currency: string;
634
+ /** Period gain in dollars (SOTA: change in unrealized P&L for HOLDINGS mode) */
635
+ periodGain: number;
636
+ /** Period return percentage (SOTA formula for HOLDINGS mode) */
637
+ periodReturn: number;
638
+ /** Time-weighted return (null for HOLDINGS mode - requires cash flow tracking) */
639
+ cumulativeTwr?: number | null;
640
+ /** Legacy field for backward compatibility */
641
+ gainLossAmount?: number | null;
642
+ /** Annualized TWR (null for HOLDINGS mode) */
643
+ annualizedTwr?: number | null;
644
+ simpleReturn: number;
645
+ annualizedSimpleReturn: number;
646
+ /** Money-weighted return (null for HOLDINGS mode - requires cash flow tracking) */
647
+ cumulativeMwr?: number | null;
648
+ /** Annualized MWR (null for HOLDINGS mode) */
649
+ annualizedMwr?: number | null;
650
+ volatility: number;
651
+ maxDrawdown: number;
652
+ /** Indicates if this is a HOLDINGS mode account (no cash flow tracking) */
653
+ isHoldingsMode?: boolean;
654
+ }
655
+ export interface UpdateAssetProfile {
656
+ id: string;
657
+ displayCode?: string | null;
658
+ name?: string | null;
659
+ notes?: string | null;
660
+ kind?: AssetKind | null;
661
+ quoteMode?: QuoteMode | null;
662
+ providerConfig?: Record<string, unknown> | null;
663
+ }
664
+ export interface TrackedItem {
665
+ id: string;
666
+ type: 'account' | 'symbol';
667
+ name: string;
668
+ }
669
+ export type ImportRunType = 'SYNC' | 'IMPORT';
670
+ export type ImportRunMode = 'INITIAL' | 'INCREMENTAL' | 'BACKFILL' | 'REPAIR';
671
+ export type ImportRunStatus = 'RUNNING' | 'APPLIED' | 'NEEDS_REVIEW' | 'FAILED' | 'CANCELLED';
672
+ export type ReviewMode = 'NEVER' | 'ALWAYS' | 'IF_WARNINGS';
673
+ export interface ImportRunSummary {
674
+ fetched: number;
675
+ inserted: number;
676
+ updated: number;
677
+ skipped: number;
678
+ warnings: number;
679
+ errors: number;
680
+ removed: number;
681
+ }
682
+ export interface ImportRun {
683
+ id: string;
684
+ accountId: string;
685
+ sourceSystem: string;
686
+ runType: ImportRunType;
687
+ mode: ImportRunMode;
688
+ status: ImportRunStatus;
689
+ startedAt: string;
690
+ finishedAt?: string;
691
+ reviewMode: ReviewMode;
692
+ appliedAt?: string;
693
+ checkpointIn?: Record<string, unknown>;
694
+ checkpointOut?: Record<string, unknown>;
695
+ summary?: ImportRunSummary;
696
+ warnings?: string[];
697
+ error?: string;
698
+ createdAt: string;
699
+ updatedAt: string;
700
+ }
701
+ export type SyncStatus = 'IDLE' | 'RUNNING' | 'NEEDS_REVIEW' | 'FAILED';
702
+ export interface BrokerSyncState {
703
+ accountId: string;
704
+ provider: string;
705
+ checkpointJson?: Record<string, unknown>;
706
+ lastAttemptedAt?: string;
707
+ lastSuccessfulAt?: string;
708
+ lastError?: string;
709
+ lastRunId?: string;
710
+ syncStatus: SyncStatus;
711
+ createdAt: string;
712
+ updatedAt: string;
713
+ }
@@ -0,0 +1,7 @@
1
+ import type { Goal, GoalAllocation, AccountValuation, GoalProgress } from './data-types';
2
+ /**
3
+ * Calculate goal progress using allocations.
4
+ * Converts account values to base currency, applies percent allocation per account,
5
+ * and computes progress ratio (0–1+) against target amount.
6
+ */
7
+ export declare function calculateGoalProgress(accountsValuations: AccountValuation[], goals: Goal[], allocations: GoalAllocation[]): GoalProgress[];