add note buy_tag and split 3 assignment for get_signal

This commit is contained in:
kevinjulian 2021-07-23 01:25:15 +07:00
parent dd923c3471
commit 5fe18be4b5
2 changed files with 8 additions and 3 deletions

View File

@ -140,6 +140,10 @@ def custom_sell(self, pair: str, trade: Trade, current_time: datetime, current_r
```
!!! Note
`buy_tag` is limited to 100 characters, remaining data will be truncated.
## Custom stoploss
The stoploss price can only ever move upwards - if the stoploss value returned from `custom_stoploss` would result in a lower stoploss price than was previously set, it will be ignored. The traditional `stoploss` value serves as an absolute lower level and will be instated as the initial stoploss.

View File

@ -530,9 +530,10 @@ class IStrategy(ABC, HyperStrategyMixin):
)
return False, False, None
(buy, sell, buy_tag) = latest[SignalType.BUY.value] == 1,\
latest[SignalType.SELL.value] == 1,\
latest.get(SignalTagType.BUY_TAG.value, None)
buy = latest[SignalType.BUY.value] == 1
sell = latest[SignalType.SELL.value] == 1
buy_tag = latest.get(SignalTagType.BUY_TAG.value, None)
logger.debug('trigger: %s (pair=%s) buy=%s sell=%s',
latest['date'], pair, str(buy), str(sell))
timeframe_seconds = timeframe_to_seconds(timeframe)