initial diagonal work (unfinished)

This commit is contained in:
Tim
2024-04-30 21:30:16 -04:00
parent e8dafc0732
commit 056a4e299d
11 changed files with 357 additions and 165 deletions

View File

@@ -4,6 +4,7 @@ import {token} from "@/blockchain/token.js";
import Color from "color";
import {DateTime} from "luxon";
import router from "@/router/index.js";
import {useChartOrderStore} from "@/orderbuild.js";
export function nav(name) {
// noinspection JSIgnoredPromiseFromCall
@@ -250,3 +251,20 @@ export function intervalToSeconds(interval) {
: 60 // if no unit char, then it's minutes
}
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}})
}
export function interpolate(a, b, zeroToOne) {
const d = (b-a)
return a + d * zeroToOne
}