Skip to content

Commit

Permalink
Strategy missing data bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu2301 committed Jul 18, 2022
1 parent b74e45e commit 5921da0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mathieuc/tradingview",
"version": "3.3.1",
"version": "3.3.2",
"description": "Tradingview instant stocks API, indicator alerts, trading bot, and more !",
"main": "main.js",
"scripts": {
Expand Down
16 changes: 15 additions & 1 deletion src/chart/study.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ module.exports = (chartSession) => class ChartStudy {
changes.push('perfReport');
}

if (parsed.data && parsed.data.report && parsed.data.report.trades) {
this.#strategyReport.trades = parsed.data.report.trades;
changes.push('tradesReport');
}

if (parsed.data && parsed.data.report && parsed.data.report.history) {
this.#strategyReport.history = parsed.data.report.history;
changes.push('historyReport');
}

if (parsed.dataCompressed) {
const parsedC = await parseCompressed(parsed.dataCompressed);

Expand Down Expand Up @@ -372,7 +382,11 @@ module.exports = (chartSession) => class ChartStudy {
this.#callbacks.studyCompleted.push(cb);
}

/** @typedef {'plots' | 'perfReport' | 'fullReport'} UpdateChangeType */
/**
* @typedef {
* 'plots' | 'perfReport' | 'tradesReport' | 'historyReport' | 'fullReport'
* } UpdateChangeType
*/

/**
* When an indicator update happens
Expand Down

0 comments on commit 5921da0

Please sign in to comment.