@alva-ai/toolkit 0.9.0 → 0.9.2-beta.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/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +82 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +33 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -440,6 +440,76 @@ interface ExecuteSignalResult {
|
|
|
440
440
|
orders: ExecuteSignalOrder[];
|
|
441
441
|
error?: string;
|
|
442
442
|
}
|
|
443
|
+
interface PortfolioAccount {
|
|
444
|
+
id: string;
|
|
445
|
+
provider: 'TREX' | 'SNAPTRADE';
|
|
446
|
+
name: string;
|
|
447
|
+
institution: string;
|
|
448
|
+
identifier?: string;
|
|
449
|
+
readOnly: boolean;
|
|
450
|
+
paper: boolean;
|
|
451
|
+
exchange?: string;
|
|
452
|
+
createdAtMs?: number;
|
|
453
|
+
subscriptions: PortfolioAccountSubscription[];
|
|
454
|
+
status?: string;
|
|
455
|
+
statusReason?: string;
|
|
456
|
+
lastSyncedAtMs?: number;
|
|
457
|
+
connectionId?: string;
|
|
458
|
+
}
|
|
459
|
+
interface PortfolioAccountSubscription {
|
|
460
|
+
id: string;
|
|
461
|
+
sourceUsername: string;
|
|
462
|
+
sourceFeed: string;
|
|
463
|
+
playbookId: string;
|
|
464
|
+
playbookName: string;
|
|
465
|
+
playbookVersion: string;
|
|
466
|
+
active: boolean;
|
|
467
|
+
deactivateReason?: string;
|
|
468
|
+
createdAt: number;
|
|
469
|
+
watermark: number;
|
|
470
|
+
}
|
|
471
|
+
interface PortfolioMoney {
|
|
472
|
+
amount: number;
|
|
473
|
+
currency: string;
|
|
474
|
+
currencySymbol: string;
|
|
475
|
+
}
|
|
476
|
+
interface PortfolioHolding {
|
|
477
|
+
symbol: string;
|
|
478
|
+
side?: string;
|
|
479
|
+
quantity: number;
|
|
480
|
+
avgCost?: PortfolioMoney;
|
|
481
|
+
currentPrice?: PortfolioMoney;
|
|
482
|
+
marketValue?: PortfolioMoney;
|
|
483
|
+
unrealizedPnl?: PortfolioMoney;
|
|
484
|
+
allocation?: number;
|
|
485
|
+
}
|
|
486
|
+
interface PortfolioSummary {
|
|
487
|
+
totalValue?: PortfolioMoney;
|
|
488
|
+
cash?: PortfolioMoney;
|
|
489
|
+
unrealizedPnl?: PortfolioMoney;
|
|
490
|
+
holdings: PortfolioHolding[];
|
|
491
|
+
asOfMs?: number;
|
|
492
|
+
}
|
|
493
|
+
interface PortfolioActivity {
|
|
494
|
+
id: string;
|
|
495
|
+
kind: string;
|
|
496
|
+
type: string;
|
|
497
|
+
occurredAtMs?: number;
|
|
498
|
+
symbol?: string;
|
|
499
|
+
side?: string;
|
|
500
|
+
quantity?: number;
|
|
501
|
+
price?: PortfolioMoney;
|
|
502
|
+
amount?: PortfolioMoney;
|
|
503
|
+
fee?: PortfolioMoney;
|
|
504
|
+
status?: string;
|
|
505
|
+
sourceLabel?: string;
|
|
506
|
+
description?: string;
|
|
507
|
+
externalReferenceId?: string;
|
|
508
|
+
}
|
|
509
|
+
interface PortfolioActivityConnection {
|
|
510
|
+
activities: PortfolioActivity[];
|
|
511
|
+
nextPageToken?: string;
|
|
512
|
+
}
|
|
443
513
|
interface NotificationListParams {
|
|
444
514
|
username: string;
|
|
445
515
|
name: string;
|
|
@@ -958,6 +1028,18 @@ declare class TradingResource {
|
|
|
958
1028
|
updateRiskRules(rules: TradingRiskRuleInput): Promise<TradingRiskRule>;
|
|
959
1029
|
}
|
|
960
1030
|
|
|
1031
|
+
declare class PortfolioResource {
|
|
1032
|
+
private client;
|
|
1033
|
+
constructor(client: AlvaClient);
|
|
1034
|
+
accounts(): Promise<PortfolioAccount[]>;
|
|
1035
|
+
summary(accountId: string): Promise<PortfolioSummary>;
|
|
1036
|
+
activities(params: {
|
|
1037
|
+
accountId: string;
|
|
1038
|
+
limit?: number;
|
|
1039
|
+
pageToken?: string;
|
|
1040
|
+
}): Promise<PortfolioActivityConnection>;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
961
1043
|
declare class ArraysJwtResource {
|
|
962
1044
|
private client;
|
|
963
1045
|
constructor(client: AlvaClient);
|
|
@@ -1097,6 +1179,7 @@ declare class AlvaClient {
|
|
|
1097
1179
|
private _screenshot?;
|
|
1098
1180
|
private _user?;
|
|
1099
1181
|
private _trading?;
|
|
1182
|
+
private _portfolio?;
|
|
1100
1183
|
private _arraysJwt?;
|
|
1101
1184
|
private _notifications?;
|
|
1102
1185
|
private _notificationPreferences?;
|
|
@@ -1118,6 +1201,7 @@ declare class AlvaClient {
|
|
|
1118
1201
|
get screenshot(): ScreenshotResource;
|
|
1119
1202
|
get user(): UserResource;
|
|
1120
1203
|
get trading(): TradingResource;
|
|
1204
|
+
get portfolio(): PortfolioResource;
|
|
1121
1205
|
get arraysJwt(): ArraysJwtResource;
|
|
1122
1206
|
get notifications(): NotificationsResource;
|
|
1123
1207
|
get notificationPreferences(): NotificationPreferencesResource;
|
package/dist/index.d.ts
CHANGED
|
@@ -440,6 +440,76 @@ interface ExecuteSignalResult {
|
|
|
440
440
|
orders: ExecuteSignalOrder[];
|
|
441
441
|
error?: string;
|
|
442
442
|
}
|
|
443
|
+
interface PortfolioAccount {
|
|
444
|
+
id: string;
|
|
445
|
+
provider: 'TREX' | 'SNAPTRADE';
|
|
446
|
+
name: string;
|
|
447
|
+
institution: string;
|
|
448
|
+
identifier?: string;
|
|
449
|
+
readOnly: boolean;
|
|
450
|
+
paper: boolean;
|
|
451
|
+
exchange?: string;
|
|
452
|
+
createdAtMs?: number;
|
|
453
|
+
subscriptions: PortfolioAccountSubscription[];
|
|
454
|
+
status?: string;
|
|
455
|
+
statusReason?: string;
|
|
456
|
+
lastSyncedAtMs?: number;
|
|
457
|
+
connectionId?: string;
|
|
458
|
+
}
|
|
459
|
+
interface PortfolioAccountSubscription {
|
|
460
|
+
id: string;
|
|
461
|
+
sourceUsername: string;
|
|
462
|
+
sourceFeed: string;
|
|
463
|
+
playbookId: string;
|
|
464
|
+
playbookName: string;
|
|
465
|
+
playbookVersion: string;
|
|
466
|
+
active: boolean;
|
|
467
|
+
deactivateReason?: string;
|
|
468
|
+
createdAt: number;
|
|
469
|
+
watermark: number;
|
|
470
|
+
}
|
|
471
|
+
interface PortfolioMoney {
|
|
472
|
+
amount: number;
|
|
473
|
+
currency: string;
|
|
474
|
+
currencySymbol: string;
|
|
475
|
+
}
|
|
476
|
+
interface PortfolioHolding {
|
|
477
|
+
symbol: string;
|
|
478
|
+
side?: string;
|
|
479
|
+
quantity: number;
|
|
480
|
+
avgCost?: PortfolioMoney;
|
|
481
|
+
currentPrice?: PortfolioMoney;
|
|
482
|
+
marketValue?: PortfolioMoney;
|
|
483
|
+
unrealizedPnl?: PortfolioMoney;
|
|
484
|
+
allocation?: number;
|
|
485
|
+
}
|
|
486
|
+
interface PortfolioSummary {
|
|
487
|
+
totalValue?: PortfolioMoney;
|
|
488
|
+
cash?: PortfolioMoney;
|
|
489
|
+
unrealizedPnl?: PortfolioMoney;
|
|
490
|
+
holdings: PortfolioHolding[];
|
|
491
|
+
asOfMs?: number;
|
|
492
|
+
}
|
|
493
|
+
interface PortfolioActivity {
|
|
494
|
+
id: string;
|
|
495
|
+
kind: string;
|
|
496
|
+
type: string;
|
|
497
|
+
occurredAtMs?: number;
|
|
498
|
+
symbol?: string;
|
|
499
|
+
side?: string;
|
|
500
|
+
quantity?: number;
|
|
501
|
+
price?: PortfolioMoney;
|
|
502
|
+
amount?: PortfolioMoney;
|
|
503
|
+
fee?: PortfolioMoney;
|
|
504
|
+
status?: string;
|
|
505
|
+
sourceLabel?: string;
|
|
506
|
+
description?: string;
|
|
507
|
+
externalReferenceId?: string;
|
|
508
|
+
}
|
|
509
|
+
interface PortfolioActivityConnection {
|
|
510
|
+
activities: PortfolioActivity[];
|
|
511
|
+
nextPageToken?: string;
|
|
512
|
+
}
|
|
443
513
|
interface NotificationListParams {
|
|
444
514
|
username: string;
|
|
445
515
|
name: string;
|
|
@@ -958,6 +1028,18 @@ declare class TradingResource {
|
|
|
958
1028
|
updateRiskRules(rules: TradingRiskRuleInput): Promise<TradingRiskRule>;
|
|
959
1029
|
}
|
|
960
1030
|
|
|
1031
|
+
declare class PortfolioResource {
|
|
1032
|
+
private client;
|
|
1033
|
+
constructor(client: AlvaClient);
|
|
1034
|
+
accounts(): Promise<PortfolioAccount[]>;
|
|
1035
|
+
summary(accountId: string): Promise<PortfolioSummary>;
|
|
1036
|
+
activities(params: {
|
|
1037
|
+
accountId: string;
|
|
1038
|
+
limit?: number;
|
|
1039
|
+
pageToken?: string;
|
|
1040
|
+
}): Promise<PortfolioActivityConnection>;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
961
1043
|
declare class ArraysJwtResource {
|
|
962
1044
|
private client;
|
|
963
1045
|
constructor(client: AlvaClient);
|
|
@@ -1097,6 +1179,7 @@ declare class AlvaClient {
|
|
|
1097
1179
|
private _screenshot?;
|
|
1098
1180
|
private _user?;
|
|
1099
1181
|
private _trading?;
|
|
1182
|
+
private _portfolio?;
|
|
1100
1183
|
private _arraysJwt?;
|
|
1101
1184
|
private _notifications?;
|
|
1102
1185
|
private _notificationPreferences?;
|
|
@@ -1118,6 +1201,7 @@ declare class AlvaClient {
|
|
|
1118
1201
|
get screenshot(): ScreenshotResource;
|
|
1119
1202
|
get user(): UserResource;
|
|
1120
1203
|
get trading(): TradingResource;
|
|
1204
|
+
get portfolio(): PortfolioResource;
|
|
1121
1205
|
get arraysJwt(): ArraysJwtResource;
|
|
1122
1206
|
get notifications(): NotificationsResource;
|
|
1123
1207
|
get notificationPreferences(): NotificationPreferencesResource;
|
package/dist/index.js
CHANGED
|
@@ -1851,6 +1851,34 @@ var TradingResource = class {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
};
|
|
1853
1853
|
|
|
1854
|
+
// src/resources/portfolio.ts
|
|
1855
|
+
var PortfolioResource = class {
|
|
1856
|
+
constructor(client) {
|
|
1857
|
+
this.client = client;
|
|
1858
|
+
}
|
|
1859
|
+
client;
|
|
1860
|
+
async accounts() {
|
|
1861
|
+
this.client._requireAuth();
|
|
1862
|
+
return this.client._request("GET", "/api/v1/portfolio/accounts");
|
|
1863
|
+
}
|
|
1864
|
+
async summary(accountId) {
|
|
1865
|
+
this.client._requireAuth();
|
|
1866
|
+
return this.client._request("GET", "/api/v1/portfolio/summary", {
|
|
1867
|
+
query: { accountId }
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
async activities(params) {
|
|
1871
|
+
this.client._requireAuth();
|
|
1872
|
+
return this.client._request("GET", "/api/v1/portfolio/activities", {
|
|
1873
|
+
query: {
|
|
1874
|
+
accountId: params.accountId,
|
|
1875
|
+
limit: params.limit,
|
|
1876
|
+
pageToken: params.pageToken
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
|
|
1854
1882
|
// src/resources/arraysJwt.ts
|
|
1855
1883
|
var ArraysJwtResource = class {
|
|
1856
1884
|
constructor(client) {
|
|
@@ -2118,6 +2146,7 @@ var AlvaClient = class {
|
|
|
2118
2146
|
_screenshot;
|
|
2119
2147
|
_user;
|
|
2120
2148
|
_trading;
|
|
2149
|
+
_portfolio;
|
|
2121
2150
|
_arraysJwt;
|
|
2122
2151
|
_notifications;
|
|
2123
2152
|
_notificationPreferences;
|
|
@@ -2178,6 +2207,9 @@ var AlvaClient = class {
|
|
|
2178
2207
|
get trading() {
|
|
2179
2208
|
return this._trading ??= new TradingResource(this);
|
|
2180
2209
|
}
|
|
2210
|
+
get portfolio() {
|
|
2211
|
+
return this._portfolio ??= new PortfolioResource(this);
|
|
2212
|
+
}
|
|
2181
2213
|
get arraysJwt() {
|
|
2182
2214
|
return this._arraysJwt ??= new ArraysJwtResource(this);
|
|
2183
2215
|
}
|
|
@@ -2644,7 +2676,7 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
2644
2676
|
};
|
|
2645
2677
|
|
|
2646
2678
|
// src/index.ts
|
|
2647
|
-
var VERSION = true ? "0.9.0" : "dev";
|
|
2679
|
+
var VERSION = true ? "0.9.2-beta.0" : "dev";
|
|
2648
2680
|
export {
|
|
2649
2681
|
AlvaClient,
|
|
2650
2682
|
AlvaError,
|