swap tpsl if sell order

master
TZGyn 9 months ago
parent c0e9eb7521
commit b8ff408186
Signed by: TZGyn
GPG Key ID: 122EAF77AE81FD4A

@ -4,7 +4,6 @@ import { z } from 'zod'
export const POST = async ({ locals, request }) => {
const type = request.headers.get('Content-Type')
console.log('Type:', type)
if (type !== 'application/json; charset=utf-8') {
return new Response()
}
@ -35,6 +34,7 @@ export const POST = async ({ locals, request }) => {
leverage: z.string().default('1'),
takeProfitPercent: z.string().optional(),
stopLossPercent: z.string().optional(),
// tpslDecimalPoint: z.string().default('1'),
})
const closePositionSchema = z.object({
type: z.literal('Close Position'),
@ -144,8 +144,8 @@ export const POST = async ({ locals, request }) => {
side,
orderType: 'Market',
qty,
takeProfit,
stopLoss,
takeProfit: side === 'Buy' ? takeProfit : stopLoss,
stopLoss: side === 'Sell' ? stopLoss : takeProfit,
isLeverage: isLeverage ? 1 : 0,
})
return new Response()

Loading…
Cancel
Save