Skip to content

Instantly share code, notes, and snippets.

@hammertoe
Created February 24, 2019 19:58
Show Gist options
  • Save hammertoe/47d46d92bcc0eb408eb9b3d06fd59a23 to your computer and use it in GitHub Desktop.
Save hammertoe/47d46d92bcc0eb408eb9b3d06fd59a23 to your computer and use it in GitHub Desktop.
Output of some balancing runs
### I have just deposited some more XRP to what was a balanced portfolio, not is it is unbalanced
(crypto_balancer) Matts-iMac:crypto_balancer matt$ crypto_balancer binance
Connected to exchange: Binance
Balances:
XRP 4468.878282
BTC 0.01609
ETH 0.42
BNB 3.04830514
USDT 33.602051
Porfolio value:
XRP 1339.14406598412 (87.97 / 40.00%)
BTC 60.90877545 (4.00 / 20.00%)
ETH 58.3401 (3.83 / 20.00%)
BNB 30.235071776861 (1.99 / 10.00%)
USDT 33.602051 (2.21 / 10.00%)
Total value: 1522.23 USDT
Balancing needed:
SELL 821.2838311492899 XRP/ETH @ 0.0021579249999999998
SELL 812.7118647540419 XRP/BTC @ 7.918500000000001e-05
SELL 407.0878150044622 XRP/BNB @ 0.030185
SELL 395.85181679602863 XRP/USDT @ 0.29966000000000004
SELL 4.0922514568091873e-16 ETH/USDT @ 138.905
SELL 5.7309632723009705e-15 BNB/USDT @ 9.91865
No trades placed, as '--trade' not given on command line
### re-running with the --trade flag and it executes trades to re-balance
(crypto_balancer) Matts-iMac:crypto_balancer matt$ crypto_balancer --trade binance
Connected to exchange: Binance
Balances:
XRP 4468.878282
BTC 0.01609
ETH 0.42
BNB 3.04830514
USDT 33.602051
Porfolio value:
XRP 1338.63014498169 (87.97 / 40.00%)
BTC 60.88721485 (4.00 / 20.00%)
ETH 58.3422 (3.83 / 20.00%)
BNB 30.227755844525 (1.99 / 10.00%)
USDT 33.602051 (2.21 / 10.00%)
Total value: 1521.69 USDT
Balancing needed:
SELL 821.2311116367927 XRP/ETH @ 0.002157465
SELL 812.734842795717 XRP/BTC @ 7.9175e-05
SELL 407.0880195733413 XRP/BNB @ 0.030185
SELL 395.82328420645064 XRP/USDT @ 0.299545
Order placed: XRP/ETH sell 821.0 @ 0.00215747
Order placed: XRP/BTC sell 812.0 @ 7.918e-05
Order placed: XRP/BNB sell 407.0 @ 0.03019
Order placed: XRP/USDT sell 395.8 @ 0.29955
### Running again, you see it now thinks the portfolio is balanced
(crypto_balancer) Matts-iMac:crypto_balancer matt$ crypto_balancer binance
Connected to exchange: Binance
Balances:
XRP 2033.078282
BTC 0.08038416
ETH 2.19128287
BNB 15.28045804
USDT 152.163941
Porfolio value:
XRP 607.91073710082 (40.02 / 40.00%)
BTC 303.60775695359996 (19.99 / 20.00%)
ETH 304.05145462685005 (20.02 / 20.00%)
BNB 151.37967768777 (9.97 / 10.00%)
USDT 152.163941 (10.02 / 10.00%)
Total value: 1519.11 USDT
No balancing needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment