Remove capital_available_percentage and raise instead
This commit is contained in:
parent
84c50bf16c
commit
3139343946
@ -148,7 +148,6 @@ Edge module has following configuration options:
|
|||||||
| `enabled` | If true, then Edge will run periodically. <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
| `enabled` | If true, then Edge will run periodically. <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||||
| `process_throttle_secs` | How often should Edge run in seconds. <br>*Defaults to `3600` (once per hour).* <br> **Datatype:** Integer
|
| `process_throttle_secs` | How often should Edge run in seconds. <br>*Defaults to `3600` (once per hour).* <br> **Datatype:** Integer
|
||||||
| `calculate_since_number_of_days` | Number of days of data against which Edge calculates Win Rate, Risk Reward and Expectancy. <br> **Note** that it downloads historical data so increasing this number would lead to slowing down the bot. <br>*Defaults to `7`.* <br> **Datatype:** Integer
|
| `calculate_since_number_of_days` | Number of days of data against which Edge calculates Win Rate, Risk Reward and Expectancy. <br> **Note** that it downloads historical data so increasing this number would lead to slowing down the bot. <br>*Defaults to `7`.* <br> **Datatype:** Integer
|
||||||
| `capital_available_percentage` | **DEPRECATED - [replaced with `tradable_balance_ratio`](configuration.md#Available balance)** This is the percentage of the total capital on exchange in stake currency. <br>As an example if you have 10 ETH available in your wallet on the exchange and this value is 0.5 (which is 50%), then the bot will use a maximum amount of 5 ETH for trading and considers it as available capital. <br>*Defaults to `0.5`.* <br> **Datatype:** Float
|
|
||||||
| `allowed_risk` | Ratio of allowed risk per trade. <br>*Defaults to `0.01` (1%)).* <br> **Datatype:** Float
|
| `allowed_risk` | Ratio of allowed risk per trade. <br>*Defaults to `0.01` (1%)).* <br> **Datatype:** Float
|
||||||
| `stoploss_range_min` | Minimum stoploss. <br>*Defaults to `-0.01`.* <br> **Datatype:** Float
|
| `stoploss_range_min` | Minimum stoploss. <br>*Defaults to `-0.01`.* <br> **Datatype:** Float
|
||||||
| `stoploss_range_max` | Maximum stoploss. <br>*Defaults to `-0.10`.* <br> **Datatype:** Float
|
| `stoploss_range_max` | Maximum stoploss. <br>*Defaults to `-0.10`.* <br> **Datatype:** Float
|
||||||
|
@ -60,7 +60,7 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
|||||||
|
|
||||||
if (config.get('edge', {}).get('enabled', False)
|
if (config.get('edge', {}).get('enabled', False)
|
||||||
and 'capital_available_percentage' in config.get('edge', {})):
|
and 'capital_available_percentage' in config.get('edge', {})):
|
||||||
logger.warning(
|
raise OperationalException(
|
||||||
"DEPRECATED: "
|
"DEPRECATED: "
|
||||||
"Using 'edge.capital_available_percentage' has been deprecated in favor of "
|
"Using 'edge.capital_available_percentage' has been deprecated in favor of "
|
||||||
"'tradable_balance_ratio'. Please migrate your configuration to "
|
"'tradable_balance_ratio'. Please migrate your configuration to "
|
||||||
|
@ -286,7 +286,6 @@ CONF_SCHEMA = {
|
|||||||
'process_throttle_secs': {'type': 'integer', 'minimum': 600},
|
'process_throttle_secs': {'type': 'integer', 'minimum': 600},
|
||||||
'calculate_since_number_of_days': {'type': 'integer'},
|
'calculate_since_number_of_days': {'type': 'integer'},
|
||||||
'allowed_risk': {'type': 'number'},
|
'allowed_risk': {'type': 'number'},
|
||||||
'capital_available_percentage': {'type': 'number'},
|
|
||||||
'stoploss_range_min': {'type': 'number'},
|
'stoploss_range_min': {'type': 'number'},
|
||||||
'stoploss_range_max': {'type': 'number'},
|
'stoploss_range_max': {'type': 'number'},
|
||||||
'stoploss_range_step': {'type': 'number'},
|
'stoploss_range_step': {'type': 'number'},
|
||||||
|
@ -57,9 +57,7 @@ class Edge:
|
|||||||
if self.config['stake_amount'] != UNLIMITED_STAKE_AMOUNT:
|
if self.config['stake_amount'] != UNLIMITED_STAKE_AMOUNT:
|
||||||
raise OperationalException('Edge works only with unlimited stake amount')
|
raise OperationalException('Edge works only with unlimited stake amount')
|
||||||
|
|
||||||
# Deprecated capital_available_percentage. Will use tradable_balance_ratio in the future.
|
self._capital_ratio: float = self.config['tradable_balance_ratio']
|
||||||
self._capital_percentage: float = self.edge_config.get(
|
|
||||||
'capital_available_percentage', self.config['tradable_balance_ratio'])
|
|
||||||
self._allowed_risk: float = self.edge_config.get('allowed_risk')
|
self._allowed_risk: float = self.edge_config.get('allowed_risk')
|
||||||
self._since_number_of_days: int = self.edge_config.get('calculate_since_number_of_days', 14)
|
self._since_number_of_days: int = self.edge_config.get('calculate_since_number_of_days', 14)
|
||||||
self._last_updated: int = 0 # Timestamp of pairs last updated time
|
self._last_updated: int = 0 # Timestamp of pairs last updated time
|
||||||
@ -157,7 +155,7 @@ class Edge:
|
|||||||
def stake_amount(self, pair: str, free_capital: float,
|
def stake_amount(self, pair: str, free_capital: float,
|
||||||
total_capital: float, capital_in_trade: float) -> float:
|
total_capital: float, capital_in_trade: float) -> float:
|
||||||
stoploss = self.stoploss(pair)
|
stoploss = self.stoploss(pair)
|
||||||
available_capital = (total_capital + capital_in_trade) * self._capital_percentage
|
available_capital = (total_capital + capital_in_trade) * self._capital_ratio
|
||||||
allowed_capital_at_risk = available_capital * self._allowed_risk
|
allowed_capital_at_risk = available_capital * self._allowed_risk
|
||||||
max_position_size = abs(allowed_capital_at_risk / stoploss)
|
max_position_size = abs(allowed_capital_at_risk / stoploss)
|
||||||
position_size = min(max_position_size, free_capital)
|
position_size = min(max_position_size, free_capital)
|
||||||
|
@ -92,7 +92,6 @@
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"process_throttle_secs": 3600,
|
"process_throttle_secs": 3600,
|
||||||
"calculate_since_number_of_days": 7,
|
"calculate_since_number_of_days": 7,
|
||||||
"capital_available_percentage": 0.5,
|
|
||||||
"allowed_risk": 0.01,
|
"allowed_risk": 0.01,
|
||||||
"stoploss_range_min": -0.01,
|
"stoploss_range_min": -0.01,
|
||||||
"stoploss_range_max": -0.1,
|
"stoploss_range_max": -0.1,
|
||||||
|
@ -1048,8 +1048,9 @@ def test_process_deprecated_setting_edge(mocker, edge_conf, caplog):
|
|||||||
'capital_available_percentage': 0.5,
|
'capital_available_percentage': 0.5,
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
with pytest.raises(OperationalException,
|
||||||
|
match=r"DEPRECATED.*Using 'edge.capital_available_percentage'*"):
|
||||||
process_temporary_deprecated_settings(edge_conf)
|
process_temporary_deprecated_settings(edge_conf)
|
||||||
assert log_has_re(r"DEPRECATED.*Using 'edge.capital_available_percentage'*", caplog)
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_conflicting_settings(mocker, default_conf, caplog):
|
def test_check_conflicting_settings(mocker, default_conf, caplog):
|
||||||
|
Loading…
Reference in New Issue
Block a user