burakoner / OKEx.Net

Open source .Net API wrapper for the @OKEx V5 Rest API and V5 Websocket API
MIT License
86 stars 48 forks source link

place order issue #81

Closed overstartup closed 1 year ago

overstartup commented 1 year ago

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 1 year ago

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.