update qty calculation

master
TZGyn 10 months ago
parent fb7aeb5daa
commit 137f778cab
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -51,13 +51,24 @@ export const POST = async ({ locals, request }) => {
let takeProfit
let stopLoss
const client = new RestClientV5({
key: key,
secret: secret,
demoTrading: true,
})
if (form.data.type === 'Flat') {
qty = form.data.qty
takeProfit = form.data.takeProfit
stopLoss = form.data.stopLoss
} else {
const wallet = await client.getCoinBalance({
accountType: 'UNIFIED',
coin: 'USDT',
})
qty = (
(Number(form.data.entryPrice) *
(Number(wallet.result.balance.transferBalance) *
Number(form.data.qtyPercent)) /
100
).toFixed(2)
@ -71,12 +82,6 @@ export const POST = async ({ locals, request }) => {
).toFixed(2)
}
const client = new RestClientV5({
key: key,
secret: secret,
demoTrading: true,
})
console.log({ qty, takeProfit, stopLoss })
const order = await client.submitOrder({

Loading…
Cancel
Save