GithubHelp home page GithubHelp logo

Comments (3)

opoloko avatar opoloko commented on June 1, 2024

Ok did more tests. If leaving NaN it works, but it does cut any previous data not available, so it only calculates the date range that is common across all stocks in portfolio. I had a look at function, and it uses dropna() to cut, that's not ideal I think.

Solution is to use bfill() in the input dataframe before passing it to portfolio, that way any NaN value (for stocks starting later than others in portfolio) are filled with the first known price, and volatility and returns are correctly calculated and considered 0.

from finquant.

vanderheijden86 avatar vanderheijden86 commented on June 1, 2024

Hi @opoloko, I'm currently also using this repo to do some portfolio analysis. I think I will encounter the same issue as you do above. Thanks for your reply to the question. Another issue that you could be facing, and I will be facing, is on re-balancing the portfolio. In real-life I would rebalance my portfolio on a yearly basis, yet there is no function to do this. Is this not necessary given the way it calculates returns? Or do you think we would need to implement this re-balancing as well to get a realistic result? Thanks already.

from finquant.

opoloko avatar opoloko commented on June 1, 2024

That's another good point indeed. Although rebalancing makes a difference, I tend to do it as little as possible (in real life and in analysis tools).

I definitely think would be nice to have it, but I also use Finquant mostly for pure quantitative/statistic analytics more than a way to calculate a 'real' returns, if you know what I mean.

In a way leaving rebalancing out and having a simple buy&hold makes things more straightforward. But yes I agree would be a nice feature to have.

from finquant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.