diff --git a/trade.py b/trade.py index 9f8eec3..259a780 100755 --- a/trade.py +++ b/trade.py @@ -163,25 +163,37 @@ if __name__ == '__main__': exit() 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 if orders_counter == 3: - t.update_orders() - logging.info('[ORDERS] Resetting orders counter') - orders_counter = 0 + try: + t.update_orders() + 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 if balances_counter == 6: - t.store_balances() - logging.info('[BALANCE] Resetting balances counter') - balances_counter = 0 + try: + t.store_balances() + 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 if market_maker_counter == 2: - t.start_market_maker() - logging.info('[MARKET MAKER] Resetting market maker counter') - market_maker_counter = 0 + try: + t.start_market_maker() + 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 balances_counter += 1