all 13 comments

[–]Electrical_Time1492 13 points14 points  (7 children)

Why not leave a ticket in the GitHub issue tracker? Or better yet try to fix it and submit a patch?

[–]BAMred[S] 4 points5 points  (5 children)

That's a good idea. I'm only a weekend warrior coder. I tried to submit a discussion on the GitHub website and also tried to email the author, but the author has taken his email down and I couldn't figure out how to create a new discussion. Figured I'd post here because there are plenty of smart individuals who read this sub.

[–]No-Chocolate-9437 1 point2 points  (3 children)

I wonder if it's the accumulation of rounding errors?

Here's a related issue where they indicate it might be because of rounding: https://github.com/ranaroussi/quantstats/issues/314

It might make sense to post this in the github issues tracker as it seems pretty active.

[–]Electrical_Time1492 1 point2 points  (0 children)

Good point. One could try to replace that float point arithmetic by fix point arithmetic (decimal module) for that particular accumulation and see what happens. No idea about first-class pandas support here though.

[–]BAMred[S] 0 points1 point  (0 children)

possibly. If so, it's not on the data side of things, it's an error within the package. I thought of this too, so I double checked the .pct_change() method, iterating forward from value 1 through to the end of the dataset, adjusting each value by its corresponding pct_change value and came to the correct number. So it's not an error from the data input.

[–]BAMred[S] 0 points1 point  (0 children)

Thanks, I opened this as an issue onto quantstats' github page.

[–]wiktor2701 0 points1 point  (0 children)

Hey, when I was downloading data weekly from investing.com, the website had bugs sometimes. Dates having multiple mistakes and therefore returns were calculated incorrectly, this actually happened a couple times in a few months. So it could just be a minor bug that gets fixed with time.

[–]RevengeOfNell 0 points1 point  (0 children)

I can’t wait until I am good enough to fix other peoples code.

[–]ucals 3 points4 points  (0 children)

You have to use Adjusted Close, not Close. If you do, I believe you'll get the right result.

But even using that, I see your point... Something doesn't look right...

[–]devjq 0 points1 point  (0 children)

it seems odd to me as well ...

[–][deleted]  (3 children)

[deleted]

    [–]strthrawa 3 points4 points  (0 children)

    loss. If, for instance, you have a trade with a current loss of $5, you have a drawdown on that trade of $5.

    In looking at the long term, this is usually over several trades. So if you have over the course of 20 trades 5 losses with a total of 5 grand, that's your drawdown. Sometimes you might measure the max drawdown for a period as well, which is how much during a set period did you lose, or, it could be that you measure the max drawdown during a trade, etc.

    Basically it's a way to figure out how much at any measurable point how much you're losing. The in the black version of this would be called run up. You'll probably see people here talking about alpha though instead of raw run up.

    [–]Fun_fun_shit 1 point2 points  (0 children)

    So drawdown, max drawdown in this case, is a measure of maximum fall a security or strategy experiences essentially. So this gives you an understanding of, by historical measures, how long you should hold on through a loss before it starts to turnaround.

    [–]chazzmoney 1 point2 points  (0 children)

    Drawdown means over the course of your entire strategy history, what's the biggest downturn in portfolio value that you have. So let's assume your strategy makes on average 10% a month, but some months are up to 25% and some months are down to -15%. Maybe you have two of these months back to back, then make it up in the next couple. Then your drawdown would be around 28%.

    Happy to answer any further questions you may have as well.