initial diagonal work (unfinished)
This commit is contained in:
18
src/misc.js
18
src/misc.js
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user