diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-05-03 00:22:33 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-05-03 00:22:33 +0200 |
commit | 9b69786341d14fd4327b117a12437fd1650cd965 (patch) | |
tree | a534f8d64d247d50929f78c92c74acbe4131a1d2 /market.py | |
parent | 40d0fa279e0745b33676f21cdc8b496ebd301cf8 (diff) | |
download | Trader-9b69786341d14fd4327b117a12437fd1650cd965.tar.gz Trader-9b69786341d14fd4327b117a12437fd1650cd965.tar.zst Trader-9b69786341d14fd4327b117a12437fd1650cd965.zip |
Include current portfolio currencies when printing balances
Diffstat (limited to 'market.py')
-rw-r--r-- | market.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -255,6 +255,7 @@ class Processor: | |||
255 | "name": "print_balances", | 255 | "name": "print_balances", |
256 | "number": 1, | 256 | "number": 1, |
257 | "fetch_balances": ["begin"], | 257 | "fetch_balances": ["begin"], |
258 | "fetch_balances_args": { "add_portfolio": True }, | ||
258 | "print_tickers": { "base_currency": "BTC" }, | 259 | "print_tickers": { "base_currency": "BTC" }, |
259 | } | 260 | } |
260 | ], | 261 | ], |
@@ -386,15 +387,19 @@ class Processor: | |||
386 | def process_step(self, scenario_name, step, kwargs): | 387 | def process_step(self, scenario_name, step, kwargs): |
387 | process_name = "process_{}__{}_{}".format(scenario_name, step["number"], step["name"]) | 388 | process_name = "process_{}__{}_{}".format(scenario_name, step["number"], step["name"]) |
388 | self.market.report.log_stage("{}_begin".format(process_name)) | 389 | self.market.report.log_stage("{}_begin".format(process_name)) |
390 | |||
391 | fetch_args = step.get("fetch_balances_args", {}) | ||
389 | if "begin" in step.get("fetch_balances", []): | 392 | if "begin" in step.get("fetch_balances", []): |
390 | self.market.balances.fetch_balances(tag="{}_begin".format(process_name), log_tickers=True) | 393 | self.market.balances.fetch_balances(tag="{}_begin".format(process_name), |
394 | log_tickers=True, **fetch_args) | ||
391 | 395 | ||
392 | for action in self.ordered_actions: | 396 | for action in self.ordered_actions: |
393 | if action in step: | 397 | if action in step: |
394 | self.run_action(action, step[action], kwargs) | 398 | self.run_action(action, step[action], kwargs) |
395 | 399 | ||
396 | if "end" in step.get("fetch_balances", []): | 400 | if "end" in step.get("fetch_balances", []): |
397 | self.market.balances.fetch_balances(tag="{}_end".format(process_name), log_tickers=True) | 401 | self.market.balances.fetch_balances(tag="{}_end".format(process_name), |
402 | log_tickers=True, **fetch_args) | ||
398 | self.market.report.log_stage("{}_end".format(process_name)) | 403 | self.market.report.log_stage("{}_end".format(process_name)) |
399 | 404 | ||
400 | def method_arguments(self, action): | 405 | def method_arguments(self, action): |