ranaroussi / quantstats

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

Update utils.py - fix issue 273 , make_index not working #282

Open gnzsnz opened 1 year ago

gnzsnz commented 1 year ago

make_index doesnt work because 'break' column is str which makes the sum(axis=1) fail. issue 273

this fix will only use the columns in the original ticker_weights

an alternate fix (not included here) would be to include 'breaks' column in drop line

index.drop(columns=["first_day", "breaks"], inplace=True)

gnzsnz commented 1 year ago

this fix will avoid make_index to error out, however the function is returning wrong values. it's hugely overstating results, basically it's rebalancing on the re-balance date and overstating returns on non rebalance dates. which has the net result of applying a leverage on the index.

grzesir commented 7 months ago

Since this library no longer seems to be maintained, we have created a duplicate of it that we plan to maintain and improve over time. If you'd like to use our version check it out here: https://github.com/Lumiwealth/quantstats_lumi

Please feel free to fork and send your pull request to this new library, we will be actively monitoring the library and approving PRs