BfxRest: add ability to specify timeframe when seeding candles

This commit is contained in:
Jacob Plaster
2019-01-11 14:38:09 +00:00
parent 504f8422b4
commit 500e662f35

View File

@@ -67,11 +67,11 @@ class BfxRest:
# Public Data # # Public Data #
################################################## ##################################################
async def get_seed_candles(self, symbol): async def get_seed_candles(self, symbol, tf='1m'):
""" """
Used by the honey framework, this function gets the last 4k candles. Used by the honey framework, this function gets the last 4k candles.
""" """
endpoint = 'candles/trade:1m:{}/hist?limit=5000&_bfx=1'.format(symbol) endpoint = 'candles/trade:{}:{}/hist?limit=5000&_bfx=1'.format(tf, symbol)
time_difference = (1000 * 60) * 5000 time_difference = (1000 * 60) * 5000
# get now to the nearest min # get now to the nearest min
now = int(round((time.time() // 60 * 60) * 1000)) now = int(round((time.time() // 60 * 60) * 1000))