aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py9
1 files changed, 6 insertions, 3 deletions
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",
60 market.report.log_stage("make_order_end") 60 market.report.log_stage("make_order_end")
61 61
62def get_user_market(config_path, user_id, debug=False): 62def get_user_market(config_path, user_id, debug=False):
63 pg_config, report_path = parse_config(config_path) 63 args = ["--config", config_path]
64 if debug:
65 args.append("--debug")
66 args = parse_args(args)
67 pg_config = parse_config(args)
64 market_id, market_config, user_id = list(fetch_markets(pg_config, str(user_id)))[0] 68 market_id, market_config, user_id = list(fetch_markets(pg_config, str(user_id)))[0]
65 args = type('Args', (object,), { "debug": debug, "quiet": False })()
66 return market.Market.from_config(market_config, args, 69 return market.Market.from_config(market_config, args,
67 pg_config=pg_config, market_id=market_id, 70 pg_config=pg_config, market_id=market_id,
68 user_id=user_id, report_path=report_path) 71 user_id=user_id)
69 72
70def fetch_markets(pg_config, user): 73def fetch_markets(pg_config, user):
71 connection = psycopg2.connect(**pg_config) 74 connection = psycopg2.connect(**pg_config)