1
0

Basic CLI

This commit is contained in:
Jon Michael Aanes 2024-07-22 14:53:48 +02:00
parent ccdaa8fd15
commit f5b69badd4

View File

@ -1,10 +1,12 @@
import datetime
import logging
import logging.handlers
import argparse
import time
from decimal import Decimal
import fin_defs
import fin_depo
from . import PATH_LOG_FILE, AutoSellConfig, config, run_auto_sell, log_results
from . import logger as module_logger
@ -13,6 +15,7 @@ logger = logging.getLogger(__name__)
def setup_logging():
"""Enables logging for the terminal and to a log file."""
PATH_LOG_FILE.parent.mkdir(parents=True, exist_ok=True)
file_handler = logging.handlers.WatchedFileHandler(filename=PATH_LOG_FILE)
file_handler.setFormatter(
@ -27,9 +30,20 @@ def setup_logging():
logger.setLevel('INFO')
module_logger.setLevel('INFO')
CLI_DESCRIPTION = """
Sells financial assets from an online account.
""".strip()
def parse_args():
parser = argparse.ArgumentParser('crypto_seller', description = CLI_DESCRIPTION)
return parser.parse_args()
def main():
"""Initializes the program."""
setup_logging()
args = parse_args()
logger.info('Initializing crypto_seller')
seller_backend = fin_depo.defi_kucoin.KucoinDepoFetcher(