Skip to main content

Finutils is a collection of some finance related python utilities.

Project description

finutils

Finutils is a collection of some finance related python utilities.

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)

Changelog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finutils-0.0.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

finutils-0.0.1-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page