Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'timestamp' in ccxt/kucoin.py #3039

Closed
dmig opened this issue Jun 5, 2018 · 4 comments
Closed

KeyError: 'timestamp' in ccxt/kucoin.py #3039

dmig opened this issue Jun 5, 2018 · 4 comments
Assignees

Comments

@dmig
Copy link

dmig commented Jun 5, 2018

Programming Language version: python 3.6.5
CCXT version: 1.14.131

timestamp = response['data']['timestamp']

Started getting this exception after lib update:

Traceback (most recent call last):
  File "lib/exchange_utils.py", line 87, in _fetch_wrapper
    response[p] = fetch_func(p)
  File "venv/lib/python3.6/site-packages/ccxt/kucoin.py", line 347
    timestamp = response['data']['timestamp']
KeyError: 'timestamp'

Looks like exchange response format differs

@kroitor kroitor self-assigned this Jun 5, 2018
@kroitor
Copy link
Member

kroitor commented Jun 5, 2018

@dmig which symbol is it? Can you please post your verbose request / response? https://github.com/ccxt/ccxt/wiki/FAQ#im-trying-to-run-the-code-but-its-not-working-how-do-i-fix-it

@dmig
Copy link
Author

dmig commented Jun 5, 2018

Ok, here it is:

Request: GET https://api.kucoin.com/v1/open/orders?symbol=DRGN-BTC {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', 'Accept-Encoding': 'gzip, deflate'} None

Response: GET https://api.kucoin.com/v1/open/orders?symbol=DRGN-BTC 200 {'Date': 'Tue, 05 Jun 2018 11:02:41 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': 'https://www.kucoin.com', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept, Accept-Language', 'Access-Control-Allow-Methods': 'POST, GET, PUT, OPTIONS, DELETE, PATCH', 'Access-Control-Max-Age': '86400', 'KC-NODE': 'localhost'} {"success":true,"code":"OK","msg":"Operation succeeded.","timestamp":1528196561612,"data":{"SELL":[[7.956E-5,3.6292,2.8874E-4],[7.957E-5,346.8973,0.02760262],[8.047E-5,671.2913,0.05401881],[8.05E-5,91.8071,0.00739047],[8.058E-5,5.8226,4.6919E-4],[8.069E-5,216.6153,0.01747869]],"BUY":[[7.908E-5,4195.641,0.33179129],[7.904E-5,448.5187,0.03545092],[7.903E-5,1155.3218,0.09130508],[7.897E-5,2274.9241,0.17965076],[7.893E-5,1559.0568,0.12305635],[7.89E-5,41.6669,0.00328752]]}}
Traceback (most recent call last):
  File "tools/ccxt-test.py", line 25, in <module>
    pp.pprint(Exchange.fetchOrderBook(market))
  File "venv/lib/python3.6/site-packages/ccxt/kucoin.py", line 347, in fetch_order_book
    timestamp = response['data']['timestamp']
KeyError: 'timestamp'

@kroitor kroitor closed this as completed in b7b8d08 Jun 5, 2018
@dmig
Copy link
Author

dmig commented Jun 5, 2018

A small testcase

import ccxt

Exchange = ccxt.Kucion(verbose=True)
print(Exchange.fetchOrderBook("DRGN/BTC"))

@kroitor
Copy link
Member

kroitor commented Jun 5, 2018

@dmig the fix has been uploaded, the new build is on the way, will be available in new version 1.14.136 in 5-10 minutes. Thx for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants