Skip to content

Instantly share code, notes, and snippets.

@SmartManoj
Created April 26, 2022 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmartManoj/5c4e0566c899bf213ffe0d66bd4ed433 to your computer and use it in GitHub Desktop.
Save SmartManoj/5c4e0566c899bf213ffe0d66bd4ed433 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