nexustrade 1.10.0 → 1.12.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 CHANGED
@@ -174,6 +174,30 @@ const book = nt.portfolio(
174
174
  );
175
175
  ```
176
176
 
177
+ Order execution belongs to the strategy. Omit it for the backward-compatible
178
+ Market default, use a fixed unit price for Buy/Sell, or set an option strategy's
179
+ maximum net debit / minimum net credit:
180
+
181
+ ```ts
182
+ nt.strategy("Buy SPY at my price", nt.always(), nt.buy(nt.stockAsset("SPY"), 10), {
183
+ orderExecution: nt.limitOrder({
184
+ price: nt.unitPriceLimit(500),
185
+ workingTime: nt.goodForDay(),
186
+ }),
187
+ });
188
+
189
+ nt.strategy("Sell the spread for $1.50 or better", nt.always(), optionAction, {
190
+ orderExecution: nt.limitOrder({
191
+ price: nt.minimumNetCredit(1.5),
192
+ workingTime: nt.goodForMinutes(30),
193
+ }),
194
+ });
195
+ ```
196
+
197
+ `currentLimit()` creates a quote-relative Limit for dynamic rebalance strategies.
198
+ It keeps the no-worse-than-current-quote protection, but it is not a resting
199
+ price target. Live option strategies must choose an explicit Limit policy.
200
+
177
201
  <details>
178
202
  <summary><b>What you can build</b> — 170+ generated builders</summary>
179
203
 
@@ -301,6 +325,49 @@ await client.listPortfolios({ includePaper: true, includePositions: true });
301
325
  await client.getPortfolio(portfolioId);
302
326
  ```
303
327
 
328
+ ### Editing a saved portfolio
329
+
330
+ `updatePortfolio` applies deterministic edits with no LLM in the path. The
331
+ `operations` array is a typed union, so the compiler knows which fields each
332
+ edit needs.
333
+
334
+ ```ts
335
+ import type { PortfolioEditOperation } from "nexustrade";
336
+
337
+ const operations: PortfolioEditOperation[] = [
338
+ { type: "rename", name: "AAPL Income" },
339
+ {
340
+ type: "replaceStrategy",
341
+ targetStrategyId: strategyId, // or targetStrategyName
342
+ strategyObject: nt.strategy(
343
+ "Buy AAPL",
344
+ nt.always(),
345
+ nt.buy(nt.stockAsset("AAPL"), 25, "percent of portfolio"),
346
+ {
347
+ orderExecution: nt.limitOrder({
348
+ price: nt.unitPriceLimit(150),
349
+ workingTime: nt.goodForDay(),
350
+ }),
351
+ },
352
+ ),
353
+ },
354
+ ];
355
+
356
+ await client.updatePortfolio(portfolioId, operations, {
357
+ idempotencyKey: "aapl-limit-v1",
358
+ });
359
+ ```
360
+
361
+ The five edits are `rename`, `addStrategies`, `removeStrategies`,
362
+ `replaceStrategy`, and `replaceStrategies`. Deploy, undeploy, delete,
363
+ scheduling, and trading-policy operations are not reachable on this route.
364
+
365
+ **`replaceStrategies` replaces the whole set**, so a strategy left out of the
366
+ array is deleted. Carry unchanged strategies through verbatim, including the
367
+ `orderExecution` each already has, or a working Limit silently reverts to
368
+ Market. `removeStrategies` takes strategy ids from a fetched portfolio; removal
369
+ by name is rejected.
370
+
304
371
  Fetched portfolio handles include a typed, read-only `policy` snapshot. Trading
305
372
  policy changes are intentionally unavailable through the SDK; edit them in
306
373
  Portfolio Settings. `PortfolioHandle.toJSON()` omits the snapshot so a fetched
@@ -25,6 +25,14 @@ function asJsonObject(value) {
25
25
  }
26
26
  return value;
27
27
  }
28
+ /**
29
+ * Boundary adapter, for the same reason `asJsonObject` exists: the operation
30
+ * members are `interface`s, which TypeScript denies the implicit index
31
+ * signature `JsonObject` requires. An operation is JSON by construction.
32
+ */
33
+ function editOperationAsJsonObject(operation) {
34
+ return { ...operation };
35
+ }
28
36
  function encodeQuery(params) {
29
37
  const search = new URLSearchParams();
30
38
  for (const [key, value] of Object.entries(params)) {
@@ -843,7 +851,7 @@ class NexusTradeClient {
843
851
  throw new Error("updatePortfolio needs at least one operation.");
844
852
  }
845
853
  const response = await this.transport.request("POST", `portfolios/${encodePathSegment(portfolioId)}/operations`, {
846
- body: { operations: operations.map((operation) => ({ ...operation })) },
854
+ body: { operations: operations.map(editOperationAsJsonObject) },
847
855
  idempotencyKey: options.idempotencyKey,
848
856
  });
849
857
  if (!isJsonObject(response.portfolio)) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sessionFlatten = exports.strategy = exports.closeOption = exports.greeksTrigger = exports.daysHeldTrigger = exports.dteTrigger = exports.pnlTrigger = exports.rebalanceOption = exports.sleeve = exports.structureTemplate = exports.openOption = exports.againstParent = exports.optionsBuilder = exports.leg = exports.dynamicRebalance = exports.launchAgent = exports.alert = exports.sell = exports.buy = exports.selectPercentile = exports.selectTop = exports.filter = exports.RebalanceNetBenefit = exports.RebalanceExpectedBenefit = exports.RebalanceEstimatedCost = exports.RebalancePlannedTurnover = exports.RebalanceAllocationDrift = exports.volatilityTarget = exports.maximumDiversificationAllocation = exports.riskParityAllocation = exports.meanVarianceAllocation = exports.always = exports.andThen = exports.multi = exports.exactly = exports.fewerThan = exports.atMost = exports.atLeast = exports.or = exports.and = exports.neq = exports.eq = exports.lte = exports.gte = exports.lt = exports.gt = exports.cryptoAsset = exports.stockAsset = exports.PORTFOLIO_WIDE = exports.CANDIDATE = void 0;
4
- exports.geneUniversePipelineFilter = exports.geneSelectTopLimit = exports.geneMaxSpreadPct = exports.geneDteBracket = exports.geneStrikeDistance = exports.geneOptionDelta = exports.geneExposurePolicy = exports.geneAllocationPolicy = exports.geneStructureKind = exports.geneStopLossPct = exports.geneTakeProfitPct = exports.geneRollTriggerDte = exports.geneDeploymentPct = exports.geneTotalBudgetPct = exports.geneAllocationPct = exports.geneBuyingPowerPct = exports.geneRankSignal = exports.geneEntryCooldownDays = exports.geneExitCondition = exports.geneEntryCondition = exports.geneSubject = exports.optimization = exports.walkForward = exports.backtest = exports.SMA = exports.RSI = exports.PriceStdDev = exports.EMA = exports.BBand = exports.portfolio = void 0;
3
+ exports.currentLimit = exports.limitOrder = exports.closeOption = exports.greeksTrigger = exports.daysHeldTrigger = exports.dteTrigger = exports.pnlTrigger = exports.rebalanceOption = exports.sleeve = exports.structureTemplate = exports.openOption = exports.againstParent = exports.optionsBuilder = exports.leg = exports.dynamicRebalance = exports.launchAgent = exports.alert = exports.sell = exports.buy = exports.selectPercentile = exports.selectTop = exports.filter = exports.RebalanceNetBenefit = exports.RebalanceExpectedBenefit = exports.RebalanceEstimatedCost = exports.RebalancePlannedTurnover = exports.RebalanceAllocationDrift = exports.volatilityTarget = exports.maximumDiversificationAllocation = exports.riskParityAllocation = exports.meanVarianceAllocation = exports.always = exports.andThen = exports.multi = exports.exactly = exports.fewerThan = exports.atMost = exports.atLeast = exports.or = exports.and = exports.neq = exports.eq = exports.lte = exports.gte = exports.lt = exports.gt = exports.cryptoAsset = exports.stockAsset = exports.PORTFOLIO_WIDE = exports.CANDIDATE = void 0;
4
+ exports.geneUniversePipelineFilter = exports.geneSelectTopLimit = exports.geneMaxSpreadPct = exports.geneDteBracket = exports.geneStrikeDistance = exports.geneOptionDelta = exports.geneExposurePolicy = exports.geneAllocationPolicy = exports.geneStructureKind = exports.geneStopLossPct = exports.geneTakeProfitPct = exports.geneRollTriggerDte = exports.geneDeploymentPct = exports.geneTotalBudgetPct = exports.geneAllocationPct = exports.geneBuyingPowerPct = exports.geneRankSignal = exports.geneConditionThreshold = exports.geneConditionWindowLength = exports.geneEntryCooldownDays = exports.geneExitCondition = exports.geneEntryCondition = exports.geneSubject = exports.optimization = exports.walkForward = exports.backtest = exports.SMA = exports.RSI = exports.PriceStdDev = exports.EMA = exports.BBand = exports.portfolio = exports.sessionFlatten = exports.strategy = exports.goodForMinutes = exports.goodForDay = exports.minimumNetCredit = exports.maximumNetDebit = exports.unitPriceLimit = void 0;
5
5
  exports.universe = universe;
6
6
  exports.AbsoluteValue = AbsoluteValue;
7
7
  exports.AverageTrueRange = AverageTrueRange;
@@ -424,8 +424,43 @@ const greeksTrigger = (bounds) => compact({ type: "greeks", ...bounds });
424
424
  exports.greeksTrigger = greeksTrigger;
425
425
  const closeOption = (config = {}) => compact({ type: "CloseOption", ...config });
426
426
  exports.closeOption = closeOption;
427
+ const limitOrder = (config) => compact({ type: "Limit", ...config });
428
+ exports.limitOrder = limitOrder;
429
+ const currentLimit = () => ({
430
+ type: "QuoteRelative",
431
+ reference: "Current",
432
+ });
433
+ exports.currentLimit = currentLimit;
434
+ const unitPriceLimit = (amount) => ({
435
+ type: "UnitPrice",
436
+ amount,
437
+ });
438
+ exports.unitPriceLimit = unitPriceLimit;
439
+ const maximumNetDebit = (amount) => ({
440
+ type: "MaximumNetDebit",
441
+ amount,
442
+ });
443
+ exports.maximumNetDebit = maximumNetDebit;
444
+ const minimumNetCredit = (amount) => ({
445
+ type: "MinimumNetCredit",
446
+ amount,
447
+ });
448
+ exports.minimumNetCredit = minimumNetCredit;
449
+ const goodForDay = () => ({ type: "Day" });
450
+ exports.goodForDay = goodForDay;
451
+ const goodForMinutes = (minutes) => ({
452
+ type: "Minutes",
453
+ minutes,
454
+ });
455
+ exports.goodForMinutes = goodForMinutes;
427
456
  // ---- assembly ----
428
- const strategy = (name, condition, action, options = {}) => compact({ name, condition, action, ...options });
457
+ const strategy = (name, condition, action, options = {}) => compact({
458
+ name,
459
+ condition,
460
+ action,
461
+ ...options,
462
+ orderExecution: options.orderExecution ?? { type: "Market" },
463
+ });
429
464
  exports.strategy = strategy;
430
465
  /**
431
466
  * Session / clock flatten — condition carries the gate (MinutesAfterOpen, Day, …).
@@ -1702,6 +1737,22 @@ const geneEntryCooldownDays = (strategyIndex, values) => ({
1702
1737
  values: values,
1703
1738
  });
1704
1739
  exports.geneEntryCooldownDays = geneEntryCooldownDays;
1740
+ /** Sweep ConditionWindowLength (Strategy scope) over a value set. */
1741
+ const geneConditionWindowLength = (strategyIndex, path, slot, values) => ({
1742
+ field: "ConditionWindowLength",
1743
+ scope: "Strategy",
1744
+ target: { scope: "Strategy", field: "ConditionWindowLength", strategyIndex, path, slot },
1745
+ values: values,
1746
+ });
1747
+ exports.geneConditionWindowLength = geneConditionWindowLength;
1748
+ /** Sweep ConditionThreshold (Strategy scope) over a value set. */
1749
+ const geneConditionThreshold = (strategyIndex, path, slot, values) => ({
1750
+ field: "ConditionThreshold",
1751
+ scope: "Strategy",
1752
+ target: { scope: "Strategy", field: "ConditionThreshold", strategyIndex, path, slot },
1753
+ values: values,
1754
+ });
1755
+ exports.geneConditionThreshold = geneConditionThreshold;
1705
1756
  /** Sweep RankSignal (Action scope) over a value set. */
1706
1757
  const geneRankSignal = (strategyIndex, values) => ({
1707
1758
  field: "RankSignal",
@@ -5,7 +5,7 @@
5
5
  * pass an API key/base URL, or set NEXUSTRADE_API_KEY / NEXUSTRADE_API_BASE_URL.
6
6
  */
7
7
  import { AgentRun } from "./agent.ts";
8
- import type { JobRequest, Portfolio } from "./generated/ntSdk.generated.js";
8
+ import type { JobRequest, Portfolio, Strategy } from "./generated/ntSdk.generated.js";
9
9
  import { PortfolioHandle, type DeployResult, type PortfolioListResult } from "./portfolio.ts";
10
10
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
11
11
  [key: string]: JsonValue;
@@ -25,6 +25,59 @@ export type JsonObject = {
25
25
  */
26
26
  export type PortfolioInput = Portfolio | JsonObject;
27
27
  export type JobInput = JobRequest | JsonObject;
28
+ /**
29
+ * One deterministic portfolio edit, as accepted by
30
+ * `POST /portfolios/:id/operations`. The book is addressed by the
31
+ * `updatePortfolio` argument, so an operation never carries a portfolio id of
32
+ * its own — the route stamps it and ignores one sent in the body.
33
+ *
34
+ * Strategy payloads are FINISHED objects in the shape `strategy()` emits,
35
+ * `orderExecution` included. The server ingests them deterministically, with no
36
+ * LLM in the path; natural-language strategy strings are rejected.
37
+ */
38
+ export interface PortfolioRenameOperation {
39
+ type: "rename";
40
+ name: string;
41
+ }
42
+ /** Append strategies. Existing strategies and their open orders are untouched. */
43
+ export interface AddStrategiesOperation {
44
+ type: "addStrategies";
45
+ strategyObjects: Strategy[];
46
+ }
47
+ /**
48
+ * Remove strategies by id, as returned on a fetched portfolio's `strategies`.
49
+ * Removal by name is not supported.
50
+ */
51
+ export interface RemoveStrategiesOperation {
52
+ type: "removeStrategies";
53
+ strategyIds: string[];
54
+ }
55
+ /** Swap a single strategy. Exactly one of the two targets identifies it. */
56
+ export type ReplaceStrategyOperation = {
57
+ type: "replaceStrategy";
58
+ strategyObject: Strategy;
59
+ } & ({
60
+ targetStrategyId: string;
61
+ targetStrategyName?: never;
62
+ } | {
63
+ targetStrategyName: string;
64
+ targetStrategyId?: never;
65
+ });
66
+ /**
67
+ * Replace the whole strategy set. The array REPLACES the book, so a strategy
68
+ * left out is deleted — carry unchanged strategies through verbatim, including
69
+ * the `orderExecution` each already has.
70
+ */
71
+ export interface ReplaceStrategiesOperation {
72
+ type: "replaceStrategies";
73
+ strategyObjects: Strategy[];
74
+ }
75
+ /**
76
+ * The edits `updatePortfolio` accepts. Deploy, undeploy, delete, scheduling and
77
+ * trading-policy operations are deliberately absent: they are not reachable on
78
+ * this route, so typing them here would only compile a guaranteed 403.
79
+ */
80
+ export type PortfolioEditOperation = PortfolioRenameOperation | AddStrategiesOperation | RemoveStrategiesOperation | ReplaceStrategyOperation | ReplaceStrategiesOperation;
28
81
  export interface ListPortfoliosOptions {
29
82
  portfolioIds?: string[];
30
83
  includeInactive?: boolean;
@@ -211,7 +264,7 @@ export declare class NexusTradeClient {
211
264
  * Guest workspaces may rename and add/remove/replace strategies; deployment,
212
265
  * scheduling, policy, and trading operations remain account-only.
213
266
  */
214
- updatePortfolio(portfolioId: string, operations: ReadonlyArray<JsonObject>, options: {
267
+ updatePortfolio(portfolioId: string, operations: ReadonlyArray<PortfolioEditOperation>, options: {
215
268
  idempotencyKey: string;
216
269
  }): Promise<PortfolioHandle>;
217
270
  /** Fork a public/shared portfolio into this workspace as an editable copy. */
@@ -18,6 +18,14 @@ function asJsonObject(value) {
18
18
  }
19
19
  return value;
20
20
  }
21
+ /**
22
+ * Boundary adapter, for the same reason `asJsonObject` exists: the operation
23
+ * members are `interface`s, which TypeScript denies the implicit index
24
+ * signature `JsonObject` requires. An operation is JSON by construction.
25
+ */
26
+ function editOperationAsJsonObject(operation) {
27
+ return { ...operation };
28
+ }
21
29
  function encodeQuery(params) {
22
30
  const search = new URLSearchParams();
23
31
  for (const [key, value] of Object.entries(params)) {
@@ -833,7 +841,7 @@ export class NexusTradeClient {
833
841
  throw new Error("updatePortfolio needs at least one operation.");
834
842
  }
835
843
  const response = await this.transport.request("POST", `portfolios/${encodePathSegment(portfolioId)}/operations`, {
836
- body: { operations: operations.map((operation) => ({ ...operation })) },
844
+ body: { operations: operations.map(editOperationAsJsonObject) },
837
845
  idempotencyKey: options.idempotencyKey,
838
846
  });
839
847
  if (!isJsonObject(response.portfolio)) {
@@ -393,6 +393,32 @@ export interface CloseOptionAction {
393
393
  quantity?: CloseQuantity;
394
394
  }
395
395
  export type Action = BuyOrSellAction | DepositOrWithdrawAction | AlertAction | LaunchAgentAction | DynamicRebalanceAction | RebalanceOptionAction | OpenOptionAction | CloseOptionAction;
396
+ export type StrategyLimitWorkingTime = {
397
+ type: "Day";
398
+ } | {
399
+ type: "Minutes";
400
+ minutes: number;
401
+ };
402
+ export type StrategyLimitPricePolicy = {
403
+ type: "QuoteRelative";
404
+ reference: "Current";
405
+ } | {
406
+ type: "UnitPrice";
407
+ amount: number;
408
+ } | {
409
+ type: "MaximumNetDebit";
410
+ amount: number;
411
+ } | {
412
+ type: "MinimumNetCredit";
413
+ amount: number;
414
+ };
415
+ export type StrategyOrderExecutionPolicy = {
416
+ type: "Market";
417
+ } | {
418
+ type: "Limit";
419
+ price: StrategyLimitPricePolicy;
420
+ workingTime?: StrategyLimitWorkingTime;
421
+ };
396
422
  /**
397
423
  * `automaticOrderApproval` is deliberately absent. It is system-managed and always
398
424
  * false for agent-created strategies, and placing it on an action fails validation —
@@ -403,6 +429,8 @@ export interface Strategy {
403
429
  condition: StrategyCondition;
404
430
  action: Action;
405
431
  active?: boolean;
432
+ /** Omitted means Market. Limit always requires an explicit price policy. */
433
+ orderExecution?: StrategyOrderExecutionPolicy;
406
434
  }
407
435
  export interface Portfolio {
408
436
  name: string;
@@ -602,8 +630,19 @@ export declare const closeOption: (config?: {
602
630
  triggers?: CloseOptionTrigger[];
603
631
  quantity?: CloseQuantity;
604
632
  }) => CloseOptionAction;
633
+ export declare const limitOrder: (config: {
634
+ price: StrategyLimitPricePolicy;
635
+ workingTime?: StrategyLimitWorkingTime;
636
+ }) => StrategyOrderExecutionPolicy;
637
+ export declare const currentLimit: () => StrategyLimitPricePolicy;
638
+ export declare const unitPriceLimit: (amount: number) => StrategyLimitPricePolicy;
639
+ export declare const maximumNetDebit: (amount: number) => StrategyLimitPricePolicy;
640
+ export declare const minimumNetCredit: (amount: number) => StrategyLimitPricePolicy;
641
+ export declare const goodForDay: () => StrategyLimitWorkingTime;
642
+ export declare const goodForMinutes: (minutes: number) => StrategyLimitWorkingTime;
605
643
  export declare const strategy: (name: string, condition: StrategyCondition, action: Action, options?: {
606
644
  active?: boolean;
645
+ orderExecution?: StrategyOrderExecutionPolicy;
607
646
  }) => Strategy;
608
647
  /**
609
648
  * Session / clock flatten — condition carries the gate (MinutesAfterOpen, Day, …).
@@ -1413,6 +1452,12 @@ export declare const walkForward: (portfolio: Portfolio, config: WalkForwardConf
1413
1452
  /** Submit a genetic optimization over the portfolio's tunable genes. */
1414
1453
  export declare const optimization: (portfolio: Portfolio, config: OptimizationConfig) => JobRequest;
1415
1454
  export type SweepSortDirection = "Highest" | "Lowest";
1455
+ /**
1456
+ * Which scalar inside an addressed condition node a parametric gene varies.
1457
+ * "Lhs"/"Rhs" name the two indicators of a comparison; "Node" names the node's
1458
+ * own number (a Then chain's window, a Multi's threshold).
1459
+ */
1460
+ export type ConditionNodeSlot = "Lhs" | "Rhs" | "Node";
1416
1461
  /** One authored sweep gene. Opaque to callers — built via the gene* builders. */
1417
1462
  export interface Gene {
1418
1463
  field: string;
@@ -1434,6 +1479,10 @@ export declare const geneExitCondition: (strategyIndex: number, values: {
1434
1479
  }[]) => Gene;
1435
1480
  /** Sweep EntryCooldownDays (Strategy scope) over a value set. */
1436
1481
  export declare const geneEntryCooldownDays: (strategyIndex: number, values: number[]) => Gene;
1482
+ /** Sweep ConditionWindowLength (Strategy scope) over a value set. */
1483
+ export declare const geneConditionWindowLength: (strategyIndex: number, path: number[], slot: ConditionNodeSlot, values: number[]) => Gene;
1484
+ /** Sweep ConditionThreshold (Strategy scope) over a value set. */
1485
+ export declare const geneConditionThreshold: (strategyIndex: number, path: number[], slot: ConditionNodeSlot, values: number[]) => Gene;
1437
1486
  /** Sweep RankSignal (Action scope) over a value set. */
1438
1487
  export declare const geneRankSignal: (strategyIndex: number, values: {
1439
1488
  label: string;
@@ -264,8 +264,36 @@ export const dteTrigger = (bounds) => compact({ type: "dte", ...bounds });
264
264
  export const daysHeldTrigger = (bounds) => compact({ type: "daysHeld", ...bounds });
265
265
  export const greeksTrigger = (bounds) => compact({ type: "greeks", ...bounds });
266
266
  export const closeOption = (config = {}) => compact({ type: "CloseOption", ...config });
267
+ export const limitOrder = (config) => compact({ type: "Limit", ...config });
268
+ export const currentLimit = () => ({
269
+ type: "QuoteRelative",
270
+ reference: "Current",
271
+ });
272
+ export const unitPriceLimit = (amount) => ({
273
+ type: "UnitPrice",
274
+ amount,
275
+ });
276
+ export const maximumNetDebit = (amount) => ({
277
+ type: "MaximumNetDebit",
278
+ amount,
279
+ });
280
+ export const minimumNetCredit = (amount) => ({
281
+ type: "MinimumNetCredit",
282
+ amount,
283
+ });
284
+ export const goodForDay = () => ({ type: "Day" });
285
+ export const goodForMinutes = (minutes) => ({
286
+ type: "Minutes",
287
+ minutes,
288
+ });
267
289
  // ---- assembly ----
268
- export const strategy = (name, condition, action, options = {}) => compact({ name, condition, action, ...options });
290
+ export const strategy = (name, condition, action, options = {}) => compact({
291
+ name,
292
+ condition,
293
+ action,
294
+ ...options,
295
+ orderExecution: options.orderExecution ?? { type: "Market" },
296
+ });
269
297
  /**
270
298
  * Session / clock flatten — condition carries the gate (MinutesAfterOpen, Day, …).
271
299
  * Never pairs with always(); PnL/DTE/daysHeld exits use closeOption({ triggers }).
@@ -1532,6 +1560,20 @@ export const geneEntryCooldownDays = (strategyIndex, values) => ({
1532
1560
  target: { scope: "Strategy", field: "EntryCooldownDays", strategyIndex },
1533
1561
  values: values,
1534
1562
  });
1563
+ /** Sweep ConditionWindowLength (Strategy scope) over a value set. */
1564
+ export const geneConditionWindowLength = (strategyIndex, path, slot, values) => ({
1565
+ field: "ConditionWindowLength",
1566
+ scope: "Strategy",
1567
+ target: { scope: "Strategy", field: "ConditionWindowLength", strategyIndex, path, slot },
1568
+ values: values,
1569
+ });
1570
+ /** Sweep ConditionThreshold (Strategy scope) over a value set. */
1571
+ export const geneConditionThreshold = (strategyIndex, path, slot, values) => ({
1572
+ field: "ConditionThreshold",
1573
+ scope: "Strategy",
1574
+ target: { scope: "Strategy", field: "ConditionThreshold", strategyIndex, path, slot },
1575
+ values: values,
1576
+ });
1535
1577
  /** Sweep RankSignal (Action scope) over a value set. */
1536
1578
  export const geneRankSignal = (strategyIndex, values) => ({
1537
1579
  field: "RankSignal",
@@ -1,7 +1,7 @@
1
1
  export { AgentRun } from "./agent.js";
2
2
  export type { AgentEvent, AgentRunOptions } from "./agent.js";
3
3
  export { HttpTransport, NexusTradeApiError, NexusTradeClient, NexusTradeWorkspaceSessionExpiredError, createCustomIndicator, createPortfolio, waitForOperation, } from "./client.js";
4
- export type { BacktestCollateralStatistics, CustomIndicatorInput, CustomIndicatorPointInput, HttpTransportOptions, JsonObject, JsonValue, ListPortfoliosOptions, NexusTradeClientOptions, RequestOptions, Transport, UploadTransport, WaitOptions, WorkspaceSessionTransport, } from "./client.js";
4
+ export type { AddStrategiesOperation, BacktestCollateralStatistics, CustomIndicatorInput, CustomIndicatorPointInput, HttpTransportOptions, JsonObject, JsonValue, ListPortfoliosOptions, NexusTradeClientOptions, PortfolioEditOperation, PortfolioRenameOperation, RemoveStrategiesOperation, ReplaceStrategiesOperation, ReplaceStrategyOperation, RequestOptions, Transport, UploadTransport, WaitOptions, WorkspaceSessionTransport, } from "./client.js";
5
5
  export { PortfolioHandle, portfolioHandleFromWire, } from "./portfolio.js";
6
6
  export type { DeployOutcome, DeployResult, PortfolioHandleOptions, PortfolioListResult, PortfolioType, ReadonlyPortfolioPolicy, } from "./portfolio.js";
7
7
  export * from "./generated/ntSdk.generated.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexustrade",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Typed TypeScript SDK for NexusTrade portfolio authoring, backtesting, and optimization",
5
5
  "license": "MIT",
6
6
  "author": "Starks Technology",