mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Add price_get_one_pip filter
This commit is contained in:
parent
c8ccdbcb9a
commit
36e714a7b2
|
@ -452,6 +452,17 @@ class Exchange:
|
|||
price = ceil(big_price) / pow(10, symbol_prec)
|
||||
return price
|
||||
|
||||
def price_get_one_pip(self, pair: str, price: float) -> float:
|
||||
"""
|
||||
Get's the "1 pip" value for this pair.
|
||||
Used in PriceFilter to calculate the 1pip movements.
|
||||
"""
|
||||
precision = self.markets[pair]['precision']['price']
|
||||
if self.precisionMode == TICK_SIZE:
|
||||
return price % precision
|
||||
else:
|
||||
return 1 / pow(10, precision)
|
||||
|
||||
def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
|
||||
rate: float, params: Dict = {}) -> Dict[str, Any]:
|
||||
order_id = f'dry_run_{side}_{randint(0, 10**6)}'
|
||||
|
|
|
@ -38,9 +38,8 @@ class PriceFilter(IPairList):
|
|||
:param precision: Precision
|
||||
:return: True if the pair can stay, false if it should be removed
|
||||
"""
|
||||
precision = self._exchange.markets[ticker['symbol']]['precision']['price']
|
||||
|
||||
compare = ticker['last'] + 1 / pow(10, precision)
|
||||
compare = ticker['last'] + self._exchange.price_get_one_pip(ticker['symbol'],
|
||||
ticker['last'])
|
||||
changeperc = (compare - ticker['last']) / ticker['last']
|
||||
if changeperc > self._low_price_ratio:
|
||||
logger.info(f"Removed {ticker['symbol']} from whitelist, "
|
||||
|
|
Loading…
Reference in New Issue
Block a user