santoshlite / Empyrial

An Open Source Portfolio Backtesting Engine for Everyone | 面向所有人的开源投资组合回测引擎
https://empyrial.gitbook.io/empyrial/
MIT License
914 stars 124 forks source link

Fixed unhashable list error thrown by valid_range function using cust… #79

Closed MehrdadDw closed 1 year ago

MehrdadDw commented 1 year ago

…om rebalance dates

Custom Rebalancing Throws the following Errors for the example:

https://empyrial.gitbook.io/empyrial/rebalancing/custom-rebalancing

empyrial.py", line 734, in check_schedule if rebalance.lower() in rebalance_periods.keys(): AttributeError: 'list' object has no attribute 'lower'

empyrial.py", line 750, in valid_range if rebalance in rebalance_periods.keys() and days <= (int(rebalance_periods[rebalance])): TypeError: unhashable type: 'list'

Commit fixes and throws the relevant errors.