Fix profit/loss calculation
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from core.trading.market import to_currency
|
||||
|
||||
|
||||
def check_max_loss(risk_model, initial_balance, account_balance):
|
||||
"""
|
||||
Check that the account balance is within the max loss limit.
|
||||
@@ -15,6 +18,8 @@ def check_max_risk(risk_model, account_trades):
|
||||
total_risk = 0
|
||||
for trade in account_trades:
|
||||
max_tmp = []
|
||||
# Need to calculate the max risk in base account currency
|
||||
# Percentages relate to the price movement, without accounting the size of the trade
|
||||
if "stop_loss_percent" in trade:
|
||||
max_tmp.append(trade["stop_loss_percent"])
|
||||
if "trailing_stop_loss_percent" in trade:
|
||||
|
||||
Reference in New Issue
Block a user