Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Update docs for 0.5.0 #236

Merged
merged 3 commits into from Dec 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -3,6 +3,9 @@
"iexenv/"
"stfpconfig.json"

.DS_Store
*.DS_Store

/.pytest_cache
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
102 changes: 63 additions & 39 deletions README.rst
Expand Up @@ -34,7 +34,7 @@ Forex/Currencies, Options, Commodities, Bonds, and Cryptocurrencies:
Example
-------

.. image:: https://addisonlynch.github.io/public/img/iexexample.gif
.. image:: https://raw.githubusercontent.com/addisonlynch/iexfinance/master/docs/source/images/iexexample.gif


Documentation
Expand Down Expand Up @@ -63,8 +63,8 @@ From development repository (dev version):
Authentication
--------------
What's Needed to Access IEX Cloud?
----------------------------------

An IEX Cloud account is required to acecss the IEX Cloud API. Various `plans <https://iexcloud.io/pricing/>`__
are availalbe, free, paid, and pay-as-you-go.
Expand All @@ -82,15 +82,15 @@ 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>")
get_symbols(token="<YOUR-TOKEN>")
or at the instantiation of a ``Stock`` object:

.. code-block:: python
from iexfinance.stocks import Stock
a = Stock("AAPL", token="<YOUR AUTH TOKEN>")
a = Stock("AAPL", token="<YOUR-TOKEN>")
a.get_quote()
Expand Down Expand Up @@ -136,40 +136,6 @@ group, obtain the `Social Sentiment <https://iexcloud.io/docs/api/#social-sentim
get_social_sentiment("AAPL")
Configuration
-------------

Selecting an API Version
~~~~~~~~~~~~~~~~~~~~~~~~

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

* ``stable`` - **default**
* ``beta``
* ``v1``
* ``latest``
* ``sandbox`` - for use with the `sandbox environment`_ (test token
must be used)

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

.. _documentation: https://iexcloud.io/docs/api/#versioning

.. _`sandbox environment`: https://iexcloud.io/docs/api/#sandbox

Output Formatting
~~~~~~~~~~~~~~~~~

By default, ``iexfinance`` returns data formatted *exactly* as received from
the IEX Endpoint. `pandas <https://pandas.pydata.org/>`__ ``DataFrame`` output
formatting is available for most endpoints.

pandas ``DataFrame`` output formatting can be selected by setting the
``IEX_OUTPUT_FORMAT`` environment variable to ``pandas`` or by passing
``output_format`` as an argument to any function call (or at the instantiation
of a ``Stock`` object).

Common Usage Examples
---------------------

Expand Down Expand Up @@ -387,6 +353,64 @@ API Status
get_api_status()
Configuration
-------------
.. _config.formatting:

Output Formatting
-----------------

By default, ``iexfinance`` returns data for most endpoints in a `pandas <https://pandas.pydata.org/>`__ ``DataFrame``.

Selecting ``json`` as the output format returns data formatted *exactly* as received from
the IEX Endpoint. Configuring ``iexfinance``'s output format can be done in two ways:

.. _config.formatting.env:

Environment Variable (Recommended)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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.

macOS/Linux
^^^^^^^^^^^

Type the following command into your terminal:

.. code-block:: bash
$ export IEX_OUTPUT_FORMAT=pandas
Windows
^^^^^^^

See `here <https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10>`__ for instructions on setting environment variables in Windows operating systems.

.. _config.formatting.arg:

``output_format`` Argument
~~~~~~~~~~~~~~~~~~~~~~~~~~

Pass ``output_format`` as an argument to any function call:

.. code-block:: python
from iexfinance.refdata import get_symbols
get_symbols(output_format='pandas').head()
or at the instantiation of a ``Stock`` object:

.. code-block:: python
from iexfinance.stocks import Stock
aapl = Stock("AAPL", output_format='pandas')
aapl.get_quote().head()
Contact
-------

Expand Down
116 changes: 63 additions & 53 deletions docs/source/configuration.rst
Expand Up @@ -8,40 +8,51 @@ There are four core components of ``iexfinance``'s configuration:

* :ref:`config.auth` - setting your IEX Cloud Authentication Token
* :ref:`config.formatting` - configuring desired output format (mirror IEX output or Pandas DataFrame)
* :ref:`config.api_version` - specifying version of IEX Cloud to use
* :ref:`config.api-version` - specifying version of IEX Cloud to use
* :ref:`config.debugging` - cached sessions, request retries, and more

.. _config.api_version:
.. _config.auth:

API Version
-----------
Authentication
--------------

The desired IEX API version can be specified using the ``IEX_API_VERSION``
environment variable. The following versions are currently supported:
An IEX Cloud account and authentication token are required to acecss the IEX Cloud API. The IEX Cloud token is accessible via the IEX Cloud Console.

* ``stable`` - **default**
* ``beta``
* ``v1``
* ``latest``
* ``sandbox`` *for testing purposes*
.. seealso:: For more information about signing up for an IEX Cloud account, see the pricing_ section of the IEX Cloud website.

.. seealso:: For more information on API versioning, see the IEX Cloud
documentation_.
.. _pricing: https://iexcloud.io/pricing

.. _documentation: https://iexcloud.io/docs/api/#versioning
Your IEX Cloud (secret) authentication token can be be stored in the ``IEX_TOKEN`` environment variable. It can also be passed to any function or at the instantiation of a ``Stock`` :ref:`object <stocks.stock_object>`.

Instructions for both authentication methods are below.

.. _config.auth:
.. _config.auth.env:

Authentication
--------------
Environment Variable (Recommended)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

An IEX Cloud account and authentication token are required to acecss the IEX Cloud API.
The easiest (and recommended) way to authenticate your IEX Cloud account is by
storing your authentication token (secret key beginning with ``sk_``) in the
``IEX_TOKEN`` environment variable.

Your IEX Cloud (secret) authentication token can be passed to any function or at the instantiation of a ``Stock`` :ref:`object <stocks.stock_object>`.
It can also be stored in the ``IEX_TOKEN`` environment variable.
.. _config.auth.env.unix:

macOS/Linux
^^^^^^^^^^^

Type the following command into your terminal:

.. code-block:: bash
$ export IEX_TOKEN=<YOUR-TOKEN>
.. _config.auth.env.windows:

Windows
^^^^^^^

See `here <https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10>`__ for instructions on setting environment variables in Windows operating systems.

The IEX Cloud token is accessible via the IEX Cloud Console.

.. _config.auth.argument:

Expand All @@ -66,16 +77,26 @@ or at the instantiation of a ``Stock`` object:
a = Stock("AAPL", token="<YOUR-TOKEN>")
a.get_quote()
.. _config.auth.env:
Where ``<YOUR-TOKEN>`` is your IEX Cloud authentication token.

.. _config.formatting:

Output Formatting
-----------------

By default, ``iexfinance`` returns data for most endpoints in a `pandas <https://pandas.pydata.org/>`__ ``DataFrame``.

Selecting ``json`` as the output format returns data formatted *exactly* as received from
the IEX Endpoint. Configuring ``iexfinance``'s output format can be done in two ways:

.. _config.formatting.env:

Environment Variable (Recommended)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The easiest (and recommended) way to authenticate your IEX Cloud account is by
storing your authentication token (secret key beginning with ``sk_``) in the
``IEX_TOKEN`` environment variable.

.. _config.auth.env.unix:
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.

macOS/Linux
^^^^^^^^^^^
Expand All @@ -84,24 +105,14 @@ Type the following command into your terminal:

.. code-block:: bash
$ export IEX_TOKEN=<YOUR-TOKEN>
.. _config.auth.env.windows:
$ export IEX_OUTPUT_FORMAT=pandas
Windows
^^^^^^^

See `here <https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10>`__ for instructions on setting environment variables in Windows operating systems.

.. _config.formatting:

Output Formatting
-----------------

By default, ``iexfinance`` returns data for most endpoints in a `pandas <https://pandas.pydata.org/>`__ ``DataFrame``.

Selecting ``json`` as the output format returns data formatted *exactly* as received from
the IEX Endpoint. Configuring ``iexfinance``'s output format can be done in two ways:
.. _config.formatting.arg:

``output_format`` Argument
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -123,26 +134,25 @@ or at the instantiation of a ``Stock`` object:
aapl = Stock("AAPL", output_format='pandas')
aapl.get_quote().head()
Environment Variable
~~~~~~~~~~~~~~~~~~~~
.. _config.api-version:

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.

macOS/Linux
^^^^^^^^^^^
API Version
-----------

Type the following command into your terminal:
The desired IEX API version can be specified using the ``IEX_API_VERSION``
environment variable. The following versions are currently supported:

.. code-block:: bash
* ``stable`` - **default**
* ``beta``
* ``v1``
* ``latest``
* ``sandbox`` *for testing purposes*

$ export IEX_OUTPUT_FORMAT=pandas
.. seealso:: For more information on API versioning, see the IEX Cloud
documentation_.

Windows
^^^^^^^
.. _documentation: https://iexcloud.io/docs/api/#versioning

See `here <https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10>`__ for instructions on setting environment variables in Windows operating systems.

.. _config.debugging:

Expand Down
Binary file added docs/source/images/iexexample.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/source/index.rst
Expand Up @@ -7,6 +7,8 @@ Welcome to iexfinance's documentation!
- :ref:`endpoints` - (mostly) 1:1 mirror of the `IEX Cloud documentation <https://iexcloud.io/api/>`__
- :ref:`package_info` - additional package information, developer/testing documentation

.. note:: iexfinance is now a pandas-driven library. The default output format is now a pandas ``DataFrame``.

.. warning:: Support for Python 2 has ended as of ``iexfinance`` version 0.5.0.

.. _account: https://iexcloud.io/pricing/
Expand All @@ -20,11 +22,11 @@ Full Contents
:maxdepth: 1
:caption: Getting Started

usage
whatsnew
install
configuration
sandbox
usage

.. _endpoints:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/install.rst
@@ -1,8 +1,8 @@
.. _install:


Install
=======
Installation
============

Dependencies
------------
Expand Down
2 changes: 2 additions & 0 deletions docs/source/sandbox.rst
Expand Up @@ -9,3 +9,5 @@ accessed by setting ``IEX_API_VERSION`` to ``iexcloud-sandbox``. This will set `
.. note:: Test keys (beginning with ``Tsk`` and ``Tpk``) must be used with the sandbox environment. To obtain these keys, select the "Viewing test data" toggler on the left side of the IEX Cloud console.

.. _`sandbox environment`: https://iexcloud.io/docs/api/#sandbox

The sandbox environment is recommended for testing purposes. Messages used in the sandbox environment will not count against a user's monthly message limit.
2 changes: 1 addition & 1 deletion docs/source/testing.rst
Expand Up @@ -24,6 +24,7 @@ All testing dependencies can be installed via ``pip install -r requirements-dev.
- codecov
- flake8
- flake8-bugbear
- flake8-rst
- pytest
- pytest-runner
- tox
Expand All @@ -32,7 +33,6 @@ All documentation dependencies can be installed via ``pip install -r docs/requir

**Docs**

- flake8-rst
- ipython
- matplotlib
- requests-cache
Expand Down