Move risk model to strategy

This commit is contained in:
2023-02-15 18:15:36 +00:00
parent 9a5ed32be9
commit 1974b19157
5 changed files with 115 additions and 17 deletions

View File

@@ -89,7 +89,6 @@ class AccountForm(RestrictedFormMixin, ModelForm):
"exchange",
"api_key",
"api_secret",
"risk_model",
"initial_balance",
"sandbox",
"enabled",
@@ -101,7 +100,6 @@ class AccountForm(RestrictedFormMixin, ModelForm):
"api_secret": "The API secret or password/token for the account.",
"sandbox": "Whether to use the sandbox/demo or not.",
"enabled": "Whether the account is enabled.",
"risk_model": "The risk model to use for this account.",
"initial_balance": "The initial balance of the account.",
}
@@ -125,6 +123,7 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"description",
"account",
"asset_group",
"risk_model",
"trading_times",
"order_type",
"time_in_force",
@@ -135,8 +134,6 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"take_profit_percent",
"stop_loss_percent",
"trailing_stop_loss_percent",
"price_slippage_percent",
"callback_price_deviation_percent",
"trade_size_percent",
)
@@ -145,6 +142,7 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"description": "Description of the strategy. Informational only.",
"account": "The account to use for this strategy.",
"asset_group": "Asset groups determine which pairs can be traded.",
"risk_model": "The risk model to use for this strategy. Highly recommended.",
"trading_times": "When the strategy will place new trades.",
"order_type": "Market: Buy/Sell at the current market price. Limit: Buy/Sell at a specified price. Limits protect you more against market slippage.",
"time_in_force": "The time in force controls how the order is executed.",
@@ -155,8 +153,6 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"take_profit_percent": "The take profit will be set at this percentage above/below the entry price.",
"stop_loss_percent": "The stop loss will be set at this percentage above/below the entry price.",
"trailing_stop_loss_percent": "The trailing stop loss will be set at this percentage above/below the entry price. A trailing stop loss will follow the price as it moves in your favor.",
"price_slippage_percent": "The price slippage is the maximum percent the price can move against you before the trade is cancelled. Limit orders will be set at this percentage against your favour. Market orders will have a price bound set if this is supported.",
"callback_price_deviation_percent": "The callback price deviation is the maximum percent the price can change between receiving the callback and acting on it. This protects against rogue or delayed callbacks. Keep it low.",
"trade_size_percent": "Percentage of the account balance to use for each trade.",
}
@@ -297,6 +293,8 @@ class RiskModelForm(RestrictedFormMixin, ModelForm):
"max_risk_percent",
"max_open_trades",
"max_open_trades_per_symbol",
"price_slippage_percent",
"callback_price_deviation_percent",
)
help_texts = {
"name": "Name of the risk model. Informational only.",
@@ -305,6 +303,8 @@ class RiskModelForm(RestrictedFormMixin, ModelForm):
"max_risk_percent": "The maximum percent of the account balance that can be risked on all open trades.",
"max_open_trades": "The maximum number of open trades.",
"max_open_trades_per_symbol": "The maximum number of open trades per symbol.",
"price_slippage_percent": "The price slippage is the maximum percent the price can move against you before the trade is cancelled. Limit orders will be set at this percentage against your favour. Market orders will have a price bound set if this is supported.",
"callback_price_deviation_percent": "The callback price deviation is the maximum percent the price can change between receiving the callback and acting on it. This protects against rogue or delayed callbacks. Keep it low.",
}