nexustrade 1.59.1 → 1.60.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.
|
@@ -59,6 +59,7 @@ exports.IndicatorRateOfChange = IndicatorRateOfChange;
|
|
|
59
59
|
exports.IndicatorSimpleMovingAverage = IndicatorSimpleMovingAverage;
|
|
60
60
|
exports.IndicatorStandardDeviation = IndicatorStandardDeviation;
|
|
61
61
|
exports.IndicatorWindowAgo = IndicatorWindowAgo;
|
|
62
|
+
exports.IndustryNewsSentiment = IndustryNewsSentiment;
|
|
62
63
|
exports.InitialValue = InitialValue;
|
|
63
64
|
exports.InsiderTrades = InsiderTrades;
|
|
64
65
|
exports.InstitutionalHoldings = InstitutionalHoldings;
|
|
@@ -1167,6 +1168,19 @@ function IndicatorWindowAgo(operand, length, interval) {
|
|
|
1167
1168
|
d.window = { length: length, interval: interval };
|
|
1168
1169
|
return d;
|
|
1169
1170
|
}
|
|
1171
|
+
/**
|
|
1172
|
+
* News sentiment about an industry over its last lookbackDays daily news snapshots (default 1, the latest). industry is one of the canonical industry tags (the same list IsIndustry uses). Headlines come from the GDELT global news feed, and a fine-tuned model scores every headline that mentions the industry: whether it is really about the industry, and whether it is positive, neutral or negative news for it (a headline it calls neutral scores 0; others score from -1.0 to 1.0). Each trading day has one snapshot at 09:15 New York, and a headline counts toward the first session whose 09:15 cutoff is at or after the time GDELT published it. Backtests and live trading read the same rows. lookbackDays counts trading sessions whether or not the industry had news in them; a single session is noisy, and about 20 sessions is the usual window for a sentiment rule. Only headlines the model judges to be about the industry count, and copies of one story within 7 days count once per session. measure (default Mean): Mean is the average sentiment from -1.0 to 1.0, Median is the middle score (the average of the two middle scores for an even count), NetCount is positive minus negative headlines, ArticleCount is the number of qualifying headlines. Every measure has no value when the window cannot be read in full: before coverage begins on 2019-09-23, across sessions with no published snapshot, or when the latest snapshot due has not been published. Mean and Median also have no value when the window holds no qualifying headline; the counts are then 0. The value is the same for every asset: it takes no target asset.
|
|
1173
|
+
* @param industry Canonical industry tag whose news to read, as IsIndustry lists it. Legacy aliases are separate news series and are rejected, never mapped.
|
|
1174
|
+
* @param measure Median: middle score from -1 to 1 (the average of the two middle scores for an even count), with no value when no qualifying headline. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying headline. NetCount: positive minus negative headlines. ArticleCount: qualifying headlines. Every measure has no value before coverage begins on 2019-09-23, across missing snapshots, or when the due snapshot is unpublished.
|
|
1175
|
+
* @param lookbackDays Whole trading sessions of daily 09:15 New York news snapshots; 1 is the latest and about 20 is the usual window. The same value for every asset.
|
|
1176
|
+
*/
|
|
1177
|
+
function IndustryNewsSentiment(industry, measure = "Mean", lookbackDays = 1) {
|
|
1178
|
+
const d = { type: "IndustryNewsSentiment" };
|
|
1179
|
+
d["industry"] = industry;
|
|
1180
|
+
d["measure"] = measure;
|
|
1181
|
+
d["lookbackDays"] = lookbackDays;
|
|
1182
|
+
return d;
|
|
1183
|
+
}
|
|
1170
1184
|
/**
|
|
1171
1185
|
* InitialValue indicator.
|
|
1172
1186
|
*/
|
|
@@ -1610,9 +1624,9 @@ function NewPoliticalDisclosure(memberId, instrument, disclosureAction) {
|
|
|
1610
1624
|
return d;
|
|
1611
1625
|
}
|
|
1612
1626
|
/**
|
|
1613
|
-
*
|
|
1627
|
+
* News sentiment about the asset over its last lookbackDays daily news snapshots (default 1, the latest). Headlines come from the GDELT global news feed, and a fine-tuned model scores every headline that names the company: whether it is really about the company, and whether it is positive, neutral or negative news for it (a headline it calls neutral scores 0; others score from -1.0 to 1.0). Each trading day has one snapshot at 09:15 New York, and a headline counts toward the first session whose 09:15 cutoff is at or after the time GDELT published it. Backtests and live trading read the same rows. lookbackDays counts trading sessions whether or not the asset had news in them; a single session is noisy, and about 20 sessions is the usual window for a sentiment rule. Only headlines the model judges to be about the company count, and copies of one story within 7 days count once per session. measure (default Mean): Mean is the average sentiment from -1.0 to 1.0, Median is the middle score (the average of the two middle scores for an even count), NetCount is positive minus negative headlines, ArticleCount is the number of qualifying headlines. Every measure has no value when the window cannot be read in full: before coverage begins on 2019-09-23, across sessions with no published snapshot, or when the latest snapshot due has not been published. Mean and Median also have no value when the window holds no qualifying headline; the counts are then 0. Headlines are matched to the issuer, so every listed share class reads the same news and META reads Facebook-era headlines.
|
|
1614
1628
|
* @param asset Pass CANDIDATE in a dynamic rebalance pipeline.
|
|
1615
|
-
* @param measure Median: middle score from -1 to 1, with no value when no qualifying news. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying news. NetCount: positive minus negative
|
|
1629
|
+
* @param measure Median: middle score from -1 to 1, with no value when no qualifying news. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying news. NetCount: positive minus negative headlines. ArticleCount: qualifying headlines. Every measure has no value before coverage begins on 2019-09-23, across missing snapshots, or when the due snapshot is unpublished.
|
|
1616
1630
|
* @param lookbackDays Whole trading sessions of daily 09:15 New York news snapshots; 1 is the latest. A row is visible from the snapshot the lake assigned it, the same time in backtests and live trading.
|
|
1617
1631
|
*/
|
|
1618
1632
|
function NewsSentiment(asset, measure = "Mean", lookbackDays = 1) {
|
|
@@ -2226,6 +2240,7 @@ const backtest = (portfolio, config) => ({
|
|
|
2226
2240
|
"interval": config.interval,
|
|
2227
2241
|
"initial_value": config.initialValue,
|
|
2228
2242
|
"generate_events": config.generateEvents,
|
|
2243
|
+
"force_new_run": config.forceNewRun,
|
|
2229
2244
|
"fee_config": config.feeConfig,
|
|
2230
2245
|
"dividend_policy": config.dividendPolicy,
|
|
2231
2246
|
}),
|
|
@@ -593,6 +593,7 @@ export type Period = "Year" | "Quarter" | "Month";
|
|
|
593
593
|
export type PositionEffect = "open" | "close";
|
|
594
594
|
export type OrderStatus = "Pending" | "Accepted" | "Pending User Approval" | "Canceled" | "Filled" | "Partially Filled";
|
|
595
595
|
export type Side = "Buy" | "Sell";
|
|
596
|
+
export type Measure = "Mean" | "Median" | "NetCount" | "ArticleCount";
|
|
596
597
|
export type Role = "Any" | "Officer" | "Director" | "TenPercentOwner" | "OfficerOrDirector";
|
|
597
598
|
export type Instrument = "Equity" | "Call" | "Put";
|
|
598
599
|
export type Instrument2 = "Equity" | "Option";
|
|
@@ -1169,6 +1170,13 @@ export declare function IndicatorStandardDeviation(operand: Indicator, length?:
|
|
|
1169
1170
|
* @param interval Unit of time
|
|
1170
1171
|
*/
|
|
1171
1172
|
export declare function IndicatorWindowAgo(operand: Indicator, length: number, interval: Interval): Indicator;
|
|
1173
|
+
/**
|
|
1174
|
+
* News sentiment about an industry over its last lookbackDays daily news snapshots (default 1, the latest). industry is one of the canonical industry tags (the same list IsIndustry uses). Headlines come from the GDELT global news feed, and a fine-tuned model scores every headline that mentions the industry: whether it is really about the industry, and whether it is positive, neutral or negative news for it (a headline it calls neutral scores 0; others score from -1.0 to 1.0). Each trading day has one snapshot at 09:15 New York, and a headline counts toward the first session whose 09:15 cutoff is at or after the time GDELT published it. Backtests and live trading read the same rows. lookbackDays counts trading sessions whether or not the industry had news in them; a single session is noisy, and about 20 sessions is the usual window for a sentiment rule. Only headlines the model judges to be about the industry count, and copies of one story within 7 days count once per session. measure (default Mean): Mean is the average sentiment from -1.0 to 1.0, Median is the middle score (the average of the two middle scores for an even count), NetCount is positive minus negative headlines, ArticleCount is the number of qualifying headlines. Every measure has no value when the window cannot be read in full: before coverage begins on 2019-09-23, across sessions with no published snapshot, or when the latest snapshot due has not been published. Mean and Median also have no value when the window holds no qualifying headline; the counts are then 0. The value is the same for every asset: it takes no target asset.
|
|
1175
|
+
* @param industry Canonical industry tag whose news to read, as IsIndustry lists it. Legacy aliases are separate news series and are rejected, never mapped.
|
|
1176
|
+
* @param measure Median: middle score from -1 to 1 (the average of the two middle scores for an even count), with no value when no qualifying headline. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying headline. NetCount: positive minus negative headlines. ArticleCount: qualifying headlines. Every measure has no value before coverage begins on 2019-09-23, across missing snapshots, or when the due snapshot is unpublished.
|
|
1177
|
+
* @param lookbackDays Whole trading sessions of daily 09:15 New York news snapshots; 1 is the latest and about 20 is the usual window. The same value for every asset.
|
|
1178
|
+
*/
|
|
1179
|
+
export declare function IndustryNewsSentiment(industry: "technology" | "financialServices" | "healthcare" | "energy" | "consumerGoods" | "entertainmentAndMedia" | "manufacturing" | "transportation" | "realEstate" | "utilities" | "agriculture" | "education" | "retail" | "artificialIntelligence" | "aiInfrastructure" | "analytics" | "cloudComputing" | "dataCenter" | "database" | "cybersecurity" | "developerTools" | "software" | "saas" | "enterpriseSoftware" | "customerExperienceSoftware" | "productivityTools" | "collaborationSoftware" | "digitalSignatureAndAuthentication" | "hardware" | "consumerElectronics" | "networking" | "semiconductor" | "chipDesign" | "chipManufacturing" | "semiconductorEquipment" | "gpuAndAccelerators" | "memoryAndStorage" | "quantumComputing" | "robotics" | "industrialAutomation" | "iot" | "smartDevices" | "wearable" | "3dPrinting" | "augmentedReality" | "virtualReality" | "space" | "satellites" | "aerospace" | "defense" | "drones" | "financialInfrastructure" | "capitalMarketsTechnology" | "banking" | "assetManagement" | "brokerage" | "payments" | "fintech" | "insurance" | "autoInsurance" | "homeInsurance" | "lifeInsurance" | "healthInsurance" | "blockchain" | "cryptocurrency" | "biotechnology" | "pharmaceuticals" | "medicalDevices" | "digitalHealth" | "lifeSciencesSoftware" | "bioinformatics" | "computationalBiology" | "computationalDrugDiscovery" | "oncology" | "immunotherapy" | "vaccines" | "veterinary" | "oil" | "gas" | "oilfieldServices" | "cleanEnergy" | "renewableEnergy" | "solarEnergy" | "windEnergy" | "nuclearEnergy" | "hydrogen" | "batteryTechnology" | "miningAndNaturalResources" | "gold" | "silver" | "chemicals" | "advancedMaterials" | "waterInfrastructure" | "wasteManagementAndRecycling" | "forestry" | "construction" | "buildingMaterials" | "electricalAndGridInfrastructure" | "logisticsAndSupplyChain" | "airline" | "maritime" | "railroads" | "automotive" | "electricVehicle" | "autonomousTransportation" | "recreationalVehicle" | "cruise" | "rideShare" | "printing" | "packaging" | "householdProducts" | "ecommerce" | "digitalMarketplace" | "fashionAndApparel" | "luxuryGoods" | "jewelry" | "foodAndBeverage" | "foodDelivery" | "nutrition" | "petCare" | "outdoorAndRecreationalEquipment" | "sportsAndFitness" | "cannabis" | "hospitalityAndTravel" | "homeSecurity" | "advertising" | "gaming" | "gambling" | "sportsBetting" | "socialMedia" | "streaming" | "movies" | "musicAndAudio" | "publishing" | "telecommunications" | "edtech" | "proptech", measure?: Measure, lookbackDays?: number): Indicator;
|
|
1172
1180
|
/**
|
|
1173
1181
|
* InitialValue indicator.
|
|
1174
1182
|
*/
|
|
@@ -1407,12 +1415,12 @@ export declare function NewInstitutionalFiling(manager: string): Indicator;
|
|
|
1407
1415
|
*/
|
|
1408
1416
|
export declare function NewPoliticalDisclosure(memberId: string, instrument: Instrument2, disclosureAction: "Any" | "Purchase" | "Sale"): Indicator;
|
|
1409
1417
|
/**
|
|
1410
|
-
*
|
|
1418
|
+
* News sentiment about the asset over its last lookbackDays daily news snapshots (default 1, the latest). Headlines come from the GDELT global news feed, and a fine-tuned model scores every headline that names the company: whether it is really about the company, and whether it is positive, neutral or negative news for it (a headline it calls neutral scores 0; others score from -1.0 to 1.0). Each trading day has one snapshot at 09:15 New York, and a headline counts toward the first session whose 09:15 cutoff is at or after the time GDELT published it. Backtests and live trading read the same rows. lookbackDays counts trading sessions whether or not the asset had news in them; a single session is noisy, and about 20 sessions is the usual window for a sentiment rule. Only headlines the model judges to be about the company count, and copies of one story within 7 days count once per session. measure (default Mean): Mean is the average sentiment from -1.0 to 1.0, Median is the middle score (the average of the two middle scores for an even count), NetCount is positive minus negative headlines, ArticleCount is the number of qualifying headlines. Every measure has no value when the window cannot be read in full: before coverage begins on 2019-09-23, across sessions with no published snapshot, or when the latest snapshot due has not been published. Mean and Median also have no value when the window holds no qualifying headline; the counts are then 0. Headlines are matched to the issuer, so every listed share class reads the same news and META reads Facebook-era headlines.
|
|
1411
1419
|
* @param asset Pass CANDIDATE in a dynamic rebalance pipeline.
|
|
1412
|
-
* @param measure Median: middle score from -1 to 1, with no value when no qualifying news. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying news. NetCount: positive minus negative
|
|
1420
|
+
* @param measure Median: middle score from -1 to 1, with no value when no qualifying news. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying news. NetCount: positive minus negative headlines. ArticleCount: qualifying headlines. Every measure has no value before coverage begins on 2019-09-23, across missing snapshots, or when the due snapshot is unpublished.
|
|
1413
1421
|
* @param lookbackDays Whole trading sessions of daily 09:15 New York news snapshots; 1 is the latest. A row is visible from the snapshot the lake assigned it, the same time in backtests and live trading.
|
|
1414
1422
|
*/
|
|
1415
|
-
export declare function NewsSentiment(asset: AssetArg, measure?:
|
|
1423
|
+
export declare function NewsSentiment(asset: AssetArg, measure?: Measure, lookbackDays?: number): Indicator;
|
|
1416
1424
|
/**
|
|
1417
1425
|
* NewTradingWeek indicator.
|
|
1418
1426
|
*/
|
|
@@ -1797,6 +1805,8 @@ export interface BacktestConfig {
|
|
|
1797
1805
|
initialValue?: number;
|
|
1798
1806
|
/** Generate detailed event data (signals, orders, audits) during backtest. Costs 5x research tokens. Events are Mongo hot-store traces retained for 3 days. Use query_backtest_events to explore them while retained. */
|
|
1799
1807
|
generateEvents?: boolean;
|
|
1808
|
+
/** Create and execute a fresh backtest instead of reusing a prior identical result. Defaults to false. Requires portfolio_id. Use for an explicitly requested rerun or warm-cache timing; this reruns the simulation and incurs the normal backtest cost. */
|
|
1809
|
+
forceNewRun?: boolean;
|
|
1800
1810
|
/** Optional fee contract keyed by AssetTypeEnum (Stock/Cryptocurrency/Option) with {amount, type: percent|dollars}. Omit for shared defaults (Option $0.65/contract). For replay of an optimizer/walk-forward study, pass that study's persisted feeConfig. OptionSlippageFraction is supported: 0 fills at quote mid, 1 at ask for buys/bid for sells; omitted uses the engine default 0.5. Fills require a current executable quote; this does not enable last-trade fallback pricing. */
|
|
1801
1811
|
feeConfig?: FeeConfig;
|
|
1802
1812
|
/** Overrides the portfolio's dividend policy for this run only. Omit to use the portfolio's own setting (cash unless it was set to reinvest). "reinvest" buys more of the paying stock on each pay date, which is what a buy-and-hold comparison against the SPY total-return baseline needs. */
|
|
@@ -946,6 +946,19 @@ export function IndicatorWindowAgo(operand, length, interval) {
|
|
|
946
946
|
d.window = { length: length, interval: interval };
|
|
947
947
|
return d;
|
|
948
948
|
}
|
|
949
|
+
/**
|
|
950
|
+
* News sentiment about an industry over its last lookbackDays daily news snapshots (default 1, the latest). industry is one of the canonical industry tags (the same list IsIndustry uses). Headlines come from the GDELT global news feed, and a fine-tuned model scores every headline that mentions the industry: whether it is really about the industry, and whether it is positive, neutral or negative news for it (a headline it calls neutral scores 0; others score from -1.0 to 1.0). Each trading day has one snapshot at 09:15 New York, and a headline counts toward the first session whose 09:15 cutoff is at or after the time GDELT published it. Backtests and live trading read the same rows. lookbackDays counts trading sessions whether or not the industry had news in them; a single session is noisy, and about 20 sessions is the usual window for a sentiment rule. Only headlines the model judges to be about the industry count, and copies of one story within 7 days count once per session. measure (default Mean): Mean is the average sentiment from -1.0 to 1.0, Median is the middle score (the average of the two middle scores for an even count), NetCount is positive minus negative headlines, ArticleCount is the number of qualifying headlines. Every measure has no value when the window cannot be read in full: before coverage begins on 2019-09-23, across sessions with no published snapshot, or when the latest snapshot due has not been published. Mean and Median also have no value when the window holds no qualifying headline; the counts are then 0. The value is the same for every asset: it takes no target asset.
|
|
951
|
+
* @param industry Canonical industry tag whose news to read, as IsIndustry lists it. Legacy aliases are separate news series and are rejected, never mapped.
|
|
952
|
+
* @param measure Median: middle score from -1 to 1 (the average of the two middle scores for an even count), with no value when no qualifying headline. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying headline. NetCount: positive minus negative headlines. ArticleCount: qualifying headlines. Every measure has no value before coverage begins on 2019-09-23, across missing snapshots, or when the due snapshot is unpublished.
|
|
953
|
+
* @param lookbackDays Whole trading sessions of daily 09:15 New York news snapshots; 1 is the latest and about 20 is the usual window. The same value for every asset.
|
|
954
|
+
*/
|
|
955
|
+
export function IndustryNewsSentiment(industry, measure = "Mean", lookbackDays = 1) {
|
|
956
|
+
const d = { type: "IndustryNewsSentiment" };
|
|
957
|
+
d["industry"] = industry;
|
|
958
|
+
d["measure"] = measure;
|
|
959
|
+
d["lookbackDays"] = lookbackDays;
|
|
960
|
+
return d;
|
|
961
|
+
}
|
|
949
962
|
/**
|
|
950
963
|
* InitialValue indicator.
|
|
951
964
|
*/
|
|
@@ -1389,9 +1402,9 @@ export function NewPoliticalDisclosure(memberId, instrument, disclosureAction) {
|
|
|
1389
1402
|
return d;
|
|
1390
1403
|
}
|
|
1391
1404
|
/**
|
|
1392
|
-
*
|
|
1405
|
+
* News sentiment about the asset over its last lookbackDays daily news snapshots (default 1, the latest). Headlines come from the GDELT global news feed, and a fine-tuned model scores every headline that names the company: whether it is really about the company, and whether it is positive, neutral or negative news for it (a headline it calls neutral scores 0; others score from -1.0 to 1.0). Each trading day has one snapshot at 09:15 New York, and a headline counts toward the first session whose 09:15 cutoff is at or after the time GDELT published it. Backtests and live trading read the same rows. lookbackDays counts trading sessions whether or not the asset had news in them; a single session is noisy, and about 20 sessions is the usual window for a sentiment rule. Only headlines the model judges to be about the company count, and copies of one story within 7 days count once per session. measure (default Mean): Mean is the average sentiment from -1.0 to 1.0, Median is the middle score (the average of the two middle scores for an even count), NetCount is positive minus negative headlines, ArticleCount is the number of qualifying headlines. Every measure has no value when the window cannot be read in full: before coverage begins on 2019-09-23, across sessions with no published snapshot, or when the latest snapshot due has not been published. Mean and Median also have no value when the window holds no qualifying headline; the counts are then 0. Headlines are matched to the issuer, so every listed share class reads the same news and META reads Facebook-era headlines.
|
|
1393
1406
|
* @param asset Pass CANDIDATE in a dynamic rebalance pipeline.
|
|
1394
|
-
* @param measure Median: middle score from -1 to 1, with no value when no qualifying news. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying news. NetCount: positive minus negative
|
|
1407
|
+
* @param measure Median: middle score from -1 to 1, with no value when no qualifying news. Mean: average sentiment from -1 to 1, with no value when the window has no qualifying news. NetCount: positive minus negative headlines. ArticleCount: qualifying headlines. Every measure has no value before coverage begins on 2019-09-23, across missing snapshots, or when the due snapshot is unpublished.
|
|
1395
1408
|
* @param lookbackDays Whole trading sessions of daily 09:15 New York news snapshots; 1 is the latest. A row is visible from the snapshot the lake assigned it, the same time in backtests and live trading.
|
|
1396
1409
|
*/
|
|
1397
1410
|
export function NewsSentiment(asset, measure = "Mean", lookbackDays = 1) {
|
|
@@ -2005,6 +2018,7 @@ export const backtest = (portfolio, config) => ({
|
|
|
2005
2018
|
"interval": config.interval,
|
|
2006
2019
|
"initial_value": config.initialValue,
|
|
2007
2020
|
"generate_events": config.generateEvents,
|
|
2021
|
+
"force_new_run": config.forceNewRun,
|
|
2008
2022
|
"fee_config": config.feeConfig,
|
|
2009
2023
|
"dividend_policy": config.dividendPolicy,
|
|
2010
2024
|
}),
|