place order issue
overstartup opened this issue · 1 comments
overstartup commented
When i want to have position side. It gives error "{1: Operation failed. }" . But if I sent it to"net" it works fine:
Anybody can help to solve it?
OkexTradeMode trademode = preOrder.OrderMarginMode == MarginMode.Isolated ? OkexTradeMode.Isolated : OkexTradeMode.Cross;
OkexMarginMode marginmode = preOrder.OrderMarginMode == MarginMode.Isolated ? OkexMarginMode.Isolated : OkexMarginMode.Cross;
OkexOrderSide orderSide = preOrder.Signal == SignalResult.Long ? OkexOrderSide.Buy : OkexOrderSide.Sell;
OkexPositionSide positionSide = OkexPositionSide.Net;
if (preOrder.Signal != SignalResult.Net)
{
positionSide = preOrder.Signal == SignalResult.Long ? OkexPositionSide.Long : OkexPositionSide.Short;
}
var orderResult = api.PlaceOrder(preOrder.Symbol, trademode,
orderSide, positionSide,
OkexOrderType.MarketOrder, preOrder.Quantity, currency: "USDT");
burakoner commented
Hi
Some parameters are optional and some are mandatory. They depend on your order. Please refer to https://www.okx.com/docs-v5/en/#rest-api-trade-place-order and check your order. I can help you.