diagonals working

This commit is contained in:
Tim
2024-05-13 16:32:16 -04:00
parent c7549e2f99
commit bf39ed946c
5 changed files with 132 additions and 31 deletions

13
src/charts/chart-misc.js Normal file
View File

@@ -0,0 +1,13 @@
import {useChartOrderStore} from "@/orderbuild.js";
export function nearestOhlcStart(time) {
// todo subtract OHLC root time
const period = useChartOrderStore().intervalSecs
return Math.round(time / period) * period
}
export function pointsToOhlcStart(points) {
return points === null ? null : points.map((p) => {
return {time: nearestOhlcStart(p.time), price: p.price}
})
}