New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when rebalancing with only one stock #65
Comments
Hey, Sorry, for the late reply? |
Hi, of course, but the point I was trying to make is that there is a math error. The end value is NOT the same here. This means that when using more than one stock), the rebalancing will create large errors. |
Sorry!! My fault, I misinterpreted the issue. If you find the bug, pin me! I'll also look at the code to see where is the problem coming from 😟 |
I haven't looked at the code for a while, but it could be the precision of the calculations in pypfopt, resulting in rounding erros outside after several balancers. Errors grow fast as I remember. May need higher precision. Could be a summation error etc. I'll have a look if I get time. Regards |
This #72 pull request solved it |
Hi,
I have tried to reproduce test results and simulated one single stock over time by forcing the weight distribution as shown below:
tickers = ["stock1", "stock2"]
weights_new_ = [1.0, 0.0]
no optimizer is used, so just using the quantstats calculations of ratios and returns.
In the next example, we do the same but with a yearly rebalancer. The thing here is that the results should be exactly the same.
There seems to be a slight error in the returns calculations over time, which turns out to be bigger with more rebalancing.
I will have some more look at it, and update if I find the bug. Btw great work!
The text was updated successfully, but these errors were encountered: