{"id":13700067,"url":"https://github.com/addisonlynch/iexfinance","last_synced_at":"2025-04-08T02:42:25.228Z","repository":{"id":26824981,"uuid":"112424608","full_name":"addisonlynch/iexfinance","owner":"addisonlynch","description":"Python SDK for IEX Cloud","archived":false,"fork":false,"pushed_at":"2022-04-06T22:30:53.000Z","size":10480,"stargazers_count":650,"open_issues_count":29,"forks_count":134,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-04-01T01:42:23.090Z","etag":null,"topics":["data","finance","pandas","stock-data","stock-prices","stocks-api"],"latest_commit_sha":null,"homepage":"https://addisonlynch.github.io/iexfinance","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/addisonlynch.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-29T04:03:01.000Z","updated_at":"2025-03-08T06:45:56.000Z","dependencies_parsed_at":"2022-08-07T12:01:08.237Z","dependency_job_id":null,"html_url":"https://github.com/addisonlynch/iexfinance","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addisonlynch%2Fiexfinance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addisonlynch%2Fiexfinance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addisonlynch%2Fiexfinance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/addisonlynch%2Fiexfinance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/addisonlynch","download_url":"https://codeload.github.com/addisonlynch/iexfinance/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767232,"owners_count":20992538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","finance","pandas","stock-data","stock-prices","stocks-api"],"created_at":"2024-08-02T20:00:48.038Z","updated_at":"2025-04-08T02:42:25.201Z","avatar_url":"https://github.com/addisonlynch.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":["Data Sources","数据来源"],"readme":"iexfinance\r\n==========\r\n\r\n.. image:: https://travis-ci.org/addisonlynch/iexfinance.svg?branch=master\r\n    :target: https://travis-ci.org/addisonlynch/iexfinance\r\n\r\n.. image:: https://codecov.io/gh/addisonlynch/iexfinance/branch/master/graphs/badge.svg?branch=master\r\n\t:target: https://codecov.io/gh/addisonlynch/iexfinance\r\n\r\n.. image:: https://badge.fury.io/py/iexfinance.svg\r\n    :target: https://badge.fury.io/py/iexfinance\r\n\r\n.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg\r\n    :target: https://opensource.org/licenses/Apache-2.0\r\n\r\nPython SDK for `IEX Cloud \u003chttps://iexcloud.io\u003e`__. Architecture mirrors\r\nthat of the IEX Cloud API (and its `documentation \u003chttps://iexcloud.io/docs/api/\u003e`__).\r\n\r\nAn easy-to-use toolkit to obtain data for Stocks, ETFs, Mutual Funds,\r\nForex/Currencies, Options, Commodities, Bonds, and Cryptocurrencies:\r\n\r\n- Real-time and delayed quotes\r\n- Historical data (daily and minutely)\r\n- Financial statements (Balance Sheet, Income Statement, Cash Flow)\r\n- End of Day Options Prices\r\n- Institutional and Fund ownership\r\n- Analyst estimates, Price targets\r\n- Corporate actions (Dividends, Splits)\r\n- Sector performance\r\n- Market analysis (gainers, losers, volume, etc.)\r\n- IEX market data \u0026 statistics (IEX supported/listed symbols, volume, etc)\r\n- Social Sentiment and CEO Compensation\r\n\r\nExample\r\n-------\r\n\r\n.. image:: https://raw.githubusercontent.com/addisonlynch/iexfinance/master/docs/source/images/iexexample.gif\r\n\r\n\r\nDocumentation\r\n-------------\r\n\r\nStable documentation is hosted on\r\n`github.io \u003chttps://addisonlynch.github.io/iexfinance/stable/\u003e`__.\r\n\r\n`Development documentation \u003chttps://addisonlynch.github.io/iexfinance/devel/\u003e`__ is also available for the latest changes in master.\r\n\r\n\r\nInstall\r\n-------\r\n\r\nFrom PyPI with pip (latest stable release):\r\n\r\n``$ pip3 install iexfinance``\r\n\r\nFrom development repository (dev version):\r\n\r\n.. code:: bash\r\n\r\n     $ git clone https://github.com/addisonlynch/iexfinance.git\r\n     $ cd iexfinance\r\n     $ python3 setup.py install\r\n\r\n\r\n\r\nWhat's Needed to Access IEX Cloud?\r\n----------------------------------\r\n\r\nAn IEX Cloud account is required to acecss the IEX Cloud API. Various `plans \u003chttps://iexcloud.io/pricing/\u003e`__\r\nare availalbe, free, paid, and pay-as-you-go.\r\n\r\nYour IEX Cloud (secret) authentication token can be passed to any function or at the instantiation of a ``Stock`` object.\r\nThe easiest way to store a token is in the ``IEX_TOKEN`` environment variable.\r\n\r\nPassing as an Argument\r\n~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nThe authentication token can also be passed to any function call:\r\n\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.refdata import get_symbols\r\n\r\n    get_symbols(token=\"\u003cYOUR-TOKEN\u003e\")\r\n\r\nor at the instantiation of a ``Stock`` object:\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n\r\n    a = Stock(\"AAPL\", token=\"\u003cYOUR-TOKEN\u003e\")\r\n    a.get_quote()\r\n\r\n\r\nHow This Package is Structured\r\n------------------------------\r\n\r\n``iexfinance`` is designed to mirror the structure of the IEX Cloud API. The\r\nfollowing IEX Cloud endpoint groups are mapped to their respective\r\n``iexfinance`` modules:\r\n\r\nThe most commonly-used\r\nendpoints are the `Stocks \u003chttps://iexcloud.io/docs/api/#stocks\u003e`__\r\nendpoints, which allow access to various information regarding equities,\r\nincluding quotes, historical prices, dividends, and much more.\r\n\r\nThe ``Stock`` `object \u003chttps://addisonlynch.github.io/iexfinance/stable/stocks.html#the-stock-object\u003e`__\r\nprovides access to most endpoints, and can be instantiated with a symbol or\r\nlist of symbols:\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n\r\n    aapl = Stock(\"AAPL\")\r\n    aapl.get_balance_sheet()\r\n\r\nThe rest of the package is designed as a 1:1 mirror. For example, using the\r\n`Alternative Data \u003chttps://iexcloud.io/docs/api/#alternative-data\u003e`__ endpoint\r\ngroup, obtain the `Social Sentiment \u003chttps://iexcloud.io/docs/api/#social-sentiment\u003e`__ endpoint with\r\n``iexfinance.altdata.get_social_sentiment``:\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.altdata import get_social_sentiment\r\n\r\n    get_social_sentiment(\"AAPL\")\r\n\r\n\r\nCommon Usage Examples\r\n---------------------\r\n\r\nThe `iex-examples \u003chttps://github.com/addisonlynch/iex-examples\u003e`__ repository provides a number of detailed examples of iexfinance usage. Basic examples are also provided below.\r\n\r\n\r\nReal-time Quotes\r\n~~~~~~~~~~~~~~~~\r\n\r\nTo obtain real-time quotes for one or more symbols, use the ``get_price``\r\nmethod of the ``Stock`` object:\r\n\r\n.. code:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n    tsla = Stock('TSLA')\r\n    tsla.get_price()\r\n\r\nor for multiple symbols, use a list or list-like object (Tuple, Pandas Series,\r\netc.):\r\n\r\n.. code:: python\r\n\r\n    batch = Stock([\"TSLA\", \"AAPL\"])\r\n    batch.get_price()\r\n\r\n\r\nHistorical Data\r\n~~~~~~~~~~~~~~~\r\n\r\nIt's possible to obtain historical data using ``get_historical_data`` and\r\n``get_historical_intraday``.\r\n\r\nDaily\r\n^^^^^\r\n\r\nTo obtain daily historical price data for one or more symbols, use the\r\n``get_historical_data`` function. This will return a daily time-series of the ticker\r\nrequested over the desired date range (``start`` and ``end`` passed as\r\n``datetime.datetime`` objects):\r\n\r\n.. code:: python\r\n\r\n    from datetime import datetime\r\n    from iexfinance.stocks import get_historical_data\r\n\r\n    start = datetime(2017, 1, 1)\r\n    end = datetime(2018, 1, 1)\r\n\r\n    df = get_historical_data(\"TSLA\", start, end)\r\n\r\nTo obtain daily closing prices only (reduces message count), set\r\n``close_only=True``:\r\n\r\n.. code:: python\r\n\r\n    df = get_historical_data(\"TSLA\", \"20190617\", close_only=True)\r\n\r\nFor Pandas DataFrame output formatting, pass ``output_format``:\r\n\r\n.. code:: python\r\n\r\n    df = get_historical_data(\"TSLA\", start, end, output_format='pandas')\r\n\r\nIt's really simple to plot this data, using `matplotlib \u003chttps://matplotlib.org/\u003e`__:\r\n\r\n.. code:: python\r\n\r\n    import matplotlib.pyplot as plt\r\n\r\n    df.plot()\r\n    plt.show()\r\n\r\n\r\nMinutely (Intraday)\r\n^^^^^^^^^^^^^^^^^^^\r\n\r\nTo obtain historical intraday data, use ``get_historical_intraday`` as follows.\r\nPass an optional ``date`` to specify a date within three months prior to the\r\ncurrent day (default is current date):\r\n\r\n.. code:: python\r\n\r\n    from datetime import datetime\r\n    from iexfinance.stocks import get_historical_intraday\r\n\r\n    date = datetime(2018, 11, 27)\r\n\r\n    get_historical_intraday(\"AAPL\", date)\r\n\r\nor for a Pandas Dataframe indexed by each minute:\r\n\r\n.. code:: python\r\n\r\n    get_historical_intraday(\"AAPL\", output_format='pandas')\r\n\r\nFundamentals\r\n~~~~~~~~~~~~\r\n\r\nFinancial Statements\r\n^^^^^^^^^^^^^^^^^^^^\r\n\r\n`Balance Sheet \u003chttps://addisonlynch.github.io/iexfinance/stable/stocks.html#balance-sheet\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n\r\n    aapl = Stock(\"AAPL\")\r\n    aapl.get_balance_sheet()\r\n\r\n`Income Statement \u003chttps://addisonlynch.github.io/iexfinance/stable/stocks.html#income-statement\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    aapl.get_income_statement()\r\n\r\n`Cash Flow \u003chttps://addisonlynch.github.io/iexfinance/stable/stocks.html#cash-flow\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    aapl.get_cash_flow()\r\n\r\n\r\nModeling/Valuation Tools\r\n^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\n`Analyst Estimates \u003chttps://addisonlynch.github.io/iexfinance/stable/stocks.html#estimates\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n\r\n    aapl = Stock(\"AAPL\")\r\n\r\n    aapl.get_estimates()\r\n\r\n\r\n`Price Target \u003chttps://addisonlynch.github.io/iexfinance/stable/stocks.html#price-target\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    aapl.get_price_target()\r\n\r\n\r\nSocial Sentiment\r\n^^^^^^^^^^^^^^^^\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.altdata import get_social_sentiment\r\n    get_social_sentiment(\"AAPL\")\r\n\r\n\r\nCEO Compensation\r\n^^^^^^^^^^^^^^^^\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.altdata import get_ceo_compensation\r\n    get_ceo_compensation(\"AAPL\")\r\n\r\nFund and Institutional Ownership\r\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n    aapl = Stock(\"AAPL\")\r\n\r\n    # Fund ownership\r\n    aapl.get_fund_ownership()\r\n\r\n    # Institutional ownership\r\n    aapl.get_institutional_ownership()\r\n\r\nReference Data\r\n~~~~~~~~~~~~~~\r\n\r\n`List of Symbols IEX supports for API calls \u003chttps://addisonlynch.github.io/iexfinance/stable/refdata.html#symbols\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.refdata import get_symbols\r\n\r\n    get_symbols()\r\n\r\n`List of Symbols IEX supports for trading \u003chttps://addisonlynch.github.io/iexfinance/stable/refdata.html#iex-symbols\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.refdata import get_iex_symbols\r\n\r\n    get_iex_symbols()\r\n\r\nAccount Usage\r\n~~~~~~~~~~~~~\r\n\r\n`Message Count \u003chttps://addisonlynch.github.io/iexfinance/stable/account.html#usage\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.account import get_usage\r\n\r\n    get_usage(quota_type='messages')\r\n\r\nAPI Status\r\n~~~~~~~~~~\r\n\r\n`IEX Cloud API Status \u003chttp://addisonlynch.github.io/iexfinance/stable/apistatus.html#iexfinance.tools.api.get_api_status\u003e`__\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.account import get_api_status\r\n\r\n    get_api_status()\r\n\r\n\r\nConfiguration\r\n-------------\r\n.. _config.formatting:\r\n\r\nOutput Formatting\r\n-----------------\r\n\r\nBy default, ``iexfinance`` returns data for most endpoints in a `pandas \u003chttps://pandas.pydata.org/\u003e`__ ``DataFrame``.\r\n\r\nSelecting ``json`` as the output format returns data formatted *exactly* as received from\r\nthe IEX Endpoint. Configuring ``iexfinance``'s output format can be done in two ways:\r\n\r\n.. _config.formatting.env:\r\n\r\nEnvironment Variable (Recommended)\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nFor persistent configuration of a specified output format, use the environment\r\nvariable ``IEX_OUTPUT_FORMAT``. This value will be overridden by the\r\n``output_format`` argument if it is passed.\r\n\r\nmacOS/Linux\r\n^^^^^^^^^^^\r\n\r\nType the following command into your terminal:\r\n\r\n.. code-block:: bash\r\n\r\n    $ export IEX_OUTPUT_FORMAT=pandas\r\n\r\nWindows\r\n^^^^^^^\r\n\r\nSee `here \u003chttps://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10\u003e`__ for instructions on setting environment variables in Windows operating systems.\r\n\r\n.. _config.formatting.arg:\r\n\r\n``output_format`` Argument\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nPass ``output_format``  as an argument to any function call:\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.refdata import get_symbols\r\n\r\n    get_symbols(output_format='pandas').head()\r\n\r\nor at the instantiation of a ``Stock`` object:\r\n\r\n.. code-block:: python\r\n\r\n    from iexfinance.stocks import Stock\r\n\r\n    aapl = Stock(\"AAPL\", output_format='pandas')\r\n    aapl.get_quote().head()\r\n\r\nContact\r\n-------\r\n\r\nEmail: `ahlshop@gmail.com \u003cahlshop@gmail.com\u003e`__\r\n\r\nTwitter: `alynchfc \u003chttps://www.twitter.com/alynchfc\u003e`__\r\n\r\nLicense\r\n-------\r\n\r\nCopyright © 2020 Addison Lynch\r\n\r\nSee LICENSE for details\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faddisonlynch%2Fiexfinance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faddisonlynch%2Fiexfinance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faddisonlynch%2Fiexfinance/lists"}