wrap methods in try/except so fails dont kill everything

This commit is contained in:
lza_menace 2020-09-07 20:38:33 -07:00
parent 7967949438
commit 5d06b8ee23

View file

@ -163,25 +163,37 @@ if __name__ == '__main__':
exit() exit()
while True: while True:
t.store_market_data() try:
t.store_market_data()
except Exception as e:
logging.info('[ERROR] Unable to store market data!', e)
# update orders every 3 minutes # update orders every 3 minutes
if orders_counter == 3: if orders_counter == 3:
t.update_orders() try:
logging.info('[ORDERS] Resetting orders counter') t.update_orders()
orders_counter = 0 logging.info('[ORDERS] Resetting orders counter')
orders_counter = 0
except Exception as e:
logging.info('[ERROR] Unable to update orders!', e)
# update balances every 6 minutes # update balances every 6 minutes
if balances_counter == 6: if balances_counter == 6:
t.store_balances() try:
logging.info('[BALANCE] Resetting balances counter') t.store_balances()
balances_counter = 0 logging.info('[BALANCE] Resetting balances counter')
balances_counter = 0
except Exception as e:
logging.info('[ERROR] Unable to update balances!', e)
# start market makers every 2 minutes # start market makers every 2 minutes
if market_maker_counter == 2: if market_maker_counter == 2:
t.start_market_maker() try:
logging.info('[MARKET MAKER] Resetting market maker counter') t.start_market_maker()
market_maker_counter = 0 logging.info('[MARKET MAKER] Resetting market maker counter')
market_maker_counter = 0
except Exception as e:
logging.info('[ERROR] Unable to start market maker!', e)
orders_counter += 1 orders_counter += 1
balances_counter += 1 balances_counter += 1