ranaroussi / quantstats

Portfolio analytics for quants, written in Python
Apache License 2.0
4.82k stars 841 forks source link

NaN Handling #316

Closed pcgm-team closed 10 months ago

pcgm-team commented 10 months ago

For my usecase I necessarily have many NaNs in certain columns in the predicted return, and the returns/volumes dataframes. Is there any way to get the optimizer to both ignore the columns with NaN in the optimization, and auto-sell out when the return is NaN.

I cannot workaround this issue by dropping/filling nans, or by doing multiple backtests (ie every year) - it is very much intended that the prevelance of NaNs in some column is near-constant and inconsistent.

Error: ->obj.values_in_time_recursive() DataEstimator found NaNs at time

pcgm-team commented 10 months ago

I expect that this situation would be extremely common for anyone working with their own datasets etc.