import datetime import logging import logging.handlers from decimal import Decimal import fin_defs from . import PATH_LOG_FILE, AutoSellConfig, run_auto_sell from . import logger as module_logger logger = logging.getLogger(__name__) def main(): PATH_LOG_FILE.parent.mkdir(parents=True, exist_ok=True) file_handler = logging.handlers.WatchedFileHandler(filename=PATH_LOG_FILE) file_handler.setFormatter( logging.Formatter( '%(levelname)s:%(asctime)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', ), ) logging.basicConfig(handlers=[logging.StreamHandler(), file_handler]) logger.setLevel('INFO') module_logger.setLevel('INFO') logger.info('Initializing crypto_seller') config = AutoSellConfig( input_amount_range=(Decimal('0.5'), Decimal('1')), interval_range=(datetime.timedelta(seconds=2), datetime.timedelta(seconds=6)), input_asset=fin_defs.MPC, output_asset=fin_defs.USDT, exit_when_empty=True, ) run_auto_sell(config) if __name__ == '__main__': main()