nexustrade 1.15.0 → 1.17.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,27 @@ const book = nt.portfolio(
|
|
|
174
174
|
);
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
Congressional-disclosure signals are native indicators too. House and Senate
|
|
178
|
+
are combined unless you explicitly choose a chamber; amount metrics default to
|
|
179
|
+
the disclosed lower bound and confirmed option disclosures are excluded by
|
|
180
|
+
default:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const pelosiPurchases = nt.PoliticalTrades(
|
|
184
|
+
nt.CANDIDATE,
|
|
185
|
+
"Nancy Pelosi",
|
|
186
|
+
"BuyAmount",
|
|
187
|
+
90,
|
|
188
|
+
"LowerBound",
|
|
189
|
+
"Equity",
|
|
190
|
+
);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Use `""` as the filer to include all members. `BuyCount` counts canonical
|
|
194
|
+
purchase events, while `BuyAmount` measures disclosed magnitude. Select
|
|
195
|
+
`"Option"` only when you want option-disclosure activity associated with the
|
|
196
|
+
underlying ticker.
|
|
197
|
+
|
|
177
198
|
Order execution belongs to the strategy. Omit it for the backward-compatible
|
|
178
199
|
Market default, use a fixed unit price for Buy/Sell, or set an option strategy's
|
|
179
200
|
maximum net debit / minimum net credit:
|
|
@@ -48,6 +48,7 @@ exports.IndicatorSimpleMovingAverage = IndicatorSimpleMovingAverage;
|
|
|
48
48
|
exports.IndicatorStandardDeviation = IndicatorStandardDeviation;
|
|
49
49
|
exports.IndicatorWindowAgo = IndicatorWindowAgo;
|
|
50
50
|
exports.InitialValue = InitialValue;
|
|
51
|
+
exports.InsiderTrades = InsiderTrades;
|
|
51
52
|
exports.IsAsset = IsAsset;
|
|
52
53
|
exports.IsAssetType = IsAssetType;
|
|
53
54
|
exports.IsIndexMember = IsIndexMember;
|
|
@@ -90,6 +91,7 @@ exports.OptionSpreadCount = OptionSpreadCount;
|
|
|
90
91
|
exports.OptionSpreadEntryPrice = OptionSpreadEntryPrice;
|
|
91
92
|
exports.OptionUnrealizedPnL = OptionUnrealizedPnL;
|
|
92
93
|
exports.Plus = Plus;
|
|
94
|
+
exports.PoliticalTrades = PoliticalTrades;
|
|
93
95
|
exports.PortfolioValue = PortfolioValue;
|
|
94
96
|
exports.PositionMaxDrawdown = PositionMaxDrawdown;
|
|
95
97
|
exports.PositionMaxDrawup = PositionMaxDrawup;
|
|
@@ -935,6 +937,21 @@ function InitialValue() {
|
|
|
935
937
|
const d = { type: "InitialValue" };
|
|
936
938
|
return d;
|
|
937
939
|
}
|
|
940
|
+
/**
|
|
941
|
+
* InsiderTrades indicator.
|
|
942
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
943
|
+
* @param metric Dollar value, shares, trade counts, or distinct buying insiders
|
|
944
|
+
* @param role Only trades by an officer, director, or 10% owner, or any insider
|
|
945
|
+
* @param windowDays Count trades whose filings became public within this many trailing days
|
|
946
|
+
*/
|
|
947
|
+
function InsiderTrades(asset, metric = "NetValue", role = "Any", windowDays = 90) {
|
|
948
|
+
const d = { type: "InsiderTrades" };
|
|
949
|
+
setAsset(d, "targetAsset", asset);
|
|
950
|
+
d["metric"] = metric;
|
|
951
|
+
d["role"] = role;
|
|
952
|
+
d["windowDays"] = windowDays;
|
|
953
|
+
return d;
|
|
954
|
+
}
|
|
938
955
|
/**
|
|
939
956
|
* IsAsset indicator.
|
|
940
957
|
* @param matchAsset The specific asset to compare against (ex. UPRO, GLD)
|
|
@@ -1425,6 +1442,27 @@ function Plus(left, right) {
|
|
|
1425
1442
|
d.indicators = [left, right];
|
|
1426
1443
|
return d;
|
|
1427
1444
|
}
|
|
1445
|
+
/**
|
|
1446
|
+
* PoliticalTrades indicator.
|
|
1447
|
+
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|
|
1448
|
+
* @param filer Member full or last name. Pass an empty string for all members.
|
|
1449
|
+
* @param metric Amount-range aggregate, event count, or distinct purchasing members.
|
|
1450
|
+
* @param windowDays Trailing calendar days measured from when each event became public.
|
|
1451
|
+
* @param amountBasis Range endpoint used by amount metrics; LowerBound is conservative.
|
|
1452
|
+
* @param instrument Equity excludes confirmed option disclosures; Option selects them explicitly.
|
|
1453
|
+
* @param chamber Optional advanced cohort filter; named-member requests should normally use All.
|
|
1454
|
+
*/
|
|
1455
|
+
function PoliticalTrades(asset, filer, metric = "BuyAmount", windowDays = 90, amountBasis = "LowerBound", instrument = "Equity", chamber = "All") {
|
|
1456
|
+
const d = { type: "PoliticalTrades" };
|
|
1457
|
+
setAsset(d, "targetAsset", asset);
|
|
1458
|
+
d["filer"] = filer;
|
|
1459
|
+
d["metric"] = metric;
|
|
1460
|
+
d["windowDays"] = windowDays;
|
|
1461
|
+
d["amountBasis"] = amountBasis;
|
|
1462
|
+
d["instrument"] = instrument;
|
|
1463
|
+
d["chamber"] = chamber;
|
|
1464
|
+
return d;
|
|
1465
|
+
}
|
|
1428
1466
|
/**
|
|
1429
1467
|
* PortfolioValue indicator.
|
|
1430
1468
|
*/
|
|
@@ -325,6 +325,13 @@ export interface DynamicRebalanceAction {
|
|
|
325
325
|
* indicator values fail closed (retain). deploymentPercent: 0 overrides.
|
|
326
326
|
*/
|
|
327
327
|
canSell?: Condition | CandidateCondition;
|
|
328
|
+
/**
|
|
329
|
+
* BACKTEST-ONLY. Permits negative rebalance targets (equity short legs).
|
|
330
|
+
* The backtest assumes shares were available to short each morning and
|
|
331
|
+
* accrues a modeled borrow fee. Live/paper deploy of a short strategy is
|
|
332
|
+
* rejected at deploy time (explicit non-parity with backtest).
|
|
333
|
+
*/
|
|
334
|
+
allowShorts?: boolean;
|
|
328
335
|
allocationPolicy?: AllocationPolicy;
|
|
329
336
|
exposurePolicy?: ExposurePolicy;
|
|
330
337
|
}
|
|
@@ -547,6 +554,7 @@ export declare const dynamicRebalance: (config: {
|
|
|
547
554
|
deploymentPercent?: number;
|
|
548
555
|
perNameAllocation?: PerNameAllocation;
|
|
549
556
|
canSell?: Condition | CandidateCondition;
|
|
557
|
+
allowShorts?: boolean;
|
|
550
558
|
allocationPolicy?: AllocationPolicy;
|
|
551
559
|
exposurePolicy?: ExposurePolicy;
|
|
552
560
|
}) => DynamicRebalanceAction;
|
|
@@ -912,6 +920,14 @@ export declare function IndicatorWindowAgo(operand: Indicator, length: number, i
|
|
|
912
920
|
* InitialValue indicator.
|
|
913
921
|
*/
|
|
914
922
|
export declare function InitialValue(): Indicator;
|
|
923
|
+
/**
|
|
924
|
+
* InsiderTrades indicator.
|
|
925
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
926
|
+
* @param metric Dollar value, shares, trade counts, or distinct buying insiders
|
|
927
|
+
* @param role Only trades by an officer, director, or 10% owner, or any insider
|
|
928
|
+
* @param windowDays Count trades whose filings became public within this many trailing days
|
|
929
|
+
*/
|
|
930
|
+
export declare function InsiderTrades(asset: AssetArg, metric?: "NetValue" | "BuyValue" | "SellValue" | "NetShares" | "BuyCount" | "SellCount" | "DistinctBuyers", role?: "Any" | "Officer" | "Director" | "TenPercentOwner", windowDays?: number): Indicator;
|
|
915
931
|
/**
|
|
916
932
|
* IsAsset indicator.
|
|
917
933
|
* @param matchAsset The specific asset to compare against (ex. UPRO, GLD)
|
|
@@ -1176,6 +1192,17 @@ export declare function OptionUnrealizedPnL(underlying: string, optionType: Opti
|
|
|
1176
1192
|
* Plus indicator.
|
|
1177
1193
|
*/
|
|
1178
1194
|
export declare function Plus(left: Indicator, right: Indicator): Indicator;
|
|
1195
|
+
/**
|
|
1196
|
+
* PoliticalTrades indicator.
|
|
1197
|
+
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|
|
1198
|
+
* @param filer Member full or last name. Pass an empty string for all members.
|
|
1199
|
+
* @param metric Amount-range aggregate, event count, or distinct purchasing members.
|
|
1200
|
+
* @param windowDays Trailing calendar days measured from when each event became public.
|
|
1201
|
+
* @param amountBasis Range endpoint used by amount metrics; LowerBound is conservative.
|
|
1202
|
+
* @param instrument Equity excludes confirmed option disclosures; Option selects them explicitly.
|
|
1203
|
+
* @param chamber Optional advanced cohort filter; named-member requests should normally use All.
|
|
1204
|
+
*/
|
|
1205
|
+
export declare function PoliticalTrades(asset: AssetArg, filer: string, metric?: "NetAmount" | "BuyAmount" | "SellAmount" | "BuyCount" | "SellCount" | "DistinctBuyers", windowDays?: number, amountBasis?: "LowerBound" | "Midpoint" | "UpperBound", instrument?: "Equity" | "Option" | "All", chamber?: "All" | "House" | "Senate"): Indicator;
|
|
1179
1206
|
/**
|
|
1180
1207
|
* PortfolioValue indicator.
|
|
1181
1208
|
*/
|
|
@@ -762,6 +762,21 @@ export function InitialValue() {
|
|
|
762
762
|
const d = { type: "InitialValue" };
|
|
763
763
|
return d;
|
|
764
764
|
}
|
|
765
|
+
/**
|
|
766
|
+
* InsiderTrades indicator.
|
|
767
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
768
|
+
* @param metric Dollar value, shares, trade counts, or distinct buying insiders
|
|
769
|
+
* @param role Only trades by an officer, director, or 10% owner, or any insider
|
|
770
|
+
* @param windowDays Count trades whose filings became public within this many trailing days
|
|
771
|
+
*/
|
|
772
|
+
export function InsiderTrades(asset, metric = "NetValue", role = "Any", windowDays = 90) {
|
|
773
|
+
const d = { type: "InsiderTrades" };
|
|
774
|
+
setAsset(d, "targetAsset", asset);
|
|
775
|
+
d["metric"] = metric;
|
|
776
|
+
d["role"] = role;
|
|
777
|
+
d["windowDays"] = windowDays;
|
|
778
|
+
return d;
|
|
779
|
+
}
|
|
765
780
|
/**
|
|
766
781
|
* IsAsset indicator.
|
|
767
782
|
* @param matchAsset The specific asset to compare against (ex. UPRO, GLD)
|
|
@@ -1252,6 +1267,27 @@ export function Plus(left, right) {
|
|
|
1252
1267
|
d.indicators = [left, right];
|
|
1253
1268
|
return d;
|
|
1254
1269
|
}
|
|
1270
|
+
/**
|
|
1271
|
+
* PoliticalTrades indicator.
|
|
1272
|
+
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|
|
1273
|
+
* @param filer Member full or last name. Pass an empty string for all members.
|
|
1274
|
+
* @param metric Amount-range aggregate, event count, or distinct purchasing members.
|
|
1275
|
+
* @param windowDays Trailing calendar days measured from when each event became public.
|
|
1276
|
+
* @param amountBasis Range endpoint used by amount metrics; LowerBound is conservative.
|
|
1277
|
+
* @param instrument Equity excludes confirmed option disclosures; Option selects them explicitly.
|
|
1278
|
+
* @param chamber Optional advanced cohort filter; named-member requests should normally use All.
|
|
1279
|
+
*/
|
|
1280
|
+
export function PoliticalTrades(asset, filer, metric = "BuyAmount", windowDays = 90, amountBasis = "LowerBound", instrument = "Equity", chamber = "All") {
|
|
1281
|
+
const d = { type: "PoliticalTrades" };
|
|
1282
|
+
setAsset(d, "targetAsset", asset);
|
|
1283
|
+
d["filer"] = filer;
|
|
1284
|
+
d["metric"] = metric;
|
|
1285
|
+
d["windowDays"] = windowDays;
|
|
1286
|
+
d["amountBasis"] = amountBasis;
|
|
1287
|
+
d["instrument"] = instrument;
|
|
1288
|
+
d["chamber"] = chamber;
|
|
1289
|
+
return d;
|
|
1290
|
+
}
|
|
1255
1291
|
/**
|
|
1256
1292
|
* PortfolioValue indicator.
|
|
1257
1293
|
*/
|