Ejemplo 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)

    if settings['market_pairs']:
        market_pairs = settings['market_pairs']
        logger.info("Found configured markets: %s", market_pairs)
        market_data = exchange_interface.get_exchange_markets(
            markets=market_pairs)
    else:
        logger.info("No configured markets, using all available on exchange.")
        market_data = exchange_interface.get_exchange_markets()


#    notifier = Notifier(config.notifiers, market_data)

    thread_list = []

    for exchange in market_data:
        num = 1
        for chunk in split_market_data(market_data[exchange]):
            market_data_chunk = dict()
            market_data_chunk[exchange] = {
                key: market_data[exchange][key]
                for key in chunk
            }

            notifier = Notifier(config.notifiers, config.indicators,
                                market_data_chunk)
            behaviour = Behaviour(config, exchange_interface, notifier)

            workerName = "Worker-{}".format(num)
            worker = AnalysisWorker(workerName, behaviour, notifier,
                                    market_data_chunk, settings, logger)
            thread_list.append(worker)
            worker.daemon = True
            worker.start()

            time.sleep(60)
            num += 1

    logger.info('All workers are running!')

    for worker in thread_list:
        worker.join()
Ejemplo n.º 2
0
# Set up logger
logs.configure_logging(settings['log_level'], settings['log_mode'])
logger = structlog.get_logger()

update_interval = ceil(settings['update_interval'] / 60)
logger.info('udate interval %d ', update_interval)

config_indicators = config.indicators

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

if settings['market_pairs']:
    market_pairs = settings['market_pairs']
    logger.info("Found configured markets: %s", market_pairs)
    market_data = exchange_interface.get_exchange_markets(markets=market_pairs)
else:
    logger.info("No configured markets, using all available on exchange.")
    market_data = exchange_interface.get_exchange_markets()

#Dict to save user defined fibonacci levels
fibonacci = None

#Global Telegram Bot Updater
updater = None

# create schedule for retrieving prices
scheduler = BackgroundScheduler()


def setup_fibonacci(market_data):