mirror of
https://git.wownero.com/lza_menace/totrader.git
synced 2024-08-15 00:33:13 +00:00
wrap methods in try/except so fails dont kill everything
This commit is contained in:
parent
7967949438
commit
5d06b8ee23
1 changed files with 22 additions and 10 deletions
32
trade.py
32
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
|
||||
|
|
Loading…
Reference in a new issue