From be35240bb2c490b9b3b80462701fb2b283e4fb93 Mon Sep 17 00:00:00 2001 From: Bryan Ingle Date: Thu, 4 Apr 2024 10:48:54 -0600 Subject: [PATCH] Futher restrict options-flow alerts to US equities and US indices --- docs/content/releases/4.19.1.md | 4 ++++ example/node/README.md | 2 +- lib/AlertManager.js | 4 ++-- lib/data/validators/instrument.js | 4 ++++ 4 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 docs/content/releases/4.19.1.md diff --git a/docs/content/releases/4.19.1.md b/docs/content/releases/4.19.1.md new file mode 100644 index 0000000..d03bae3 --- /dev/null +++ b/docs/content/releases/4.19.1.md @@ -0,0 +1,4 @@ +**Bug Fixes** + +* Updated the `AlertManager.filterPropertiesForSymbol` function to further limit options-flow properties (to US equities and US indices). +* Updated the `AlertManager.filterTemplatesForSymbol` function to further limit options-flow properties (to US equities and US indices). diff --git a/example/node/README.md b/example/node/README.md index 224960f..22d91ae 100644 --- a/example/node/README.md +++ b/example/node/README.md @@ -34,5 +34,5 @@ These scripts also illustrate: ```shell node example.js --user_id=me node example.js --user_id=me --mode=http -node example.js --user_id=me --host=localhost --port=3000 +node example.js --user_id=me --host=localhost --port=3010 ``` \ No newline at end of file diff --git a/lib/AlertManager.js b/lib/AlertManager.js index 44bdd0f..4de1841 100644 --- a/lib/AlertManager.js +++ b/lib/AlertManager.js @@ -1093,7 +1093,7 @@ module.exports = (() => { } if (valid && (property.property_id === 238 || property.property_id === 239)) { - valid = instrument.hasOptions; + valid = instrument.hasOptions && (instrument.symbolType === 1 || instrument.symbolType === 9); } if (valid && is.number(target)) { @@ -1234,7 +1234,7 @@ module.exports = (() => { } if (valid && properties.some(p => p === 238 || p === 239)) { - valid = instrument.hasOptions; + valid = instrument.hasOptions && (instrument.symbolType === 1 || instrument.symbolType === 9); } return valid; diff --git a/lib/data/validators/instrument.js b/lib/data/validators/instrument.js index 7023ae3..bc31c3c 100644 --- a/lib/data/validators/instrument.js +++ b/lib/data/validators/instrument.js @@ -28,6 +28,10 @@ module.exports = (() => { if ((property.property_id === 238 || property.property_id === 239) && !instrument.hasOptions) { throw new Error(`${symbol} does not have options and cannot be used for option flow alerts`); } + + if ((property.property_id === 238 || property.property_id === 239) && !(instrument.symbolType === 1 || instrument.symbolType === 9)) { + throw new Error(`${symbol} does not support option flow alerts`); + } } } };