Finutils is a collection of some finance related python utilities.
Project description
finutils
Finutils is a collection of some finance related python utilities.
Installation
python3 -m pip install finutils
Requirements
- python>=(tested to work with 3.7)
- pandas>=(tested to work with 1.1.0)
- pandas_datareader>=(tested to work with 0.9.0)
- importlib-metadata>=1.7.0 (needed for intel python distributions only)
- readme-renderer>=26.0 (needed for intel python distributions only)
CachedReader (finutils.CachedReader)
This is a wrapper around pandas_datareader.data.DataReader. The module provides local persistent caching (as csv files) and only downloads the incremental change (online - local) and stores it. As a result, the number of api calls are decreased and also the data is available locally (after the first download).
Example Code
Preferred way :
Below code updates local copy of data (if outdated) and gives data in date range.
import datetime
import requests_cache
from finutils import CachedReader
expire_after = datetime.timedelta(days=3)
session = requests_cache.CachedSession(cache_name='cache', backend='sqlite', expire_after=expire_after)
cr = CachedReader('./data', 'yahoo', session)
df = cr.get_data('RELIANCE.NS', datetime.date(2010, 1, 1), datetime.date(2020, 1, 1))
Optional Way :
Below code gets data from local copy without update check
import datetime
import requests_cache
from finutils import CachedReader
cr = CachedReader('./data', 'yahoo')
df = cr.filter_df_by_date(cr.get_scrip_data_local('RELIANCE.NS'), datetime.date(2010, 1, 1), datetime.date(2020, 1, 1))
print(df)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file finutils-0.0.2.tar.gz
.
File metadata
- Download URL: finutils-0.0.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceb06bd5ac3798c00dee5d8ee8421403d7a86261f777b920a11d28322ac756f8 |
|
MD5 | 864d4727ad7917994d1041eae214f4f7 |
|
BLAKE2b-256 | aa703e72f5715417b99006375195d2a42d2599c625b1b031aaae7a2ce2365bc7 |
File details
Details for the file finutils-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: finutils-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acb717383fc0653414c6248091c2bc0fc23b07349b6540cde54979d9a9c07e65 |
|
MD5 | f72fb8caae7e3e10dca76ecdaeea05be |
|
BLAKE2b-256 | 0cb0a6eeddbd2c19370e93ad53beb4f3a990f2b39e8bf719cdf65e557e8aa965 |