diff --git a/src/routes/webhook/tradingview/+server.ts b/src/routes/webhook/tradingview/+server.ts index a646dc3..41342d4 100644 --- a/src/routes/webhook/tradingview/+server.ts +++ b/src/routes/webhook/tradingview/+server.ts @@ -73,10 +73,10 @@ export const POST = async ({ locals, request }) => { ) qty = ( - Number(form.data.entryPrice) / - ((Number(wallet.result.list[0].totalAvailableBalance) * + (Number(form.data.entryPrice) * Number(form.data.qtyPercent)) / - 100) + 100 / + Number(wallet.result.list[0].totalAvailableBalance) ).toString() takeProfit = ( Number(form.data.entryPrice) * @@ -85,7 +85,7 @@ export const POST = async ({ locals, request }) => { stopLoss = ( Number(form.data.entryPrice) * (1 - Number(form.data.stopLossPercent) / 100) - ).toString(2) + ).toString() } console.log({ qty, takeProfit, stopLoss }) @@ -99,8 +99,6 @@ export const POST = async ({ locals, request }) => { takeProfit, stopLoss, }) - - console.log(order.result.orderId) } catch (error) { console.log('Error', error) } finally {