Begin work on increasing position size

master
Mark Veidemanis 1 year ago
parent 5843000df6
commit b4424a7782
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -80,6 +80,14 @@ ADJUST_CLOSE_NOTIFY_CHOICES = (
("adjust", "Adjust violating trades"),
)
ADJUST_WITH_DIRECTION_CHOICES = (
("none", "None"),
("close", "Close violating trades"),
("notify", "Notify only"),
("adjust", "Increase and reduce"),
("adjust_up", "Increase only"),
("adjust_down", "Reduce only"),
)
# class Plan(models.Model):
# name = models.CharField(max_length=255, unique=True)

@ -283,6 +283,15 @@ class ActiveManagementTestCase(StrategyMixin, SymbolPriceMock, TestCase):
},
)
def test_position_size_violated_increase_only(self):
pass
def test_position_size_violated_decrease_only(self):
pass
def test_position_size_violated_increase_decrease(self):
pass
def test_protection_violated(self):
self.trades[0]["takeProfitOrder"] = {"price": "0.0001"}
self.trades[0]["stopLossOrder"] = {"price": "0.0001"}

@ -203,6 +203,15 @@ class ActiveManagementLiveTestCase(ElasticMock, StrategyMixin, LiveBase, TestCas
trades = self.account.client.get_all_open_trades()
self.assertEqual(len(trades), 0)
def test_ams_position_size_violated_increase(self):
pass
def test_ams_position_size_violated_decrease(self):
pass
def test_ams_position_size_violated_increase_decrease(self):
pass
def test_ams_protection_violated(self):
self.active_management_policy.when_protection_violated = "close"
self.active_management_policy.save()

@ -44,6 +44,13 @@ def check_max_risk(risk_model, account_balance_usd, account_trades):
return allowed
def check_max_trade_risk(risk_model, account_balance_usd, trade):
"""
Check that the trade is within the max trade risk percentage of the account size.
"""
pass
def check_max_open_trades(risk_model, account_trades):
"""
Check that the number of trades in the account is within the max open trades limit.

Loading…
Cancel
Save