There are four core components of iexfinance’s configuration:

  • API Version - specifying version of IEX Cloud to use

  • Authentication - setting your IEX Cloud Authentication Token

  • Output Formatting - configuring desired output format (mirror IEX output or Pandas DataFrame)

  • Debugging - cached sessions, request retries, and more

API Version

The desired IEX API version can be specified using the IEX_API_VERSION environment variable. The following versions are currently supported:

  • v1 - note: this will be deprecated in iexfinance version 0.4.2

  • iexcloud-beta

  • iexcloud-v1 - default


iexfinance now defaults to IEX Cloud for all calls. The use of v1 as IEX_API_VERSION will be warned in iexfinance 0.4.1 and deprecated in 0.4.2.


The beta period for IEX Cloud ends on June 1st, 2019. At this time, all calls using iexcloud-beta will mirror those of iexcloud-v1.

See also

For more information on API versioning, see the IEX Cloud documentation.


An IEX Cloud account is required to acecss the IEX Cloud API.

Your IEX Cloud (secret) authentication token can be passed to any function or at the instantiation of a Stock object It can also be stored in the IEX_TOKEN environment variable.

Passing as an Argument

The authentication token can also be passed to any function call:

from iexfinance.refdata import get_symbols

get_symbols(output_format='pandas', token="<YOUR AUTH TOKEN>")

or at the instantiation of a Stock object:

from iexfinance.stocks import Stock

a = Stock("AAPL", token="<YOUR AUTH TOKEN>")

Output Formatting

By default, iexfinance returns data formatted exactly as received from the IEX Endpoint. pandas DataFrame output formatting is available for most endpoints. Configuring iexfinance’s output format can be done in two ways:

output_format Argument

Pass output_format as an argument to any function call:

In [1]: from iexfinance.refdata import get_symbols

In [2]: get_symbols(output_format='pandas').head()
  currency        date exchange  ... region  symbol type
0      UDS  2019-05-14      NSY  ...     SU       A   cs
1      UDS  2019-05-14      SNY  ...     SU      AA   cs
2      SUD  2019-05-14      SEP  ...     US    AAAU   te
3      UDS  2019-05-14      ANS  ...     US    AABA  fec
4      DSU  2019-05-14      NYS  ...     SU     AAC   cs

[5 rows x 9 columns]

or at the instantiation of a Stock object:

In [3]: from iexfinance.stocks import Stock

In [4]: aapl = Stock("AAPL", output_format='pandas')

In [5]: aapl.get_quote().head()
avgTotalVolume    29464923
calculationPrice     close
change                2.97
changePercent      0.01606
close               190.62

Environment Variable

For persistent configuration of a specified output format, use the environment variable IEX_OUTPUT_FORMAT. This value will be overridden by the output_format argument if it is passed.


Type the following command into your terminal:

$ export IEX_OUTPUT_FORMAT=pandas


See here


_IEXBase Class

All iexfinance requests are made using the base class _IEXBase.

class iexfinance.base._IEXBase(**kwargs)

Base class for retrieving equities information from IEX Cloud. Conducts query operations including preparing and executing queries from the API.


Desired number of retries if a request fails


int, default 3, optional


Pause time between retry attempts


float default 0.5, optional


A cached requests-cache session


requests_cache.session, default None, optional


Desired integer parsing datatype


datatype, default int, optional


Desired floating point parsing datatype


datatype, default float, optional


Desired output format (json or pandas DataFrame). This can also be set using the environment variable IEX_OUTPUT_FORMAT.


str, default “json”, optional


Authentication token (reuqired for use with IEX Cloud)


str, optional

Cached Sessions

iexfinance import requests-cache cached sessions. To pass a cached session to your request, pass the session keyword argument to any function call, or at instantiation of a Stock object.

Request Parameters

  • Use retry_count to specify the number of times to retry a failed request. The default value is 3.

  • Use pause to specify the time between retry attempts. The default value is 0.5.