X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=store.py;h=a7aad22d9fcab3933307df21f7974497ba996f61;hb=18167a3c502e9d61828067c3f6e56b5182584249;hp=dfadef22e1d2ad5e7591d5793bbaefbfc8105857;hpb=3d0247f944d7510943dfaa64eeb0e15a43b6c989;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/store.py b/store.py index dfadef2..a7aad22 100644 --- a/store.py +++ b/store.py @@ -43,13 +43,14 @@ class ReportStore: }) @classmethod - def log_balances(cls, market): + def log_balances(cls, market, tag=None): cls.print_log("[Balance]") for currency, balance in BalanceStore.all.items(): cls.print_log("\t{}".format(balance)) cls.add_log({ "type": "balance", + "tag": tag, "balances": BalanceStore.as_json() }) @@ -196,13 +197,13 @@ class BalanceStore: return amounts @classmethod - def fetch_balances(cls, market): + def fetch_balances(cls, market, tag=None): all_balances = market.fetch_all_balances() for currency, balance in all_balances.items(): if balance["exchange_total"] != 0 or balance["margin_total"] != 0 or \ currency in cls.all: cls.all[currency] = portfolio.Balance(currency, balance) - ReportStore.log_balances(market) + ReportStore.log_balances(market, tag=tag) @classmethod def dispatch_assets(cls, amount, liquidity="medium", repartition=None):