nexustrade 1.37.0 → 1.39.3
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.
|
@@ -14,6 +14,8 @@ exports.BuyingPower = BuyingPower;
|
|
|
14
14
|
exports.ChaikinMoneyFlow = ChaikinMoneyFlow;
|
|
15
15
|
exports.CommodityChannelIndex = CommodityChannelIndex;
|
|
16
16
|
exports.CompoundAnnualGrowthRate = CompoundAnnualGrowthRate;
|
|
17
|
+
exports.ConsecutiveDecrease = ConsecutiveDecrease;
|
|
18
|
+
exports.ConsecutiveIncrease = ConsecutiveIncrease;
|
|
17
19
|
exports.ConsecutiveTrue = ConsecutiveTrue;
|
|
18
20
|
exports.Correlation = Correlation;
|
|
19
21
|
exports.CountTrue = CountTrue;
|
|
@@ -67,6 +69,7 @@ exports.IVHVRatio = IVHVRatio;
|
|
|
67
69
|
exports.IVPercentile = IVPercentile;
|
|
68
70
|
exports.IVRank = IVRank;
|
|
69
71
|
exports.KeltnerChannel = KeltnerChannel;
|
|
72
|
+
exports.LastDividend = LastDividend;
|
|
70
73
|
exports.LastOrderPrice = LastOrderPrice;
|
|
71
74
|
exports.Log = Log;
|
|
72
75
|
exports.LowOfDay = LowOfDay;
|
|
@@ -638,6 +641,32 @@ function CompoundAnnualGrowthRate(asset, metric, years) {
|
|
|
638
641
|
d["years"] = years;
|
|
639
642
|
return d;
|
|
640
643
|
}
|
|
644
|
+
/**
|
|
645
|
+
* Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value. Examples: ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) (consecutive completed quarters of higher reported revenue for AAPL, up to 8).
|
|
646
|
+
* @param indicator The inner indicator whose period closing values are compared. Pass CANDIDATE to its asset in a dynamic rebalance pipeline.
|
|
647
|
+
* @param period Calendar period (America/New_York) whose closing values are compared.
|
|
648
|
+
* @param lookback Whole number of completed periods to count, 1 to 60; the streak is capped here.
|
|
649
|
+
*/
|
|
650
|
+
function ConsecutiveDecrease(indicator, period, lookback) {
|
|
651
|
+
const d = { type: "ConsecutiveDecrease" };
|
|
652
|
+
d["period"] = period;
|
|
653
|
+
d["lookback"] = lookback;
|
|
654
|
+
d.indicators = [indicator];
|
|
655
|
+
return d;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value. Examples: ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) (consecutive completed quarters of higher reported revenue for AAPL, up to 8).
|
|
659
|
+
* @param indicator The inner indicator whose period closing values are compared. Pass CANDIDATE to its asset in a dynamic rebalance pipeline.
|
|
660
|
+
* @param period Calendar period (America/New_York) whose closing values are compared.
|
|
661
|
+
* @param lookback Whole number of completed periods to count, 1 to 60; the streak is capped here.
|
|
662
|
+
*/
|
|
663
|
+
function ConsecutiveIncrease(indicator, period, lookback) {
|
|
664
|
+
const d = { type: "ConsecutiveIncrease" };
|
|
665
|
+
d["period"] = period;
|
|
666
|
+
d["lookback"] = lookback;
|
|
667
|
+
d.indicators = [indicator];
|
|
668
|
+
return d;
|
|
669
|
+
}
|
|
641
670
|
/**
|
|
642
671
|
* ConsecutiveTrue indicator.
|
|
643
672
|
* @param condition Condition evaluated over the window.
|
|
@@ -1210,6 +1239,15 @@ function KeltnerChannel(asset, length = 20, interval = "Day", multiplier = 2, li
|
|
|
1210
1239
|
d.window = { length: length, interval: interval };
|
|
1211
1240
|
return d;
|
|
1212
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* The most recent regular cash dividend per share whose ex-dividend date is on or before the evaluation date (America/New_York), split-adjusted onto today's share basis, special dividends excluded. Returns null when the asset has no regular dividend on or before that date. Each payment is one observation for TrailingSum, so TrailingSum(LastDividend(asset), 4) sums the last four payments, which is trailing-twelve-month dividends for a quarterly payer (use 12 for a monthly payer).
|
|
1244
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1245
|
+
*/
|
|
1246
|
+
function LastDividend(asset) {
|
|
1247
|
+
const d = { type: "LastDividend" };
|
|
1248
|
+
setAsset(d, "targetAsset", asset);
|
|
1249
|
+
return d;
|
|
1250
|
+
}
|
|
1213
1251
|
/**
|
|
1214
1252
|
* LastOrderPrice indicator.
|
|
1215
1253
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -504,6 +504,7 @@ export type OptionSpreadType = "vertical" | "calendar" | "diagonal" | "ironCondo
|
|
|
504
504
|
export type CloseScope = "spread" | "leg";
|
|
505
505
|
export type RebalanceOptionPositionScope = "portfolio" | "strategy";
|
|
506
506
|
export type FundamentalMetric = "totalRevenue" | "grossProfit" | "operatingIncome" | "ebitda" | "epsActual" | "epsEstimate" | "netIncome" | "freeCashFlow" | "totalAssets" | "totalLiab" | "shortTermDebt" | "longTermDebt" | "commonStockSharesOutstanding" | "dividendYield" | "openingPrice" | "highestPrice" | "lowestPrice" | "closingPrice" | "volume" | "marketCap" | "peRatioTTM" | "psRatioTTM" | "pbRatioTTM" | "enterpriseValue";
|
|
507
|
+
export type Period = "Year" | "Quarter" | "Month";
|
|
507
508
|
export type PositionEffect = "open" | "close";
|
|
508
509
|
export type OrderStatus = "Pending" | "Accepted" | "Pending User Approval" | "Canceled" | "Filled" | "Partially Filled";
|
|
509
510
|
export type Side = "Buy" | "Sell";
|
|
@@ -786,6 +787,20 @@ export declare function CommodityChannelIndex(asset: AssetArg, length?: number,
|
|
|
786
787
|
* @param years Floating point years value
|
|
787
788
|
*/
|
|
788
789
|
export declare function CompoundAnnualGrowthRate(asset: AssetArg, metric: FundamentalMetric, years: number): Indicator;
|
|
790
|
+
/**
|
|
791
|
+
* Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value. Examples: ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) (consecutive completed quarters of higher reported revenue for AAPL, up to 8).
|
|
792
|
+
* @param indicator The inner indicator whose period closing values are compared. Pass CANDIDATE to its asset in a dynamic rebalance pipeline.
|
|
793
|
+
* @param period Calendar period (America/New_York) whose closing values are compared.
|
|
794
|
+
* @param lookback Whole number of completed periods to count, 1 to 60; the streak is capped here.
|
|
795
|
+
*/
|
|
796
|
+
export declare function ConsecutiveDecrease(indicator: Indicator, period: Period, lookback: number): Indicator;
|
|
797
|
+
/**
|
|
798
|
+
* Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value. Examples: ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) (consecutive completed quarters of higher reported revenue for AAPL, up to 8).
|
|
799
|
+
* @param indicator The inner indicator whose period closing values are compared. Pass CANDIDATE to its asset in a dynamic rebalance pipeline.
|
|
800
|
+
* @param period Calendar period (America/New_York) whose closing values are compared.
|
|
801
|
+
* @param lookback Whole number of completed periods to count, 1 to 60; the streak is capped here.
|
|
802
|
+
*/
|
|
803
|
+
export declare function ConsecutiveIncrease(indicator: Indicator, period: Period, lookback: number): Indicator;
|
|
789
804
|
/**
|
|
790
805
|
* ConsecutiveTrue indicator.
|
|
791
806
|
* @param condition Condition evaluated over the window.
|
|
@@ -1097,6 +1112,11 @@ export declare function IVRank(asset: AssetArg, length?: number, interval?: Inte
|
|
|
1097
1112
|
* @param line Which Keltner line to evaluate
|
|
1098
1113
|
*/
|
|
1099
1114
|
export declare function KeltnerChannel(asset: AssetArg, length?: number, interval?: Interval, multiplier?: number, line?: "upper" | "middle" | "lower"): Indicator;
|
|
1115
|
+
/**
|
|
1116
|
+
* The most recent regular cash dividend per share whose ex-dividend date is on or before the evaluation date (America/New_York), split-adjusted onto today's share basis, special dividends excluded. Returns null when the asset has no regular dividend on or before that date. Each payment is one observation for TrailingSum, so TrailingSum(LastDividend(asset), 4) sums the last four payments, which is trailing-twelve-month dividends for a quarterly payer (use 12 for a monthly payer).
|
|
1117
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1118
|
+
*/
|
|
1119
|
+
export declare function LastDividend(asset: AssetArg): Indicator;
|
|
1100
1120
|
/**
|
|
1101
1121
|
* LastOrderPrice indicator.
|
|
1102
1122
|
* @param asset Ticker name (ex. SPY, BTC)
|
|
@@ -438,6 +438,32 @@ export function CompoundAnnualGrowthRate(asset, metric, years) {
|
|
|
438
438
|
d["years"] = years;
|
|
439
439
|
return d;
|
|
440
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value. Examples: ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) (consecutive completed quarters of higher reported revenue for AAPL, up to 8).
|
|
443
|
+
* @param indicator The inner indicator whose period closing values are compared. Pass CANDIDATE to its asset in a dynamic rebalance pipeline.
|
|
444
|
+
* @param period Calendar period (America/New_York) whose closing values are compared.
|
|
445
|
+
* @param lookback Whole number of completed periods to count, 1 to 60; the streak is capped here.
|
|
446
|
+
*/
|
|
447
|
+
export function ConsecutiveDecrease(indicator, period, lookback) {
|
|
448
|
+
const d = { type: "ConsecutiveDecrease" };
|
|
449
|
+
d["period"] = period;
|
|
450
|
+
d["lookback"] = lookback;
|
|
451
|
+
d.indicators = [indicator];
|
|
452
|
+
return d;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Number of consecutive completed calendar periods (America/New_York; period is Year, Quarter or Month), ending with the last completed period, whose closing value of the inner indicator was strictly higher (ConsecutiveIncrease) or strictly lower (ConsecutiveDecrease) than the previous period's closing value. A period's closing value is the inner indicator's last non-null value observed in that period. The in-progress current period never counts, equal values are not a change, and a completed period with no value breaks the streak. The count is capped at lookback (an integer from 1 to 60). Returns null when no completed period has a value. Examples: ConsecutiveIncrease(LastDividend(KO), Year, 10) >= 10 (KO raised its regular dividend per share in each of the last 10 completed years); ConsecutiveIncrease(Fundamental(AAPL, totalRevenue), Quarter, 8) (consecutive completed quarters of higher reported revenue for AAPL, up to 8).
|
|
456
|
+
* @param indicator The inner indicator whose period closing values are compared. Pass CANDIDATE to its asset in a dynamic rebalance pipeline.
|
|
457
|
+
* @param period Calendar period (America/New_York) whose closing values are compared.
|
|
458
|
+
* @param lookback Whole number of completed periods to count, 1 to 60; the streak is capped here.
|
|
459
|
+
*/
|
|
460
|
+
export function ConsecutiveIncrease(indicator, period, lookback) {
|
|
461
|
+
const d = { type: "ConsecutiveIncrease" };
|
|
462
|
+
d["period"] = period;
|
|
463
|
+
d["lookback"] = lookback;
|
|
464
|
+
d.indicators = [indicator];
|
|
465
|
+
return d;
|
|
466
|
+
}
|
|
441
467
|
/**
|
|
442
468
|
* ConsecutiveTrue indicator.
|
|
443
469
|
* @param condition Condition evaluated over the window.
|
|
@@ -1010,6 +1036,15 @@ export function KeltnerChannel(asset, length = 20, interval = "Day", multiplier
|
|
|
1010
1036
|
d.window = { length: length, interval: interval };
|
|
1011
1037
|
return d;
|
|
1012
1038
|
}
|
|
1039
|
+
/**
|
|
1040
|
+
* The most recent regular cash dividend per share whose ex-dividend date is on or before the evaluation date (America/New_York), split-adjusted onto today's share basis, special dividends excluded. Returns null when the asset has no regular dividend on or before that date. Each payment is one observation for TrailingSum, so TrailingSum(LastDividend(asset), 4) sums the last four payments, which is trailing-twelve-month dividends for a quarterly payer (use 12 for a monthly payer).
|
|
1041
|
+
* @param asset Ticker name (ex. SPY, BTC)
|
|
1042
|
+
*/
|
|
1043
|
+
export function LastDividend(asset) {
|
|
1044
|
+
const d = { type: "LastDividend" };
|
|
1045
|
+
setAsset(d, "targetAsset", asset);
|
|
1046
|
+
return d;
|
|
1047
|
+
}
|
|
1013
1048
|
/**
|
|
1014
1049
|
* LastOrderPrice indicator.
|
|
1015
1050
|
* @param asset Ticker name (ex. SPY, BTC)
|