aboutsummaryrefslogtreecommitdiff
path: root/helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'helper.py')
-rw-r--r--helper.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/helper.py b/helper.py
index f1aeaf2..8ef2d64 100644
--- a/helper.py
+++ b/helper.py
@@ -4,10 +4,13 @@ from store import *
4 4
5def move_balances(market, debug=False): 5def move_balances(market, debug=False):
6 needed_in_margin = {} 6 needed_in_margin = {}
7 for currency in BalanceStore.all:
8 if BalanceStore.all[currency].margin_free != 0:
9 needed_in_margin[currency] = 0
7 for trade in TradeStore.all: 10 for trade in TradeStore.all:
11 if trade.value_to.currency not in needed_in_margin:
12 needed_in_margin[trade.value_to.currency] = 0
8 if trade.trade_type == "short": 13 if trade.trade_type == "short":
9 if trade.value_to.currency not in needed_in_margin:
10 needed_in_margin[trade.value_to.currency] = 0
11 needed_in_margin[trade.value_to.currency] += abs(trade.value_to) 14 needed_in_margin[trade.value_to.currency] += abs(trade.value_to)
12 for currency, needed in needed_in_margin.items(): 15 for currency, needed in needed_in_margin.items():
13 current_balance = BalanceStore.all[currency].margin_free 16 current_balance = BalanceStore.all[currency].margin_free