aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.py b/main.py
index 856d449..55981bf 100644
--- a/main.py
+++ b/main.py
@@ -63,7 +63,8 @@ def make_order(market, value, currency, action="acquire",
63def get_user_market(config_path, user_id, debug=False): 63def get_user_market(config_path, user_id, debug=False):
64 pg_config, report_path = parse_config(config_path) 64 pg_config, report_path = parse_config(config_path)
65 market_config = list(fetch_markets(pg_config, str(user_id)))[0][0] 65 market_config = list(fetch_markets(pg_config, str(user_id)))[0][0]
66 return market.Market.from_config(market_config, debug=debug) 66 args = type('Args', (object,), { "debug": debug, "quiet": False })()
67 return market.Market.from_config(market_config, args, user_id=user_id, report_path=report_path)
67 68
68def fetch_markets(pg_config, user): 69def fetch_markets(pg_config, user):
69 connection = psycopg2.connect(**pg_config) 70 connection = psycopg2.connect(**pg_config)
@@ -109,6 +110,9 @@ def parse_args(argv):
109 parser.add_argument("--after", 110 parser.add_argument("--after",
110 default=False, action='store_const', const=True, 111 default=False, action='store_const', const=True,
111 help="Run the steps after the cryptoportfolio update") 112 help="Run the steps after the cryptoportfolio update")
113 parser.add_argument("--quiet",
114 default=False, action='store_const', const=True,
115 help="Don't print messages")
112 parser.add_argument("--debug", 116 parser.add_argument("--debug",
113 default=False, action='store_const', const=True, 117 default=False, action='store_const', const=True,
114 help="Run in debug mode") 118 help="Run in debug mode")
@@ -131,7 +135,7 @@ def parse_args(argv):
131def process(market_config, user_id, report_path, args): 135def process(market_config, user_id, report_path, args):
132 try: 136 try:
133 market.Market\ 137 market.Market\
134 .from_config(market_config, debug=args.debug, user_id=user_id, report_path=report_path)\ 138 .from_config(market_config, args, user_id=user_id, report_path=report_path)\
135 .process(args.action, before=args.before, after=args.after) 139 .process(args.action, before=args.before, after=args.after)
136 except Exception as e: 140 except Exception as e:
137 print("{}: {}".format(e.__class__.__name__, e)) 141 print("{}: {}".format(e.__class__.__name__, e))