()
| 47 | let interval = NaN; |
| 48 | |
| 49 | async function step() { |
| 50 | const period = { ...chart.periods[0] }; |
| 51 | |
| 52 | const times = Object.keys(periods); |
| 53 | const intrval = times[times.length - 1] - times[times.length - 2]; |
| 54 | if (Number.isNaN(interval) && times.length >= 2) interval = intrval; |
| 55 | |
| 56 | if (!Number.isNaN(interval) && interval !== intrval) { |
| 57 | throw new Error(`Wrong interval: ${intrval} (should be ${interval})`); |
| 58 | } |
| 59 | |
| 60 | indicators.forEach(([n, i]) => { |
| 61 | const plots = { ...i.periods[0] }; |
| 62 | delete plots.$time; |
| 63 | period[n] = { plots }; |
| 64 | |
| 65 | Object.keys(i.graphic).forEach((g) => { |
| 66 | if (!i.graphic[g].length) return; |
| 67 | if (!period[n].graphics) period[n].graphics = {}; |
| 68 | period[n].graphics[g] = i.graphic[g]; |
| 69 | }); |
| 70 | }); |
| 71 | |
| 72 | periods[period.time] = period; |
| 73 | |
| 74 | console.log('Next ->', period.time, times.length); |
| 75 | |
| 76 | await chart.replayStep(1); |
| 77 | step(); |
| 78 | } |
| 79 | |
| 80 | chart.onReplayEnd(async () => { |
| 81 | await client.end(); |
no test coverage detected