简体   繁体   中英

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

I use the CCXT module to communicate with multiple cryptocurrency exchanges. 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.

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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