X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=store.py;h=2a71bed1e55c0cd9c7e1e417f05d6c7cd24d2350;hb=8a87fda40d24e3048809990f965c07d4a1e7559e;hp=76cfec88f4648e55cd9f1b084204e46f5ad730b4;hpb=9b69786341d14fd4327b117a12437fd1650cd965;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/store.py b/store.py index 76cfec8..2a71bed 100644 --- a/store.py +++ b/store.py @@ -99,7 +99,7 @@ class ReportStore: "args": args, }) - def log_balances(self, tag=None, tickers=None, + def log_balances(self, tag=None, checkpoint=None, tickers=None, ticker_currency=None, compute_value=None, type=None): self.print_log("[Balance]") for currency, balance in self.market.balances.all.items(): @@ -108,6 +108,7 @@ class ReportStore: log = { "type": "balance", "tag": tag, + "checkpoint": checkpoint, "balances": self.market.balances.as_json() } @@ -303,7 +304,8 @@ class BalanceStore: compute_value, type) return amounts - def fetch_balances(self, tag=None, add_portfolio=False, log_tickers=False, + def fetch_balances(self, tag=None, add_portfolio=False, + checkpoint=None, log_tickers=False, ticker_currency="BTC", ticker_compute_value="average", ticker_type="total"): all_balances = self.market.ccxt.fetch_all_balances() for currency, balance in all_balances.items(): @@ -315,11 +317,11 @@ class BalanceStore: self.all.setdefault(currency, portfolio.Balance(currency, {})) if log_tickers: tickers = self.in_currency(ticker_currency, compute_value=ticker_compute_value, type=ticker_type) - self.market.report.log_balances(tag=tag, + self.market.report.log_balances(tag=tag, checkpoint=checkpoint, tickers=tickers, ticker_currency=ticker_currency, compute_value=ticker_compute_value, type=ticker_type) else: - self.market.report.log_balances(tag=tag) + self.market.report.log_balances(tag=tag, checkpoint=checkpoint) def dispatch_assets(self, amount, liquidity="medium", repartition=None): if repartition is None: