nexustrade 1.36.0 → 1.37.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/cjs/client.js +1 -0
- package/dist/cjs/generated/ntSdk.generated.js +1 -0
- package/dist/cjs/portfolio.js +12 -0
- package/dist/esm/client.js +1 -0
- package/dist/esm/generated/ntSdk.generated.d.ts +6 -0
- package/dist/esm/generated/ntSdk.generated.js +1 -0
- package/dist/esm/portfolio.d.ts +5 -1
- package/dist/esm/portfolio.js +12 -0
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -518,6 +518,7 @@ const BACKTEST_ARG_NAMES = [
|
|
|
518
518
|
["initial_value", "initialValue"],
|
|
519
519
|
["generate_events", "generateEvents"],
|
|
520
520
|
["fee_config", "feeConfig"],
|
|
521
|
+
["dividend_policy", "dividendPolicy"],
|
|
521
522
|
];
|
|
522
523
|
function isJsonObject(value) {
|
|
523
524
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -2096,6 +2096,7 @@ const backtest = (portfolio, config) => ({
|
|
|
2096
2096
|
"initial_value": config.initialValue,
|
|
2097
2097
|
"generate_events": config.generateEvents,
|
|
2098
2098
|
"fee_config": config.feeConfig,
|
|
2099
|
+
"dividend_policy": config.dividendPolicy,
|
|
2099
2100
|
}),
|
|
2100
2101
|
});
|
|
2101
2102
|
exports.backtest = backtest;
|
package/dist/cjs/portfolio.js
CHANGED
|
@@ -132,6 +132,8 @@ class PortfolioHandle {
|
|
|
132
132
|
supportsFractionalShares;
|
|
133
133
|
supportsCrypto;
|
|
134
134
|
alertsEnabled;
|
|
135
|
+
/** "cash" (the default when omitted) or "reinvest". */
|
|
136
|
+
dividendPolicy;
|
|
135
137
|
/** Chat draft id after `save()`, or fetched portfolio id. Not serialized. */
|
|
136
138
|
id = null;
|
|
137
139
|
/** Present on list/get summaries: paper | live | chat. */
|
|
@@ -188,6 +190,9 @@ class PortfolioHandle {
|
|
|
188
190
|
if (typeof record.alertsEnabled === "boolean") {
|
|
189
191
|
this.alertsEnabled = record.alertsEnabled;
|
|
190
192
|
}
|
|
193
|
+
if (record.dividendPolicy === "cash" || record.dividendPolicy === "reinvest") {
|
|
194
|
+
this.dividendPolicy = record.dividendPolicy;
|
|
195
|
+
}
|
|
191
196
|
if (record.type === "paper" ||
|
|
192
197
|
record.type === "live" ||
|
|
193
198
|
record.type === "chat") {
|
|
@@ -218,6 +223,7 @@ class PortfolioHandle {
|
|
|
218
223
|
key === "supportsFractionalShares" ||
|
|
219
224
|
key === "supportsCrypto" ||
|
|
220
225
|
key === "alertsEnabled" ||
|
|
226
|
+
key === "dividendPolicy" ||
|
|
221
227
|
key === "type" ||
|
|
222
228
|
key === "isActive" ||
|
|
223
229
|
key === "strategyNames" ||
|
|
@@ -264,6 +270,9 @@ class PortfolioHandle {
|
|
|
264
270
|
if (this.alertsEnabled !== undefined) {
|
|
265
271
|
body.alertsEnabled = this.alertsEnabled;
|
|
266
272
|
}
|
|
273
|
+
if (this.dividendPolicy !== undefined) {
|
|
274
|
+
body.dividendPolicy = this.dividendPolicy;
|
|
275
|
+
}
|
|
267
276
|
if (this.type !== undefined)
|
|
268
277
|
body.type = this.type;
|
|
269
278
|
if (this.isActive !== undefined)
|
|
@@ -378,6 +387,9 @@ class PortfolioHandle {
|
|
|
378
387
|
}
|
|
379
388
|
if (options.feeConfig !== undefined)
|
|
380
389
|
input.feeConfig = options.feeConfig;
|
|
390
|
+
if (options.dividendPolicy !== undefined) {
|
|
391
|
+
input.dividendPolicy = options.dividendPolicy;
|
|
392
|
+
}
|
|
381
393
|
const response = await transport.request("POST", "backtests/batch", {
|
|
382
394
|
body: { backtests: [input] },
|
|
383
395
|
idempotencyKey: options.idempotencyKey,
|
package/dist/esm/client.js
CHANGED
|
@@ -508,6 +508,7 @@ const BACKTEST_ARG_NAMES = [
|
|
|
508
508
|
["initial_value", "initialValue"],
|
|
509
509
|
["generate_events", "generateEvents"],
|
|
510
510
|
["fee_config", "feeConfig"],
|
|
511
|
+
["dividend_policy", "dividendPolicy"],
|
|
511
512
|
];
|
|
512
513
|
function isJsonObject(value) {
|
|
513
514
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -479,8 +479,11 @@ export interface Portfolio {
|
|
|
479
479
|
supportsFractionalShares?: boolean;
|
|
480
480
|
supportsCrypto?: boolean;
|
|
481
481
|
alertsEnabled?: boolean;
|
|
482
|
+
/** "cash" (default when omitted) or "reinvest" into the paying stock. */
|
|
483
|
+
dividendPolicy?: DividendPolicy;
|
|
482
484
|
policy?: AuthoredPortfolioPolicy;
|
|
483
485
|
}
|
|
486
|
+
export type DividendPolicy = "cash" | "reinvest";
|
|
484
487
|
export type AssetType = "Stock" | "Cryptocurrency" | "Option" | "Other";
|
|
485
488
|
export type Interval = "Day" | "Hour" | "Minute";
|
|
486
489
|
export type Comparator = "lessThan" | "greaterThan" | "lessThanOrEqual" | "greaterThanOrEqual" | "equal" | "notEqual";
|
|
@@ -710,6 +713,7 @@ export declare const portfolio: (name: string, strategies: Strategy[], options?:
|
|
|
710
713
|
supportsFractionalShares?: boolean;
|
|
711
714
|
supportsCrypto?: boolean;
|
|
712
715
|
alertsEnabled?: boolean;
|
|
716
|
+
dividendPolicy?: DividendPolicy;
|
|
713
717
|
policy?: AuthoredPortfolioPolicy;
|
|
714
718
|
}) => PortfolioHandle;
|
|
715
719
|
/**
|
|
@@ -1629,6 +1633,8 @@ export interface BacktestConfig {
|
|
|
1629
1633
|
generateEvents?: boolean;
|
|
1630
1634
|
/** Optional fee contract keyed by AssetTypeEnum (Stock/Cryptocurrency/Option) with {amount, type: percent|dollars}. Omit for shared defaults (Option $0.65/contract). For replay of an optimizer/walk-forward study, pass that study's persisted feeConfig. Option fill slippage (OptionSlippageFraction) is not set here — engine default 0.5 applies. */
|
|
1631
1635
|
feeConfig?: FeeConfig;
|
|
1636
|
+
/** Overrides the portfolio's dividend policy for this run only. Omit to use the portfolio's own setting (cash unless it was set to reinvest). "reinvest" buys more of the paying stock on each pay date, which is what a buy-and-hold comparison against the SPY total-return baseline needs. */
|
|
1637
|
+
dividendPolicy?: "cash" | "reinvest";
|
|
1632
1638
|
}
|
|
1633
1639
|
export interface WalkForwardConfig {
|
|
1634
1640
|
/** Global calendar start for the walk-forward study (ISO date). Each Minute evaluation window cannot exceed 730 days of minute data counting minute-indicator warmup, which is the only cap; the 90-day seed first look is a default for callers who name no dates. */
|
|
@@ -1896,6 +1896,7 @@ export const backtest = (portfolio, config) => ({
|
|
|
1896
1896
|
"initial_value": config.initialValue,
|
|
1897
1897
|
"generate_events": config.generateEvents,
|
|
1898
1898
|
"fee_config": config.feeConfig,
|
|
1899
|
+
"dividend_policy": config.dividendPolicy,
|
|
1899
1900
|
}),
|
|
1900
1901
|
});
|
|
1901
1902
|
/** Submit a walk-forward study (anchored or rolling folds, GA or sweep engine). */
|
package/dist/esm/portfolio.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* import this module without a cycle through `client.ts`.
|
|
10
10
|
*/
|
|
11
11
|
import { type JsonObject, type Transport } from "./client.ts";
|
|
12
|
-
import type { AuthoredPortfolioPolicy, AuthoredStockEligibility, Portfolio, Strategy } from "./generated/ntSdk.generated.js";
|
|
12
|
+
import type { AuthoredPortfolioPolicy, AuthoredStockEligibility, DividendPolicy, Portfolio, Strategy } from "./generated/ntSdk.generated.js";
|
|
13
13
|
export type PortfolioType = "paper" | "live" | "chat";
|
|
14
14
|
export type DeployOutcome = "minted" | "reactivated" | "already_active" | "seed_recovered";
|
|
15
15
|
export interface DeployResult {
|
|
@@ -68,6 +68,8 @@ export declare class PortfolioHandle implements Portfolio {
|
|
|
68
68
|
supportsFractionalShares?: boolean;
|
|
69
69
|
supportsCrypto?: boolean;
|
|
70
70
|
alertsEnabled?: boolean;
|
|
71
|
+
/** "cash" (the default when omitted) or "reinvest". */
|
|
72
|
+
dividendPolicy?: DividendPolicy;
|
|
71
73
|
/** Chat draft id after `save()`, or fetched portfolio id. Not serialized. */
|
|
72
74
|
id: string | null;
|
|
73
75
|
/** Present on list/get summaries: paper | live | chat. */
|
|
@@ -112,6 +114,8 @@ export declare class PortfolioHandle implements Portfolio {
|
|
|
112
114
|
initialValue?: number;
|
|
113
115
|
generateEvents?: boolean;
|
|
114
116
|
feeConfig?: JsonObject;
|
|
117
|
+
/** Overrides the portfolio's own dividend policy for this run only. */
|
|
118
|
+
dividendPolicy?: DividendPolicy;
|
|
115
119
|
transport?: Transport;
|
|
116
120
|
}): Promise<JsonObject>;
|
|
117
121
|
}
|
package/dist/esm/portfolio.js
CHANGED
|
@@ -95,6 +95,8 @@ export class PortfolioHandle {
|
|
|
95
95
|
supportsFractionalShares;
|
|
96
96
|
supportsCrypto;
|
|
97
97
|
alertsEnabled;
|
|
98
|
+
/** "cash" (the default when omitted) or "reinvest". */
|
|
99
|
+
dividendPolicy;
|
|
98
100
|
/** Chat draft id after `save()`, or fetched portfolio id. Not serialized. */
|
|
99
101
|
id = null;
|
|
100
102
|
/** Present on list/get summaries: paper | live | chat. */
|
|
@@ -151,6 +153,9 @@ export class PortfolioHandle {
|
|
|
151
153
|
if (typeof record.alertsEnabled === "boolean") {
|
|
152
154
|
this.alertsEnabled = record.alertsEnabled;
|
|
153
155
|
}
|
|
156
|
+
if (record.dividendPolicy === "cash" || record.dividendPolicy === "reinvest") {
|
|
157
|
+
this.dividendPolicy = record.dividendPolicy;
|
|
158
|
+
}
|
|
154
159
|
if (record.type === "paper" ||
|
|
155
160
|
record.type === "live" ||
|
|
156
161
|
record.type === "chat") {
|
|
@@ -181,6 +186,7 @@ export class PortfolioHandle {
|
|
|
181
186
|
key === "supportsFractionalShares" ||
|
|
182
187
|
key === "supportsCrypto" ||
|
|
183
188
|
key === "alertsEnabled" ||
|
|
189
|
+
key === "dividendPolicy" ||
|
|
184
190
|
key === "type" ||
|
|
185
191
|
key === "isActive" ||
|
|
186
192
|
key === "strategyNames" ||
|
|
@@ -227,6 +233,9 @@ export class PortfolioHandle {
|
|
|
227
233
|
if (this.alertsEnabled !== undefined) {
|
|
228
234
|
body.alertsEnabled = this.alertsEnabled;
|
|
229
235
|
}
|
|
236
|
+
if (this.dividendPolicy !== undefined) {
|
|
237
|
+
body.dividendPolicy = this.dividendPolicy;
|
|
238
|
+
}
|
|
230
239
|
if (this.type !== undefined)
|
|
231
240
|
body.type = this.type;
|
|
232
241
|
if (this.isActive !== undefined)
|
|
@@ -341,6 +350,9 @@ export class PortfolioHandle {
|
|
|
341
350
|
}
|
|
342
351
|
if (options.feeConfig !== undefined)
|
|
343
352
|
input.feeConfig = options.feeConfig;
|
|
353
|
+
if (options.dividendPolicy !== undefined) {
|
|
354
|
+
input.dividendPolicy = options.dividendPolicy;
|
|
355
|
+
}
|
|
344
356
|
const response = await transport.request("POST", "backtests/batch", {
|
|
345
357
|
body: { backtests: [input] },
|
|
346
358
|
idempotencyKey: options.idempotencyKey,
|