@wealthfolio/addon-sdk 2.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.
- package/README.md +47 -17
- package/dist/{chunk-TB3G7LNW.js → chunk-6MGUTH7T.js} +2 -2
- package/dist/chunk-6MGUTH7T.js.map +1 -0
- package/dist/index.js +44 -8
- package/dist/index.js.map +1 -1
- package/dist/permissions.js +1 -1
- package/dist/src/data-types.d.ts +311 -111
- package/dist/src/goal-progress.d.ts +7 -0
- package/dist/src/host-api.d.ts +27 -17
- package/dist/src/index.d.ts +2 -1
- 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;
|
|
129
|
+
unitPrice?: string;
|
|
130
|
+
amount?: string;
|
|
131
|
+
fee?: string;
|
|
57
132
|
currency: string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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;
|
|
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,37 @@ export interface ActivityImport {
|
|
|
134
257
|
accountId: string;
|
|
135
258
|
currency?: string;
|
|
136
259
|
activityType: ActivityType;
|
|
260
|
+
subtype?: string;
|
|
137
261
|
date?: Date | string;
|
|
138
262
|
symbol: string;
|
|
139
263
|
amount?: number;
|
|
140
264
|
quantity?: number;
|
|
141
265
|
unitPrice?: number;
|
|
142
266
|
fee?: number;
|
|
267
|
+
fxRate?: number;
|
|
143
268
|
accountName?: string;
|
|
144
269
|
symbolName?: string;
|
|
270
|
+
/** Resolved exchange MIC for the symbol (populated during validation) */
|
|
271
|
+
exchangeMic?: string;
|
|
145
272
|
errors?: Record<string, string[]>;
|
|
146
273
|
isValid: boolean;
|
|
147
274
|
lineNumber?: number;
|
|
148
275
|
isDraft: boolean;
|
|
149
276
|
comment?: string;
|
|
150
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
|
+
}
|
|
151
291
|
export interface ImportMappingData {
|
|
152
292
|
accountId: string;
|
|
153
293
|
fieldMappings: Record<string, string>;
|
|
@@ -155,29 +295,14 @@ export interface ImportMappingData {
|
|
|
155
295
|
symbolMappings: Record<string, string>;
|
|
156
296
|
accountMappings: Record<string, string>;
|
|
157
297
|
}
|
|
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 {
|
|
298
|
+
export interface SymbolSearchResult {
|
|
180
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;
|
|
181
306
|
shortName: string;
|
|
182
307
|
quoteType: string;
|
|
183
308
|
symbol: string;
|
|
@@ -185,9 +310,13 @@ export interface QuoteSummary {
|
|
|
185
310
|
score: number;
|
|
186
311
|
typeDisplay: string;
|
|
187
312
|
longName: string;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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;
|
|
191
320
|
}
|
|
192
321
|
export interface MarketDataProviderInfo {
|
|
193
322
|
id: string;
|
|
@@ -195,16 +324,6 @@ export interface MarketDataProviderInfo {
|
|
|
195
324
|
logoFilename: string;
|
|
196
325
|
lastSyncedDate: string | null;
|
|
197
326
|
}
|
|
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
327
|
export interface Tag {
|
|
209
328
|
id: string;
|
|
210
329
|
name: string;
|
|
@@ -224,25 +343,44 @@ export type ValidationResult = {
|
|
|
224
343
|
status: 'error';
|
|
225
344
|
errors: string[];
|
|
226
345
|
};
|
|
227
|
-
export interface Sector {
|
|
228
|
-
name: string;
|
|
229
|
-
weight: number;
|
|
230
|
-
}
|
|
231
|
-
export interface Country {
|
|
232
|
-
name: string;
|
|
233
|
-
weight: number;
|
|
234
|
-
}
|
|
235
346
|
export interface Instrument {
|
|
236
347
|
id: string;
|
|
237
348
|
symbol: string;
|
|
238
349
|
name?: string | null;
|
|
239
350
|
currency: string;
|
|
240
351
|
notes?: string | null;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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;
|
|
246
384
|
}
|
|
247
385
|
export interface MonetaryValue {
|
|
248
386
|
local: number;
|
|
@@ -280,6 +418,7 @@ export interface Holding {
|
|
|
280
418
|
holdingType: HoldingType;
|
|
281
419
|
accountId: string;
|
|
282
420
|
instrument?: Instrument | null;
|
|
421
|
+
assetKind?: AssetKind | null;
|
|
283
422
|
quantity: number;
|
|
284
423
|
openDate?: string | Date | null;
|
|
285
424
|
lots?: Lot[] | null;
|
|
@@ -301,33 +440,35 @@ export interface Holding {
|
|
|
301
440
|
weight: number;
|
|
302
441
|
asOfDate: string;
|
|
303
442
|
}
|
|
443
|
+
/**
|
|
444
|
+
* Asset interface matching the v3 backend model.
|
|
445
|
+
* Identity is opaque (UUID). Classification is via `kind` and `instrumentType`.
|
|
446
|
+
*/
|
|
304
447
|
export interface Asset {
|
|
305
448
|
id: string;
|
|
306
|
-
|
|
449
|
+
kind: AssetKind;
|
|
307
450
|
name?: string | null;
|
|
308
|
-
|
|
309
|
-
symbol: string;
|
|
310
|
-
symbolMapping?: string | null;
|
|
311
|
-
assetClass?: string | null;
|
|
312
|
-
assetSubClass?: string | null;
|
|
451
|
+
displayCode?: string | null;
|
|
313
452
|
notes?: string | null;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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;
|
|
318
463
|
createdAt: string;
|
|
319
464
|
updatedAt: string;
|
|
320
|
-
currency: string;
|
|
321
|
-
dataSource: string;
|
|
322
|
-
sectors?: string | null;
|
|
323
|
-
url?: string | null;
|
|
324
465
|
}
|
|
325
466
|
export interface Quote {
|
|
326
467
|
id: string;
|
|
327
468
|
createdAt: string;
|
|
328
469
|
dataSource: string;
|
|
329
470
|
timestamp: string;
|
|
330
|
-
|
|
471
|
+
assetId: string;
|
|
331
472
|
open: number;
|
|
332
473
|
high: number;
|
|
333
474
|
low: number;
|
|
@@ -335,10 +476,11 @@ export interface Quote {
|
|
|
335
476
|
close: number;
|
|
336
477
|
adjclose: number;
|
|
337
478
|
currency: string;
|
|
479
|
+
notes?: string | null;
|
|
338
480
|
}
|
|
339
481
|
export interface QuoteUpdate {
|
|
340
482
|
timestamp: string;
|
|
341
|
-
|
|
483
|
+
assetId: string;
|
|
342
484
|
open: number;
|
|
343
485
|
high: number;
|
|
344
486
|
low: number;
|
|
@@ -350,16 +492,11 @@ export interface Settings {
|
|
|
350
492
|
theme: string;
|
|
351
493
|
font: string;
|
|
352
494
|
baseCurrency: string;
|
|
495
|
+
instanceId: string;
|
|
353
496
|
onboardingCompleted: boolean;
|
|
354
497
|
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;
|
|
498
|
+
menuBarVisible: boolean;
|
|
499
|
+
syncEnabled: boolean;
|
|
363
500
|
}
|
|
364
501
|
export interface Goal {
|
|
365
502
|
id: string;
|
|
@@ -382,11 +519,18 @@ export interface GoalProgress {
|
|
|
382
519
|
progress: number;
|
|
383
520
|
currency: string;
|
|
384
521
|
}
|
|
522
|
+
export interface IncomeByAsset {
|
|
523
|
+
assetId: string;
|
|
524
|
+
kind: AssetKind;
|
|
525
|
+
symbol: string;
|
|
526
|
+
name: string;
|
|
527
|
+
income: number;
|
|
528
|
+
}
|
|
385
529
|
export interface IncomeSummary {
|
|
386
530
|
period: string;
|
|
387
531
|
byMonth: Record<string, number>;
|
|
388
532
|
byType: Record<string, number>;
|
|
389
|
-
|
|
533
|
+
byAsset: Record<string, IncomeByAsset>;
|
|
390
534
|
byCurrency: Record<string, number>;
|
|
391
535
|
totalIncome: number;
|
|
392
536
|
currency: string;
|
|
@@ -487,27 +631,83 @@ export interface PerformanceMetrics {
|
|
|
487
631
|
periodStartDate?: string | null;
|
|
488
632
|
periodEndDate?: string | null;
|
|
489
633
|
currency: string;
|
|
490
|
-
|
|
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 */
|
|
491
641
|
gainLossAmount?: number | null;
|
|
492
|
-
|
|
642
|
+
/** Annualized TWR (null for HOLDINGS mode) */
|
|
643
|
+
annualizedTwr?: number | null;
|
|
493
644
|
simpleReturn: number;
|
|
494
645
|
annualizedSimpleReturn: number;
|
|
495
|
-
|
|
496
|
-
|
|
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;
|
|
497
650
|
volatility: number;
|
|
498
651
|
maxDrawdown: number;
|
|
652
|
+
/** Indicates if this is a HOLDINGS mode account (no cash flow tracking) */
|
|
653
|
+
isHoldingsMode?: boolean;
|
|
499
654
|
}
|
|
500
655
|
export interface UpdateAssetProfile {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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;
|
|
508
663
|
}
|
|
509
664
|
export interface TrackedItem {
|
|
510
665
|
id: string;
|
|
511
666
|
type: 'account' | 'symbol';
|
|
512
667
|
name: string;
|
|
513
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[];
|