burakoner / OKX.Api

Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper
MIT License
39 stars 15 forks source link

PlaceOrder error #19

Closed xiuxiang closed 1 year ago

xiuxiang commented 1 year ago

api.SetApiCredentials has been set correctly var trade_01 = api.PlaceOrder("BTC-USDT", OkexTradeMode.Cash, OkexOrderSide.Buy, OkexPositionSide.Long, OkexOrderType.MarketOrder, 0.01m); Error : 1: All operations failed There is no specific error message, I don't know how to deal with it

burakoner commented 1 year ago

Sorry for delay, I was on vacation. You can track original response with RawResponse as below.

var api = new OKXRestApiClient(new OKXRestApiClientOptions
{
    RawResponse = true,
});

var call = await api.SomeMethodToCall();
var rawResponse = call.Raw;
mesutpiskin commented 6 months ago

Hello, I am encountering a similar error. The Response object appears to be empty, what could be the reason for this, do you have any information on this case? Thanks for assist

var trade_01 = await api.OrderBookTrading.Trade.PlaceOrderAsync("BTC-USDT", OkxTradeMode.Cash, OkxOrderSide.Buy, OkxPositionSide.Long, OkxOrderType.MarketOrder, 0.1m);

image

mesutpiskin commented 6 months ago

Hello, I am encountering a similar error. The Response object appears to be empty, what could be the reason for this, do you have any information on this case? Thanks for assist

var trade_01 = await api.OrderBookTrading.Trade.PlaceOrderAsync("BTC-USDT", OkxTradeMode.Cash, OkxOrderSide.Buy, OkxPositionSide.Long, OkxOrderType.MarketOrder, 0.1m);

image

When I sent a request with Postman, I received a response like below, the reason for the error is due to insufficient balance, but the error message returned in the data is not being handled, I guess an improvement is needed here.

service response:

{
    "code": "1",
    "data": [
        {
            "clOrdId": "b15",
            "ordId": "",
            "sCode": "51008",
            "sMsg": "Order failed. Insufficient USDT balance in account. ",
            "tag": ""
        }
    ],
    "inTime": "1709043826429122",
    "msg": "All operations failed",
    "outTime": "1709043826429623"
}