nexustrade 1.0.0 → 1.2.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/AGENTS.md +49 -3
- package/README.md +361 -63
- package/dist/cjs/client.js +382 -9
- package/dist/cjs/generated/ntSdk.generated.js +51 -0
- package/dist/esm/client.d.ts +98 -0
- package/dist/esm/client.js +381 -8
- package/dist/esm/generated/ntSdk.generated.d.ts +51 -4
- package/dist/esm/generated/ntSdk.generated.js +47 -0
- package/package.json +1 -1
|
@@ -131,6 +131,15 @@ export interface GreekFilter {
|
|
|
131
131
|
minRho?: number;
|
|
132
132
|
maxRho?: number;
|
|
133
133
|
}
|
|
134
|
+
/** Bid/ask constraints applied with `greekFilter` during resolution; a candidate must pass both. */
|
|
135
|
+
export interface LiquidityFilter {
|
|
136
|
+
/** Max (ask-bid)/mid. Preferred: $0.50 is 50% of a $1.00 contract, 1.7% of a $30.00 one. */
|
|
137
|
+
maxSpreadPct?: number;
|
|
138
|
+
/** Max ask-bid in dollars. When both bounds are set, both must pass. */
|
|
139
|
+
maxSpreadAbsolute?: number;
|
|
140
|
+
/** Minimum bid — excludes contracts you cannot sell into. */
|
|
141
|
+
minBid?: number;
|
|
142
|
+
}
|
|
134
143
|
export interface OptionsBuilderLeg {
|
|
135
144
|
optionType: OptionType;
|
|
136
145
|
direction: OptionDirection;
|
|
@@ -142,6 +151,7 @@ export interface OptionsBuilderLeg {
|
|
|
142
151
|
expirationRange?: ExpirationRange;
|
|
143
152
|
ratio?: number;
|
|
144
153
|
greekFilter?: GreekFilter;
|
|
154
|
+
liquidityFilter?: LiquidityFilter;
|
|
145
155
|
}
|
|
146
156
|
/** Shared fields for `leg(...)` (discriminated on distanceType). */
|
|
147
157
|
export type LegConfigBase = {
|
|
@@ -154,6 +164,7 @@ export type LegConfigBase = {
|
|
|
154
164
|
expirationRange?: ExpirationRange;
|
|
155
165
|
ratio?: number;
|
|
156
166
|
greekFilter?: GreekFilter;
|
|
167
|
+
liquidityFilter?: LiquidityFilter;
|
|
157
168
|
};
|
|
158
169
|
/** Percent/dollars strike — fallback optional. */
|
|
159
170
|
export type LegConfigPercentOrDollars = LegConfigBase & {
|
|
@@ -710,11 +721,17 @@ export declare function GapSize(asset: AssetArg): Indicator;
|
|
|
710
721
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
711
722
|
*/
|
|
712
723
|
export declare function HighOfDay(asset: AssetArg): Indicator;
|
|
724
|
+
/**
|
|
725
|
+
* ImpliedVolatility indicator.
|
|
726
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
727
|
+
* @param dte Target constant-maturity tenor in calendar days (e.g. 30)
|
|
728
|
+
*/
|
|
729
|
+
export declare function ImpliedVolatility(asset: AssetArg, dte?: number): Indicator;
|
|
713
730
|
/**
|
|
714
731
|
* Index indicator.
|
|
715
732
|
* @param metric Ticker key matching hydrated index price data (add more in BigQuery + rehydrate as needed)
|
|
716
733
|
*/
|
|
717
|
-
export declare function Index(metric?: "VIX" | "SPX" | "NDX" | "DJI" | "RUT" | "SKEW" | "VVIX" | "
|
|
734
|
+
export declare function Index(metric?: "VIX" | "SPX" | "NDX" | "DJI" | "RUT" | "SKEW" | "VVIX" | "USDBROAD" | "TNX"): Indicator;
|
|
718
735
|
/**
|
|
719
736
|
* IndicatorAtMinutesAfterOpen indicator.
|
|
720
737
|
* @param minutesAfterOpen The number of minutes after market open to capture the indicator value
|
|
@@ -790,6 +807,26 @@ export declare function IsIndustry(asset: AssetArg, industry: "technology" | "fi
|
|
|
790
807
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
791
808
|
*/
|
|
792
809
|
export declare function IsNotAsset(matchAsset: AssetArg, asset: AssetArg): Indicator;
|
|
810
|
+
/**
|
|
811
|
+
* IVHVRatio indicator.
|
|
812
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
813
|
+
* @param hvWindow Trading days of log-return history for realized volatility
|
|
814
|
+
*/
|
|
815
|
+
export declare function IVHVRatio(asset: AssetArg, hvWindow?: number): Indicator;
|
|
816
|
+
/**
|
|
817
|
+
* IVPercentile indicator.
|
|
818
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
819
|
+
* @param length Length of time
|
|
820
|
+
* @param interval Unit of time
|
|
821
|
+
*/
|
|
822
|
+
export declare function IVPercentile(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
823
|
+
/**
|
|
824
|
+
* IVRank indicator.
|
|
825
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
826
|
+
* @param length Length of time
|
|
827
|
+
* @param interval Unit of time
|
|
828
|
+
*/
|
|
829
|
+
export declare function IVRank(asset: AssetArg, length?: number, interval?: Interval): Indicator;
|
|
793
830
|
/**
|
|
794
831
|
* LastOrderPrice indicator.
|
|
795
832
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -1287,13 +1324,20 @@ export interface Gene {
|
|
|
1287
1324
|
/** Sweep Subject (Portfolio scope) over a value set. */
|
|
1288
1325
|
export declare const geneSubject: (values: AssetArg[][]) => Gene;
|
|
1289
1326
|
/** Sweep EntryCondition (Strategy scope) over a value set. */
|
|
1290
|
-
export declare const geneEntryCondition: (strategyIndex: number, values:
|
|
1327
|
+
export declare const geneEntryCondition: (strategyIndex: number, values: {
|
|
1328
|
+
label: string;
|
|
1329
|
+
condition: Condition;
|
|
1330
|
+
}[]) => Gene;
|
|
1291
1331
|
/** Sweep ExitCondition (Strategy scope) over a value set. */
|
|
1292
|
-
export declare const geneExitCondition: (strategyIndex: number, values:
|
|
1332
|
+
export declare const geneExitCondition: (strategyIndex: number, values: {
|
|
1333
|
+
label: string;
|
|
1334
|
+
condition: Condition;
|
|
1335
|
+
}[]) => Gene;
|
|
1293
1336
|
/** Sweep EntryCooldownDays (Strategy scope) over a value set. */
|
|
1294
1337
|
export declare const geneEntryCooldownDays: (strategyIndex: number, values: number[]) => Gene;
|
|
1295
1338
|
/** Sweep RankSignal (Action scope) over a value set. */
|
|
1296
1339
|
export declare const geneRankSignal: (strategyIndex: number, values: {
|
|
1340
|
+
label: string;
|
|
1297
1341
|
indicator: Indicator;
|
|
1298
1342
|
direction: SweepSortDirection;
|
|
1299
1343
|
}[]) => Gene;
|
|
@@ -1323,5 +1367,8 @@ export declare const geneDteBracket: (strategyIndex: number, legIndex: number, v
|
|
|
1323
1367
|
/** Sweep SelectTopLimit (UniversePipeline scope) over a value set. */
|
|
1324
1368
|
export declare const geneSelectTopLimit: (strategyIndex: number, stageIndex: number, values: number[]) => Gene;
|
|
1325
1369
|
/** Sweep UniversePipelineFilter (UniversePipeline scope) over a value set. */
|
|
1326
|
-
export declare const geneUniversePipelineFilter: (strategyIndex: number, stageIndex: number, values:
|
|
1370
|
+
export declare const geneUniversePipelineFilter: (strategyIndex: number, stageIndex: number, values: {
|
|
1371
|
+
label: string;
|
|
1372
|
+
condition: Condition;
|
|
1373
|
+
}[]) => Gene;
|
|
1327
1374
|
export {};
|
|
@@ -184,6 +184,7 @@ export const leg = (config) => {
|
|
|
184
184
|
expirationRange: config.expirationRange,
|
|
185
185
|
ratio: config.ratio,
|
|
186
186
|
greekFilter: config.greekFilter,
|
|
187
|
+
liquidityFilter: config.liquidityFilter,
|
|
187
188
|
});
|
|
188
189
|
};
|
|
189
190
|
export const optionsBuilder = (config) => compact(config);
|
|
@@ -542,6 +543,17 @@ export function HighOfDay(asset) {
|
|
|
542
543
|
setAsset(d, "targetAsset", asset);
|
|
543
544
|
return d;
|
|
544
545
|
}
|
|
546
|
+
/**
|
|
547
|
+
* ImpliedVolatility indicator.
|
|
548
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
549
|
+
* @param dte Target constant-maturity tenor in calendar days (e.g. 30)
|
|
550
|
+
*/
|
|
551
|
+
export function ImpliedVolatility(asset, dte = 30) {
|
|
552
|
+
const d = { type: "ImpliedVolatility" };
|
|
553
|
+
setAsset(d, "targetAsset", asset);
|
|
554
|
+
d["dte"] = dte;
|
|
555
|
+
return d;
|
|
556
|
+
}
|
|
545
557
|
/**
|
|
546
558
|
* Index indicator.
|
|
547
559
|
* @param metric Ticker key matching hydrated index price data (add more in BigQuery + rehydrate as needed)
|
|
@@ -689,6 +701,41 @@ export function IsNotAsset(matchAsset, asset) {
|
|
|
689
701
|
setAsset(d, "targetAsset", asset);
|
|
690
702
|
return d;
|
|
691
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* IVHVRatio indicator.
|
|
706
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
707
|
+
* @param hvWindow Trading days of log-return history for realized volatility
|
|
708
|
+
*/
|
|
709
|
+
export function IVHVRatio(asset, hvWindow = 20) {
|
|
710
|
+
const d = { type: "IVHVRatio" };
|
|
711
|
+
setAsset(d, "targetAsset", asset);
|
|
712
|
+
d["hvWindow"] = hvWindow;
|
|
713
|
+
return d;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* IVPercentile indicator.
|
|
717
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
718
|
+
* @param length Length of time
|
|
719
|
+
* @param interval Unit of time
|
|
720
|
+
*/
|
|
721
|
+
export function IVPercentile(asset, length = 252, interval = "Day") {
|
|
722
|
+
const d = { type: "IVPercentile" };
|
|
723
|
+
setAsset(d, "targetAsset", asset);
|
|
724
|
+
d.window = { length: length, interval: interval };
|
|
725
|
+
return d;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* IVRank indicator.
|
|
729
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
730
|
+
* @param length Length of time
|
|
731
|
+
* @param interval Unit of time
|
|
732
|
+
*/
|
|
733
|
+
export function IVRank(asset, length = 252, interval = "Day") {
|
|
734
|
+
const d = { type: "IVRank" };
|
|
735
|
+
setAsset(d, "targetAsset", asset);
|
|
736
|
+
d.window = { length: length, interval: interval };
|
|
737
|
+
return d;
|
|
738
|
+
}
|
|
692
739
|
/**
|
|
693
740
|
* LastOrderPrice indicator.
|
|
694
741
|
* @param asset Ticker name (ex. SPY, BTC)
|