aboutsummaryrefslogtreecommitdiff
path: root/market.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-22 21:35:00 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-23 23:49:32 +0100
commit07fa7a4bf8f7a6f799120fb9a5965a09bea6c38e (patch)
tree77b3a11def1f6f005a87b49dffa58bd860cad8fb /market.py
parentb53f483d54367875bed3769d2e4817866fbde224 (diff)
downloadTrader-07fa7a4bf8f7a6f799120fb9a5965a09bea6c38e.tar.gz
Trader-07fa7a4bf8f7a6f799120fb9a5965a09bea6c38e.tar.zst
Trader-07fa7a4bf8f7a6f799120fb9a5965a09bea6c38e.zip
Add quiet flag for running
Diffstat (limited to 'market.py')
-rw-r--r--market.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/market.py b/market.py
index 2ddebfa..fc5832c 100644
--- a/market.py
+++ b/market.py
@@ -13,11 +13,12 @@ class Market:
13 trades = None 13 trades = None
14 balances = None 14 balances = None
15 15
16 def __init__(self, ccxt_instance, debug=False, user_id=None, report_path=None): 16 def __init__(self, ccxt_instance, args, user_id=None, report_path=None):
17 self.debug = debug 17 self.args = args
18 self.debug = args.debug
18 self.ccxt = ccxt_instance 19 self.ccxt = ccxt_instance
19 self.ccxt._market = self 20 self.ccxt._market = self
20 self.report = ReportStore(self) 21 self.report = ReportStore(self, verbose_print=(not args.quiet))
21 self.trades = TradeStore(self) 22 self.trades = TradeStore(self)
22 self.balances = BalanceStore(self) 23 self.balances = BalanceStore(self)
23 self.processor = Processor(self) 24 self.processor = Processor(self)
@@ -26,7 +27,7 @@ class Market:
26 self.report_path = report_path 27 self.report_path = report_path
27 28
28 @classmethod 29 @classmethod
29 def from_config(cls, config, debug=False, user_id=None, report_path=None): 30 def from_config(cls, config, args, user_id=None, report_path=None):
30 config["apiKey"] = config.pop("key", None) 31 config["apiKey"] = config.pop("key", None)
31 32
32 ccxt_instance = ccxt.poloniexE(config) 33 ccxt_instance = ccxt.poloniexE(config)
@@ -43,7 +44,7 @@ class Market:
43 ccxt_instance.session.request = request_wrap.__get__(ccxt_instance.session, 44 ccxt_instance.session.request = request_wrap.__get__(ccxt_instance.session,
44 ccxt_instance.session.__class__) 45 ccxt_instance.session.__class__)
45 46
46 return cls(ccxt_instance, debug=debug, user_id=user_id, report_path=report_path) 47 return cls(ccxt_instance, args, user_id=user_id, report_path=report_path)
47 48
48 def store_report(self): 49 def store_report(self):
49 self.report.merge(Portfolio.report) 50 self.report.merge(Portfolio.report)