nexustrade 1.39.3 → 1.41.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
@@ -747,6 +747,31 @@ tables; your SQL does not change when it does.
747
747
  > The Python SDK additionally ships `nt.lake.sql(...)`, a DuckDB/pandas
748
748
  > convenience layer over these same endpoints.
749
749
 
750
+ ## Managed watchlist universes
751
+
752
+ `nt.updateWatchlist({watchlistKey, memberId, instrument, amountBasis, chamber, output})`
753
+ maintains a visible managed list from `PoliticalRemainingPurchases`. Its strategy
754
+ has no condition and places no orders. `nt.watchlistUniverse(watchlistKey)` selects
755
+ that producer's committed membership for a separate `DynamicRebalance` in the same
756
+ portfolio. Each key has one producer and may have several consumers. Other action
757
+ types cannot consume this universe.
758
+
759
+ ```ts
760
+ const producer = nt.updateWatchlist({
761
+ watchlistKey: "pelosi-holdings", memberId: "P000197", instrument: "Equity",
762
+ amountBasis: "Midpoint", chamber: "All",
763
+ output: {name: "Pelosi disclosed holdings", purpose: "Follow public holdings",
764
+ alertSettings: {onChange: true, inApp: true, email: true, briefCadence: "weekly"}},
765
+ });
766
+ const consumerUniverse = nt.watchlistUniverse("pelosi-holdings");
767
+ ```
768
+
769
+ `output` supplies initial name, purpose and alerts. Subsequent user renames and
770
+ settings remain authoritative. Live and paper consumers wait for durable list
771
+ publication; backtests keep membership local to the run and never edit the user's
772
+ visible list. Discovery and data loads remain full, so this does not establish a
773
+ performance saving. Omitted amount basis uses `LowerBound`.
774
+
750
775
  ## Complete method reference
751
776
 
752
777
  Every public method on `NexusTradeClient`. A test in this package fails if one
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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.geneReplaceExitCondition = exports.geneExitCondition = exports.geneReplaceEntryCondition = 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;
3
+ 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.updateWatchlist = exports.launchAgent = exports.alert = exports.sell = exports.buy = exports.watchlistUniverse = 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.geneReplaceExitCondition = exports.geneExitCondition = exports.geneReplaceEntryCondition = 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 = exports.currentLimit = exports.limitOrder = void 0;
5
5
  exports.universe = universe;
6
6
  exports.AbsoluteValue = AbsoluteValue;
7
7
  exports.AccumulationDistribution = AccumulationDistribution;
@@ -376,6 +376,9 @@ function universe(source, assets) {
376
376
  }
377
377
  return { source };
378
378
  }
379
+ /** The latest revision of the list an updateWatchlist producer in this portfolio maintains. */
380
+ const watchlistUniverse = (watchlistKey) => ({ source: "WATCHLIST", watchlistKey });
381
+ exports.watchlistUniverse = watchlistUniverse;
379
382
  // ---- equity + cash actions ----
380
383
  const buy = (target, amount, type = "percent of portfolio") => ({ type: "Buy", targetAsset: toAsset(target), amount: { type, amount } });
381
384
  exports.buy = buy;
@@ -385,6 +388,19 @@ const alert = (message) => ({ type: "Alert", message });
385
388
  exports.alert = alert;
386
389
  const launchAgent = (config) => compact({ type: "LaunchAgent", ...config });
387
390
  exports.launchAgent = launchAgent;
391
+ const updateWatchlist = (config) => ({
392
+ type: "UpdateWatchlist",
393
+ watchlistKey: config.watchlistKey,
394
+ ...(config.output ? { output: config.output } : {}),
395
+ source: compact({
396
+ type: "PoliticalRemainingPurchases",
397
+ memberId: config.memberId,
398
+ instrument: config.instrument,
399
+ amountBasis: config.amountBasis,
400
+ chamber: config.chamber,
401
+ }),
402
+ });
403
+ exports.updateWatchlist = updateWatchlist;
388
404
  const dynamicRebalance = (config) => compact({ type: "DynamicRebalance", ...config });
389
405
  exports.dynamicRebalance = dynamicRebalance;
390
406
  // ---- options ----
@@ -72,6 +72,9 @@ export type Universe = {
72
72
  } | {
73
73
  source: "SPECIFIC_ASSETS";
74
74
  assets: Asset[];
75
+ } | {
76
+ source: "WATCHLIST";
77
+ watchlistKey: string;
75
78
  };
76
79
  export interface Allocation {
77
80
  type: AllocationType;
@@ -264,6 +267,33 @@ export interface AlertAction {
264
267
  type: "Alert";
265
268
  message: string;
266
269
  }
270
+ /**
271
+ * Keep a portfolio-scoped list set to every security where a member of Congress
272
+ * still holds disclosed purchases. Refreshes every tick, places no orders, and
273
+ * takes no condition. A DynamicRebalance reads it with watchlistUniverse(key).
274
+ * Backtests use run-local membership; live and paper wait for durable publication.
275
+ */
276
+ export interface UpdateWatchlistAction {
277
+ type: "UpdateWatchlist";
278
+ watchlistKey: string;
279
+ output?: {
280
+ name?: string;
281
+ purpose?: string;
282
+ alertSettings?: {
283
+ onChange: boolean;
284
+ inApp: boolean;
285
+ email: boolean;
286
+ briefCadence: "inherit" | "daily" | "weekly" | "never";
287
+ };
288
+ };
289
+ source: {
290
+ type: "PoliticalRemainingPurchases";
291
+ memberId: string;
292
+ instrument?: "Equity" | "Option" | "All";
293
+ amountBasis?: "LowerBound" | "Midpoint" | "UpperBound";
294
+ chamber?: "All" | "House" | "Senate";
295
+ };
296
+ }
267
297
  export interface LaunchAgentAction {
268
298
  type: "LaunchAgent";
269
299
  planningModel: string;
@@ -406,7 +436,7 @@ export interface CloseOptionAction {
406
436
  triggers?: CloseOptionTrigger[];
407
437
  quantity?: CloseQuantity;
408
438
  }
409
- export type Action = BuyOrSellAction | DepositOrWithdrawAction | AlertAction | LaunchAgentAction | DynamicRebalanceAction | RebalanceOptionAction | OpenOptionAction | CloseOptionAction;
439
+ export type Action = BuyOrSellAction | DepositOrWithdrawAction | AlertAction | LaunchAgentAction | DynamicRebalanceAction | RebalanceOptionAction | OpenOptionAction | CloseOptionAction | UpdateWatchlistAction;
410
440
  export type StrategyLimitWorkingTime = {
411
441
  type: "Day";
412
442
  } | {
@@ -488,7 +518,7 @@ export type AssetType = "Stock" | "Cryptocurrency" | "Option" | "Other";
488
518
  export type Interval = "Day" | "Hour" | "Minute";
489
519
  export type Comparator = "lessThan" | "greaterThan" | "lessThanOrEqual" | "greaterThanOrEqual" | "equal" | "notEqual";
490
520
  export type SelectDirection = "Highest" | "Lowest";
491
- export type UniverseSource = "ALL_US_STOCKS" | "SP500" | "NASDAQ100" | "DJIA" | "CRYPTO" | "SPECIFIC_ASSETS";
521
+ export type UniverseSource = "ALL_US_STOCKS" | "SP500" | "NASDAQ100" | "DJIA" | "CRYPTO" | "SPECIFIC_ASSETS" | "WATCHLIST";
492
522
  export type AllocationType = "percent of portfolio" | "percent of buying power" | "percent of current positions" | "dollars" | "number of assets";
493
523
  export type DepositWithdrawAllocationType = "percent of portfolio" | "percent of buying power" | "dollars";
494
524
  export type OptionAllocationType = "dollars" | "percent of portfolio" | "percent of buying power" | "contracts" | "percent of realized premium";
@@ -572,6 +602,8 @@ export declare const selectTop: (metric: Indicator, limit: number, direction?: S
572
602
  export declare const selectPercentile: (metric: Indicator, percentile: number, direction?: SelectDirection) => PipelineStage;
573
603
  export declare function universe(source: "ALL_US_STOCKS" | "SP500" | "NASDAQ100" | "DJIA" | "CRYPTO"): Universe;
574
604
  export declare function universe(source: "SPECIFIC_ASSETS", assets: AssetArg[]): Universe;
605
+ /** The latest revision of the list an updateWatchlist producer in this portfolio maintains. */
606
+ export declare const watchlistUniverse: (watchlistKey: string) => Universe;
575
607
  export declare const buy: (target: AssetArg, amount: number, type?: AllocationType) => BuyOrSellAction;
576
608
  export declare const sell: (target: AssetArg, amount: number, type?: AllocationType) => BuyOrSellAction;
577
609
  export declare const alert: (message: string) => AlertAction;
@@ -585,6 +617,14 @@ export declare const launchAgent: (config: {
585
617
  skipPlanning: boolean;
586
618
  cooldownMinutes?: number;
587
619
  }) => LaunchAgentAction;
620
+ export declare const updateWatchlist: (config: {
621
+ watchlistKey: string;
622
+ memberId: string;
623
+ output?: UpdateWatchlistAction["output"];
624
+ instrument?: "Equity" | "Option" | "All";
625
+ amountBasis?: "LowerBound" | "Midpoint" | "UpperBound";
626
+ chamber?: "All" | "House" | "Senate";
627
+ }) => UpdateWatchlistAction;
588
628
  export declare const dynamicRebalance: (config: {
589
629
  universe: Universe;
590
630
  pipeline: PipelineStage[];
@@ -200,11 +200,25 @@ export function universe(source, assets) {
200
200
  }
201
201
  return { source };
202
202
  }
203
+ /** The latest revision of the list an updateWatchlist producer in this portfolio maintains. */
204
+ export const watchlistUniverse = (watchlistKey) => ({ source: "WATCHLIST", watchlistKey });
203
205
  // ---- equity + cash actions ----
204
206
  export const buy = (target, amount, type = "percent of portfolio") => ({ type: "Buy", targetAsset: toAsset(target), amount: { type, amount } });
205
207
  export const sell = (target, amount, type = "percent of portfolio") => ({ type: "Sell", targetAsset: toAsset(target), amount: { type, amount } });
206
208
  export const alert = (message) => ({ type: "Alert", message });
207
209
  export const launchAgent = (config) => compact({ type: "LaunchAgent", ...config });
210
+ export const updateWatchlist = (config) => ({
211
+ type: "UpdateWatchlist",
212
+ watchlistKey: config.watchlistKey,
213
+ ...(config.output ? { output: config.output } : {}),
214
+ source: compact({
215
+ type: "PoliticalRemainingPurchases",
216
+ memberId: config.memberId,
217
+ instrument: config.instrument,
218
+ amountBasis: config.amountBasis,
219
+ chamber: config.chamber,
220
+ }),
221
+ });
208
222
  export const dynamicRebalance = (config) => compact({ type: "DynamicRebalance", ...config });
209
223
  // ---- options ----
210
224
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexustrade",
3
- "version": "1.39.3",
3
+ "version": "1.41.0",
4
4
  "description": "Typed TypeScript SDK for NexusTrade portfolio authoring, backtesting, and optimization",
5
5
  "license": "MIT",
6
6
  "author": "Starks Technology",