aboutsummaryrefslogtreecommitdiff
path: root/store.py
diff options
context:
space:
mode:
Diffstat (limited to 'store.py')
-rw-r--r--store.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/store.py b/store.py
index 76cfec8..2a71bed 100644
--- a/store.py
+++ b/store.py
@@ -99,7 +99,7 @@ class ReportStore:
99 "args": args, 99 "args": args,
100 }) 100 })
101 101
102 def log_balances(self, tag=None, tickers=None, 102 def log_balances(self, tag=None, checkpoint=None, tickers=None,
103 ticker_currency=None, compute_value=None, type=None): 103 ticker_currency=None, compute_value=None, type=None):
104 self.print_log("[Balance]") 104 self.print_log("[Balance]")
105 for currency, balance in self.market.balances.all.items(): 105 for currency, balance in self.market.balances.all.items():
@@ -108,6 +108,7 @@ class ReportStore:
108 log = { 108 log = {
109 "type": "balance", 109 "type": "balance",
110 "tag": tag, 110 "tag": tag,
111 "checkpoint": checkpoint,
111 "balances": self.market.balances.as_json() 112 "balances": self.market.balances.as_json()
112 } 113 }
113 114
@@ -303,7 +304,8 @@ class BalanceStore:
303 compute_value, type) 304 compute_value, type)
304 return amounts 305 return amounts
305 306
306 def fetch_balances(self, tag=None, add_portfolio=False, log_tickers=False, 307 def fetch_balances(self, tag=None, add_portfolio=False,
308 checkpoint=None, log_tickers=False,
307 ticker_currency="BTC", ticker_compute_value="average", ticker_type="total"): 309 ticker_currency="BTC", ticker_compute_value="average", ticker_type="total"):
308 all_balances = self.market.ccxt.fetch_all_balances() 310 all_balances = self.market.ccxt.fetch_all_balances()
309 for currency, balance in all_balances.items(): 311 for currency, balance in all_balances.items():
@@ -315,11 +317,11 @@ class BalanceStore:
315 self.all.setdefault(currency, portfolio.Balance(currency, {})) 317 self.all.setdefault(currency, portfolio.Balance(currency, {}))
316 if log_tickers: 318 if log_tickers:
317 tickers = self.in_currency(ticker_currency, compute_value=ticker_compute_value, type=ticker_type) 319 tickers = self.in_currency(ticker_currency, compute_value=ticker_compute_value, type=ticker_type)
318 self.market.report.log_balances(tag=tag, 320 self.market.report.log_balances(tag=tag, checkpoint=checkpoint,
319 tickers=tickers, ticker_currency=ticker_currency, 321 tickers=tickers, ticker_currency=ticker_currency,
320 compute_value=ticker_compute_value, type=ticker_type) 322 compute_value=ticker_compute_value, type=ticker_type)
321 else: 323 else:
322 self.market.report.log_balances(tag=tag) 324 self.market.report.log_balances(tag=tag, checkpoint=checkpoint)
323 325
324 def dispatch_assets(self, amount, liquidity="medium", repartition=None): 326 def dispatch_assets(self, amount, liquidity="medium", repartition=None):
325 if repartition is None: 327 if repartition is None: