YahooFinanceDataLoader
YahooFinanceDataLoader allows to download historical quotes data in bulk from the YahooFinance website. The downloaded data is in csv format.
API
Implemented methods:
- download_bulk_data
- get_assets_from_csv
download_bulk_data ( assetsList, start_date, end_date, interval, data_directory, maxNThreads=20, nTrials=3 )
Method description: downloads stocks historical data from YahooFinance in csv format.
Return Value: a list of symbols for which download has failed
Parameters:
- assetsList - list of assets, for example ['AAPL', 'MSFT', 'NVDA']
- start_date - start date for your download ('yyyy-mm-dd'), for example '2019-01-01'
- end_date - end date for your download ('yyyy-mm-dd'), for example '2019-01-31'
- interval - download interval, '1d' for daily, '1wk' for weekly, '1mo'
- data_directory - directory location to save downloaded data
Optional parameters:
- maxNThreads - maximum number of threads to use for data download, the default value is 20.
- nTrials - number of trials to be used for download, the default value is 3. Explanation: due to connectivity issues your download may fail, and it is worth trying to re-send your download request.
Example:
from YahooFinanceDataLoader import download_bulk_data
assetsList = ['AAPL', 'ADBE', 'AMZN', 'CSCO', 'FB', 'GOOGL', 'FAKE']
start_date = '2018-01-01'
end_date = '2018-01-31'
interval = '1d'
data_directory = '/home/user_name/stock_price_data'
maxNThreads = 20
nTrials = 3
failed_downloads = download_bulk_data(assetsList, start_date, end_date, interval,
data_directory, maxNThreads, nTrials)
print('Failed downloads: ', failed_downloads)
get_assets_from_csv ( csv_file, field_list = ['Symbol', 'Company'] )
Method description: reads assets from the csv file and returns a list of assets. csv file has to have a header, and the column containing stock symbols has to be named 'Symbol'
Return Value: a list of asset symbols read from the csv file
Parameters:
- csv_file - path to the csv file containing assets data
Optional parameters:
- field_list - a list containing csv file header names, for example ['Symbol', 'Company']
Example:
from YahooFinanceDataLoader import download_bulk_data
assetsList = get_assets_from_csv('/home/user_name/assets.csv', ['Symbol', 'Company'])
start_date = '2018-01-01'
end_date = '2018-01-31'
interval = '1d'
data_directory = '/home/user_name/stock_price_data'
maxNThreads = 20
nTrials = 3
failed_downloads = download_bulk_data(assetsList, start_date, end_date, interval,
data_directory, maxNThreads, nTrials)
print('Failed downloads: ', failed_downloads)
Release files for YahooFinanceDataLoader 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| YahooFinanceDataLoader-0.1.0.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| YahooFinanceDataLoader-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.5 kB
Release files / YahooFinanceDataLoader-0.1.0.tar.gz
| Download URL | YahooFinanceDataLoader-0.1.0.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42551aad86bbe753d72a17f1f3870b7f0bdc77e95868c7e4bcdaf9e32fcdac4d
|
|
BLAKE2b-256 checksum How to use checksums |
183a7030714b4b094b60e950f5c38107d681e585b76f2019dee126934dadc3c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|
Release files / YahooFinanceDataLoader-0.1.0-py3-none-any.whl
| Download URL | YahooFinanceDataLoader-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa890d06d21ac2dcc6666368f7212d2503514e75ed7b30cb1f8f937449cbfff3
|
|
BLAKE2b-256 checksum How to use checksums |
62f42dc0b686d8f9dbd5cab5e8a1bb6a85a722a30fede141e7cebd4cf8af1c10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
|