update tpsl price decimals to follow entry point

master
TZGyn 9 months ago
parent 40805df808
commit 7afff761df
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -102,7 +102,8 @@ export const POST = async ({ locals, request }) => {
const [price, decimals] = form.data.entryPrice.split('.')
console.log('Decimals', decimals)
console.log('Decimals Length', decimals.length)
console.log('Decimals Length', decimals?.length || 0)
const decimalLength = decimals?.length || 0
qty = (
(Number(wallet.result.list[0].totalAvailableBalance) *
@ -113,11 +114,11 @@ export const POST = async ({ locals, request }) => {
takeProfit = (
Number(form.data.entryPrice) *
(1 + Number(form.data.takeProfitPercent) / 100)
).toFixed(1)
).toFixed(decimalLength)
stopLoss = (
Number(form.data.entryPrice) *
(1 - Number(form.data.stopLossPercent) / 100)
).toFixed(1)
).toFixed(decimalLength)
side = form.data.side
} else {
const position = await client.getPositionInfo({

Loading…
Cancel
Save