Skip to content

Instantly share code, notes, and snippets.

@macd2
Last active January 4, 2021 06:29
Show Gist options
  • Save macd2/0430c7c77a6630c21c6167dfe034b660 to your computer and use it in GitHub Desktop.
Save macd2/0430c7c77a6630c21c6167dfe034b660 to your computer and use it in GitHub Desktop.
jesse-bot multi-symbol-download allows you to download multiple symbols in a loop without the need of manually inserting each symbol
# add this file to YOUR_PROJECT_ROOT
from YOUR_PROJECT_ROOT.symbols_ import symbols
from jesse import register_custom_exception_handler
from jesse.modes import import_candles_mode
from jesse.services import db
from jesse.routes import router
def get_candles(start_date, routes_, extra_candles_):
router.set_routes(routes_)
router.set_extra_candles(extra_candles_)
for i in symbols:
try:
tmfrm = [x[2] for x in routes_ if x[1] == i][0]
print('Downloading:', i, tmfrm)
register_custom_exception_handler()
import_candles_mode.run(exchange='Binance', symbol=i, start_date_str=start_date, skip_confirmation=True)
db.close_connection()
except IndexError:
print(f'Please add {i} to routes_')
except Exception as e:
print(e)
if __name__ == '__main__':
# Set start_date and timeframe than run python3 get_candles.py
start_date = '2020-01-01'
timeframe = '4h'
get_candles(start_date=start_date, routes_=[('Binance', x, timeframe, 'YOURS_STRATEGY') for x in symbols], extra_candles_=[])
# add this file to YOUR_PROJECT_ROOT and insert your desired symbols
symbols = ["BTC-USDT", "ETH-USDT",add_your_symbols...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment