Merge pull request #5935 from freqtrade/short_buy_tag_compat
Short buy tag compat
This commit is contained in:
@@ -43,3 +43,24 @@ As this does however increase risk and provides no benefit, it's been removed fo
|
||||
|
||||
Using separate hyperopt files was deprecated in 2021.4 and was removed in 2021.9.
|
||||
Please switch to the new [Parametrized Strategies](hyperopt.md) to benefit from the new hyperopt interface.
|
||||
|
||||
## Margin / short changes
|
||||
|
||||
// TODO-lev: update version here
|
||||
|
||||
## Strategy changes
|
||||
|
||||
As strategies now have to support multiple different signal types, some things had to change.
|
||||
|
||||
Columns:
|
||||
|
||||
* `buy` -> `enter_long`
|
||||
* `sell` -> `exit_long`
|
||||
* `buy_tag` -> `enter_tag`
|
||||
|
||||
New columns are `enter_short` and `exit_short`, which will initiate short trades (requires additional configuration!)
|
||||
|
||||
### webhooks - `buy_tag` has been renamed to `enter_tag`
|
||||
|
||||
This should apply only to your strategy and potentially to webhooks.
|
||||
We will keep a compatibility layer for 1-2 versions (so both `buy_tag` and `enter_tag` will still work), but support for this in webhooks will disappear after that.
|
||||
|
@@ -77,7 +77,7 @@ class AwesomeStrategy(IStrategy):
|
||||
|
||||
***
|
||||
|
||||
## Buy Tag
|
||||
## Enter Tag
|
||||
|
||||
When your strategy has multiple buy signals, you can name the signal that triggered.
|
||||
Then you can access you buy signal on `custom_sell`
|
||||
@@ -89,7 +89,7 @@ def populate_buy_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
(dataframe['rsi'] < 35) &
|
||||
(dataframe['volume'] > 0)
|
||||
),
|
||||
['buy', 'buy_tag']] = (1, 'buy_signal_rsi')
|
||||
['buy', 'enter_tag']] = (1, 'buy_signal_rsi')
|
||||
|
||||
return dataframe
|
||||
|
||||
@@ -97,14 +97,14 @@ def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_r
|
||||
current_profit: float, **kwargs):
|
||||
dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe)
|
||||
last_candle = dataframe.iloc[-1].squeeze()
|
||||
if trade.buy_tag == 'buy_signal_rsi' and last_candle['rsi'] > 80:
|
||||
if trade.enter_tag == 'buy_signal_rsi' and last_candle['rsi'] > 80:
|
||||
return 'sell_signal_rsi'
|
||||
return None
|
||||
|
||||
```
|
||||
|
||||
!!! Note
|
||||
`buy_tag` is limited to 100 characters, remaining data will be truncated.
|
||||
`enter_tag` is limited to 100 characters, remaining data will be truncated.
|
||||
|
||||
## Exit tag
|
||||
|
||||
|
@@ -498,7 +498,7 @@ for more information.
|
||||
&
|
||||
(dataframe['volume'] > 0)
|
||||
),
|
||||
['buy', 'buy_tag']] = (1, 'buy_signal_rsi')
|
||||
['buy', 'enter_tag']] = (1, 'buy_signal_rsi')
|
||||
|
||||
return dataframe
|
||||
```
|
||||
|
@@ -83,7 +83,7 @@ Possible parameters are:
|
||||
* `fiat_currency`
|
||||
* `order_type`
|
||||
* `current_rate`
|
||||
* `buy_tag`
|
||||
* `enter_tag`
|
||||
|
||||
### Webhookbuycancel
|
||||
|
||||
@@ -101,7 +101,7 @@ Possible parameters are:
|
||||
* `fiat_currency`
|
||||
* `order_type`
|
||||
* `current_rate`
|
||||
* `buy_tag`
|
||||
* `enter_tag`
|
||||
|
||||
### Webhookbuyfill
|
||||
|
||||
@@ -117,7 +117,7 @@ Possible parameters are:
|
||||
* `stake_amount`
|
||||
* `stake_currency`
|
||||
* `fiat_currency`
|
||||
* `buy_tag`
|
||||
* `enter_tag`
|
||||
|
||||
### Webhooksell
|
||||
|
||||
|
Reference in New Issue
Block a user