diff options
Diffstat (limited to 'store.py')
-rw-r--r-- | store.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -43,13 +43,14 @@ class ReportStore: | |||
43 | }) | 43 | }) |
44 | 44 | ||
45 | @classmethod | 45 | @classmethod |
46 | def log_balances(cls, market): | 46 | def log_balances(cls, market, tag=None): |
47 | cls.print_log("[Balance]") | 47 | cls.print_log("[Balance]") |
48 | for currency, balance in BalanceStore.all.items(): | 48 | for currency, balance in BalanceStore.all.items(): |
49 | cls.print_log("\t{}".format(balance)) | 49 | cls.print_log("\t{}".format(balance)) |
50 | 50 | ||
51 | cls.add_log({ | 51 | cls.add_log({ |
52 | "type": "balance", | 52 | "type": "balance", |
53 | "tag": tag, | ||
53 | "balances": BalanceStore.as_json() | 54 | "balances": BalanceStore.as_json() |
54 | }) | 55 | }) |
55 | 56 | ||
@@ -196,13 +197,13 @@ class BalanceStore: | |||
196 | return amounts | 197 | return amounts |
197 | 198 | ||
198 | @classmethod | 199 | @classmethod |
199 | def fetch_balances(cls, market): | 200 | def fetch_balances(cls, market, tag=None): |
200 | all_balances = market.fetch_all_balances() | 201 | all_balances = market.fetch_all_balances() |
201 | for currency, balance in all_balances.items(): | 202 | for currency, balance in all_balances.items(): |
202 | if balance["exchange_total"] != 0 or balance["margin_total"] != 0 or \ | 203 | if balance["exchange_total"] != 0 or balance["margin_total"] != 0 or \ |
203 | currency in cls.all: | 204 | currency in cls.all: |
204 | cls.all[currency] = portfolio.Balance(currency, balance) | 205 | cls.all[currency] = portfolio.Balance(currency, balance) |
205 | ReportStore.log_balances(market) | 206 | ReportStore.log_balances(market, tag=tag) |
206 | 207 | ||
207 | @classmethod | 208 | @classmethod |
208 | def dispatch_assets(cls, amount, liquidity="medium", repartition=None): | 209 | def dispatch_assets(cls, amount, liquidity="medium", repartition=None): |