fmilthaler / FinQuant

A program for financial portfolio management, analysis and optimisation.
MIT License
1.34k stars 190 forks source link

Compute Sortino ratio (#67) #108

Closed fmilthaler closed 11 months ago

fmilthaler commented 1 year ago

Addition of Sortino ratio to FinQuant

PietropaoloFrisoni commented 12 months ago

Amazing, I didn't realize that so much work was already done to add the Sortino Ratio to FinQuant. Thank you so much for your work @aft90 and @fmilthaler! I will happily go into the details and complete the feature implementation as soon as possible.

Sorry to bother you @fmilthaler, but it looks like some checks (build 3.11) were not successful. I tried to resolve some conflicts which appeared after pulling and pushing an empty commit as a test, and I hope I haven't done any damage : ). Do you have any idea how to solve these?

All the best

PietropaoloFrisoni commented 12 months ago

@fmilthaler Ok, it is all fixed now.

fmilthaler commented 12 months ago

Amazing, I didn't realize that so much work was already done to add the Sortino Ratio to FinQuant. Thank you so much for your work @aft90 and @fmilthaler! I will happily go into the details and complete the feature implementation as soon as possible.

Sorry to bother you @fmilthaler, but it looks like some checks (build 3.11) were not successful. I tried to resolve some conflicts which appeared after pulling and pushing an empty commit as a test, and I hope I haven't done any damage : ). Do you have any idea how to solve these?

All the best

Sorry, I couldn't check it out yesterday, but seems like you got it solved now. Well done :)

fmilthaler commented 11 months ago

@PietropaoloFrisoni Apologies for not telling you about this. I saw that you updated README.tex.md manually, and then your changes were overwritten by the automated script. You should not update the README.tex.md. The actual readme of the project is README.md. When you make changes in there, they are automatically ported over to README.tex.md (just to keep that file up to date). By now it is somewhat of an redundant version, which was initially used to get the LaTeX equations into README.md.

Anyways, make your changes in README.md, not README.tex.md :)

PietropaoloFrisoni commented 11 months ago

Thank you, Frank. I was actually going to ask you what was going on XD.

Before next week I'll most probably complete this PR (I would like to perform some sanity checks on the Sortino Ratio with other sources first).

All the best

PietropaoloFrisoni commented 11 months ago

Ultimately, I implemented the Sortino ratio described in this document.

Different documents and tutorials seem to implement slightly different versions of the Sortino ratio. Performing the same test with the portfolio described in this example using FinQuant delivers the same result of PerformanceAnalytics R package, which provides a function to compute the Sortino ratio. (There is a slight difference since the example considers Close Price instead of the Adjusted Close Price, but using the same format gives precisely the same output).

@fmilthaler Please let me know if you like the current order in which the portfolio parameters are displayed or if there is anything you want to add/remove/change : )

All the best

fmilthaler commented 11 months ago

Excellent, I'll take a more detailled look at it tomorrow. Could you please add this to one of the examples? I guess Example-Analysis would be the best place?!

PietropaoloFrisoni commented 11 months ago

Excellent, I'll take a more detailled look at it tomorrow. Could you please add this to one of the examples? I guess Example-Analysis would be the best place?

Yep, I keep forgetting about updating the examples. I'll add it tomorrow 👍

fmilthaler commented 11 months ago

Other than the docstring comment (which you actually did correctly, strictly speaking), this looks good to me. Will approve and merge as soon as the comment is re-added.

fmilthaler commented 11 months ago

One additional request: Could you add this line to CONTRIBUTORS.md:

- @aft90: helped to implement the Sortino Ratio