BingX-API / docs

BingX API Docs
4 stars 4 forks source link

Bulk order in swap API only places one order only #6

Open AnMakc opened 1 month ago

AnMakc commented 1 month ago

When multiple orders are sent to the /openApi/swap/v2/trade/batchOrders Bulk order endpoint, only one of the orders is placed and non-informative error is returned for others.

For example, request with following orders

{
    "batchOrders": [
        {
            "symbol": "BTC-USDT",
            "side": "SELL",
            "positionSide": "BOTH",
            "type": "STOP_MARKET",
            "reduceOnly": true,
            "stopPrice": 65000,
            "quantity": 0.0004,
        },
        {
            "symbol": "BTC-USDT",
            "side": "SELL",
            "positionSide": "BOTH",
            "type": "TAKE_PROFIT_MARKET",
            "reduceOnly": true,
            "stopPrice": 75000,
            "quantity": 0.0002,
        },
        {
            "symbol": "BTC-USDT",
            "side": "SELL",
            "positionSide": "BOTH",
            "type": "TAKE_PROFIT_MARKET",
            "reduceOnly": true,
            "stopPrice": 80000,
            "quantity": 0.0002,
        },
    ]
}

Results in following response:

{
    "code": 80001,
    "data": {
        "orders": [
            {
                "orderId": 1778161388905664512,
                "positionSide": "BOTH",
                "quantity": 0.0004,
                "reduceOnly": true,
                "side": "SELL",
                "stopPrice": 65000,
                "symbol": "BTC-USDT",
                "type": "STOP_MARKET",
                "workingType": "MARK_PRICE",
                // Remaining fields for this order here
            }
        ]
    },
    "msg": "Please try again later; Please try again later",
}
AnMakc commented 1 month ago

Note that attempt to place several orders one-by-one using POST /openApi/swap/v2/trade/order may also return "Please try again later;" message if requests are sent with no artificial delay.