diff --git a/src/lib/numbers.ts b/src/lib/numbers.ts index 83af15b..b090522 100644 --- a/src/lib/numbers.ts +++ b/src/lib/numbers.ts @@ -1,4 +1,4 @@ -function roundUp(num: number, precision: number) { +export function roundUp(num: number, precision: number) { precision = Math.pow(10, precision) return Math.ceil(num * precision) / precision } diff --git a/src/routes/webhook/tradingview/tradingstop/+server.ts b/src/routes/webhook/tradingview/tradingstop/+server.ts index 1376f98..6e4cd83 100644 --- a/src/routes/webhook/tradingview/tradingstop/+server.ts +++ b/src/routes/webhook/tradingview/tradingstop/+server.ts @@ -1,5 +1,6 @@ import { db } from '$lib/db/index.js' import { bybit_logs } from '$lib/db/schema.js' +import { roundUp } from '$lib/numbers' import { json } from '@sveltejs/kit' import { RestClientV5 } from 'bybit-api' import { z } from 'zod'