0

所以我是一个较新的 Python 入门程序。我一直在尝试拼凑一个程序,并且我正在使用 Python-Binance 包装器,但我无法弄清楚如何准确输入此参数以让我在此处返回信息。

例如,我正在尝试获取名为 ADAETH 的硬币配对的信息。这是行,但我不知道调用它的语法。我觉得我在这里遗漏了一些明显的东西。

get_order_book(**params) 获取市场订单簿

https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#order-book

参数: •symbol (str) – 必需 •limit (int) – 默认 100;最大 1000

回报:

API 响应

"lastUpdateId": 1027024,
"bids": [
    [
        "4.00000000",     # PRICE
        "431.00000000",   # QTY
        []                # Can be ignored
    ]
],
"asks": [
    [
        "4.00000200",
        "12.00000000",
        []
    ]
]
4

1 回答 1

0

如果你是 python 新手,我相信你会喜欢这个建议:安装它附带的Anaconda和名为 Spyder 的 IDE,它非常有用。我不确定您为什么要使用该库,但我建议您改用这个库https://github.com/sammchardy/python-binance这个是官方的。要安装 binance 库,请在 conda promt 中使用此命令

pip install python-binance

然后您可以在 .py 文件中使用此代码(使用 spyder 创建)

from binance.client import Client
api_key = 
api_secret = 
client = Client(api_key, api_secret)
orders=client.get_order_book(symbol='ADAETH') #This will give you a dict with current orders (bids and ask) and a an integer that represent the last updated ID.

来源:https ://python-binance.readthedocs.io/en/latest/index.html

于 2018-11-09T17:14:49.087 回答