nexustrade 1.39.3 → 1.42.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,63 @@ 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
+
775
+ `updateInstitutionalWatchlist` follows an exact manager's latest publicly
776
+ available complete equity book. `updateInsiderWatchlist` selects qualifying
777
+ positive purchases by first public availability, with optional owner, issuer,
778
+ and role scope. Both use the same publication and consumer contract:
779
+
780
+ ```ts
781
+ const manager = nt.updateInstitutionalWatchlist({
782
+ watchlistKey: "berkshire-equities", managerCik: "1067983",
783
+ });
784
+ const insider = nt.updateInsiderWatchlist({
785
+ watchlistKey: "insider-purchases", windowDays: 90, role: "OfficerOrDirector",
786
+ });
787
+ const screen = nt.updateScreenerWatchlist({
788
+ watchlistKey: "berkshire-top-20", refreshMinutes: 1440,
789
+ columns: [nt.screenColumn("price", nt.screenPrice()),
790
+ nt.screenColumn("holding", nt.screenDisclosure(manager.source))],
791
+ filter: nt.screenAll(nt.screenCompare("price", "Gte", 5),
792
+ nt.screenCompare("holding", "Gt", 0)),
793
+ selection: nt.screenTop("holding", 20),
794
+ });
795
+ const screenUniverse = nt.watchlistUniverse("berkshire-top-20");
796
+ ```
797
+
798
+ The screen evaluates on its scheduled cadence and reuses accepted membership
799
+ between refreshes. Missing facts remain unknown. `screenAny` composes OR rules;
800
+ `screenPercentile` ranks the filtered candidates with known rank values.
801
+ `screenBarVolume` and `screenBarDollarVolume` require a completed historical
802
+ bar; live quotes do not supply those metrics in this release. Price and disclosure
803
+ metrics support live screens. Failed coverage or publication blocks new allocation
804
+ while consumers retain their exit behavior. Screen execution uses in-memory DuckDB;
805
+ no local database volume or LLM call is required for refreshes.
806
+
750
807
  ## Complete method reference
751
808
 
752
809
  Every public method on `NexusTradeClient`. A test in this package fails if one
@@ -1,7 +1,8 @@
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.screenPercentile = exports.screenTop = exports.screenAny = exports.screenAll = exports.screenCompare = exports.screenDisclosure = exports.screenBarDollarVolume = exports.screenBarVolume = exports.screenPrice = exports.screenColumn = exports.updateScreenerWatchlist = exports.updateInsiderWatchlist = exports.updateInstitutionalWatchlist = 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.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 = 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 = void 0;
5
+ exports.geneUniversePipelineFilter = exports.geneSelectTopLimit = exports.geneMaxSpreadPct = exports.geneDteBracket = exports.geneStrikeDistance = exports.geneOptionDelta = void 0;
5
6
  exports.universe = universe;
6
7
  exports.AbsoluteValue = AbsoluteValue;
7
8
  exports.AccumulationDistribution = AccumulationDistribution;
@@ -376,6 +377,9 @@ function universe(source, assets) {
376
377
  }
377
378
  return { source };
378
379
  }
380
+ /** The latest revision of the list an updateWatchlist producer in this portfolio maintains. */
381
+ const watchlistUniverse = (watchlistKey) => ({ source: "WATCHLIST", watchlistKey });
382
+ exports.watchlistUniverse = watchlistUniverse;
379
383
  // ---- equity + cash actions ----
380
384
  const buy = (target, amount, type = "percent of portfolio") => ({ type: "Buy", targetAsset: toAsset(target), amount: { type, amount } });
381
385
  exports.buy = buy;
@@ -385,6 +389,60 @@ const alert = (message) => ({ type: "Alert", message });
385
389
  exports.alert = alert;
386
390
  const launchAgent = (config) => compact({ type: "LaunchAgent", ...config });
387
391
  exports.launchAgent = launchAgent;
392
+ const updateWatchlist = (config) => ({
393
+ type: "UpdateWatchlist",
394
+ watchlistKey: config.watchlistKey,
395
+ ...(config.output ? { output: config.output } : {}),
396
+ source: compact({
397
+ type: "PoliticalRemainingPurchases",
398
+ memberId: config.memberId,
399
+ instrument: config.instrument,
400
+ amountBasis: config.amountBasis,
401
+ chamber: config.chamber,
402
+ }),
403
+ });
404
+ exports.updateWatchlist = updateWatchlist;
405
+ const updateInstitutionalWatchlist = (config) => ({
406
+ type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
407
+ ...(config.output ? { output: config.output } : {}),
408
+ source: compact({ type: "InstitutionalHoldings", managerCik: config.managerCik, windowDays: config.windowDays }),
409
+ });
410
+ exports.updateInstitutionalWatchlist = updateInstitutionalWatchlist;
411
+ const updateInsiderWatchlist = (config) => ({
412
+ type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
413
+ ...(config.output ? { output: config.output } : {}),
414
+ source: compact({ type: "InsiderPurchases", windowDays: config.windowDays, role: config.role,
415
+ ownerCik: config.ownerCik, issuerCik: config.issuerCik }),
416
+ });
417
+ exports.updateInsiderWatchlist = updateInsiderWatchlist;
418
+ /** Scalar PIT screen: facts are sampled only when due. Volume uses certified completed historical OHLC at the replay interval; live quote/trade volume stays unknown. */
419
+ const updateScreenerWatchlist = (config) => ({
420
+ type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
421
+ ...(config.output ? { output: config.output } : {}),
422
+ source: compact({ type: "Screener", columns: config.columns, filter: config.filter,
423
+ selection: config.selection, refreshMinutes: config.refreshMinutes }),
424
+ });
425
+ exports.updateScreenerWatchlist = updateScreenerWatchlist;
426
+ const screenColumn = (key, metric) => ({ key, metric });
427
+ exports.screenColumn = screenColumn;
428
+ const screenPrice = () => ({ type: "ObservedPrice" });
429
+ exports.screenPrice = screenPrice;
430
+ const screenBarVolume = () => ({ type: "BarVolume" });
431
+ exports.screenBarVolume = screenBarVolume;
432
+ const screenBarDollarVolume = () => ({ type: "BarDollarVolume" });
433
+ exports.screenBarDollarVolume = screenBarDollarVolume;
434
+ const screenDisclosure = (source) => ({ type: "Disclosure", source });
435
+ exports.screenDisclosure = screenDisclosure;
436
+ const screenCompare = (field, op, value) => ({ type: "Compare", field, op, value });
437
+ exports.screenCompare = screenCompare;
438
+ const screenAll = (...rules) => ({ type: "All", rules });
439
+ exports.screenAll = screenAll;
440
+ const screenAny = (...rules) => ({ type: "Any", rules });
441
+ exports.screenAny = screenAny;
442
+ const screenTop = (field, limit, direction = "Descending") => ({ type: "Top", field, direction, limit });
443
+ exports.screenTop = screenTop;
444
+ const screenPercentile = (field, percentile, direction = "Descending") => ({ type: "Percentile", field, direction, percentile });
445
+ exports.screenPercentile = screenPercentile;
388
446
  const dynamicRebalance = (config) => compact({ type: "DynamicRebalance", ...config });
389
447
  exports.dynamicRebalance = dynamicRebalance;
390
448
  // ---- 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,8 +267,83 @@ export interface AlertAction {
264
267
  type: "Alert";
265
268
  message: string;
266
269
  }
270
+ /**
271
+ * Keep a portfolio-scoped list set to currently public source membership.
272
+ * 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 type DisclosureWatchlistSource = {
277
+ type: "PoliticalRemainingPurchases";
278
+ memberId: string;
279
+ instrument?: "Equity" | "Option" | "All";
280
+ amountBasis?: "LowerBound" | "Midpoint" | "UpperBound";
281
+ chamber?: "All" | "House" | "Senate";
282
+ } | {
283
+ type: "InstitutionalHoldings";
284
+ managerCik: string;
285
+ windowDays?: number;
286
+ } | {
287
+ type: "InsiderPurchases";
288
+ windowDays: number;
289
+ role?: "Any" | "Officer" | "Director" | "TenPercentOwner" | "OfficerOrDirector";
290
+ ownerCik?: string;
291
+ issuerCik?: string;
292
+ };
293
+ export type ScreenMetric = {
294
+ type: "ObservedPrice" | "BarVolume" | "BarDollarVolume";
295
+ } | {
296
+ type: "Disclosure";
297
+ source: DisclosureWatchlistSource;
298
+ };
299
+ export type ScreenRule = {
300
+ type: "Compare";
301
+ field: string;
302
+ op: "Gt" | "Gte" | "Lt" | "Lte" | "Eq" | "Ne";
303
+ value: number;
304
+ } | {
305
+ type: "All" | "Any";
306
+ rules: ScreenRule[];
307
+ };
308
+ export type ScreenSelection = {
309
+ type: "Top";
310
+ field: string;
311
+ direction: "Ascending" | "Descending";
312
+ limit: number;
313
+ } | {
314
+ type: "Percentile";
315
+ field: string;
316
+ direction: "Ascending" | "Descending";
317
+ percentile: number;
318
+ };
319
+ export interface ScreenerSource {
320
+ type: "Screener";
321
+ columns: {
322
+ key: string;
323
+ metric: ScreenMetric;
324
+ }[];
325
+ filter: ScreenRule;
326
+ selection?: ScreenSelection;
327
+ refreshMinutes: number;
328
+ }
329
+ export interface UpdateWatchlistAction {
330
+ type: "UpdateWatchlist";
331
+ watchlistKey: string;
332
+ output?: {
333
+ name?: string;
334
+ purpose?: string;
335
+ alertSettings?: {
336
+ onChange: boolean;
337
+ inApp: boolean;
338
+ email: boolean;
339
+ briefCadence: "inherit" | "daily" | "weekly" | "never";
340
+ };
341
+ };
342
+ source: DisclosureWatchlistSource | ScreenerSource;
343
+ }
267
344
  export interface LaunchAgentAction {
268
345
  type: "LaunchAgent";
346
+ watchlistId?: string;
269
347
  planningModel: string;
270
348
  executionModel: string;
271
349
  initialMessage: string;
@@ -406,7 +484,7 @@ export interface CloseOptionAction {
406
484
  triggers?: CloseOptionTrigger[];
407
485
  quantity?: CloseQuantity;
408
486
  }
409
- export type Action = BuyOrSellAction | DepositOrWithdrawAction | AlertAction | LaunchAgentAction | DynamicRebalanceAction | RebalanceOptionAction | OpenOptionAction | CloseOptionAction;
487
+ export type Action = BuyOrSellAction | DepositOrWithdrawAction | AlertAction | LaunchAgentAction | DynamicRebalanceAction | RebalanceOptionAction | OpenOptionAction | CloseOptionAction | UpdateWatchlistAction;
410
488
  export type StrategyLimitWorkingTime = {
411
489
  type: "Day";
412
490
  } | {
@@ -488,7 +566,7 @@ export type AssetType = "Stock" | "Cryptocurrency" | "Option" | "Other";
488
566
  export type Interval = "Day" | "Hour" | "Minute";
489
567
  export type Comparator = "lessThan" | "greaterThan" | "lessThanOrEqual" | "greaterThanOrEqual" | "equal" | "notEqual";
490
568
  export type SelectDirection = "Highest" | "Lowest";
491
- export type UniverseSource = "ALL_US_STOCKS" | "SP500" | "NASDAQ100" | "DJIA" | "CRYPTO" | "SPECIFIC_ASSETS";
569
+ export type UniverseSource = "ALL_US_STOCKS" | "SP500" | "NASDAQ100" | "DJIA" | "CRYPTO" | "SPECIFIC_ASSETS" | "WATCHLIST";
492
570
  export type AllocationType = "percent of portfolio" | "percent of buying power" | "percent of current positions" | "dollars" | "number of assets";
493
571
  export type DepositWithdrawAllocationType = "percent of portfolio" | "percent of buying power" | "dollars";
494
572
  export type OptionAllocationType = "dollars" | "percent of portfolio" | "percent of buying power" | "contracts" | "percent of realized premium";
@@ -572,6 +650,8 @@ export declare const selectTop: (metric: Indicator, limit: number, direction?: S
572
650
  export declare const selectPercentile: (metric: Indicator, percentile: number, direction?: SelectDirection) => PipelineStage;
573
651
  export declare function universe(source: "ALL_US_STOCKS" | "SP500" | "NASDAQ100" | "DJIA" | "CRYPTO"): Universe;
574
652
  export declare function universe(source: "SPECIFIC_ASSETS", assets: AssetArg[]): Universe;
653
+ /** The latest revision of the list an updateWatchlist producer in this portfolio maintains. */
654
+ export declare const watchlistUniverse: (watchlistKey: string) => Universe;
575
655
  export declare const buy: (target: AssetArg, amount: number, type?: AllocationType) => BuyOrSellAction;
576
656
  export declare const sell: (target: AssetArg, amount: number, type?: AllocationType) => BuyOrSellAction;
577
657
  export declare const alert: (message: string) => AlertAction;
@@ -584,7 +664,59 @@ export declare const launchAgent: (config: {
584
664
  continueExisting: boolean;
585
665
  skipPlanning: boolean;
586
666
  cooldownMinutes?: number;
667
+ watchlistId?: string;
587
668
  }) => LaunchAgentAction;
669
+ export declare const updateWatchlist: (config: {
670
+ watchlistKey: string;
671
+ memberId: string;
672
+ output?: UpdateWatchlistAction["output"];
673
+ instrument?: "Equity" | "Option" | "All";
674
+ amountBasis?: "LowerBound" | "Midpoint" | "UpperBound";
675
+ chamber?: "All" | "House" | "Senate";
676
+ }) => UpdateWatchlistAction & {
677
+ source: Extract<DisclosureWatchlistSource, {
678
+ type: "PoliticalRemainingPurchases";
679
+ }>;
680
+ };
681
+ export declare const updateInstitutionalWatchlist: (config: {
682
+ watchlistKey: string;
683
+ managerCik: string;
684
+ windowDays?: number;
685
+ output?: UpdateWatchlistAction["output"];
686
+ }) => UpdateWatchlistAction & {
687
+ source: Extract<DisclosureWatchlistSource, {
688
+ type: "InstitutionalHoldings";
689
+ }>;
690
+ };
691
+ export declare const updateInsiderWatchlist: (config: {
692
+ watchlistKey: string;
693
+ windowDays: number;
694
+ role?: "Any" | "Officer" | "Director" | "TenPercentOwner" | "OfficerOrDirector";
695
+ ownerCik?: string;
696
+ issuerCik?: string;
697
+ output?: UpdateWatchlistAction["output"];
698
+ }) => UpdateWatchlistAction & {
699
+ source: Extract<DisclosureWatchlistSource, {
700
+ type: "InsiderPurchases";
701
+ }>;
702
+ };
703
+ /** Scalar PIT screen: facts are sampled only when due. Volume uses certified completed historical OHLC at the replay interval; live quote/trade volume stays unknown. */
704
+ export declare const updateScreenerWatchlist: (config: Omit<ScreenerSource, "type"> & {
705
+ watchlistKey: string;
706
+ output?: UpdateWatchlistAction["output"];
707
+ }) => UpdateWatchlistAction & {
708
+ source: ScreenerSource;
709
+ };
710
+ export declare const screenColumn: (key: string, metric: ScreenMetric) => ScreenerSource["columns"][number];
711
+ export declare const screenPrice: () => ScreenMetric;
712
+ export declare const screenBarVolume: () => ScreenMetric;
713
+ export declare const screenBarDollarVolume: () => ScreenMetric;
714
+ export declare const screenDisclosure: (source: DisclosureWatchlistSource) => ScreenMetric;
715
+ export declare const screenCompare: (field: string, op: "Gt" | "Gte" | "Lt" | "Lte" | "Eq" | "Ne", value: number) => ScreenRule;
716
+ export declare const screenAll: (...rules: ScreenRule[]) => ScreenRule;
717
+ export declare const screenAny: (...rules: ScreenRule[]) => ScreenRule;
718
+ export declare const screenTop: (field: string, limit: number, direction?: "Ascending" | "Descending") => ScreenSelection;
719
+ export declare const screenPercentile: (field: string, percentile: number, direction?: "Ascending" | "Descending") => ScreenSelection;
588
720
  export declare const dynamicRebalance: (config: {
589
721
  universe: Universe;
590
722
  pipeline: PipelineStage[];
@@ -200,11 +200,53 @@ 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
+ });
222
+ export const updateInstitutionalWatchlist = (config) => ({
223
+ type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
224
+ ...(config.output ? { output: config.output } : {}),
225
+ source: compact({ type: "InstitutionalHoldings", managerCik: config.managerCik, windowDays: config.windowDays }),
226
+ });
227
+ export const updateInsiderWatchlist = (config) => ({
228
+ type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
229
+ ...(config.output ? { output: config.output } : {}),
230
+ source: compact({ type: "InsiderPurchases", windowDays: config.windowDays, role: config.role,
231
+ ownerCik: config.ownerCik, issuerCik: config.issuerCik }),
232
+ });
233
+ /** Scalar PIT screen: facts are sampled only when due. Volume uses certified completed historical OHLC at the replay interval; live quote/trade volume stays unknown. */
234
+ export const updateScreenerWatchlist = (config) => ({
235
+ type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
236
+ ...(config.output ? { output: config.output } : {}),
237
+ source: compact({ type: "Screener", columns: config.columns, filter: config.filter,
238
+ selection: config.selection, refreshMinutes: config.refreshMinutes }),
239
+ });
240
+ export const screenColumn = (key, metric) => ({ key, metric });
241
+ export const screenPrice = () => ({ type: "ObservedPrice" });
242
+ export const screenBarVolume = () => ({ type: "BarVolume" });
243
+ export const screenBarDollarVolume = () => ({ type: "BarDollarVolume" });
244
+ export const screenDisclosure = (source) => ({ type: "Disclosure", source });
245
+ export const screenCompare = (field, op, value) => ({ type: "Compare", field, op, value });
246
+ export const screenAll = (...rules) => ({ type: "All", rules });
247
+ export const screenAny = (...rules) => ({ type: "Any", rules });
248
+ export const screenTop = (field, limit, direction = "Descending") => ({ type: "Top", field, direction, limit });
249
+ export const screenPercentile = (field, percentile, direction = "Descending") => ({ type: "Percentile", field, direction, percentile });
208
250
  export const dynamicRebalance = (config) => compact({ type: "DynamicRebalance", ...config });
209
251
  // ---- options ----
210
252
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexustrade",
3
- "version": "1.39.3",
3
+ "version": "1.42.0",
4
4
  "description": "Typed TypeScript SDK for NexusTrade portfolio authoring, backtesting, and optimization",
5
5
  "license": "MIT",
6
6
  "author": "Starks Technology",