A package for getting a US equity earnings announcement calendar.
Project description
ecal (pronounced ee-cal) is a package for getting a US equity earnings announcement calendar.
For more documentation, please see http://ecal.readthedocs.io.
Installation
ecal can be easily installed with pip:
$ pip install ecal
Usage
ecal is really simple to use. Below you’ll find the basics.
Getting the earnings announcements for a single date
To get the earnings announcements for a single date simply import ecal and call get():
import ecal
cal_df = ecal.get('2017-03-30')
The results will be an earnings calendar in a pandas DataFrame:
ticker when
date
2017-03-30 AEHR amc
2017-03-30 ANGO bmo
2017-03-30 BSET --
2017-03-30 FC amc
2017-03-30 LNN bmo
2017-03-30 SAIC bmo
2017-03-30 TITN bmo
The returned DataFrame has the following columns:
- ticker
is the ticker symbol on NYSE or NASDAQ.
- when
can be bmo which means before market open, amc which means after market close or -- which means no time reported.
If there were no announcements for this day, an empty DataFrame will be returned.
Getting the earnings announcements for a date range
It is equally easy to get the earnings announcements for a date range:
import ecal
cal_df = ecal.get('2018-01-01', '2018-01-05')
Once again the results will be an earnings calendar in a pandas DataFrame:
ticker when
date
2018-01-04 CMC bmo
2018-01-04 LNDC amc
2018-01-04 NEOG bmo
2018-01-04 RAD amc
2018-01-04 RECN amc
2018-01-04 UNF bmo
2018-01-05 AEHR amc
2018-01-05 ANGO bmo
2018-01-05 FC amc
2018-01-05 LW bmo
2018-01-05 PKE bmo
2018-01-05 PSMT amc
2018-01-05 RPM bmo
2018-01-05 SONC amc
2018-01-05 WBA bmo
Days with no earnings announcements will have no rows in the DataFrame. In the example above, there were no announcements on Jan first, second and third.
It should be noted that ecal fetches earnings announcements from api.earningscalendar.net by default. This source limits us to 1 call per second. However you don’t have to worry about this because the ecal.ECNFetcher throttles calls to the API to prevent rate limiting. That said, please note that this fetcher gets announcements one day at a time which means if you want 30 days, it’s going to take 30 seconds to get that data. Yikes. Fear not… that’s why ecal comes with caching.
Caching
ecal supports caching so that repeated calls to ecal.get() don’t actually make calls to the server. Runtime caching is enabled by default which means calls during your program’s execution will be cached. However, the ecal.RuntimeCache is only temporary and the next time your program runs it will call the API again.
Persistent on disk caching is provided via ecal.SqliteCache and can be easily enabled by setting ecal.default_cache once before calls to ecal.get():
import ecal
ecal.default_cache = ecal.SqliteCache('ecal.db')
cal_df = ecal.get('2017-03-30')
Extension
ecal is very easy to extend in case you want to support another caching system or even create an earnings announcement fetcher. For more documentation, please see http://ecal.readthedocs.io.
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
Built Distribution
File details
Details for the file ecal-1.0.2.tar.gz
.
File metadata
- Download URL: ecal-1.0.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf617ecec08df6a114fb0e1cc053d0a96ce0e4ae34bc758dc648a9c2ed9e06d1 |
|
MD5 | d5da67867ab07b2705303399a7f2ef22 |
|
BLAKE2b-256 | 051545123a05b1c77a156681cafbfb2ff33630b2d48574329d337627c6a942ef |
File details
Details for the file ecal-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: ecal-1.0.2-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 900b9fea81e7f7f6fa91e61227bbb258c44f47d4546866539b14673aa82136ea |
|
MD5 | 00505350fc15c3c6979f4e1784270567 |
|
BLAKE2b-256 | 39c3f1a56b8ad5ffdf5d444b37d96bc6c6296c17ad09a2f0b09e628f170814de |