]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/blobdiff - helper.py
Add print_balances helper
[perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git] / helper.py
index 8ef2d642203252c8d14ab9328ad1fbcb7e59a4d8..3e39785d4bb1a75d5bde324403161ddc3dcc053a 100644 (file)
--- a/helper.py
+++ b/helper.py
@@ -118,6 +118,14 @@ def print_orders(market, base_currency="BTC"):
         print(balance)
     TradeStore.print_all_with_order()
 
+def print_balances(market, base_currency="BTC"):
+    BalanceStore.fetch_balances(market)
+    for currency, balance in BalanceStore.all.items():
+        print(balance)
+    if base_currency is not None:
+        print("total:")
+        print(sum(BalanceStore.in_currency(base_currency, market).values()))
+
 def process_sell_needed__1_sell(market, base_currency="BTC", debug=False):
     prepare_trades(market, base_currency=base_currency, debug=debug)
     TradeStore.prepare_orders(compute_value="average", only="dispose")