Finish implementing risk models
This commit is contained in:
@@ -112,7 +112,7 @@ class Account(models.Model):
|
||||
supported_symbols = models.JSONField(default=list)
|
||||
instruments = models.JSONField(default=list)
|
||||
currency = models.CharField(max_length=255, null=True, blank=True)
|
||||
riskmodel = models.ForeignKey(
|
||||
risk_model = models.ForeignKey(
|
||||
"core.RiskModel", on_delete=models.SET_NULL, null=True, blank=True
|
||||
)
|
||||
|
||||
@@ -383,6 +383,13 @@ class RiskModel(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(null=True, blank=True)
|
||||
# Maximum amount of money to have lost from the initial balance to stop trading
|
||||
maximum_loss_ratio = models.FloatField(default=0.05)
|
||||
max_loss_percent = models.FloatField(default=0.05)
|
||||
# Maximum amount of money to risk on all open trades
|
||||
maximum_risk_ratio = models.FloatField(default=0.05)
|
||||
max_risk_percent = models.FloatField(default=0.05)
|
||||
# Maximum number of trades
|
||||
max_open_trades = models.IntegerField(default=10)
|
||||
# Maximum number of trades per symbol
|
||||
max_open_trades_per_symbol = models.IntegerField(default=2)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
Reference in New Issue
Block a user