Comments (5)
Hello! Can you please post the output of
import cvxportfolio as cvx
md = cvx.MarketSimulator(['NVDA']).market_data
md.returns.loc[md.returns['NVDA'].isnull()]
on my machine there are no missing values for NVDA
in 2001, there might have been a yfinance
download issue on your end?
from cvxportfolio.
Thanks, I didn't get any warnings. This is the output:
Updating data
.
NVDA USDOLLAR
Date
2001-09-10 NaN 0.000137
2001-09-12 NaN 0.000139
2023-09-21 NaN NaN
from cvxportfolio.
from cvxportfolio.
I'm working on a fix, the Yahoo finance interface is not up to standards. I have done most testing on recent data (say, after 2010) and large cap US stocks. On those there are very rarely (I haven't seen any) missing rows in the data. I have seen bugs like this on low cap or foreign stocks, but this is the first time it is reported on a large cap US stock in recent history.
In the 2016 examples we were heavily filtering (any stock with missing data was excluded), at the time with quandl data (now defunct). The goal is to have an interface modular enough to plug a new data source with minimal code (alpha vantage, bloomberg, ...). Yahoo finance however is the only one that works without subscription (to my knowledge) and has acceptable quality, so I want to keep it as default (also for the examples). By the way, you can always use Cvxportfolio with user-provided returns and volumes (as it was done in the original interface), and filter in any way you wish.
What's your suggestion for dealing with a missing row like the one you had? All default estimators (expected return, covariances, transaction cost model parameters, ...) are robust to missing data, they are OK. The simulator however needs to make an assumption there. Do we propagate the last closing price (so on the missing days the returns are zero, but on the day before it might be larger in absolute value)? Do we just refuse to use that stock? (Which is basically what happens now.) Another possible fix from the user side is to do resampling (e.g., monthly) with the trading_frequency
option to the simulator, which makes it robust to (some) missing data rows.
Thanks!
from cvxportfolio.
Thank you. It looks like a data download issue, it probably originated in a dependency package. We definitely need stricter checks on the downloaded data quality. In the meantime you can delete your cache folder $HOME/cvxportfolio_data, or just the NVDA file, and re-run the script.
I see, thanks.
from cvxportfolio.
Related Issues (20)
- Questions on accounting model (e.g., for short positions) HOT 3
- Robustify online execution of example strategies (when open prices are missing) HOT 1
- Failure on non-numeric (object dtpye) user-provided data difficult to understand HOT 6
- Example request - Margin in a different currency HOT 14
- BUG: packaging failed to include modules moved into submodules (constraints, data)
- Feature request: handle user-defined time-varying universes (and better error checks with temporary `nan`s in user-provided returns) HOT 13
- Data quality issues in `ftse100_daily` example strategy
- EOFError: Ran out of input HOT 4
- Rendering of code blocks in README on github is broken
- Feature request: add `market_data=None` option to `Policy.execute`
- Feature request: Add constraint priority with automatic resolution into soft-constraints HOT 1
- Is it possible to have different costs definition depending on entry or exit HOT 1
- can we load into our custom crypto data into cvxportfolio for backtesting and portfolio construction ? [bounty possible] HOT 1
- Feature Request: Online Data Loading HOT 1
- Ecos needs to added in pyproject "test" optional dependencies HOT 1
- Issue loading data from FRED HOT 9
- Testsuite failing on py 3.9 b/c of dependencies HOT 1
- The result of backtesting 30 years is different from 5 years? HOT 5
- Feature Request: Ignore Tcosts in first period HOT 2
- Incompatible with Numpy 2.0
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 cvxportfolio.