@wealthfolio/addon-sdk 2.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -17
- package/dist/{chunk-TB3G7LNW.js → chunk-VQ2BY7K3.js} +17 -3
- package/dist/chunk-VQ2BY7K3.js.map +1 -0
- package/dist/index.js +46 -8
- package/dist/index.js.map +1 -1
- package/dist/permissions.js +1 -1
- package/dist/src/data-types.d.ts +374 -116
- package/dist/src/goal-progress.d.ts +7 -0
- package/dist/src/host-api.d.ts +83 -18
- package/dist/src/index.d.ts +2 -1
- package/dist/src/query-keys.d.ts +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/dist/chunk-TB3G7LNW.js.map +0 -1
package/dist/src/data-types.d.ts
CHANGED
|
@@ -5,19 +5,75 @@
|
|
|
5
5
|
export declare const ActivityType: {
|
|
6
6
|
readonly BUY: "BUY";
|
|
7
7
|
readonly SELL: "SELL";
|
|
8
|
+
readonly SPLIT: "SPLIT";
|
|
8
9
|
readonly DIVIDEND: "DIVIDEND";
|
|
9
10
|
readonly INTEREST: "INTEREST";
|
|
10
11
|
readonly DEPOSIT: "DEPOSIT";
|
|
11
12
|
readonly WITHDRAWAL: "WITHDRAWAL";
|
|
12
|
-
readonly ADD_HOLDING: "ADD_HOLDING";
|
|
13
|
-
readonly REMOVE_HOLDING: "REMOVE_HOLDING";
|
|
14
13
|
readonly TRANSFER_IN: "TRANSFER_IN";
|
|
15
14
|
readonly TRANSFER_OUT: "TRANSFER_OUT";
|
|
16
15
|
readonly FEE: "FEE";
|
|
17
16
|
readonly TAX: "TAX";
|
|
18
|
-
readonly
|
|
17
|
+
readonly CREDIT: "CREDIT";
|
|
18
|
+
readonly ADJUSTMENT: "ADJUSTMENT";
|
|
19
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
19
20
|
};
|
|
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];
|
|
21
77
|
export declare const DataSource: {
|
|
22
78
|
readonly YAHOO: "YAHOO";
|
|
23
79
|
readonly MANUAL: "MANUAL";
|
|
@@ -32,6 +88,7 @@ export type AccountType = (typeof AccountType)[keyof typeof AccountType];
|
|
|
32
88
|
export declare const HoldingType: {
|
|
33
89
|
readonly CASH: "cash";
|
|
34
90
|
readonly SECURITY: "security";
|
|
91
|
+
readonly ALTERNATIVE_ASSET: "AlternativeAsset";
|
|
35
92
|
};
|
|
36
93
|
export type HoldingType = (typeof HoldingType)[keyof typeof HoldingType];
|
|
37
94
|
export type ImportRequiredField = 'symbol' | 'quantity' | 'price' | 'date' | 'type';
|
|
@@ -44,36 +101,70 @@ export interface Account {
|
|
|
44
101
|
currency: string;
|
|
45
102
|
isDefault: boolean;
|
|
46
103
|
isActive: boolean;
|
|
104
|
+
isArchived: boolean;
|
|
105
|
+
trackingMode: 'TRANSACTIONS' | 'HOLDINGS' | 'NOT_SET';
|
|
47
106
|
createdAt: Date;
|
|
48
107
|
updatedAt: Date;
|
|
49
108
|
platformId?: string;
|
|
109
|
+
accountNumber?: string;
|
|
110
|
+
meta?: string;
|
|
111
|
+
provider?: string;
|
|
112
|
+
providerAccountId?: string;
|
|
50
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Activity interface matching the v3 backend model
|
|
116
|
+
*/
|
|
51
117
|
export interface Activity {
|
|
52
118
|
id: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 | null;
|
|
129
|
+
unitPrice?: string | null;
|
|
130
|
+
amount?: string | null;
|
|
131
|
+
fee?: string | null;
|
|
57
132
|
currency: string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
133
|
+
fxRate?: string | null;
|
|
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;
|
|
65
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;
|
|
66
154
|
export interface ActivityDetails {
|
|
67
155
|
id: string;
|
|
68
156
|
activityType: ActivityType;
|
|
157
|
+
subtype?: string | null;
|
|
158
|
+
status?: ActivityStatus;
|
|
69
159
|
date: Date;
|
|
70
|
-
quantity:
|
|
71
|
-
unitPrice:
|
|
72
|
-
amount:
|
|
73
|
-
fee:
|
|
160
|
+
quantity: string | null;
|
|
161
|
+
unitPrice: string | null;
|
|
162
|
+
amount: string | null;
|
|
163
|
+
fee: string | null;
|
|
74
164
|
currency: string;
|
|
75
|
-
|
|
165
|
+
needsReview: boolean;
|
|
76
166
|
comment?: string;
|
|
167
|
+
fxRate?: string | null;
|
|
77
168
|
createdAt: Date;
|
|
78
169
|
assetId: string;
|
|
79
170
|
updatedAt: Date;
|
|
@@ -82,7 +173,14 @@ export interface ActivityDetails {
|
|
|
82
173
|
accountCurrency: string;
|
|
83
174
|
assetSymbol: string;
|
|
84
175
|
assetName?: string;
|
|
85
|
-
|
|
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>;
|
|
86
184
|
subRows?: ActivityDetails[];
|
|
87
185
|
}
|
|
88
186
|
export interface ActivitySearchResponse {
|
|
@@ -91,22 +189,47 @@ export interface ActivitySearchResponse {
|
|
|
91
189
|
totalRowCount: number;
|
|
92
190
|
};
|
|
93
191
|
}
|
|
192
|
+
export interface SymbolInput {
|
|
193
|
+
id?: string;
|
|
194
|
+
symbol?: string;
|
|
195
|
+
exchangeMic?: string;
|
|
196
|
+
kind?: string;
|
|
197
|
+
name?: string;
|
|
198
|
+
quoteMode?: QuoteMode;
|
|
199
|
+
}
|
|
94
200
|
export interface ActivityCreate {
|
|
95
201
|
id?: string;
|
|
96
202
|
accountId: string;
|
|
97
203
|
activityType: string;
|
|
204
|
+
subtype?: string | null;
|
|
98
205
|
activityDate: string | Date;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
206
|
+
sourceGroupId?: string;
|
|
207
|
+
symbol?: SymbolInput;
|
|
208
|
+
quantity?: string | number | null;
|
|
209
|
+
unitPrice?: string | number | null;
|
|
210
|
+
amount?: string | number | null;
|
|
103
211
|
currency?: string;
|
|
104
|
-
fee?: number;
|
|
105
|
-
isDraft: boolean;
|
|
212
|
+
fee?: string | number | null;
|
|
106
213
|
comment?: string | null;
|
|
214
|
+
fxRate?: string | number | null;
|
|
215
|
+
metadata?: string | Record<string, unknown>;
|
|
107
216
|
}
|
|
108
|
-
export interface ActivityUpdate
|
|
217
|
+
export interface ActivityUpdate {
|
|
109
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>;
|
|
110
233
|
}
|
|
111
234
|
export interface ActivityBulkMutationRequest {
|
|
112
235
|
creates?: ActivityCreate[];
|
|
@@ -134,20 +257,46 @@ export interface ActivityImport {
|
|
|
134
257
|
accountId: string;
|
|
135
258
|
currency?: string;
|
|
136
259
|
activityType: ActivityType;
|
|
260
|
+
subtype?: string;
|
|
137
261
|
date?: Date | string;
|
|
138
|
-
symbol
|
|
139
|
-
amount?: number;
|
|
140
|
-
quantity?: number;
|
|
141
|
-
unitPrice?: number;
|
|
142
|
-
fee?: number;
|
|
262
|
+
symbol?: string;
|
|
263
|
+
amount?: number | string | null;
|
|
264
|
+
quantity?: number | string | null;
|
|
265
|
+
unitPrice?: number | string | null;
|
|
266
|
+
fee?: number | string | null;
|
|
267
|
+
fxRate?: number | string | null;
|
|
143
268
|
accountName?: string;
|
|
144
269
|
symbolName?: string;
|
|
270
|
+
/** Resolved exchange MIC for the symbol (populated during validation) */
|
|
271
|
+
exchangeMic?: string;
|
|
272
|
+
/** Resolved quote currency hint (e.g., GBp) */
|
|
273
|
+
quoteCcy?: string;
|
|
274
|
+
/** Resolved instrument type hint (e.g., EQUITY, CRYPTO) */
|
|
275
|
+
instrumentType?: string;
|
|
276
|
+
/** Resolved quote mode hint (e.g., MANUAL, MARKET) */
|
|
277
|
+
quoteMode?: string;
|
|
145
278
|
errors?: Record<string, string[]>;
|
|
279
|
+
warnings?: Record<string, string[]>;
|
|
280
|
+
duplicateOfId?: string;
|
|
281
|
+
duplicateOfLineNumber?: number;
|
|
146
282
|
isValid: boolean;
|
|
147
283
|
lineNumber?: number;
|
|
148
284
|
isDraft: boolean;
|
|
149
285
|
comment?: string;
|
|
150
286
|
}
|
|
287
|
+
export interface ImportActivitiesSummary {
|
|
288
|
+
total: number;
|
|
289
|
+
imported: number;
|
|
290
|
+
skipped: number;
|
|
291
|
+
duplicates: number;
|
|
292
|
+
assetsCreated: number;
|
|
293
|
+
success: boolean;
|
|
294
|
+
}
|
|
295
|
+
export interface ImportActivitiesResult {
|
|
296
|
+
activities: ActivityImport[];
|
|
297
|
+
importRunId: string;
|
|
298
|
+
summary: ImportActivitiesSummary;
|
|
299
|
+
}
|
|
151
300
|
export interface ImportMappingData {
|
|
152
301
|
accountId: string;
|
|
153
302
|
fieldMappings: Record<string, string>;
|
|
@@ -155,29 +304,14 @@ export interface ImportMappingData {
|
|
|
155
304
|
symbolMappings: Record<string, string>;
|
|
156
305
|
accountMappings: Record<string, string>;
|
|
157
306
|
}
|
|
158
|
-
export interface
|
|
159
|
-
id: string;
|
|
160
|
-
isin: string | null;
|
|
161
|
-
name: string | null;
|
|
162
|
-
assetType: string | null;
|
|
163
|
-
symbol: string;
|
|
164
|
-
symbolMapping: string | null;
|
|
165
|
-
assetClass: string | null;
|
|
166
|
-
assetSubClass: string | null;
|
|
167
|
-
notes: string | null;
|
|
168
|
-
countries: string | null;
|
|
169
|
-
categories: string | null;
|
|
170
|
-
classes: string | null;
|
|
171
|
-
attributes: string | null;
|
|
172
|
-
createdAt: Date;
|
|
173
|
-
currency: string;
|
|
174
|
-
dataSource: string;
|
|
175
|
-
updatedAt: Date;
|
|
176
|
-
sectors: string | null;
|
|
177
|
-
url: string | null;
|
|
178
|
-
}
|
|
179
|
-
export interface QuoteSummary {
|
|
307
|
+
export interface SymbolSearchResult {
|
|
180
308
|
exchange: string;
|
|
309
|
+
/** Canonical exchange MIC code (e.g., "XNAS", "XTSE") */
|
|
310
|
+
exchangeMic?: string;
|
|
311
|
+
/** Friendly exchange name (e.g., "NASDAQ" instead of "NMS" or "XNAS") */
|
|
312
|
+
exchangeName?: string;
|
|
313
|
+
/** Currency derived from exchange (e.g., "USD", "CAD") */
|
|
314
|
+
currency?: string;
|
|
181
315
|
shortName: string;
|
|
182
316
|
quoteType: string;
|
|
183
317
|
symbol: string;
|
|
@@ -185,9 +319,13 @@ export interface QuoteSummary {
|
|
|
185
319
|
score: number;
|
|
186
320
|
typeDisplay: string;
|
|
187
321
|
longName: string;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
322
|
+
dataSource?: string;
|
|
323
|
+
/** Asset kind for custom assets (e.g., "INVESTMENT", "OTHER") */
|
|
324
|
+
assetKind?: string;
|
|
325
|
+
/** True if this asset already exists in user's database */
|
|
326
|
+
isExisting?: boolean;
|
|
327
|
+
/** The existing asset ID if found */
|
|
328
|
+
existingAssetId?: string;
|
|
191
329
|
}
|
|
192
330
|
export interface MarketDataProviderInfo {
|
|
193
331
|
id: string;
|
|
@@ -195,16 +333,6 @@ export interface MarketDataProviderInfo {
|
|
|
195
333
|
logoFilename: string;
|
|
196
334
|
lastSyncedDate: string | null;
|
|
197
335
|
}
|
|
198
|
-
export interface MarketData {
|
|
199
|
-
createdAt: Date;
|
|
200
|
-
dataSource: string;
|
|
201
|
-
date: Date;
|
|
202
|
-
id: string;
|
|
203
|
-
marketPrice: number;
|
|
204
|
-
state: 'CLOSE';
|
|
205
|
-
symbol: string;
|
|
206
|
-
symbolProfileId: string;
|
|
207
|
-
}
|
|
208
336
|
export interface Tag {
|
|
209
337
|
id: string;
|
|
210
338
|
name: string;
|
|
@@ -224,25 +352,44 @@ export type ValidationResult = {
|
|
|
224
352
|
status: 'error';
|
|
225
353
|
errors: string[];
|
|
226
354
|
};
|
|
227
|
-
export interface Sector {
|
|
228
|
-
name: string;
|
|
229
|
-
weight: number;
|
|
230
|
-
}
|
|
231
|
-
export interface Country {
|
|
232
|
-
name: string;
|
|
233
|
-
weight: number;
|
|
234
|
-
}
|
|
235
355
|
export interface Instrument {
|
|
236
356
|
id: string;
|
|
237
357
|
symbol: string;
|
|
238
358
|
name?: string | null;
|
|
239
359
|
currency: string;
|
|
240
360
|
notes?: string | null;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
361
|
+
quoteMode: QuoteMode;
|
|
362
|
+
preferredProvider?: string | null;
|
|
363
|
+
classifications?: AssetClassifications | null;
|
|
364
|
+
}
|
|
365
|
+
export interface AssetClassifications {
|
|
366
|
+
assetType?: TaxonomyCategory | null;
|
|
367
|
+
riskCategory?: TaxonomyCategory | null;
|
|
368
|
+
assetClasses: CategoryWithWeight[];
|
|
369
|
+
sectors: CategoryWithWeight[];
|
|
370
|
+
regions: CategoryWithWeight[];
|
|
371
|
+
customGroups: CategoryWithWeight[];
|
|
372
|
+
}
|
|
373
|
+
export interface TaxonomyCategory {
|
|
374
|
+
id: string;
|
|
375
|
+
taxonomyId: string;
|
|
376
|
+
parentId?: string | null;
|
|
377
|
+
name: string;
|
|
378
|
+
key: string;
|
|
379
|
+
color: string;
|
|
380
|
+
description?: string | null;
|
|
381
|
+
sortOrder: number;
|
|
382
|
+
createdAt: string;
|
|
383
|
+
updatedAt: string;
|
|
384
|
+
}
|
|
385
|
+
export interface CategoryRef {
|
|
386
|
+
id: string;
|
|
387
|
+
name: string;
|
|
388
|
+
}
|
|
389
|
+
export interface CategoryWithWeight {
|
|
390
|
+
category: TaxonomyCategory;
|
|
391
|
+
topLevelCategory: CategoryRef;
|
|
392
|
+
weight: number;
|
|
246
393
|
}
|
|
247
394
|
export interface MonetaryValue {
|
|
248
395
|
local: number;
|
|
@@ -280,6 +427,7 @@ export interface Holding {
|
|
|
280
427
|
holdingType: HoldingType;
|
|
281
428
|
accountId: string;
|
|
282
429
|
instrument?: Instrument | null;
|
|
430
|
+
assetKind?: AssetKind | null;
|
|
283
431
|
quantity: number;
|
|
284
432
|
openDate?: string | Date | null;
|
|
285
433
|
lots?: Lot[] | null;
|
|
@@ -301,33 +449,35 @@ export interface Holding {
|
|
|
301
449
|
weight: number;
|
|
302
450
|
asOfDate: string;
|
|
303
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* Asset interface matching the v3 backend model.
|
|
454
|
+
* Identity is opaque (UUID). Classification is via `kind` and `instrumentType`.
|
|
455
|
+
*/
|
|
304
456
|
export interface Asset {
|
|
305
457
|
id: string;
|
|
306
|
-
|
|
458
|
+
kind: AssetKind;
|
|
307
459
|
name?: string | null;
|
|
308
|
-
|
|
309
|
-
symbol: string;
|
|
310
|
-
symbolMapping?: string | null;
|
|
311
|
-
assetClass?: string | null;
|
|
312
|
-
assetSubClass?: string | null;
|
|
460
|
+
displayCode?: string | null;
|
|
313
461
|
notes?: string | null;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
462
|
+
metadata?: Record<string, unknown>;
|
|
463
|
+
isActive?: boolean;
|
|
464
|
+
quoteMode: QuoteMode;
|
|
465
|
+
quoteCcy: string;
|
|
466
|
+
instrumentType?: string | null;
|
|
467
|
+
instrumentSymbol?: string | null;
|
|
468
|
+
instrumentExchangeMic?: string | null;
|
|
469
|
+
instrumentKey?: string | null;
|
|
470
|
+
providerConfig?: Record<string, unknown> | null;
|
|
471
|
+
exchangeName?: string | null;
|
|
318
472
|
createdAt: string;
|
|
319
473
|
updatedAt: string;
|
|
320
|
-
currency: string;
|
|
321
|
-
dataSource: string;
|
|
322
|
-
sectors?: string | null;
|
|
323
|
-
url?: string | null;
|
|
324
474
|
}
|
|
325
475
|
export interface Quote {
|
|
326
476
|
id: string;
|
|
327
477
|
createdAt: string;
|
|
328
478
|
dataSource: string;
|
|
329
479
|
timestamp: string;
|
|
330
|
-
|
|
480
|
+
assetId: string;
|
|
331
481
|
open: number;
|
|
332
482
|
high: number;
|
|
333
483
|
low: number;
|
|
@@ -335,10 +485,11 @@ export interface Quote {
|
|
|
335
485
|
close: number;
|
|
336
486
|
adjclose: number;
|
|
337
487
|
currency: string;
|
|
488
|
+
notes?: string | null;
|
|
338
489
|
}
|
|
339
490
|
export interface QuoteUpdate {
|
|
340
491
|
timestamp: string;
|
|
341
|
-
|
|
492
|
+
assetId: string;
|
|
342
493
|
open: number;
|
|
343
494
|
high: number;
|
|
344
495
|
low: number;
|
|
@@ -350,16 +501,12 @@ export interface Settings {
|
|
|
350
501
|
theme: string;
|
|
351
502
|
font: string;
|
|
352
503
|
baseCurrency: string;
|
|
504
|
+
timezone?: string;
|
|
505
|
+
instanceId: string;
|
|
353
506
|
onboardingCompleted: boolean;
|
|
354
507
|
autoUpdateCheckEnabled: boolean;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
settings: Settings | null;
|
|
358
|
-
isLoading: boolean;
|
|
359
|
-
isError: boolean;
|
|
360
|
-
updateBaseCurrency: (currency: Settings['baseCurrency']) => Promise<void>;
|
|
361
|
-
accountsGrouped: boolean;
|
|
362
|
-
setAccountsGrouped: (value: boolean) => void;
|
|
508
|
+
menuBarVisible: boolean;
|
|
509
|
+
syncEnabled: boolean;
|
|
363
510
|
}
|
|
364
511
|
export interface Goal {
|
|
365
512
|
id: string;
|
|
@@ -382,11 +529,18 @@ export interface GoalProgress {
|
|
|
382
529
|
progress: number;
|
|
383
530
|
currency: string;
|
|
384
531
|
}
|
|
532
|
+
export interface IncomeByAsset {
|
|
533
|
+
assetId: string;
|
|
534
|
+
kind: AssetKind;
|
|
535
|
+
symbol: string;
|
|
536
|
+
name: string;
|
|
537
|
+
income: number;
|
|
538
|
+
}
|
|
385
539
|
export interface IncomeSummary {
|
|
386
540
|
period: string;
|
|
387
541
|
byMonth: Record<string, number>;
|
|
388
542
|
byType: Record<string, number>;
|
|
389
|
-
|
|
543
|
+
byAsset: Record<string, IncomeByAsset>;
|
|
390
544
|
byCurrency: Record<string, number>;
|
|
391
545
|
totalIncome: number;
|
|
392
546
|
currency: string;
|
|
@@ -487,27 +641,131 @@ export interface PerformanceMetrics {
|
|
|
487
641
|
periodStartDate?: string | null;
|
|
488
642
|
periodEndDate?: string | null;
|
|
489
643
|
currency: string;
|
|
490
|
-
|
|
644
|
+
/** Period gain in dollars (SOTA: change in unrealized P&L for HOLDINGS mode) */
|
|
645
|
+
periodGain: number;
|
|
646
|
+
/** Period return percentage (SOTA formula for HOLDINGS mode) */
|
|
647
|
+
periodReturn: number;
|
|
648
|
+
/** Time-weighted return (null for HOLDINGS mode - requires cash flow tracking) */
|
|
649
|
+
cumulativeTwr?: number | null;
|
|
650
|
+
/** Legacy field for backward compatibility */
|
|
491
651
|
gainLossAmount?: number | null;
|
|
492
|
-
|
|
652
|
+
/** Annualized TWR (null for HOLDINGS mode) */
|
|
653
|
+
annualizedTwr?: number | null;
|
|
493
654
|
simpleReturn: number;
|
|
494
655
|
annualizedSimpleReturn: number;
|
|
495
|
-
|
|
496
|
-
|
|
656
|
+
/** Money-weighted return (null for HOLDINGS mode - requires cash flow tracking) */
|
|
657
|
+
cumulativeMwr?: number | null;
|
|
658
|
+
/** Annualized MWR (null for HOLDINGS mode) */
|
|
659
|
+
annualizedMwr?: number | null;
|
|
497
660
|
volatility: number;
|
|
498
661
|
maxDrawdown: number;
|
|
662
|
+
/** Indicates if this is a HOLDINGS mode account (no cash flow tracking) */
|
|
663
|
+
isHoldingsMode?: boolean;
|
|
499
664
|
}
|
|
500
665
|
export interface UpdateAssetProfile {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
666
|
+
id: string;
|
|
667
|
+
displayCode?: string | null;
|
|
668
|
+
name?: string | null;
|
|
669
|
+
notes?: string | null;
|
|
670
|
+
kind?: AssetKind | null;
|
|
671
|
+
quoteMode?: QuoteMode | null;
|
|
672
|
+
providerConfig?: Record<string, unknown> | null;
|
|
508
673
|
}
|
|
509
674
|
export interface TrackedItem {
|
|
510
675
|
id: string;
|
|
511
676
|
type: 'account' | 'symbol';
|
|
512
677
|
name: string;
|
|
513
678
|
}
|
|
679
|
+
export type ImportRunType = 'SYNC' | 'IMPORT';
|
|
680
|
+
export type ImportRunMode = 'INITIAL' | 'INCREMENTAL' | 'BACKFILL' | 'REPAIR';
|
|
681
|
+
export type ImportRunStatus = 'RUNNING' | 'APPLIED' | 'NEEDS_REVIEW' | 'FAILED' | 'CANCELLED';
|
|
682
|
+
export type ReviewMode = 'NEVER' | 'ALWAYS' | 'IF_WARNINGS';
|
|
683
|
+
export interface ImportRunSummary {
|
|
684
|
+
fetched: number;
|
|
685
|
+
inserted: number;
|
|
686
|
+
updated: number;
|
|
687
|
+
skipped: number;
|
|
688
|
+
warnings: number;
|
|
689
|
+
errors: number;
|
|
690
|
+
removed: number;
|
|
691
|
+
}
|
|
692
|
+
export interface ImportRun {
|
|
693
|
+
id: string;
|
|
694
|
+
accountId: string;
|
|
695
|
+
sourceSystem: string;
|
|
696
|
+
runType: ImportRunType;
|
|
697
|
+
mode: ImportRunMode;
|
|
698
|
+
status: ImportRunStatus;
|
|
699
|
+
startedAt: string;
|
|
700
|
+
finishedAt?: string;
|
|
701
|
+
reviewMode: ReviewMode;
|
|
702
|
+
appliedAt?: string;
|
|
703
|
+
checkpointIn?: Record<string, unknown>;
|
|
704
|
+
checkpointOut?: Record<string, unknown>;
|
|
705
|
+
summary?: ImportRunSummary;
|
|
706
|
+
warnings?: string[];
|
|
707
|
+
error?: string;
|
|
708
|
+
createdAt: string;
|
|
709
|
+
updatedAt: string;
|
|
710
|
+
}
|
|
711
|
+
export type SyncStatus = 'IDLE' | 'RUNNING' | 'NEEDS_REVIEW' | 'FAILED';
|
|
712
|
+
export interface BrokerSyncState {
|
|
713
|
+
accountId: string;
|
|
714
|
+
provider: string;
|
|
715
|
+
checkpointJson?: Record<string, unknown>;
|
|
716
|
+
lastAttemptedAt?: string;
|
|
717
|
+
lastSuccessfulAt?: string;
|
|
718
|
+
lastError?: string;
|
|
719
|
+
lastRunId?: string;
|
|
720
|
+
syncStatus: SyncStatus;
|
|
721
|
+
createdAt: string;
|
|
722
|
+
updatedAt: string;
|
|
723
|
+
}
|
|
724
|
+
export interface SnapshotInfo {
|
|
725
|
+
id: string;
|
|
726
|
+
snapshotDate: string;
|
|
727
|
+
source: string;
|
|
728
|
+
positionCount: number;
|
|
729
|
+
cashCurrencyCount: number;
|
|
730
|
+
}
|
|
731
|
+
export interface SnapshotHoldingInput {
|
|
732
|
+
assetId?: string;
|
|
733
|
+
symbol: string;
|
|
734
|
+
quantity: string;
|
|
735
|
+
currency: string;
|
|
736
|
+
averageCost?: string;
|
|
737
|
+
exchangeMic?: string;
|
|
738
|
+
name?: string;
|
|
739
|
+
dataSource?: string;
|
|
740
|
+
assetKind?: string;
|
|
741
|
+
}
|
|
742
|
+
export interface SnapshotPositionInput {
|
|
743
|
+
symbol: string;
|
|
744
|
+
quantity: string;
|
|
745
|
+
avgCost?: string;
|
|
746
|
+
currency: string;
|
|
747
|
+
exchangeMic?: string;
|
|
748
|
+
}
|
|
749
|
+
export interface SnapshotInput {
|
|
750
|
+
date: string;
|
|
751
|
+
positions: SnapshotPositionInput[];
|
|
752
|
+
cashBalances: Record<string, string>;
|
|
753
|
+
}
|
|
754
|
+
export interface SnapshotSymbolCheckResult {
|
|
755
|
+
symbol: string;
|
|
756
|
+
found: boolean;
|
|
757
|
+
assetName?: string;
|
|
758
|
+
assetId?: string;
|
|
759
|
+
currency?: string;
|
|
760
|
+
exchangeMic?: string;
|
|
761
|
+
}
|
|
762
|
+
export interface CheckSnapshotImportResult {
|
|
763
|
+
existingDates: string[];
|
|
764
|
+
symbols: SnapshotSymbolCheckResult[];
|
|
765
|
+
validationErrors: string[];
|
|
766
|
+
}
|
|
767
|
+
export interface SnapshotImportResult {
|
|
768
|
+
snapshotsImported: number;
|
|
769
|
+
snapshotsFailed: number;
|
|
770
|
+
errors: string[];
|
|
771
|
+
}
|
|
@@ -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[];
|