Finish implementing active management hooks

This commit is contained in:
2023-02-18 11:54:30 +00:00
parent 3e35214e82
commit 466b17400f
9 changed files with 271 additions and 123 deletions

View File

@@ -1,17 +1,9 @@
from datetime import time
from decimal import Decimal as D
from os import getenv
from unittest.mock import Mock, patch
from core.models import (
Account,
Hook,
OrderSettings,
RiskModel,
Signal,
Strategy,
TradingTime,
User,
)
from core.models import Account, OrderSettings, RiskModel, Strategy, TradingTime, User
# Create patch mixin to mock out the Elastic client
@@ -48,7 +40,7 @@ class SymbolPriceMock:
cls.patcher = patch("core.exchanges.common.get_symbol_price")
patcher = cls.patcher.start()
patcher.return_value = 1
patcher.return_value = D(1)
@classmethod
def tearDownClass(cls):
@@ -141,7 +133,7 @@ class StrategyMixin:
max_loss_percent=50,
max_risk_percent=10,
max_open_trades=10,
max_open_trades_per_symbol=2,
max_open_trades_per_symbol=5,
)
self.strategy = Strategy.objects.create(