diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-05 12:14:49 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-04-05 12:14:49 +0200 |
commit | e6015816224f8f405e9b1c9557f22e73b21246e8 (patch) | |
tree | dc1e22add15b904f5c960024a23fd664769a09f7 /main.py | |
parent | dcc1e201c17dd096fb757f973341e98865809f33 (diff) | |
download | Trader-e6015816224f8f405e9b1c9557f22e73b21246e8.tar.gz Trader-e6015816224f8f405e9b1c9557f22e73b21246e8.tar.zst Trader-e6015816224f8f405e9b1c9557f22e73b21246e8.zip |
Fix console helper
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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 | ||
62 | def get_user_market(config_path, user_id, debug=False): | 62 | def 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 | ||
70 | def fetch_markets(pg_config, user): | 73 | def fetch_markets(pg_config, user): |
71 | connection = psycopg2.connect(**pg_config) | 74 | connection = psycopg2.connect(**pg_config) |