Begin adding order settings
This commit is contained in:
@@ -10,6 +10,7 @@ from .models import ( # AssetRestriction,
|
||||
AssetRule,
|
||||
Hook,
|
||||
NotificationSettings,
|
||||
OrderSettings,
|
||||
RiskModel,
|
||||
Signal,
|
||||
Strategy,
|
||||
@@ -125,16 +126,17 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
|
||||
"asset_group",
|
||||
"risk_model",
|
||||
"trading_times",
|
||||
"order_type",
|
||||
"time_in_force",
|
||||
"order_settings",
|
||||
# "order_type",
|
||||
# "time_in_force",
|
||||
"entry_signals",
|
||||
"exit_signals",
|
||||
"trend_signals",
|
||||
"enabled",
|
||||
"take_profit_percent",
|
||||
"stop_loss_percent",
|
||||
"trailing_stop_loss_percent",
|
||||
"trade_size_percent",
|
||||
# "take_profit_percent",
|
||||
# "stop_loss_percent",
|
||||
# "trailing_stop_loss_percent",
|
||||
# "trade_size_percent",
|
||||
)
|
||||
|
||||
help_texts = {
|
||||
@@ -144,16 +146,16 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
|
||||
"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.",
|
||||
# "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.",
|
||||
"entry_signals": "Callbacks received to these signals will trigger a trade.",
|
||||
"exit_signals": "Callbacks received to these signals will close all trades for the symbol on the account.",
|
||||
"trend_signals": "Callbacks received to these signals will limit the trading direction of the given symbol to the callback direction until further notice.",
|
||||
"enabled": "Whether the strategy is enabled.",
|
||||
"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.",
|
||||
"trade_size_percent": "Percentage of the account balance to use for each trade.",
|
||||
# "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.",
|
||||
# "trade_size_percent": "Percentage of the account balance to use for each trade.",
|
||||
}
|
||||
|
||||
entry_signals = forms.ModelMultipleChoiceField(
|
||||
@@ -361,3 +363,28 @@ class AssetRuleForm(RestrictedFormMixin, ModelForm):
|
||||
"trigger_below": "Trigger Bearish when value is below this.",
|
||||
"trigger_above": "Trigger Bullish when value is above this.",
|
||||
}
|
||||
|
||||
|
||||
class OrderSettingsForm(RestrictedFormMixin, ModelForm):
|
||||
class Meta:
|
||||
model = OrderSettings
|
||||
fields = (
|
||||
"name",
|
||||
"description",
|
||||
"order_type",
|
||||
"time_in_force",
|
||||
"take_profit_percent",
|
||||
"stop_loss_percent",
|
||||
"trailing_stop_loss_percent",
|
||||
"trade_size_percent",
|
||||
)
|
||||
help_texts = {
|
||||
"name": "Name of the order settings. Informational only.",
|
||||
"description": "Description of the order settings. Informational only.",
|
||||
"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.",
|
||||
"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.",
|
||||
"trade_size_percent": "Percentage of the account balance to use for each trade.",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user