nexustrade 1.29.0 → 1.29.1
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
CHANGED
|
@@ -261,13 +261,13 @@ const book = nt.portfolio("Momentum", [
|
|
|
261
261
|
],
|
|
262
262
|
weightIndicator: nt.RSI(nt.CANDIDATE, 14),
|
|
263
263
|
limit: 10,
|
|
264
|
-
deploymentPercent: 80,
|
|
264
|
+
deploymentPercent: nt.Value(80),
|
|
265
265
|
})),
|
|
266
266
|
], { initialValue: 100_000 });
|
|
267
267
|
```
|
|
268
268
|
|
|
269
269
|
Note the key is `universe`, not `universeConfig` (the Python SDK spells it
|
|
270
|
-
`universe_config`). `deploymentPercent: 80` invests 80% of the portfolio across
|
|
270
|
+
`universe_config`). `deploymentPercent: nt.Value(80)` invests 80% of the portfolio across
|
|
271
271
|
the selection and leaves the rest in cash — a **total** cap, not per-name.
|
|
272
272
|
</details>
|
|
273
273
|
|
package/README.md
CHANGED
|
@@ -107,6 +107,7 @@ exports.OptionSpreadEntryPrice = OptionSpreadEntryPrice;
|
|
|
107
107
|
exports.OptionUnrealizedPnL = OptionUnrealizedPnL;
|
|
108
108
|
exports.ParabolicSar = ParabolicSar;
|
|
109
109
|
exports.Plus = Plus;
|
|
110
|
+
exports.PoliticalPurchaseShare = PoliticalPurchaseShare;
|
|
110
111
|
exports.PoliticalTrades = PoliticalTrades;
|
|
111
112
|
exports.PortfolioValue = PortfolioValue;
|
|
112
113
|
exports.PositionMaxDrawdown = PositionMaxDrawdown;
|
|
@@ -1672,6 +1673,19 @@ function Plus(left, right) {
|
|
|
1672
1673
|
d.indicators = [left, right];
|
|
1673
1674
|
return d;
|
|
1674
1675
|
}
|
|
1676
|
+
/**
|
|
1677
|
+
* PoliticalPurchaseShare indicator.
|
|
1678
|
+
* @param memberId Bioguide member id, for example P000197. The share uses the member's whole public purchase record.
|
|
1679
|
+
* @param instrument Which side of the equity/option purchase mix to return, as a percent from 0 to 100.
|
|
1680
|
+
* @param amountBasis Estimate for disclosed purchase ranges. Midpoint is the default.
|
|
1681
|
+
*/
|
|
1682
|
+
function PoliticalPurchaseShare(memberId, instrument = "Equity", amountBasis = "Midpoint") {
|
|
1683
|
+
const d = { type: "PoliticalPurchaseShare" };
|
|
1684
|
+
d["memberId"] = memberId;
|
|
1685
|
+
d["instrument"] = instrument;
|
|
1686
|
+
d["amountBasis"] = amountBasis;
|
|
1687
|
+
return d;
|
|
1688
|
+
}
|
|
1675
1689
|
/**
|
|
1676
1690
|
* PoliticalTrades indicator.
|
|
1677
1691
|
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|
|
@@ -90,9 +90,10 @@ export interface PerNameAllocation {
|
|
|
90
90
|
type: "percent of portfolio" | "dollars";
|
|
91
91
|
amount: number;
|
|
92
92
|
}
|
|
93
|
+
/** Author budget values as indicators, including Value for a constant. */
|
|
93
94
|
export interface DeploymentBudget {
|
|
94
95
|
type: DeploymentBudgetType;
|
|
95
|
-
amount:
|
|
96
|
+
amount: Indicator;
|
|
96
97
|
}
|
|
97
98
|
export interface ExpirationSelector {
|
|
98
99
|
minDaysToExpiration: number;
|
|
@@ -317,7 +318,7 @@ export interface DynamicRebalanceAction {
|
|
|
317
318
|
pipeline: PipelineStage[];
|
|
318
319
|
weightIndicator: Indicator | CandidateIndicator;
|
|
319
320
|
limit?: number;
|
|
320
|
-
deploymentPercent?:
|
|
321
|
+
deploymentPercent?: Indicator;
|
|
321
322
|
perNameAllocation?: PerNameAllocation;
|
|
322
323
|
/**
|
|
323
324
|
* Candidate-bound gate on NON-TARGET FULL EXITS only. Omitted = always sell
|
|
@@ -345,6 +346,7 @@ export interface RebalanceOptionAction {
|
|
|
345
346
|
limit?: number;
|
|
346
347
|
totalBudget?: DeploymentBudget;
|
|
347
348
|
perNameAllocation?: OptionAllocation;
|
|
349
|
+
sizingMode?: "fixedPerName" | "proportionalToWeight";
|
|
348
350
|
positionScope?: RebalanceOptionPositionScope;
|
|
349
351
|
sleeves?: RebalanceOptionSleeve[];
|
|
350
352
|
allocationPolicy?: AllocationPolicy;
|
|
@@ -498,6 +500,7 @@ export type PositionEffect = "open" | "close";
|
|
|
498
500
|
export type OrderStatus = "Pending" | "Accepted" | "Pending User Approval" | "Canceled" | "Filled" | "Partially Filled";
|
|
499
501
|
export type Side = "Buy" | "Sell";
|
|
500
502
|
export type MinOrMax = "min" | "max";
|
|
503
|
+
export type AmountBasis = "LowerBound" | "Midpoint" | "UpperBound";
|
|
501
504
|
export declare const CANDIDATE: Candidate;
|
|
502
505
|
/** Portfolio-wide targetAssets: [] — rebalance cadence, not per-ticker DCA. */
|
|
503
506
|
export declare const PORTFOLIO_WIDE: PortfolioWide;
|
|
@@ -575,7 +578,7 @@ export declare const dynamicRebalance: (config: {
|
|
|
575
578
|
pipeline: PipelineStage[];
|
|
576
579
|
weightIndicator: Indicator | CandidateIndicator;
|
|
577
580
|
limit?: number;
|
|
578
|
-
deploymentPercent?:
|
|
581
|
+
deploymentPercent?: Indicator;
|
|
579
582
|
perNameAllocation?: PerNameAllocation;
|
|
580
583
|
canSell?: Condition | CandidateCondition;
|
|
581
584
|
allowShorts?: boolean;
|
|
@@ -628,6 +631,7 @@ export declare const rebalanceOption: (config: {
|
|
|
628
631
|
limit?: number;
|
|
629
632
|
totalBudget?: DeploymentBudget;
|
|
630
633
|
perNameAllocation?: OptionAllocation;
|
|
634
|
+
sizingMode?: "fixedPerName" | "proportionalToWeight";
|
|
631
635
|
positionScope?: RebalanceOptionPositionScope;
|
|
632
636
|
sleeves?: RebalanceOptionSleeve[];
|
|
633
637
|
allocationPolicy?: AllocationPolicy;
|
|
@@ -1334,6 +1338,13 @@ export declare function ParabolicSar(asset: AssetArg, interval?: Interval, step?
|
|
|
1334
1338
|
* Plus indicator.
|
|
1335
1339
|
*/
|
|
1336
1340
|
export declare function Plus(left: Indicator, right: Indicator): Indicator;
|
|
1341
|
+
/**
|
|
1342
|
+
* PoliticalPurchaseShare indicator.
|
|
1343
|
+
* @param memberId Bioguide member id, for example P000197. The share uses the member's whole public purchase record.
|
|
1344
|
+
* @param instrument Which side of the equity/option purchase mix to return, as a percent from 0 to 100.
|
|
1345
|
+
* @param amountBasis Estimate for disclosed purchase ranges. Midpoint is the default.
|
|
1346
|
+
*/
|
|
1347
|
+
export declare function PoliticalPurchaseShare(memberId: string, instrument?: "Equity" | "Option", amountBasis?: AmountBasis): Indicator;
|
|
1337
1348
|
/**
|
|
1338
1349
|
* PoliticalTrades indicator.
|
|
1339
1350
|
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|
|
@@ -1345,7 +1356,7 @@ export declare function Plus(left: Indicator, right: Indicator): Indicator;
|
|
|
1345
1356
|
* @param chamber Optional advanced cohort filter; named-member requests should normally use All.
|
|
1346
1357
|
* @param memberId Bioguide id such as P000197. Matches exactly and overrides filer, because names collide.
|
|
1347
1358
|
*/
|
|
1348
|
-
export declare function PoliticalTrades(asset: AssetArg, filer: string, metric?: "NetAmount" | "BuyAmount" | "SellAmount" | "BuyCount" | "SellCount" | "DistinctBuyers" | "Held", windowDays?: number, amountBasis?:
|
|
1359
|
+
export declare function PoliticalTrades(asset: AssetArg, filer: string, metric?: "NetAmount" | "BuyAmount" | "SellAmount" | "BuyCount" | "SellCount" | "DistinctBuyers" | "Held", windowDays?: number, amountBasis?: AmountBasis, instrument?: "Equity" | "Option" | "All", chamber?: "All" | "House" | "Senate", memberId?: string): Indicator;
|
|
1349
1360
|
/**
|
|
1350
1361
|
* PortfolioValue indicator.
|
|
1351
1362
|
*/
|
|
@@ -1477,6 +1477,19 @@ export function Plus(left, right) {
|
|
|
1477
1477
|
d.indicators = [left, right];
|
|
1478
1478
|
return d;
|
|
1479
1479
|
}
|
|
1480
|
+
/**
|
|
1481
|
+
* PoliticalPurchaseShare indicator.
|
|
1482
|
+
* @param memberId Bioguide member id, for example P000197. The share uses the member's whole public purchase record.
|
|
1483
|
+
* @param instrument Which side of the equity/option purchase mix to return, as a percent from 0 to 100.
|
|
1484
|
+
* @param amountBasis Estimate for disclosed purchase ranges. Midpoint is the default.
|
|
1485
|
+
*/
|
|
1486
|
+
export function PoliticalPurchaseShare(memberId, instrument = "Equity", amountBasis = "Midpoint") {
|
|
1487
|
+
const d = { type: "PoliticalPurchaseShare" };
|
|
1488
|
+
d["memberId"] = memberId;
|
|
1489
|
+
d["instrument"] = instrument;
|
|
1490
|
+
d["amountBasis"] = amountBasis;
|
|
1491
|
+
return d;
|
|
1492
|
+
}
|
|
1480
1493
|
/**
|
|
1481
1494
|
* PoliticalTrades indicator.
|
|
1482
1495
|
* @param asset Pass CANDIDATE inside a rebalance pipeline to bind each stock.
|