From 199a5d0214b3a14ed2a9fd9f5b6d3ee3131bd967 Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Sun, 24 Feb 2019 18:40:36 +0000 Subject: [PATCH] Take rebalance threshold from config file --- README.md | 3 ++- crypto_balancer/main.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b0de2e..a58d47e 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,13 @@ $ pip install -e . ``` ## Config -Create a config file in `config.ini` with definition of your exchange and portfolio percentages. +Create a config file in `config.ini` with definition of your exchange and portfolio percentages, and theshold (percent) that rebalancing is needed: ``` [binance] api_key = api_secret = +threshold = 2.0 targets = XRP 40 BTC 20 ETH 20 diff --git a/crypto_balancer/main.py b/crypto_balancer/main.py index 065cdd2..151a310 100644 --- a/crypto_balancer/main.py +++ b/crypto_balancer/main.py @@ -56,7 +56,7 @@ def exchange_choices(): print() rates = fetch_rates(exch, targets.keys()) - balancer = SimpleBalancer(targets, args.valuebase) + balancer = SimpleBalancer(targets, args.valuebase, threshold=float(config['threshold'])) base_values = balancer.calc_base_values(balances, rates) total_base_value = sum(base_values.values())