Revert having price_rounding_mode as configuration
This commit is contained in:
@@ -5,8 +5,6 @@ bot constants
|
||||
"""
|
||||
from typing import Any, Dict, List, Literal, Tuple
|
||||
|
||||
from ccxt import ROUND, ROUND_DOWN, ROUND_UP, TRUNCATE
|
||||
|
||||
from freqtrade.enums import CandleType, PriceType, RPCMessageType
|
||||
|
||||
|
||||
@@ -52,8 +50,6 @@ DEFAULT_DATAFRAME_COLUMNS = ['date', 'open', 'high', 'low', 'close', 'volume']
|
||||
# it has wide consequences for stored trades files
|
||||
DEFAULT_TRADES_COLUMNS = ['timestamp', 'id', 'type', 'side', 'price', 'amount', 'cost']
|
||||
TRADING_MODES = ['spot', 'margin', 'futures']
|
||||
PRICE_ROUND_MODES = [TRUNCATE, ROUND, ROUND_UP, ROUND_DOWN]
|
||||
DEFAULT_PRICE_ROUND_MODE = ROUND_UP
|
||||
MARGIN_MODES = ['cross', 'isolated', '']
|
||||
|
||||
LAST_BT_RESULT_FN = '.last_result.json'
|
||||
@@ -480,9 +476,7 @@ CONF_SCHEMA = {
|
||||
'outdated_offset': {'type': 'integer', 'minimum': 1},
|
||||
'markets_refresh_interval': {'type': 'integer'},
|
||||
'ccxt_config': {'type': 'object'},
|
||||
'ccxt_async_config': {'type': 'object'},
|
||||
'price_rounding_mode': {'type': 'integer', 'enum': PRICE_ROUND_MODES,
|
||||
'default': DEFAULT_PRICE_ROUND_MODE}
|
||||
'ccxt_async_config': {'type': 'object'}
|
||||
},
|
||||
'required': ['name']
|
||||
},
|
||||
|
@@ -143,9 +143,7 @@ class Exchange:
|
||||
if config.get('margin_mode')
|
||||
else MarginMode.NONE
|
||||
)
|
||||
self.liquidation_buffer = config.get("liquidation_buffer", 0.05)
|
||||
self._price_rounding_mode = exchange_config.get("price_rounding_mode",
|
||||
DEFAULT_PRICE_ROUND_MODE)
|
||||
self.liquidation_buffer = config.get('liquidation_buffer', 0.05)
|
||||
|
||||
# Deep merge ft_has with default ft_has options
|
||||
self._ft_has = deep_merge_dicts(self._ft_has, deepcopy(self._ft_has_default))
|
||||
@@ -732,13 +730,14 @@ class Exchange:
|
||||
"""
|
||||
return amount_to_precision(amount, self.get_precision_amount(pair), self.precisionMode)
|
||||
|
||||
def price_to_precision(self, pair: str, price: float) -> float:
|
||||
def price_to_precision(self, pair: str, price: float, rounding_mode: int) -> float:
|
||||
"""
|
||||
Returns the price rounded to the precision the Exchange accepts.
|
||||
The default price_rounding_mode in conf is ROUND_UP
|
||||
The default price_rounding_mode in conf is ROUND.
|
||||
Must use ROUND_UP / ROUND_DOWN for stoploss calculations.
|
||||
"""
|
||||
return price_to_precision(price, self.get_precision_price(pair),
|
||||
self.precisionMode, self._price_rounding_mode)
|
||||
self.precisionMode, rounding_mode)
|
||||
|
||||
def price_get_one_pip(self, pair: str, price: float) -> float:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user