pointsToTvOhlcStart() bugfix

This commit is contained in:
tim
2024-08-28 19:37:58 -04:00
parent 79a6822fd5
commit 8ce7f82098

View File

@@ -17,8 +17,8 @@ export function nearestOhlcStart(timestamp, periodSeconds=null) {
return Math.round((timestamp-OHLC_START) / periodSeconds) * periodSeconds + OHLC_START
}
export function pointsToTvOhlcStart(points) {
export function pointsToTvOhlcStart(points, periodSeconds=null) {
return points === null ? null : points.map((p) => {
return {time: nearestOhlcStart(p.time/1000)*1000, price: p.price}
return {time: nearestOhlcStart(p.time, periodSeconds), price: p.price}
})
}