1
0
crypto-seller/crypto_seller/__main__.py

42 lines
1.1 KiB
Python
Raw Normal View History

2024-07-17 20:21:58 +00:00
import datetime
import logging
import logging.handlers
2024-07-17 20:21:58 +00:00
from decimal import Decimal
import fin_defs
2024-07-17 20:21:58 +00:00
from . import PATH_LOG_FILE, AutoSellConfig, run_auto_sell
from . import logger as module_logger
2024-07-17 20:21:58 +00:00
logger = logging.getLogger(__name__)
2024-07-17 20:21:58 +00:00
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')
2024-07-17 20:21:58 +00:00
logger.info('Initializing crypto_seller')
2024-07-17 20:21:58 +00:00
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,
2024-07-17 20:21:58 +00:00
)
run_auto_sell(config)
2024-07-17 20:21:58 +00:00
if __name__ == '__main__':
main()