<reponame>colticol/bold-arbitrager<gh_stars>0
import sys
import time

from settings import settings
from exchange.exchange_controller import ExchangeController


class BoldArbitrager(object):
  """Arbitrager"""
  def __init__(self):
    self.__symbol  = settings['logic']['symbol']
    self.__interval = settings['logic']['interval']
    self.__force_close_position = settings['logic']['force_close_position']
    self.__exchange = ExchangeController(settings['exchange'], settings['logic'])

  def go(self):
    try:
      while True:
        self.__exchange.arbitrage(self.__symbol)
        time.sleep(self.__interval)
    except Exception as e:
      raise e
    finally:
      if self.__force_close_position:
        self.__exchange.force_close_position(self.__symbol)

if __name__ == '__main__':
  bot = BoldArbitrager()
  bot.go()
