You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to solve it.
The call requires a start date and a end date. The docs make it seem its not mandatory.
def date_to_seconds(date_str):
"""Convert UTC date to seconds
If using offset strings add "UTC" to date string e.g. "now UTC", "11 hours ago UTC"
See dateparse docs for formats http://dateparser.readthedocs.io/en/latest/
:param date_str: date in readable format, i.e. "January 01, 2018", "11 hours ago UTC", "now UTC"
:type date_str: str
"""
# get epoch value in UTC
epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
# parse our date string
d = dateparser.parse(date_str)
# if the date is not timezone aware apply UTC timezone
if d.tzinfo is None or d.tzinfo.utcoffset(d) is None:
d = d.replace(tzinfo=pytz.utc)
# return the difference in time
return int((d - epoch).total_seconds())
I am trying to get a 1hour Kline for a token and I cant get it to work.
from kucoin.client import Client as kucoin_client
kucoin_api_key = '6cccc1f'
kucoin_api_secret = '96912bcccc47b'
kucoin_api_passphrase = 'Voccccccc!'
kucoin_client = kucoin_client(kucoin_api_key, kucoin_api_secret, kucoin_api_passphrase)
symbol = 'ETH-BTC'
interval = '1hour'
x = {'symbol': symbol}
y = {'kline_type': interval}
try:
getkline = kucoin_client.get_kline_data(**x, **y)
getkline = kucoin_client.get_kline_data(symbol, interval)
except Exception as e:
error_call = e
getkline gets the result: '<coroutine object Client.get_kline_data at 0x00000111C02ADE40>' which obviosuly not what I want.
What am I doing wrong?
The text was updated successfully, but these errors were encountered: