forked from microsoft/qlib
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add description of dataset document (microsoft#742)
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Data Collector | ||
|
||
## Introduction | ||
|
||
Scripts for data collection | ||
|
||
- yahoo: get *US/CN* stock data from *Yahoo Finance* | ||
- fund: get fund data from *http://fund.eastmoney.com* | ||
- cn_index: get *CN index* from *http://www.csindex.com.cn*, *CSI300*/*CSI100* | ||
- us_index: get *US index* from *https://en.wikipedia.org/wiki*, *SP500*/*NASDAQ100*/*DJIA*/*SP400* | ||
- contrib: scripts for some auxiliary functions | ||
|
||
|
||
## Custom Data Collection | ||
|
||
> Specific implementation reference: https://github.com/microsoft/qlib/tree/main/scripts/data_collector/yahoo | ||
1. Create a dataset code directory in the current directory | ||
2. Add `collector.py` | ||
- add collector class: | ||
```python | ||
CUR_DIR = Path(__file__).resolve().parent | ||
sys.path.append(str(CUR_DIR.parent.parent)) | ||
from data_collector.base import BaseCollector, BaseNormalize, BaseRun | ||
class UserCollector(BaseCollector): | ||
... | ||
``` | ||
- add normalize class: | ||
```python | ||
class UserNormalzie(BaseNormalize): | ||
... | ||
``` | ||
- add `CLI` class: | ||
```python | ||
class Run(BaseRun): | ||
... | ||
``` | ||
3. add `README.md` | ||
4. add `requirements.txt` | ||
|
||
|
||
## Description of dataset | ||
|
||
| | Basic data | | ||
|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------| | ||
| Features | **Price/Volume**: <br> - $close/$open/$low/$high/$volume/$change/$factor | | ||
| Calendar | **\<freq>.txt**: <br> - day.txt<br> - 1min.txt | | ||
| Instruments | **\<market>.txt**: <br> - required: **all.txt**; <br> - csi300.txt/csi500.txt/sp500.txt | | ||
|
||
- `Features`: data, **digital** | ||
- if not **adjusted**, **factor=1** | ||
|
||
### Data-dependent component | ||
|
||
> To make the component running correctly, the dependent data are required | ||
| Component | required data | | ||
|---------------------------------------------------|--------------------------------| | ||
| Data retrieval | Features, Calendar, Instrument | | ||
| Backtest | **Features[Price/Volume]**, Calendar, Instruments | |