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)
|
price = ceil(big_price) / pow(10, symbol_prec)
|
||||||
return price
|
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,
|
def dry_run_order(self, pair: str, ordertype: str, side: str, amount: float,
|
||||||
rate: float, params: Dict = {}) -> Dict[str, Any]:
|
rate: float, params: Dict = {}) -> Dict[str, Any]:
|
||||||
order_id = f'dry_run_{side}_{randint(0, 10**6)}'
|
order_id = f'dry_run_{side}_{randint(0, 10**6)}'
|
||||||
|
@ -38,9 +38,8 @@ class PriceFilter(IPairList):
|
|||||||
:param precision: Precision
|
:param precision: Precision
|
||||||
:return: True if the pair can stay, false if it should be removed
|
:return: True if the pair can stay, false if it should be removed
|
||||||
"""
|
"""
|
||||||
precision = self._exchange.markets[ticker['symbol']]['precision']['price']
|
compare = ticker['last'] + self._exchange.price_get_one_pip(ticker['symbol'],
|
||||||
|
ticker['last'])
|
||||||
compare = ticker['last'] + 1 / pow(10, precision)
|
|
||||||
changeperc = (compare - ticker['last']) / ticker['last']
|
changeperc = (compare - ticker['last']) / ticker['last']
|
||||||
if changeperc > self._low_price_ratio:
|
if changeperc > self._low_price_ratio:
|
||||||
logger.info(f"Removed {ticker['symbol']} from whitelist, "
|
logger.info(f"Removed {ticker['symbol']} from whitelist, "
|
||||||
|
Loading…
Reference in New Issue
Block a user