X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=main.py;h=6383ed17775f185ad3973358a9bbcbc3a83b3a0c;hb=e6015816224f8f405e9b1c9557f22e73b21246e8;hp=b68d5408a800ced65e9c29242fabb169e5d481ba;hpb=a42d6cc8a49e82d851cde587fbc938b3b6364f63;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/main.py b/main.py index b68d540..6383ed1 100644 --- a/main.py +++ b/main.py @@ -60,12 +60,15 @@ def make_order(market, value, currency, action="acquire", market.report.log_stage("make_order_end") def get_user_market(config_path, user_id, debug=False): - pg_config, report_path = parse_config(config_path) + args = ["--config", config_path] + if debug: + args.append("--debug") + args = parse_args(args) + pg_config = parse_config(args) market_id, market_config, user_id = list(fetch_markets(pg_config, str(user_id)))[0] - args = type('Args', (object,), { "debug": debug, "quiet": False })() return market.Market.from_config(market_config, args, pg_config=pg_config, market_id=market_id, - user_id=user_id, report_path=report_path) + user_id=user_id) def fetch_markets(pg_config, user): connection = psycopg2.connect(**pg_config)