简体   繁体   English

binance-python:如何获取期货交易品种数据?

[英]binance-python: How to get futures symbol data?

I see a function in client.py called futures_exchange_info(self) .我在 client.py 中看到一个名为futures_exchange_info(self)的 function 。 What is self here?这里的self是什么? The documentation is really slim but I'm assuming it refers to Exchange Information ?文档真的很薄,但我假设它指的是Exchange Information How does this function work exactly?这个 function 是如何工作的? I've tried calling it as futures_exchange_info('VETUSDT') but I just get the error: "TypeError: futures_exchange_info() takes 1 positional argument but 2 were given".我尝试将其称为futures_exchange_info('VETUSDT')但我只是收到错误消息:“TypeError:futures_exchange_info() 采用 1 个位置参数,但给出了 2 个”。

Does anyone know how this function works?有谁知道这个 function 是如何工作的?

You need to create a Client object and then call client.futures_exchange_info() .您需要创建一个Client object 然后调用client.futures_exchange_info() The method takes no parameters and according to the documentation returns "Current exchange trading rules and symbol information".该方法不带参数,根据文档返回“当前交易所交易规则和交易品种信息”。

Something like this should work:像这样的东西应该工作:

from binance.client import Client

client = Client(api_key, api_secret)
info = client.futures_exchange_info()

Documentation is here and take a look at the quick start .文档在这里并查看快速入门

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

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