简体   繁体   English

Python 加密货币 | CCXT.ftx().fetch_my_trades() KeyError“符号”

[英]Python cryptocurrency | CCXT.ftx().fetch_my_trades() KeyError "Symbol"

I use the CCXT module to communicate with multiple cryptocurrency exchanges.我使用 CCXT 模块与多个加密货币交易所进行通信。 However when trying to request my trades or other orders I get the error "Key error symbol" even tho i use a Valid symbol and other functions work.然而,当我尝试请求我的交易或其他订单时,即使我使用了有效符号并且其他功能正常工作,我也会收到错误“关键错误符号”。

Code :代码 :

cftx = ccxt.ftx({"apiKey":ftx_keys.api,
          "secret":ftx_keys.secret})
print(cftx.fetch_my_trades(symbol="BTC-PERP",limit=100))

Error:错误:

File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\ccxt\ftx.py", line 564, in parse_trade
    symbol = market['symbol']
KeyError: 'symbol'

I have tried other symbols and markets but without succses我尝试过其他符号和市场,但没有成功

You should call load_markets() before trying to fetch anything related to markets.在尝试获取与市场相关的任何内容之前,您应该调用load_markets()

Change your code like below:更改您的代码,如下所示:

cftx = ccxt.ftx({"apiKey":ftx_keys.api,
          "secret":ftx_keys.secret})
markets = cftx.load_markets()
print(cftx.fetch_my_trades(symbol="BTC-PERP",limit=100))

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

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