stable/freqtrade/commands/trade_commands.py

30 lines
714 B
Python
Raw Normal View History

import logging
from typing import Any, Dict
2021-04-01 05:49:54 +00:00
logger = logging.getLogger(__name__)
def start_trading(args: Dict[str, Any]) -> int:
"""
Main entry point for trading mode
"""
2020-01-26 23:49:25 +00:00
# Import here to avoid loading worker module when it's not used
from freqtrade.worker import Worker
2020-01-26 23:49:25 +00:00
# Create and run worker
worker = None
try:
worker = Worker(args)
worker.run()
except Exception as e:
logger.error(str(e))
logger.exception("Fatal exception!")
except KeyboardInterrupt:
logger.info('SIGINT received, aborting ...')
finally:
if worker:
logger.info("worker found ... calling exit")
worker.exit()
return 0