繁体   English   中英

在Python中为Binance API输入参数

[英]Inputting parameters for Binance API in Python

所以我是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",
        []
    ]
]

如果您是python的新手,我相信您会喜欢此建议的:安装Anaconda随附的工具,以及名为Spyder的IDE,这确实有用。 我不确定您为什么要使用该库,但我建议使用此库,而不是https://github.com/sammchardy/python-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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM