mirror of
https://github.com/hydrosquall/tiingo-python.git
synced 2025-12-20 12:54:19 +01:00
Clarify API Usage in Docs
This commit is contained in:
27
README.rst
27
README.rst
@@ -39,7 +39,8 @@ First, install the library from PyPi:
|
|||||||
|
|
||||||
pip install tiingo
|
pip install tiingo
|
||||||
|
|
||||||
Now you can use the TiingoClient to make your API calls. (Other parameters are available for each endpoint beyond what has been written below, see docs for full details.)
|
Next, initialize your client object. It is recommended to use an environment
|
||||||
|
variable to initialize your client object for convenience.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -47,10 +48,27 @@ Now you can use the TiingoClient to make your API calls. (Other parameters are a
|
|||||||
# Set TIINGO_API_KEY in your environment variables in your .bash_profile, OR
|
# Set TIINGO_API_KEY in your environment variables in your .bash_profile, OR
|
||||||
# pass a dictionary with 'api_key' as a key into the TiingoClient.
|
# pass a dictionary with 'api_key' as a key into the TiingoClient.
|
||||||
|
|
||||||
# With environment variable
|
|
||||||
client = TiingoClient()
|
client = TiingoClient()
|
||||||
# With hardcoded dictionary key
|
|
||||||
client = TiingoClient({'api_key': "MY_SECRET_API_KEY"})
|
Alternately, you may use a dictionary to customize/authorize your client.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
config = {}
|
||||||
|
|
||||||
|
# To reuse the same HTTP Session across API calls (and have better performance), include a session key.
|
||||||
|
config['session'] = True
|
||||||
|
|
||||||
|
# If you don't have your API key as an environment variable,
|
||||||
|
# pass it in via a configuration dictionary.
|
||||||
|
config['api_key'] = "MY_SECRET_API_KEY"
|
||||||
|
|
||||||
|
# Initialize
|
||||||
|
client = TiingoClient(config)
|
||||||
|
|
||||||
|
Now you can use ``TiingoClient`` to make your API calls. (Other parameters are available for each endpoint beyond what has been written below, see the Tiingo website for full details).
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
# Get Ticker
|
# Get Ticker
|
||||||
# See official docs for list of all supported tickers + date ranges
|
# See official docs for list of all supported tickers + date ranges
|
||||||
@@ -69,6 +87,7 @@ Now you can use the TiingoClient to make your API calls. (Other parameters are a
|
|||||||
# Get news articles about given tickers or search terms from given domains
|
# Get news articles about given tickers or search terms from given domains
|
||||||
# Coming soon!
|
# Coming soon!
|
||||||
|
|
||||||
|
|
||||||
Further Docs
|
Further Docs
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ To use Tiingo Python in a project::
|
|||||||
|
|
||||||
import tiingo
|
import tiingo
|
||||||
|
|
||||||
Now you can use the ``TiingoClient`` to make your API calls. (Other parameters are available for each endpoint beyond what has been written below, see docs for full details.)
|
|
||||||
|
Next, initialize your client object. It is recommended to use an environment
|
||||||
|
variable to initialize your client object for convenience.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -14,11 +16,26 @@ Now you can use the ``TiingoClient`` to make your API calls. (Other parameters a
|
|||||||
# Set TIINGO_API_KEY in your environment variables in your .bash_profile, OR
|
# Set TIINGO_API_KEY in your environment variables in your .bash_profile, OR
|
||||||
# pass a dictionary with 'api_key' as a key into the TiingoClient.
|
# pass a dictionary with 'api_key' as a key into the TiingoClient.
|
||||||
|
|
||||||
# With environment variable
|
|
||||||
client = TiingoClient()
|
client = TiingoClient()
|
||||||
# With hardcoded dictionary key
|
|
||||||
client = TiingoClient({'api_key': "MY_SECRET_API_KEY"})
|
|
||||||
|
|
||||||
|
Alternately, you may use a dictionary to customize/authorize your client.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
config = {}
|
||||||
|
|
||||||
|
# To reuse the same HTTP Session across API calls (and have better)
|
||||||
|
# performance, include a session key.
|
||||||
|
config['session'] = True
|
||||||
|
# If you don't have your API key as an environment variable,
|
||||||
|
# pass it in via a configuration dictionary.
|
||||||
|
config['api_key'] = "MY_SECRET_API_KEY"
|
||||||
|
|
||||||
|
# Initialize
|
||||||
|
client = TiingoClient(config)
|
||||||
|
|
||||||
|
Now you can use ``TiingoClient`` to make your API calls. (Other parameters are available for each endpoint beyond what has been written below, see the Tiingo website for full details).
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
# Get Ticker
|
# Get Ticker
|
||||||
# See official docs for list of all supported tickers + date ranges
|
# See official docs for list of all supported tickers + date ranges
|
||||||
ticker_metadata = client.get_ticker_metadata("GOOGL")
|
ticker_metadata = client.get_ticker_metadata("GOOGL")
|
||||||
|
|||||||
Reference in New Issue
Block a user