Update docs and tests for newly deprectated settings
This commit is contained in:
parent
b7f01a08f3
commit
ce69abc06e
@ -81,11 +81,11 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
||||
| `ask_strategy.bid_last_balance` | Interpolate the selling price. More information [below](#sell-price-without-orderbook-enabled).
|
||||
| `ask_strategy.use_order_book` | Enable selling of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> **Datatype:** Boolean
|
||||
| `ask_strategy.order_book_top` | Bot will use the top N rate in Order Book "price_side" to sell. I.e. a value of 2 will allow the bot to pick the 2nd ask rate in [Order Book Asks](#sell-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `ask_strategy.use_sell_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean
|
||||
| `ask_strategy.sell_profit_only` | Wait until the bot reaches `ask_strategy.sell_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `ask_strategy.sell_profit_offset` | Sell-signal is only active above this value. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
|
||||
| `ask_strategy.ignore_roi_if_buy_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `ask_strategy.ignore_buying_expired_candle_after` | Specifies the number of seconds until a buy signal is no longer used. <br> **Datatype:** Integer
|
||||
| `use_sell_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean
|
||||
| `sell_profit_only` | Wait until the bot reaches `sell_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `sell_profit_offset` | Sell-signal is only active above this value. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
|
||||
| `ignore_roi_if_buy_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `ignore_buying_expired_candle_after` | Specifies the number of seconds until a buy signal is no longer used. <br> **Datatype:** Integer
|
||||
| `order_types` | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Dict
|
||||
| `order_time_in_force` | Configure time in force for buy and sell orders. [More information below](#understand-order_time_in_force). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** Dict
|
||||
| `exchange.name` | **Required.** Name of the exchange class to use. [List below](#user-content-what-values-for-exchangename). <br> **Datatype:** String
|
||||
@ -156,11 +156,11 @@ Values set in the configuration file always overwrite values set in the strategy
|
||||
* `order_time_in_force`
|
||||
* `unfilledtimeout`
|
||||
* `disable_dataframe_checks`
|
||||
* `use_sell_signal` (ask_strategy)
|
||||
* `sell_profit_only` (ask_strategy)
|
||||
* `sell_profit_offset` (ask_strategy)
|
||||
* `ignore_roi_if_buy_signal` (ask_strategy)
|
||||
* `ignore_buying_expired_candle_after` (ask_strategy)
|
||||
* `use_sell_signal`
|
||||
* `sell_profit_only`
|
||||
* `sell_profit_offset`
|
||||
* `ignore_roi_if_buy_signal`
|
||||
* `ignore_buying_expired_candle_after`
|
||||
|
||||
### Configuring amount per trade
|
||||
|
||||
@ -291,16 +291,16 @@ See [the telegram documentation](telegram-usage.md) for details on usage.
|
||||
|
||||
When working with larger timeframes (for example 1h or more) and using a low `max_open_trades` value, the last candle can be processed as soon as a trade slot becomes available. When processing the last candle, this can lead to a situation where it may not be desirable to use the buy signal on that candle. For example, when using a condition in your strategy where you use a cross-over, that point may have passed too long ago for you to start a trade on it.
|
||||
|
||||
In these situations, you can enable the functionality to ignore candles that are beyond a specified period by setting `ask_strategy.ignore_buying_expired_candle_after` to a positive number, indicating the number of seconds after which the buy signal becomes expired.
|
||||
In these situations, you can enable the functionality to ignore candles that are beyond a specified period by setting `ignore_buying_expired_candle_after` to a positive number, indicating the number of seconds after which the buy signal becomes expired.
|
||||
|
||||
For example, if your strategy is using a 1h timeframe, and you only want to buy within the first 5 minutes when a new candle comes in, you can add the following configuration to your strategy:
|
||||
|
||||
``` json
|
||||
"ask_strategy":{
|
||||
{
|
||||
//...
|
||||
"ignore_buying_expired_candle_after": 300,
|
||||
"price_side": "bid",
|
||||
// ...
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
!!! Note
|
||||
|
@ -1128,11 +1128,10 @@ def test_pairlist_resolving_fallback(mocker):
|
||||
assert config['datadir'] == Path.cwd() / "user_data/data/binance"
|
||||
|
||||
|
||||
@pytest.mark.skip(reason='Currently no deprecated / moved sections')
|
||||
# The below is kept as a sample for the future.
|
||||
@pytest.mark.parametrize("setting", [
|
||||
("ask_strategy", "use_sell_signal", True,
|
||||
"experimental", "use_sell_signal", False),
|
||||
None, "use_sell_signal", False),
|
||||
])
|
||||
def test_process_temporary_deprecated_settings(mocker, default_conf, setting, caplog):
|
||||
patched_configuration_load_config_file(mocker, default_conf)
|
||||
@ -1141,10 +1140,14 @@ def test_process_temporary_deprecated_settings(mocker, default_conf, setting, ca
|
||||
# (they may not exist in the config)
|
||||
default_conf[setting[0]] = {}
|
||||
default_conf[setting[3]] = {}
|
||||
# Assign new setting
|
||||
default_conf[setting[0]][setting[1]] = setting[2]
|
||||
|
||||
# Assign deprecated setting
|
||||
default_conf[setting[3]][setting[4]] = setting[5]
|
||||
default_conf[setting[0]][setting[1]] = setting[2]
|
||||
# Assign new setting
|
||||
if setting[3]:
|
||||
default_conf[setting[3]][setting[4]] = setting[5]
|
||||
else:
|
||||
default_conf[setting[4]] = setting[5]
|
||||
|
||||
# New and deprecated settings are conflicting ones
|
||||
with pytest.raises(OperationalException, match=r'DEPRECATED'):
|
||||
@ -1153,13 +1156,20 @@ def test_process_temporary_deprecated_settings(mocker, default_conf, setting, ca
|
||||
caplog.clear()
|
||||
|
||||
# Delete new setting
|
||||
del default_conf[setting[0]][setting[1]]
|
||||
if setting[3]:
|
||||
del default_conf[setting[3]][setting[4]]
|
||||
else:
|
||||
del default_conf[setting[4]]
|
||||
|
||||
process_temporary_deprecated_settings(default_conf)
|
||||
assert log_has_re('DEPRECATED', caplog)
|
||||
# The value of the new setting shall have been set to the
|
||||
# value of the deprecated one
|
||||
assert default_conf[setting[0]][setting[1]] == setting[5]
|
||||
if setting[3]:
|
||||
assert default_conf[setting[3]][setting[4]] == setting[2]
|
||||
else:
|
||||
assert default_conf[setting[4]] == setting[2]
|
||||
|
||||
|
||||
|
||||
@pytest.mark.parametrize("setting", [
|
||||
@ -1209,16 +1219,16 @@ def test_check_conflicting_settings(mocker, default_conf, caplog):
|
||||
# New and deprecated settings are conflicting ones
|
||||
with pytest.raises(OperationalException, match=r'DEPRECATED'):
|
||||
check_conflicting_settings(default_conf,
|
||||
'sectionA', 'new_setting',
|
||||
'sectionB', 'deprecated_setting')
|
||||
'sectionB', 'deprecated_setting',
|
||||
'sectionA', 'new_setting')
|
||||
|
||||
caplog.clear()
|
||||
|
||||
# Delete new setting (deprecated exists)
|
||||
del default_conf['sectionA']['new_setting']
|
||||
check_conflicting_settings(default_conf,
|
||||
'sectionA', 'new_setting',
|
||||
'sectionB', 'deprecated_setting')
|
||||
'sectionB', 'deprecated_setting',
|
||||
'sectionA', 'new_setting')
|
||||
assert not log_has_re('DEPRECATED', caplog)
|
||||
assert 'new_setting' not in default_conf['sectionA']
|
||||
|
||||
@ -1229,8 +1239,8 @@ def test_check_conflicting_settings(mocker, default_conf, caplog):
|
||||
# Delete deprecated setting
|
||||
del default_conf['sectionB']['deprecated_setting']
|
||||
check_conflicting_settings(default_conf,
|
||||
'sectionA', 'new_setting',
|
||||
'sectionB', 'deprecated_setting')
|
||||
'sectionB', 'deprecated_setting',
|
||||
'sectionA', 'new_setting')
|
||||
assert not log_has_re('DEPRECATED', caplog)
|
||||
assert default_conf['sectionA']['new_setting'] == 'valA'
|
||||
|
||||
@ -1242,8 +1252,6 @@ def test_process_deprecated_setting(mocker, default_conf, caplog):
|
||||
# (they may not exist in the config)
|
||||
default_conf['sectionA'] = {}
|
||||
default_conf['sectionB'] = {}
|
||||
# Assign new setting
|
||||
default_conf['sectionA']['new_setting'] = 'valA'
|
||||
# Assign deprecated setting
|
||||
default_conf['sectionB']['deprecated_setting'] = 'valB'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user