-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
5 additions
and
33 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,15 @@ | ||
# financial-data | ||
|
||
Intraday financial data files for backtesting or analysis. Currently this includes minute bars for: | ||
|
||
- S&P 500 from 2010-2018 in USD (SPXUSD) | ||
- NIKKEI 225 from 2010-2018 in JPY (JPXJPY) | ||
- DAX 30 from 2010-2018 in EUR (GRXEUR) | ||
- EUROSTOXX 50 from 2010-2018 in EUR (ETXEUR) | ||
- Currencies pairs: AUD_JPY, AUD_USD, EUR_USD, GBP_USD, USD_CAD | ||
- Cryptocurrencies pairs: BTC_USD, BTC_EUR, ETH_EUR | ||
|
||
## Data file path structure | ||
|
||
`data/<type>/<provider>/<instrument>` | ||
|
||
For example, `data/stocks/histdata/sp500/DAT_ASCII_SPXUSD_M1_2010.csv` is stock data for the S&P 500 index from the histdata provider. | ||
|
||
## Create a Pandas dataframe | ||
|
||
```python | ||
import pandas as pd | ||
|
||
year = 2017 | ||
instrument = 'SPXUSD' | ||
provider = 'histdata' | ||
filename = 'data/stocks/{2}/{0}/DAT_ASCII_{0}_M1_{1}.csv'.format(instrument, year, provider) | ||
|
||
price_data = pd.read_csv(filename, index_col=0, delimiter=';', header=None) | ||
|
||
price_data.index.name = 'date' | ||
price_data.index = pd.to_datetime(price_data.index) | ||
price_data.drop(columns=[5], inplace=True) | ||
columns={1: 'open', 2: 'high', 3: 'low', 4: 'close'} | ||
price_data.rename(columns=columns, inplace=True) | ||
This package will parse the CSV files and return them as a [Pandas DataFrame](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html). | ||
|
||
price_data.head(3) | ||
``` | ||
## Project moved to GitLab | ||
|
||
``` | ||
open high low close | ||
date | ||
2017-01-02 18:00:00 2241.00 2244.50 2241.0 2243.50 | ||
2017-01-02 18:01:00 2243.75 2243.75 2243.0 2243.00 | ||
2017-01-02 18:02:00 2243.25 2243.25 2243.0 2243.25 | ||
``` | ||
Due to volume of data in the project I have moved it to Gitlab: https://gitlab.com/user4725345/pyfinancialdata |