Giter Site home page Giter Site logo

pbvrct / eodhistoricaldata-python-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 2.0 519 KB

Wrapper around eodhistoricaldata.com endpoints for easier data downloading

License: MIT License

Python 100.00%
python intraday-data eodhistoricaldata pandas fundamental-data

eodhistoricaldata-python-api's Introduction

Description

After working with data from eodhistoricaldata.com for a while I made this to simplify fetching and aggregating from their different endpoints and returning it in a consistent format.

Usage

Set up

  • Have python and pandas installed (I'm using Python 3.8.10 and pandas 1.3.1)
  • Download the EOD_api.py file to your working directory

Market data - daily and intraday

You can download data for different stocks across different exchanges by just providing a list of tickers

import EOD_api as eod
import os
token = os.environ['EOD_TOKEN'] # Place your token here, i.e. token = '12ab3cd5efgh45.12345678'
eod.ohlcv( ['AAPL.US','BP.LSE'], token, '2020-10-13', '2020-10-15').retrieve_data()

ohlcv_example

eod.ohlcv_intraday( ['AAPL.US'], token, '2020-10-13', '2020-10-14',intraday_frec='5m').retrieve_data()

intraday_example

Fundamental data

The Income Statement, Balance Sheet, and Cash Flow data all in one pandas dataframe

eod.fundamental( ['AAPL.US','MSFT.US'], token, '2020-04-01', '2020-08-01').retrieve_data()

fundamental_example

Extra

Some extra functions and methods to make data exploration easier from the start

Show


Get the list of available exchanges:

eod.get_exchange_list( token )
exchange_list


Get info on all the available tickers from a exchange:

eod.get_all_tickers_exchange('US',token) 
tickers_exchange_example


Find tickers by marketcap:

eod.stock_screener( 7, token, 'US', initial_offset = 0, mincap = None, maxcap = None)['code']
find_tickers_example


Some methods to make it easier to add or remove data incrementally instead of downloading all the data from the data provider at every step during data exploration:

data = eod.ohlcv( ['AAPL.US','BP.LSE'], token, '2020-10-13', '2020-10-15')
data.retrieve_data()
ohlcv_example
data.add_tickers(['MSFT.US']).retrieve_data()
add_ticker_example
data.truncate_dates('2020-10-13','2020-10-14').retrieve_data()
truncate_dates_example
data.remove_tickers(['MSFT.US','BP.LSE']).retrieve_data()
truncate_dates_example

Syntax

Show

Class ohlcv( tickers, token, start, end):

Downloads ohlcv data to a pandas dataframe

Arguments

  • tickers : List of tickers to download
  • token : String with your key from the data provider
  • start : String with the initial date from which to download data
  • end : String with the final date from which to download data

Methods

  • retrieve_data() : Return the dataframe with the data
  • add_tickers( tickers) : Download more tickers to the dataframe
    • tickers: List of tickers to download
  • remove_tickers( tickers) : Remove tickers
    • tickers: List of tickers to remove
  • truncate_dates( start, end) : Remove dates
    • start: String with the new initial date
    • end : String with the new final date

Class ohlcv_intraday( tickers, token, start, end, intraday_frec='5m'):

Downloads intraday data to a pandas dataframe

Arguments (same as ohlcv)

  • intraday_frec: Frecuency of intraday data. '5m' and '1m'. Check the data provider for availability of data.

Methods (Same as ohlcv)

Class fundamental( tickers, token, start, end):

Downloads fundamental data to a pandas dataframe. The Income Statement, Balance Sheet, and Cash Flow data is aggregated into one dataframe. If any columns have duplicated names only one is kept.

Arguments (same as ohlcv)

Methods (Same as ohlcv)

Function get_exchange_list( token):

Returns a list of the available exchanges and some more info

Function get_all_tickers_exchange( exchange, token):

Returns a list of the available tickers for a exchange and some more info

Function stock_screener( n_stocks, token, exchange, initial_offset = 0, mincap = None, maxcap = None):

Finds first n stocks in exchange by marketcap

Arguments

  • n_stocks: Int. Number of stocks to find
  • exchange: String. Chosen exchange
  • initial_offset : Number of stocks to skip
  • mincap :Minimum market capitalization
  • maxcap :Maximum market capitalization

More types of data

I don't plan to maintain this.
However, I created a EODdata class inside the EOD_api.py that you can subclass to add more types of data. This way you might download all of your data from eodhistoricaldata.com in a streamlined way. You can check all of the data types they offer in their website. For example you could include options, bonds, live data, financial news, insider trading, etc.
If you found any of this useful I would appreciate feedback.

eodhistoricaldata-python-api's People

Contributors

pbvrct avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.