Skip to main content
iexfinance
===============

.. image:: https://travis-ci.org/addisonlynch/iexfinance.svg?branch=master
:target: https://travis-ci.org/addisonlynch/iexfinance

.. image:: https://codecov.io/gh/addisonlynch/iexfinance/branch/master/graphs/badge.svg?branch=master
:target: https://codecov.io/gh/addisonlynch/iexfinance

.. image:: https://badge.fury.io/py/iexfinance.svg
:target: https://badge.fury.io/py/iexfinance

.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg
:target: https://opensource.org/licenses/Apache-2.0


Python module to get stock data from the
`Investors Exchange (IEX) <https://iextrading.com/>`__
`Developer API <https://iextrading.com/developer/>`__
platform. iexfinance provides real-time financial data from the various IEX
endpoints, as well as historical data.

This data includes stock quotes, fundamentals, actions, and information. In
addition, support for IEX market data and statistics is provided.

- `Stocks <https://iextrading.com/developer/docs/#stocks>`__
- `Reference Data <https://iextrading.com/developer/docs/#reference-data>`__
- `IEX Market Data <https://iextrading.com/developer/docs/#iex-market-data>`__
- `IEX Stats <https://iextrading.com/developer/docs/#iex-stats>`__

Documentation
-------------

See `IEX Finance
Documentation <https://addisonlynch.github.io/iexfinance/index.html#Documentation>`__

Install
-------

>From PyPI with pip (latest stable release):

``$ pip3 install iexfinance``

>From development repository (dev version):

.. code:: bash

$ git clone https://github.com/addisonlynch/iexfinance.git
$ cd iexfinance
$ python3 setup.py install

Usage Examples
--------------


Using iexfinance to access data from IEX is quite easy. The most commonly-used
endpoints are the `Stocks <https://iextrading.com/developer/docs/#stocks>`__
endpoints, which allow access to various information regarding equities,
including quotes, historical prices, dividends, and much more.

All top-level functions (such as ``Stock`` and ``get_historical_data``), allow
for `Request Parameters
<https://addisonlynch.github.io/usage.html#parameters>`__, which
include ``retry_count``, ``pause``, and ``session``. These parameters are
entirely optional. The first two deal with how unsuccessful requests are
handled, and the third allows for the passing of a cached ``requests-cache``
session (see `caching
<https://addisonlynch.github.io/iexfinance/caching.html>`__.

Stock Endpoints
^^^^^^^^^^^^^^^

.. code:: python

from iexfinance import Stock
tsla = Stock('TSLA')
tsla.get_open()
tsla.get_price()

It's also possible to obtain historical data from the ``get_historical_data``
top-level function. This will return a daily time-series of the ticker
requested over the desired date range (``start`` and ``end`` passed as
``datetime.datetime`` objects).

Pandas DataFrame and JSON (dict) output formatting are selected with the
``output_format`` parameter.

**Historical Data**

.. code:: python

from iexfinance import get_historical_data
from datetime import datetime

start = datetime(2017, 2, 9)
end = datetime(2017, 5, 24)

df = get_historical_data("AAPL", start=start, end=end, output_format='pandas')
df.head()

The resulting DataFrame will indexed by date, with a column for each OHLC
datapoint:

.. image:: /docs/source/images/dfdailyaapl.JPG

It's really simple to plot this data, using `matplotlib:

.. code:: python

import matplotlib.pyplot as plt

df.plot()
plt.show()

<https://matplotlib.org/>`__

.. image:: /docs/source/images/plotdailyaapl.jpg

IEX Reference Data
^^^^^^^^^^^^^^^^^^

Support for the `IEX Reference Data
<https://iextrading.com/developer/docs/#reference-data>`__ endpoints is
available through the top level functions ``get_symbols``,
``get_corporate_actions``, ``get_dividends``, ``get_next_day_ex_date``, and
``get_listed_symbol_dir``. As with all endpoints, request parameters such as
``retry_count`` and output format selection (through ``output_format``) can be
passed to the call.

.. code:: python

from iexfinance import get_available_symbols

get_available_symbols(output_format='pandas')[:2]


IEX Market Data
^^^^^^^^^^^^^^^

The `IEX Market Data
<https://iextrading.com/developer/docs/#iex-market-data>`__ endpoints are
supported through various top-level functions, including ``get_market_tops``
and ``get_market_deep``.

.. code:: python

from iexfinance import get_market_tops

get_market_tops()



IEX Stats
^^^^^^^^^

The `IEX Stats
<https://iextrading.com/developer/docs/#iex-stats>`__ endpoints are
supported through various top-level functions, including ``get_stats_intraday``
and ``get_stats_recent``. These endpoints provide IEX's trading statistics for
a given ticker.

.. code:: python

from iexfinance import get_stats_intraday

get_stats_intraday()



Contact
-------

Email: `ahlshop@gmail.com <ahlshop@gmail.com>`__

Twitter: `alynchfc <https://www.twitter.com/alynchfc>`__

License
-------

Copyright © 2017 Addison Lynch

See LICENSE for details


Metadata

Release files for iexfinance 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iexfinance 0.3.1
File Size Uploaded
iexfinance-0.3.1.tar.gz 15.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iexfinance 0.3.1
File Interpreter ABI Platform
iexfinance-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.1 kB

Release files / iexfinance-0.3.1.tar.gz

Download URL iexfinance-0.3.1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4c8690b010bcfdebe16fec3a56910d5034d536e31c74defd2507bcc0ec52ade1
BLAKE2b-256 checksum
How to use checksums
bedffaf785c3ed1009c9611e9d177ccfce1517f614e2ba731b2c35937ce9daa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / iexfinance-0.3.1-py3-none-any.whl

Download URL iexfinance-0.3.1-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b32ad64beff61138d73861886d9f3541297deb59af1c2e18364eaaca9d27876
BLAKE2b-256 checksum
How to use checksums
48ace8bcadc374ef1d74fccda5f706b9dec8a83a09cf3823e4ed3424a44a2e92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

1 release file

0.3.2

1 release file

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page