Comments (3)
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.
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.
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)
- Check feature/stocks-clustering
- Inverted Axis when plotting HOT 1
- Question about plotting EF HOT 2
- Error on data download HOT 2
- Naive question regarding Allocation HOT 1
- Plotting error HOT 1
- Limit allocation weights HOT 1
- 'Index' object has no attribute 'tz_localize' HOT 2
- Depciation warning 5.0 HOT 1
- Depreciation pandas HOT 6
- example/Example-Build-Portfolio-from-web.py fails HOT 1
- Quandl is dead, remove it HOT 12
- Create an Asset parent class for Stock and Market
- Stock.data should be of type pandas.Series
- Set up pylint HOT 1
- Use type hints consistently HOT 3
- Detect and fix issues with mypy and pylint HOT 4
- Create GitHub workflow to automatically build/push a new release to pypi
- Set up another GitHub Actions workflow for pylint
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finquant.