我如何使用 python-binance 获取订单的 orderId?

时间:2021-01-30 11:58:52

标签: python binance

我最近开始关注python-binance。我通读了整个 API,并在 Google 上花了很长时间,试图找出如何获得 orderId

API 经常声明您需要 orderId 来执行某些功能,但从未说明如何实际获取订单的 orderId

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

您需要先创建一个订单,您将在响应中获得 orderId:

{
    "symbol": "BTCUSDT",
    "orderId": 28,
    "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP",
    "transactTime": 1507725176595,
    "price": "0.00000000",
    "origQty": "10.00000000",
    "executedQty": "10.00000000",
    "status": "FILLED",
    "timeInForce": "GTC",
    "type": "MARKET",
    "side": "SELL"
}

看这里https://python-binance.readthedocs.io/en/latest/binance.html?highlight=create_order#binance.client.Client.create_order