eguidotti / bidask

Efficient Estimation of Bid-Ask Spreads from Open, High, Low, and Close Prices
https://doi.org/10.1016/j.jfineco.2024.103916
GNU General Public License v3.0
99 stars 26 forks source link

RuntimeWarning: invalid value encountered in double_scalars #4

Closed tommedema closed 2 years ago

tommedema commented 2 years ago

Reproducible code:

import warnings
from bidask import edge

# treat warnings as errors
warnings.filterwarnings('error')

edge(
    np.array([18.21, 17.61, 17.61]),
    np.array([18.21, 17.61, 17.61]),
    np.array([17.61, 17.61, 17.61]),
    np.array([17.61, 17.61, 17.61])
)
Screen Shot 2022-11-03 at 8 21 42 PM
eguidotti commented 2 years ago

Thanks! This is fixed in the new version (just updated on PyPI). The function now returns nan when the variance is zero, as it should be.