Comments (1)
I have implemented a less aggressive nan strategy that fixes the problem described in this issue. This approach gives more control and responsibility to the pinkfish user to solve problems with their timeseries, while also providing options to automatically fix problems.
(1) fetch_timeseries() no longer removes rows with nan values.
(2) select_tradeperiod() lets you specify the columns to check for nan values via check_fields
argument. The default is ['close']. You can specify an empty list if you want.
(3) finalize_timeseries() has an argument that lets you specify whether to drop rows with nan values via dropna
, default is False.
(4) The stock_market_calendar is no longer applied unless force_stock_market_calendar=True is set in select_tradeperiod().
A warning is issued if nan values are detected within finalize_timeseries(). A function was added find_nan_rows()' to help track down problematic timeseries. The above changes were also made for portfolio, except
dropna` default is True in portfolio.finalize_timeseries().
With the default settings, the example above works as you expect.
"Yahoo data downloads from 1971 ... not good enough, but adequate for a quick test."
This is or was a problem on Windows platform only. You can see if it's been resolved by setting from_year=1900 in fetch_timeseries(). If it's no longer a problem, please let me know and I'll remove the check.
from pinkfish.
Related Issues (20)
- Backtesting with several symbols HOT 2
- Integrate this lib with backtrader to support any timeframe candles HOT 2
- Idea: Adding multiple stocks and re-balance each week. HOT 7
- Question HOT 8
- feature: Can we save plots to files? HOT 2
- can we use our own data? HOT 6
- Can we buy at open and sell at close same candlestick? HOT 10
- what is drawdown_recovery ? HOT 4
- The number of derivatives at boundaries does not match: expected 2, got 0+0 HOT 2
- is there an option to backtest, but without money? HOT 1
- How rigid are the pinkfish requirements? HOT 8
- Need facility for using data sources other than yfinance/Yahoo HOT 4
- Not able to specify the leaf data dir for benchmark HOT 1
- Is it possible to remove dependency on TAlib? HOT 8
- Missing adj_close column still causing me problems HOT 4
- Unstable backtest results HOT 4
- cant import pinkfish HOT 4
- Stats error in case of empty tradelog HOT 2
- installing issue with python 3.3 HOT 8
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 pinkfish.