Add risk model and views
This commit is contained in:
@@ -112,6 +112,9 @@ 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(
|
||||
"core.RiskModel", on_delete=models.SET_NULL, null=True, blank=True
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
name = f"{self.name} ({self.exchange})"
|
||||
@@ -375,20 +378,11 @@ class NotificationSettings(models.Model):
|
||||
return f"Notification settings for {self.user}"
|
||||
|
||||
|
||||
# class Perms(models.Model):
|
||||
# class Meta:
|
||||
# permissions = (
|
||||
# ("bypass_hashing", "Can bypass field hashing"), #
|
||||
# ("bypass_blacklist", "Can bypass the blacklist"), #
|
||||
# ("bypass_encryption", "Can bypass field encryption"), #
|
||||
# ("bypass_obfuscation", "Can bypass field obfuscation"), #
|
||||
# ("bypass_delay", "Can bypass data delay"), #
|
||||
# ("bypass_randomisation", "Can bypass data randomisation"), #
|
||||
# ("post_irc", "Can post to IRC"),
|
||||
# ("post_discord", "Can post to Discord"),
|
||||
# ("query_search", "Can search with query strings"), #
|
||||
# ("use_insights", "Can use the Insights page"),
|
||||
# ("index_int", "Can use the internal index"),
|
||||
# ("index_meta", "Can use the meta index"),
|
||||
# ("restricted_sources", "Can access restricted sources"),
|
||||
# )
|
||||
class RiskModel(models.Model):
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
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)
|
||||
# Maximum amount of money to risk on all open trades
|
||||
maximum_risk_ratio = models.FloatField(default=0.05)
|
||||
|
||||
Reference in New Issue
Block a user