EodData Client

Usage

Working with data frames:

import os

from eoddata_client import EodDataHttpClient

client = EodDataHttpClient(os.environ['EOD_DATA_LOGIN'],
                           os.environ['EOD_DATA_PASSWORD'])

quotes = client.symbol_history('nasdaq', 'msft', datetime.date(1992, 1, 1))
quotes['Diff'] = quotes['Close'].shift(1) - quotes['Close']
print(quotes.tail())

#            Symbol   Open   High    Low  Close    Volume  Diff
# 2017-09-20   MSFT  75.35  75.55  74.31  74.94  21587800  0.50
# 2017-09-21   MSFT  75.11  75.24  74.11  74.21  19186100  0.73
# 2017-09-22   MSFT  73.99  74.51  73.85  74.41  14111300 -0.20
# 2017-09-25   MSFT  74.09  74.25  72.92  73.26  24149100  1.15
# 2017-09-26   MSFT  73.67  73.81  72.99  73.26  18019500  0.00

Working with regular list of objects:

import os

from eoddata_client import EodDataHttpClient

client = EodDataHttpClient(os.environ['EOD_DATA_LOGIN'],
                           os.environ['EOD_DATA_PASSWORD'])

quotes = client.symbol_history('nasdaq', 'msft', datetime.date(1992, 1, 1))
print(quotes[:2])
"""
[EodDataQuoteExtended(symbol=MSFT, quote_datetime=1992-01-01 00:00:00, open=2.319, high=2.319, low=2.319, close=2.319, volume=0, open_interest=0, previous=0.0, change=0.0, bid=0.0, ask=0.0, previous_close=0.0, next_open=0.0, modified=0001-01-01 00:00:00, name=Microsoft Corp, description=Microsoft Corp),
 EodDataQuoteExtended(symbol=MSFT, quote_datetime=1992-01-02 00:00:00, open=2.308, high=2.392, low=2.282, close=2.377, volume=1551300, open_interest=0, previous=0.0, change=0.0, bid=0.0, ask=0.0, previous_close=0.0, next_open=0.0, modified=2008-12-27 12:51:50.413000, name=Microsoft Corp, description=Microsoft Corp)]
"""

Client API

Http client

class EodDataHttpClient(username, password, base_url='http://ws.eoddata.com/data.asmx/', max_login_retries=3, logger=None)[source]

EodData web service client.

Endpoints:
  • CountryList - country_list;
  • DataClientLatestVersion - data_client_latest_version;
  • DataFormats - data_formats;
  • ExchangeGet - exchange_detail;
  • ExchangeList - exchange_list;
  • ExchangeMonths - exchange_months;
  • FundamentalList - fundamental_list;
  • Login - login;
  • NewsList - news_list;
  • NewsListBySymbol - news_list_by_symbol;
  • QuoteGet - quote_detail;
  • QuoteList - quote_list;
  • QuoteList2 - quote_list_specific;
  • QuoteListByDate - quote_list_by_date;
  • QuoteListByDate2 - quote_list_by_date_compact;
  • QuoteListByDatePeriod - quote_list_by_date_period;
  • QuoteListByDatePeriod2 - quote_list_by_date_period_compact;
  • SplitListByExchange;
  • SplitListBySymbol;
  • SymbolChangesByExchange;
  • SymbolChart;
  • SymbolGet;
  • SymbolHistory - symbol_history;
  • SymbolHistoryPeriod - symbol_history_period;
  • SymbolHistoryPeriodByDateRange - symbol_history_period;
  • SymbolList - symbol_list;
  • SymbolList2 - symbol_list_compact;
  • TechnicalList;
  • Top10Gains;
  • Top10Losses;
  • UpdateDataFormat;
  • ValidateAccess.
country_list()[source]

Returns a list of available countries.

Returns:
[(‘AF’, ‘Afghanistan’), (‘AL’, ‘Albania’), (‘DZ’, ‘Algeria’),
(‘AS’, ‘American Samoa’), (‘AD’, ‘Andorra’), (‘AO’, ‘Angola’)]
Return type:List of tuples with country code and country name. For example
data_client_latest_version()[source]

Returns the latest version information of Data Client.

Returns:
String with the latest version of data client in format
”MAJOR.MINOR.PATCH.HOTFIX”.
data_formats()[source]

Returns the list of data formats.

exchange_detail(exchange_code)[source]

Get detailed information about an exchange.

Returns:EodDataExchange or None
exchange_list(output_format='entity-list')[source]

Get all available exchanges.

Returns:EodData exchanges.
Return type:list or pandas.DataFrame
exchange_months()[source]

Returns the number of Months history a user is allowed to download.

fundamental_list()[source]

Returns a complete list of fundamental data for an entire exchange.

get_params(additional=None)[source]

Get dictionary with parameters for a request.

Parameters:additional (dict or None) – Additional parameters for a request.
Returns:Dictionary with parameters for a request.
login()[source]
Login to EODData Financial Information Web Service.
Used for Web Authentication.
Returns:bool, whether authentication was successful or not.
news_list(exchange_code)[source]

Returns a list of News articles for an entire exchange.

news_list_by_symbol(exchange_code)[source]

Returns a list of News articles for a given Exchange and Symbol.

process_response(response)[source]
Process response from EodData web service. All responses from
EodData web service have common format. This method is kind of a wrapper to process all responses.
Parameters:

response (requests.Response) – Response that comes from EodData web service.

Returns:

bool, True - success, False - expired / invalid token

Raises:
  • InvalidExchangeCode, InvalidSymbolCode, EodDataInternalServerError,
  • NoDataAvailableError
quote_detail(exchange_code, symbol)[source]

Get an end of day quote for a specific symbol.

Returns:EodDataQuoteExtended or None.
quote_list(exchange_code, output_format='entity-list')[source]

Get a complete list of end of day quotes for an entire exchange.

Parameters:exchange_code (str) – Exchange code.
Returns:EodData extended quotes.
Return type:list or pandas.DataFrame
quote_list_by_date(exchange_code, date, output_format='entity-list')[source]
Get a complete list of end of day quotes for an entire exchange
and a specific date.
Parameters:
  • exchange_code – Exchange code.
  • date (datetime.date) – Date.
Returns:

EodData extended quotes

Return type:

list or pandas.DataFrame

quote_list_by_date_compact(exchange_code, date, output_format='entity-list')[source]
Get a complete list of end of day quotes for an entire exchange
and a specific date (compact format).
Returns:EodData compact quotes
Return type:list or pandas.DataFrame
quote_list_by_date_period(exchange_code, date, period, output_format='entity-list')[source]
Get a complete list of end of day quotes for an entire exchange
and a specific date (compact format).
Returns:EodData extended quotes
Return type:list or pandas.DataFrame
quote_list_by_date_period_compact(exchange_code, date, period, output_format='entity-list')[source]
Get a complete list of end of day quotes for an entire exchange
and a specific date (compact format).
Parameters:
  • exchange_code (str) – Exchange code.
  • date (datetime.date) – Date.
  • period (str) – Period code.
Returns:

EodData compact quotes.

Return type:

list or pandas.DataFrame

quote_list_specific(exchange_code, symbol_list, output_format='entity-list')[source]

Get end of day quotes for specific symbols.

Parameters:
  • exchange_code (str) – Exchange code.
  • symbol_list (list of str) – Symbol list.
Returns:

EodData extended quotes.

Return type:

list or pandas.DataFrame

retry(func, *args, **kwargs)[source]

Try to get a new token and call function one more time

Parameters:func – Function to retry
Returns:Result of func() call
retry_limit(func)[source]

Decorator to have control over retry count.

Returns:Wrapped function.
Raises:ReloginDepthReachedError
symbol_history(exchange_code, symbol, start_date, output_format='entity-list')[source]
Get a list of historical end of day data of a specified symbol
and specified start date up to today’s date.
Parameters:
  • exchange_code (str) – Exchange code.
  • symbol (str) – Symbol.
  • start_date (datetime.date) – Start date.
Returns:

EodData extended quotes.

Return type:

list or pandas.DataFrame

symbol_history_period(exchange_code, symbol, date, period, output_format='entity-list')[source]
Get a list of historical data of a specified symbol, specified date
and specified period.
Parameters:
  • exchange_code (str) – Exchange code.
  • symbol (str) – Symbol.
  • date (datetime.date) – Date.
  • period (str) – Period code.
Returns:

EodData extended quotes.

Return type:

list or pandas.DataFrame

symbol_history_period_by_range(exchange_code, symbol, start_date, end_date, period, output_format='entity-list')[source]
Get a list of historical data of a specified symbol,
specified date range and specified period.
Parameters:
  • exchange_code (str) – Exchange code.
  • symbol (str) – Symbol.
  • start_date (datetime.date) – Period start.
  • end_date (datetime.date) – Period end.
  • period (str) – Period code.
Returns:

EodData extended quotes.

Return type:

list or pandas.DataFrame

symbol_list(exchange_code, output_format='entity-list')[source]

Get a list of symbols of a specified exchange.

Parameters:exchange_code (str) – Exchange code.
Returns:list or pandas.DataFrame
symbol_list_compact(exchange_code, output_format='entity-list')[source]

Get a list of symbols (compact format) of a specified exchange.

Parameters:exchange_code (str) – Exchange code.
Returns:list or pandas.DataFrame

Errors

class Error[source]

Base error for this module.

class TestEnvironmentNotSet[source]

Test environment variables not set.

class InvalidTokenError[source]

Request was sent with invalid token.

class InvalidExchangeCodeError[source]

Error trying to get data for unknown exchange.

class InvalidSymbolCodeError[source]

Error trying to get data for unknown symbol.

class InvalidCredentialsError[source]

Error trying to login with invalid credentials.

class NoDataAvailableError[source]

Error trying to access unavailable data

class EodDataInternalServerError[source]

Internal server error occurred when requesting data from EodData wev service.

class ReloginDepthReachedError[source]

Relogin depth reached.

class AccessLimitError[source]

Error trying to access data beyond available subscription.

Business entities and utils

Business entities

class EodDataExchange(code, name, last_trade_time, country_code, currency, advances, declines, timezone, suffix='', is_intraday=False, intraday_start_date=None, has_intraday=False)[source]

EodData Exchange.

code

str – Exchange code

name

str – Datetime of the last trade

last_trade_time

datetime – Datetime of the last trade

country_code

str – Code of the country where this exchange is situated

currency

str – Exchange currency

advances

int – Advances count

declines

int – Declines count

suffix

str – Exchange suffix

timezone

str – Exchange timezone

is_intraday

bool – Availability of intraday data.

intraday_start_date

datetime or None – Intraday data availability start date.

has_intraday

bool – Indicates if EodData has intraday data for this exchange.

classmethod from_xml(xml_exchange)[source]

Get EodDataExchange object from xml element.

Parameters:xml_exchange – Exchange XML element.
Returns:EodDataExchange instance or None.
class EodDataQuoteCompact(symbol, quote_datetime, open, high, low, close, volume, open_interest, before, after)[source]

EodData quote.

symbol

str – Symbol.

quote_datetime

datetime – Quote datetime.

open

float – Open price.

high

float – High price.

low

float – Low price.

close

float – Close price.

volume

int – Traded volume.

open_interest

int – Open interest.

before

float

after

float

classmethod from_xml(xml_quote)[source]

Get instance from xml.

Returns:EodDataQuoteCompact instance or None.
symbol = None

Security symbol

class EodDataQuoteExtended(symbol, quote_datetime, open, high, low, close, volume, open_interest, previous, change, bid, ask, modified, previous_close=0, next_open=0, name='', description='')[source]

EodData extended quote.

symbol

str – Symbol.

quote_datetime

datetime – Quote datetime.

open

float – Open price.

high

float – High price.

low

float – Low price.

close

float – Close price.

volume

int – Traded volume.

open_interest

int – Open interest.

previous

float – Previous close price.

change

float – Change from previous close.

bid

float – Bid price.

ask

float – Ask price.

modified

datetime – Time of the last update for this security.

name

str – Full name of a traded asset.

description

str – Description.

df_columns

tuple of str – Data frame columns (static attribute).

classmethod from_xml(xml_quote)[source]

Get EodDataQuoteExtended object from xml element.

Returns:EodDataQuoteExtended instance or None.
class EodDataSymbol(code, name, long_name)[source]

EodData symbol.

code

str – Symbol code.

name

str – Asset name.

long_name

str – Long name.

classmethod from_xml(xml_symbol)[source]

Get EodDataSymbol object from xml element.

Returns:EodDataSymbol instance or None.
class EodDataSymbolCompact(code, name)[source]

EodData symbol (compact).

code

str – Symbol code.

name

str – Asset name.

classmethod from_xml(xml_symbol)[source]

Get EodDataSymbolCompact object from xml element.

Returns:EodDataSymbolCompact instance or None.

Utils

class ObjectProxy(wrapped)[source]

Proxy object.

class RecursionDepthManager(func, max_depth=3)[source]

Decorator to manage recursion depth.

utils.string_to_datetime(iso8601_datetime_string)

Converts ISO 8601 datetime string to Python datetime

Parameters:iso8601_datetime_string (str) – ISO 8601 datetime string
Returns:datetime.datetime object
Raises:ValueError

Indices and tables