nexustrade 1.41.0 → 1.52.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 +42 -4
- package/dist/cjs/client.js +2 -2
- package/dist/cjs/generated/ntSdk.generated.js +62 -2
- package/dist/esm/client.d.ts +9 -8
- package/dist/esm/client.js +2 -2
- package/dist/esm/generated/ntSdk.generated.d.ts +119 -10
- package/dist/esm/generated/ntSdk.generated.js +45 -0
- package/dist/esm/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -394,9 +394,15 @@ await client.updatePortfolio(portfolioId, operations, {
|
|
|
394
394
|
});
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
|
|
398
|
-
`
|
|
399
|
-
|
|
397
|
+
Prefer one `updatePortfolio` operation with a finished `portfolio` patch.
|
|
398
|
+
It can combine `strategies`, `deployment` (frequency and timing), `name`,
|
|
399
|
+
`policy.stockEligibility`, `dividendPolicy`, and alerts. Omitted fields retain
|
|
400
|
+
their saved values. Draft starting capital and capabilities can change only
|
|
401
|
+
before deployment. The existing strategy and rename operations remain supported.
|
|
402
|
+
Every authored operation for the target in one call commits together; validation
|
|
403
|
+
failure saves none of them. Reusing the same idempotency key replays the saved
|
|
404
|
+
result. Deploy, undeploy, delete and automated approval remain separate account
|
|
405
|
+
operations.
|
|
400
406
|
|
|
401
407
|
**`replaceStrategies` replaces the whole set**, so a strategy left out of the
|
|
402
408
|
array is deleted. Carry unchanged strategies through verbatim, including the
|
|
@@ -772,6 +778,38 @@ publication; backtests keep membership local to the run and never edit the user'
|
|
|
772
778
|
visible list. Discovery and data loads remain full, so this does not establish a
|
|
773
779
|
performance saving. Omitted amount basis uses `LowerBound`.
|
|
774
780
|
|
|
781
|
+
`updateInstitutionalWatchlist` follows an exact manager's latest publicly
|
|
782
|
+
available complete equity book. `updateInsiderWatchlist` selects qualifying
|
|
783
|
+
positive purchases by first public availability, with optional owner, issuer,
|
|
784
|
+
and role scope. Both use the same publication and consumer contract:
|
|
785
|
+
|
|
786
|
+
```ts
|
|
787
|
+
const manager = nt.updateInstitutionalWatchlist({
|
|
788
|
+
watchlistKey: "berkshire-equities", managerCik: "1067983",
|
|
789
|
+
});
|
|
790
|
+
const insider = nt.updateInsiderWatchlist({
|
|
791
|
+
watchlistKey: "insider-purchases", windowDays: 90, role: "OfficerOrDirector",
|
|
792
|
+
});
|
|
793
|
+
const screen = nt.updateScreenerWatchlist({
|
|
794
|
+
watchlistKey: "berkshire-top-20", refreshMinutes: 1440,
|
|
795
|
+
columns: [nt.screenColumn("price", nt.screenPrice()),
|
|
796
|
+
nt.screenColumn("holding", nt.screenDisclosure(manager.source))],
|
|
797
|
+
filter: nt.screenAll(nt.screenCompare("price", "Gte", 5),
|
|
798
|
+
nt.screenCompare("holding", "Gt", 0)),
|
|
799
|
+
selection: nt.screenTop("holding", 20),
|
|
800
|
+
});
|
|
801
|
+
const screenUniverse = nt.watchlistUniverse("berkshire-top-20");
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
The screen evaluates on its scheduled cadence and reuses accepted membership
|
|
805
|
+
between refreshes. Missing facts remain unknown. `screenAny` composes OR rules;
|
|
806
|
+
`screenPercentile` ranks the filtered candidates with known rank values.
|
|
807
|
+
`screenBarVolume` and `screenBarDollarVolume` require a completed historical
|
|
808
|
+
bar; live quotes do not supply those metrics in this release. Price and disclosure
|
|
809
|
+
metrics support live screens. Failed coverage or publication blocks new allocation
|
|
810
|
+
while consumers retain their exit behavior. Screen execution uses in-memory DuckDB;
|
|
811
|
+
no local database volume or LLM call is required for refreshes.
|
|
812
|
+
|
|
775
813
|
## Complete method reference
|
|
776
814
|
|
|
777
815
|
Every public method on `NexusTradeClient`. A test in this package fails if one
|
|
@@ -795,7 +833,7 @@ is missing here, so this list cannot drift from the code.
|
|
|
795
833
|
| `createPortfolio(book, { idempotencyKey })` | Persist a portfolio definition |
|
|
796
834
|
| `listPortfolios(options)` | List portfolios, with filters and pagination |
|
|
797
835
|
| `getPortfolio(portfolioId)` | Read one portfolio |
|
|
798
|
-
| `updatePortfolio(id, operations, { idempotencyKey })` |
|
|
836
|
+
| `updatePortfolio(id, operations, { idempotencyKey })` | Atomically save a finished authored portfolio patch |
|
|
799
837
|
| `forkPublicPortfolio(sharedId, { idempotencyKey })` | Fork a public portfolio into the workspace |
|
|
800
838
|
| `deploy(portfolioId, { frequency })` | Start paper trading it |
|
|
801
839
|
| `undeploy(portfolioId)` | Stop it |
|
package/dist/cjs/client.js
CHANGED
|
@@ -867,8 +867,8 @@ class NexusTradeClient {
|
|
|
867
867
|
}
|
|
868
868
|
/**
|
|
869
869
|
* Apply deterministic no-code portfolio edits without invoking Aurora.
|
|
870
|
-
*
|
|
871
|
-
*
|
|
870
|
+
* Finished authored patches can combine strategies, evaluation timing and
|
|
871
|
+
* stock eligibility in one save. Activation and automated approval remain separate.
|
|
872
872
|
*/
|
|
873
873
|
async updatePortfolio(portfolioId, operations, options) {
|
|
874
874
|
if (operations.length === 0) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
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;
|
|
@@ -12,6 +13,7 @@ exports.BollingerBand = BollingerBand;
|
|
|
12
13
|
exports.BullishFairValueGap = BullishFairValueGap;
|
|
13
14
|
exports.BuyingPower = BuyingPower;
|
|
14
15
|
exports.ChaikinMoneyFlow = ChaikinMoneyFlow;
|
|
16
|
+
exports.ChartBar = ChartBar;
|
|
15
17
|
exports.CommodityChannelIndex = CommodityChannelIndex;
|
|
16
18
|
exports.CompoundAnnualGrowthRate = CompoundAnnualGrowthRate;
|
|
17
19
|
exports.ConsecutiveDecrease = ConsecutiveDecrease;
|
|
@@ -401,6 +403,47 @@ const updateWatchlist = (config) => ({
|
|
|
401
403
|
}),
|
|
402
404
|
});
|
|
403
405
|
exports.updateWatchlist = updateWatchlist;
|
|
406
|
+
const updateInstitutionalWatchlist = (config) => ({
|
|
407
|
+
type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
|
|
408
|
+
...(config.output ? { output: config.output } : {}),
|
|
409
|
+
source: compact({ type: "InstitutionalHoldings", managerCik: config.managerCik, windowDays: config.windowDays }),
|
|
410
|
+
});
|
|
411
|
+
exports.updateInstitutionalWatchlist = updateInstitutionalWatchlist;
|
|
412
|
+
const updateInsiderWatchlist = (config) => ({
|
|
413
|
+
type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
|
|
414
|
+
...(config.output ? { output: config.output } : {}),
|
|
415
|
+
source: compact({ type: "InsiderPurchases", windowDays: config.windowDays, role: config.role,
|
|
416
|
+
ownerCik: config.ownerCik, issuerCik: config.issuerCik }),
|
|
417
|
+
});
|
|
418
|
+
exports.updateInsiderWatchlist = updateInsiderWatchlist;
|
|
419
|
+
/** 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. */
|
|
420
|
+
const updateScreenerWatchlist = (config) => ({
|
|
421
|
+
type: "UpdateWatchlist", watchlistKey: config.watchlistKey,
|
|
422
|
+
...(config.output ? { output: config.output } : {}),
|
|
423
|
+
source: compact({ type: "Screener", columns: config.columns, filter: config.filter,
|
|
424
|
+
selection: config.selection, refreshMinutes: config.refreshMinutes }),
|
|
425
|
+
});
|
|
426
|
+
exports.updateScreenerWatchlist = updateScreenerWatchlist;
|
|
427
|
+
const screenColumn = (key, metric) => ({ key, metric });
|
|
428
|
+
exports.screenColumn = screenColumn;
|
|
429
|
+
const screenPrice = () => ({ type: "ObservedPrice" });
|
|
430
|
+
exports.screenPrice = screenPrice;
|
|
431
|
+
const screenBarVolume = () => ({ type: "BarVolume" });
|
|
432
|
+
exports.screenBarVolume = screenBarVolume;
|
|
433
|
+
const screenBarDollarVolume = () => ({ type: "BarDollarVolume" });
|
|
434
|
+
exports.screenBarDollarVolume = screenBarDollarVolume;
|
|
435
|
+
const screenDisclosure = (source) => ({ type: "Disclosure", source });
|
|
436
|
+
exports.screenDisclosure = screenDisclosure;
|
|
437
|
+
const screenCompare = (field, op, value) => ({ type: "Compare", field, op, value });
|
|
438
|
+
exports.screenCompare = screenCompare;
|
|
439
|
+
const screenAll = (...rules) => ({ type: "All", rules });
|
|
440
|
+
exports.screenAll = screenAll;
|
|
441
|
+
const screenAny = (...rules) => ({ type: "Any", rules });
|
|
442
|
+
exports.screenAny = screenAny;
|
|
443
|
+
const screenTop = (field, limit, direction = "Descending") => ({ type: "Top", field, direction, limit });
|
|
444
|
+
exports.screenTop = screenTop;
|
|
445
|
+
const screenPercentile = (field, percentile, direction = "Descending") => ({ type: "Percentile", field, direction, percentile });
|
|
446
|
+
exports.screenPercentile = screenPercentile;
|
|
404
447
|
const dynamicRebalance = (config) => compact({ type: "DynamicRebalance", ...config });
|
|
405
448
|
exports.dynamicRebalance = dynamicRebalance;
|
|
406
449
|
// ---- options ----
|
|
@@ -630,6 +673,23 @@ function ChaikinMoneyFlow(asset, length = 20, interval = "Day") {
|
|
|
630
673
|
d.window = { length: length, interval: interval };
|
|
631
674
|
return d;
|
|
632
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* ChartBar indicator.
|
|
678
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
679
|
+
* @param barMinutes Completed candles aligned to 9:30 ET for stocks. Must divide the 390-minute regular session.
|
|
680
|
+
* @param line open: oldest selected candle; close: newest; high/low: range; sma: mean candle closes.
|
|
681
|
+
* @param bars Number of chart candles, not elapsed minutes. SMA20 on five-minute candles: barMinutes=5, bars=20.
|
|
682
|
+
* @param offsetBars Skip this many latest completed candles. 1 selects the previous window.
|
|
683
|
+
*/
|
|
684
|
+
function ChartBar(asset, barMinutes = 5, line = "close", bars = 1, offsetBars = 0) {
|
|
685
|
+
const d = { type: "ChartBar" };
|
|
686
|
+
setAsset(d, "targetAsset", asset);
|
|
687
|
+
d["barMinutes"] = barMinutes;
|
|
688
|
+
d["line"] = line;
|
|
689
|
+
d["bars"] = bars;
|
|
690
|
+
d["offsetBars"] = offsetBars;
|
|
691
|
+
return d;
|
|
692
|
+
}
|
|
633
693
|
/**
|
|
634
694
|
* CommodityChannelIndex indicator.
|
|
635
695
|
* @param asset Ticker name (ex. SPY, BTC)
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -72,12 +72,13 @@ export interface ReplaceStrategiesOperation {
|
|
|
72
72
|
type: "replaceStrategies";
|
|
73
73
|
strategyObjects: Strategy[];
|
|
74
74
|
}
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
/** Complete finished authored patch; omitted fields retain their saved values. */
|
|
76
|
+
export interface UpdatePortfolioOperation {
|
|
77
|
+
type: "updatePortfolio";
|
|
78
|
+
portfolio: Partial<Pick<Portfolio, "name" | "initialValue" | "strategies" | "deployment" | "policy" | "dividendPolicy" | "alertsEnabled" | "supportsFractionalShares" | "supportsCrypto">>;
|
|
79
|
+
}
|
|
80
|
+
/** All operations in one call for this portfolio are validated and saved atomically. */
|
|
81
|
+
export type PortfolioEditOperation = UpdatePortfolioOperation | PortfolioRenameOperation | AddStrategiesOperation | RemoveStrategiesOperation | ReplaceStrategyOperation | ReplaceStrategiesOperation;
|
|
81
82
|
export interface ListOrdersOptions {
|
|
82
83
|
portfolioId?: string;
|
|
83
84
|
statuses?: ReadonlyArray<OrderStatus>;
|
|
@@ -268,8 +269,8 @@ export declare class NexusTradeClient {
|
|
|
268
269
|
getPortfolio(portfolioId: string): Promise<PortfolioHandle>;
|
|
269
270
|
/**
|
|
270
271
|
* Apply deterministic no-code portfolio edits without invoking Aurora.
|
|
271
|
-
*
|
|
272
|
-
*
|
|
272
|
+
* Finished authored patches can combine strategies, evaluation timing and
|
|
273
|
+
* stock eligibility in one save. Activation and automated approval remain separate.
|
|
273
274
|
*/
|
|
274
275
|
updatePortfolio(portfolioId: string, operations: ReadonlyArray<PortfolioEditOperation>, options: {
|
|
275
276
|
idempotencyKey: string;
|
package/dist/esm/client.js
CHANGED
|
@@ -857,8 +857,8 @@ export class NexusTradeClient {
|
|
|
857
857
|
}
|
|
858
858
|
/**
|
|
859
859
|
* Apply deterministic no-code portfolio edits without invoking Aurora.
|
|
860
|
-
*
|
|
861
|
-
*
|
|
860
|
+
* Finished authored patches can combine strategies, evaluation timing and
|
|
861
|
+
* stock eligibility in one save. Activation and automated approval remain separate.
|
|
862
862
|
*/
|
|
863
863
|
async updatePortfolio(portfolioId, operations, options) {
|
|
864
864
|
if (operations.length === 0) {
|
|
@@ -268,11 +268,64 @@ export interface AlertAction {
|
|
|
268
268
|
message: string;
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
271
|
-
* Keep a portfolio-scoped list set to
|
|
272
|
-
*
|
|
271
|
+
* Keep a portfolio-scoped list set to currently public source membership.
|
|
272
|
+
* Refreshes every tick, places no orders, and
|
|
273
273
|
* takes no condition. A DynamicRebalance reads it with watchlistUniverse(key).
|
|
274
274
|
* Backtests use run-local membership; live and paper wait for durable publication.
|
|
275
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
|
+
}
|
|
276
329
|
export interface UpdateWatchlistAction {
|
|
277
330
|
type: "UpdateWatchlist";
|
|
278
331
|
watchlistKey: string;
|
|
@@ -286,16 +339,11 @@ export interface UpdateWatchlistAction {
|
|
|
286
339
|
briefCadence: "inherit" | "daily" | "weekly" | "never";
|
|
287
340
|
};
|
|
288
341
|
};
|
|
289
|
-
source:
|
|
290
|
-
type: "PoliticalRemainingPurchases";
|
|
291
|
-
memberId: string;
|
|
292
|
-
instrument?: "Equity" | "Option" | "All";
|
|
293
|
-
amountBasis?: "LowerBound" | "Midpoint" | "UpperBound";
|
|
294
|
-
chamber?: "All" | "House" | "Senate";
|
|
295
|
-
};
|
|
342
|
+
source: DisclosureWatchlistSource | ScreenerSource;
|
|
296
343
|
}
|
|
297
344
|
export interface LaunchAgentAction {
|
|
298
345
|
type: "LaunchAgent";
|
|
346
|
+
watchlistId?: string;
|
|
299
347
|
planningModel: string;
|
|
300
348
|
executionModel: string;
|
|
301
349
|
initialMessage: string;
|
|
@@ -499,6 +547,12 @@ export interface AuthoredStockEligibility {
|
|
|
499
547
|
export interface AuthoredPortfolioPolicy {
|
|
500
548
|
stockEligibility: AuthoredStockEligibility;
|
|
501
549
|
}
|
|
550
|
+
export interface AuthoredDeploymentTiming {
|
|
551
|
+
frequency: "Constant" | "OpenClose";
|
|
552
|
+
openDelayMinutes?: number;
|
|
553
|
+
closeLeadMinutes?: number;
|
|
554
|
+
intervalSeconds?: number;
|
|
555
|
+
}
|
|
502
556
|
export interface Portfolio {
|
|
503
557
|
name: string;
|
|
504
558
|
initialValue?: number;
|
|
@@ -512,6 +566,7 @@ export interface Portfolio {
|
|
|
512
566
|
/** "cash" (default when omitted) or "reinvest" into the paying stock. */
|
|
513
567
|
dividendPolicy?: DividendPolicy;
|
|
514
568
|
policy?: AuthoredPortfolioPolicy;
|
|
569
|
+
deployment?: AuthoredDeploymentTiming;
|
|
515
570
|
}
|
|
516
571
|
export type DividendPolicy = "cash" | "reinvest";
|
|
517
572
|
export type AssetType = "Stock" | "Cryptocurrency" | "Option" | "Other";
|
|
@@ -616,6 +671,7 @@ export declare const launchAgent: (config: {
|
|
|
616
671
|
continueExisting: boolean;
|
|
617
672
|
skipPlanning: boolean;
|
|
618
673
|
cooldownMinutes?: number;
|
|
674
|
+
watchlistId?: string;
|
|
619
675
|
}) => LaunchAgentAction;
|
|
620
676
|
export declare const updateWatchlist: (config: {
|
|
621
677
|
watchlistKey: string;
|
|
@@ -624,7 +680,50 @@ export declare const updateWatchlist: (config: {
|
|
|
624
680
|
instrument?: "Equity" | "Option" | "All";
|
|
625
681
|
amountBasis?: "LowerBound" | "Midpoint" | "UpperBound";
|
|
626
682
|
chamber?: "All" | "House" | "Senate";
|
|
627
|
-
}) => UpdateWatchlistAction
|
|
683
|
+
}) => UpdateWatchlistAction & {
|
|
684
|
+
source: Extract<DisclosureWatchlistSource, {
|
|
685
|
+
type: "PoliticalRemainingPurchases";
|
|
686
|
+
}>;
|
|
687
|
+
};
|
|
688
|
+
export declare const updateInstitutionalWatchlist: (config: {
|
|
689
|
+
watchlistKey: string;
|
|
690
|
+
managerCik: string;
|
|
691
|
+
windowDays?: number;
|
|
692
|
+
output?: UpdateWatchlistAction["output"];
|
|
693
|
+
}) => UpdateWatchlistAction & {
|
|
694
|
+
source: Extract<DisclosureWatchlistSource, {
|
|
695
|
+
type: "InstitutionalHoldings";
|
|
696
|
+
}>;
|
|
697
|
+
};
|
|
698
|
+
export declare const updateInsiderWatchlist: (config: {
|
|
699
|
+
watchlistKey: string;
|
|
700
|
+
windowDays: number;
|
|
701
|
+
role?: "Any" | "Officer" | "Director" | "TenPercentOwner" | "OfficerOrDirector";
|
|
702
|
+
ownerCik?: string;
|
|
703
|
+
issuerCik?: string;
|
|
704
|
+
output?: UpdateWatchlistAction["output"];
|
|
705
|
+
}) => UpdateWatchlistAction & {
|
|
706
|
+
source: Extract<DisclosureWatchlistSource, {
|
|
707
|
+
type: "InsiderPurchases";
|
|
708
|
+
}>;
|
|
709
|
+
};
|
|
710
|
+
/** 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. */
|
|
711
|
+
export declare const updateScreenerWatchlist: (config: Omit<ScreenerSource, "type"> & {
|
|
712
|
+
watchlistKey: string;
|
|
713
|
+
output?: UpdateWatchlistAction["output"];
|
|
714
|
+
}) => UpdateWatchlistAction & {
|
|
715
|
+
source: ScreenerSource;
|
|
716
|
+
};
|
|
717
|
+
export declare const screenColumn: (key: string, metric: ScreenMetric) => ScreenerSource["columns"][number];
|
|
718
|
+
export declare const screenPrice: () => ScreenMetric;
|
|
719
|
+
export declare const screenBarVolume: () => ScreenMetric;
|
|
720
|
+
export declare const screenBarDollarVolume: () => ScreenMetric;
|
|
721
|
+
export declare const screenDisclosure: (source: DisclosureWatchlistSource) => ScreenMetric;
|
|
722
|
+
export declare const screenCompare: (field: string, op: "Gt" | "Gte" | "Lt" | "Lte" | "Eq" | "Ne", value: number) => ScreenRule;
|
|
723
|
+
export declare const screenAll: (...rules: ScreenRule[]) => ScreenRule;
|
|
724
|
+
export declare const screenAny: (...rules: ScreenRule[]) => ScreenRule;
|
|
725
|
+
export declare const screenTop: (field: string, limit: number, direction?: "Ascending" | "Descending") => ScreenSelection;
|
|
726
|
+
export declare const screenPercentile: (field: string, percentile: number, direction?: "Ascending" | "Descending") => ScreenSelection;
|
|
628
727
|
export declare const dynamicRebalance: (config: {
|
|
629
728
|
universe: Universe;
|
|
630
729
|
pipeline: PipelineStage[];
|
|
@@ -756,6 +855,7 @@ export declare const portfolio: (name: string, strategies: Strategy[], options?:
|
|
|
756
855
|
alertsEnabled?: boolean;
|
|
757
856
|
dividendPolicy?: DividendPolicy;
|
|
758
857
|
policy?: AuthoredPortfolioPolicy;
|
|
858
|
+
deployment?: AuthoredDeploymentTiming;
|
|
759
859
|
}) => PortfolioHandle;
|
|
760
860
|
/**
|
|
761
861
|
* AbsoluteValue indicator.
|
|
@@ -812,6 +912,15 @@ export declare function BuyingPower(): Indicator;
|
|
|
812
912
|
* @param interval Unit of time
|
|
813
913
|
*/
|
|
814
914
|
export declare function ChaikinMoneyFlow(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
915
|
+
/**
|
|
916
|
+
* ChartBar indicator.
|
|
917
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
918
|
+
* @param barMinutes Completed candles aligned to 9:30 ET for stocks. Must divide the 390-minute regular session.
|
|
919
|
+
* @param line open: oldest selected candle; close: newest; high/low: range; sma: mean candle closes.
|
|
920
|
+
* @param bars Number of chart candles, not elapsed minutes. SMA20 on five-minute candles: barMinutes=5, bars=20.
|
|
921
|
+
* @param offsetBars Skip this many latest completed candles. 1 selects the previous window.
|
|
922
|
+
*/
|
|
923
|
+
export declare function ChartBar(asset: AssetArg, barMinutes?: number, line?: "open" | "high" | "low" | "close" | "sma", bars?: number, offsetBars?: number): Indicator;
|
|
815
924
|
/**
|
|
816
925
|
* CommodityChannelIndex indicator.
|
|
817
926
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -219,6 +219,34 @@ export const updateWatchlist = (config) => ({
|
|
|
219
219
|
chamber: config.chamber,
|
|
220
220
|
}),
|
|
221
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 });
|
|
222
250
|
export const dynamicRebalance = (config) => compact({ type: "DynamicRebalance", ...config });
|
|
223
251
|
// ---- options ----
|
|
224
252
|
/**
|
|
@@ -425,6 +453,23 @@ export function ChaikinMoneyFlow(asset, length = 20, interval = "Day") {
|
|
|
425
453
|
d.window = { length: length, interval: interval };
|
|
426
454
|
return d;
|
|
427
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* ChartBar indicator.
|
|
458
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
459
|
+
* @param barMinutes Completed candles aligned to 9:30 ET for stocks. Must divide the 390-minute regular session.
|
|
460
|
+
* @param line open: oldest selected candle; close: newest; high/low: range; sma: mean candle closes.
|
|
461
|
+
* @param bars Number of chart candles, not elapsed minutes. SMA20 on five-minute candles: barMinutes=5, bars=20.
|
|
462
|
+
* @param offsetBars Skip this many latest completed candles. 1 selects the previous window.
|
|
463
|
+
*/
|
|
464
|
+
export function ChartBar(asset, barMinutes = 5, line = "close", bars = 1, offsetBars = 0) {
|
|
465
|
+
const d = { type: "ChartBar" };
|
|
466
|
+
setAsset(d, "targetAsset", asset);
|
|
467
|
+
d["barMinutes"] = barMinutes;
|
|
468
|
+
d["line"] = line;
|
|
469
|
+
d["bars"] = bars;
|
|
470
|
+
d["offsetBars"] = offsetBars;
|
|
471
|
+
return d;
|
|
472
|
+
}
|
|
428
473
|
/**
|
|
429
474
|
* CommodityChannelIndex indicator.
|
|
430
475
|
* @param asset Ticker name (ex. SPY, BTC)
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -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 { AddStrategiesOperation, BacktestCollateralStatistics, CustomIndicatorInput, CustomIndicatorPointInput, HttpTransportOptions, JsonObject, JsonValue, ListOrdersOptions, ListPortfoliosOptions, NexusTradeClientOptions, PortfolioEditOperation, PortfolioRenameOperation, RemoveStrategiesOperation, ReplaceStrategiesOperation, ReplaceStrategyOperation, RequestOptions, Transport, UploadTransport, WaitOptions, WorkspaceSessionTransport, } from "./client.js";
|
|
4
|
+
export type { AddStrategiesOperation, BacktestCollateralStatistics, CustomIndicatorInput, CustomIndicatorPointInput, HttpTransportOptions, JsonObject, JsonValue, ListOrdersOptions, ListPortfoliosOptions, NexusTradeClientOptions, PortfolioEditOperation, UpdatePortfolioOperation, 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";
|