This commit is contained in:
gbojen 2021-04-07 22:25:54 +02:00
parent 5ee879a747
commit f8244d9d76
2 changed files with 6 additions and 5 deletions

View File

@ -167,7 +167,7 @@ If the trading range over the last 10 days is <1%, remove the pair from the whit
#### VolatilityFilter
Volatily is the degree of historical variation of a pairs over time, is is measured by the standard deviation of logarithmic daily returns.
Volatily is the degree of historical variation of a pairs over time, is is measured by the standard deviation of logarithmic daily returns. Returns are assumed to be normally distributed, although actual distribution might be different. In a normal distribution, 68% of observations fall within one standard deviation and 95% of observations fall within two standard deviations. Assuming a volatilty of 0.05 means that the expected returns for 20 out of 30 days is expected to be less than 5% (one standard deviation). Volatility is a positive ratio of the expected deviation of return and can be greater than 1.00. Please refer to the wikipedia definition of [`volatility`](https://en.wikipedia.org/wiki/Volatility_(finance)).
Removes pairs where the average volatility over a `lookback_days` days is below `min_volatility` and above `max_volatility`. Since this is a filter that requires additional data, the results are cached for `refresh_period`.
@ -181,8 +181,8 @@ If the volatilty over the last 10 days is not in the range of 0.20-0.30, remove
{
"method": "VolatilityFilter",
"lookback_days": 10,
"min_volatilty": 0.20,
"max_volatilty": 0.30,
"min_volatility": 0.05,
"max_volatility": 0.50,
"refresh_period": 86400
}
]

View File

@ -94,8 +94,9 @@ class VolatilityFilter(IPairList):
:return: True if the pair can stay, false if it should be removed
"""
# Check symbol in cache
if pair in self._pair_cache:
return self._pair_cache[pair]
cached_res = self._pair_cache.get(pair, None)
if cached_res is not None:
return cached_res
result = False
if daily_candles is not None and not daily_candles.empty: