Implement storing asset restriction callbacks

This commit is contained in:
2023-02-10 23:26:30 +00:00
parent c283c6c192
commit 010aba7f81
5 changed files with 78 additions and 8 deletions

View File

@@ -89,10 +89,10 @@ class AccountForm(RestrictedFormMixin, ModelForm):
"exchange",
"api_key",
"api_secret",
"sandbox",
"enabled",
"risk_model",
"initial_balance",
"sandbox",
"enabled",
)
help_texts = {
"name": "Name of the account. Informational only.",
@@ -119,6 +119,7 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"name",
"description",
"account",
"asset_group",
"trading_times",
"order_type",
"time_in_force",
@@ -138,6 +139,7 @@ class StrategyForm(RestrictedFormMixin, ModelForm):
"name": "Name of the strategy. Informational only.",
"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.",
"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.",
@@ -323,6 +325,7 @@ class AssetRestrictionForm(RestrictedFormMixin, ModelForm):
"name",
"description",
"pairs",
"pairs_parsed",
)
help_texts = {
"name": "Name of the asset restriction group. Informational only.",
@@ -330,6 +333,8 @@ class AssetRestrictionForm(RestrictedFormMixin, ModelForm):
"pairs": "Comma-separated list of pairs to restrict when a webhook is received. This does nothing on its own.",
}
pairs_parsed = forms.BooleanField(widget=forms.HiddenInput)
def clean(self):
cleaned_data = super(AssetRestrictionForm, self).clean()
if "pairs" in cleaned_data and cleaned_data["pairs"]: