π Get real-time stocks from TradingView
TypeScript backtestingbacktesting-trading-strategiesbitcoinchartscryptocryptocurrencyethereumrealtime-stocksstocksstocks-apistocks-pricestradingtradingviewtradingview-apitradingview-indicatortradingview-replaytradingview-scraper
Fixes
Mathieu Colmoned6107b7f277
diff --git a/main.js b/main.jsindex becae2e..c625b30 100644--- a/main.js+++ b/main.js@@ -232,7 +232,7 @@ module.exports = (autoInit = true) => {* @typedef {Object} IndicatorInfos Indicator infos* @property {string} id ID of the indicator (Like: XXX;XXXXXXXXXXXXXXXXXXXXX)* @property {string} [name] Name of the indicator- * @property {string} version Wanted version of the indicator+ * @property {'last' | string} [version] Wanted version of the indicator* @property {(string | number | boolean | null)[]} [settings] Indicator settings value* @property {'study' | 'strategy'} [type] Script type*@@ -455,7 +455,7 @@ module.exports = (autoInit = true) => {if (['timescale_update', 'du'].includes(packet.type)) {await updatePeriods(packet);- onUpdate([...periods].reverse(), strategies);+ if (!isEnded) onUpdate([...periods].reverse(), strategies);return;}diff --git a/miscRequests.js b/miscRequests.jsindex fa7c908..e3cc6be 100644--- a/miscRequests.js+++ b/miscRequests.js@@ -275,11 +275,11 @@ module.exports = {/*** Get an indicator* @param {string} id Indicator ID (Like: PUB;XXXXXXXXXXXXXXXXXXXXX)- * @param {string} version Wanted version of the indicator+ * @param {'last' | string} [version] Wanted version of the indicator* @param {'study' | 'strategy'} [type] Script type* @returns {Promise<Indicator>} Indicator*/- async getIndicator(id, version, settings = [], type = 'study') {+ async getIndicator(id, version = 'last', settings = [], type = 'study') {const indicID = id.replace(/ |%/g, '%25');let data = await request({