* @param {import('../types').TimeFrame} timeframe Chart period timeframe * @param {number} [range] Number of loaded periods/candles (Default: 100) * @param {number} [reference] Reference candle timestamp (Default is now)
(timeframe = '240', range = 100, reference = null)
| 302 | * @param {number} [reference] Reference candle timestamp (Default is now) |
| 303 | */ |
| 304 | setSeries(timeframe = '240', range = 100, reference = null) { |
| 305 | if (!this.#currentSeries) { |
| 306 | this.#handleError('Please set the market before setting series'); |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | const calcRange = !reference ? range : ['bar_count', reference, range]; |
| 311 | |
| 312 | this.#periods = {}; |
| 313 | |
| 314 | this.#client.send(`${this.#seriesCreated ? 'modify' : 'create'}_series`, [ |
| 315 | this.#chartSessionID, |
| 316 | '$prices', |
| 317 | 's1', |
| 318 | `ser_${this.#currentSeries}`, |
| 319 | timeframe, |
| 320 | this.#seriesCreated ? '' : calcRange, |
| 321 | ]); |
| 322 | |
| 323 | this.#seriesCreated = true; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Set the chart market |
no test coverage detected