Skip to content

Instantly share code, notes, and snippets.

@SmartManoj
Created April 26, 2022 10:49
Show Gist options
  • Save SmartManoj/4b127e9ea4fe695ec32482680ffd7b2a to your computer and use it in GitHub Desktop.
Save SmartManoj/4b127e9ea4fe695ec32482680ffd7b2a to your computer and use it in GitHub Desktop.
import ccxt
from datetime import datetime
from pprint import pprint
connection = ccxt.gateio()
pair = 'FITFI/USDT'
timestamp = int(datetime.strptime(
"2022-04-26 10:30:00+00:00", "%Y-%m-%d %H:%M:%S%z").timestamp())
timeframe = '1m'
timeframe = '10s'
response = connection.fetch_ohlcv(pair, timeframe, None, 2,
params={'to': timestamp})
pprint([datetime.utcfromtimestamp(response[-1][0] / 1000).isoformat(), *response[-1][1:]])
pprint([datetime.utcfromtimestamp(response[0][0] / 1000).isoformat(), *response[0][1:]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment