Esempio n. 1
0
def main():
    """Initializes the application
    """
     # Load settings and create the config object
    config = Configuration()
    settings = config.settings

    # Set up logger
    logs.configure_logging(settings['log_level'], settings['log_mode'])
    logger = structlog.get_logger()

    # Configure and run configured behaviour.
    exchange_interface = ExchangeInterface(config.exchanges)
    notifier = Notifier(config.notifiers)

    behaviour = Behaviour(
        config,
        exchange_interface,
        notifier
    )

    while True:
        behaviour.run(settings['market_pairs'], settings['output_mode'])
        logger.info("Sleeping for %s seconds", settings['update_interval'])
        time.sleep(settings['update_interval'])
Esempio n. 2
0
def run_from_config(config_ff, threadID):
    # Load settings and create the config object
    config = Configuration(config_ff)
    settings = config.settings

    # Set up logger
    logs.configure_logging(settings['log_level'], settings['log_mode'])
    logger = structlog.get_logger()

    logger.info(" %s", threadID)

    # Configure and run configured behaviour.
    exchange_interface = ExchangeInterface(config.exchanges)
    notifier = Notifier(config.notifiers, config)

    behaviour = Behaviour(config, exchange_interface, notifier)

    while True:
        if settings['run_on_start']:
            start = time.time()
            behaviour.run(settings['market_pairs'], settings['output_mode'])
            end = time.time()

            dif = end - start

            wait_for = settings['update_interval'] - int(dif)
            logger.info("Sleeping for %s seconds", wait_for)
            time.sleep(wait_for)
        else:
            logger.info("Run on start not enabled waiting for %s seconds",
                        settings['wait_and_run'])
            time.sleep(settings['wait_and_run'])
Esempio n. 3
0
def main():
    """Initializes the application
    """
    # Load settings and create the config object
    config = Configuration()
    settings = config.settings

    # Set up logger
    logs.configure_logging(settings['log_level'], settings['log_mode'])
    logger = structlog.get_logger()

    # Configure and run configured behaviour.
    exchange_interface = ExchangeInterface(config.exchanges)
    notifier = Notifier(config.notifiers)

    behaviour = Behaviour(config, exchange_interface, notifier)

    while True:
        behaviour.run(settings['market_pairs'], settings['output_mode'])
        logger.info("Sleeping for %s seconds", settings['update_interval'])
        time.sleep(settings['update_interval'])
Esempio n. 4
0
def load_exchange(exchange):
    global config, market_data, fibonacci, new_results
           
    try:
        single_config = dict()
        single_config[exchange] = config.exchanges[exchange]
                
        single_exchange_interface = ExchangeInterface(single_config)
            
        single_market_data = dict()
        single_market_data[exchange] = market_data[exchange]
                
        behaviour = Behaviour(config, single_exchange_interface)
    
        new_result = behaviour.run(exchange, single_market_data, fibonacci, config.settings['output_mode'])
        
        new_results[exchange] = new_result[exchange]
        
        return True
    except Exception as exc:
        logger.info('Exception while processing exchange: %s', exchange)
        #logger.info('%s', exc)
        raise exc