/pytiingo

Python SDK for the Tiingo Finance API

Primary LanguagePythonMIT LicenseMIT

Pytiingo

Pytiingo is a Python SDK written for the Tiingo Financial Markets API. Tiingo delivers performant access to data from financial markets such as equities, cyrptocurrencies, and forex. They also support queryable fundamentals and news data spanning 20+ years.

Use Pytiingo to query Tiingo's REST endpoints and receive data in JSON or Pandas format. Pytiingo will support real time streaming of financial data in the coming future. This library requires a free API key, which can be retrieved by making a free account on their website. You can also look at all the available functionality in their API Documentation.

Install

Install the latest package using pip:

pip install pytiingo

To install from the source, clone the directory using:

git clone git@github.com:philipk19238/pytiingo.git

Navigate to the project directory and run:

python setup.py --install

REST Usage

Documentation below interfaces with Tiingo's REST endpoints

Initialize the Client

The REST Client can be initialized as follows:

from pytiingo import RESTClient 

client = RESTClient(token='YOUR_API_TOKEN') 

If you want your data in a Pandas format, use:

from pytiingo import RESTClient 

client = RESTClient(token='YOUR_API_TOKEN', output_format='pandas') 

Sample API Calls

EOD Equities

from pytiingo import RESTClient 

client = RESTClient(token='YOUR_API_TOKEN') 
price = client.eod.get_prices('GOOG')

Cryptocurrencies

from pytiingo import RESTClient

client = RESTClient(token='YOUR_API_TOKEN')
prices = client.crypto.get_prices(tickers='BTCUSD',
                                  startDate='2019-01-02',
                                  resampleFreq='5min')

Forex

from pytiingo import RESTClient

client = RESTClient(token='YOUR_API_TOKEN')
prices = client.forex.get_prices('AUDUSD')

Real Time Equities

from pytiingo import RESTClient

client = RESTClient(token='YOUR_API_TOKEN')
prices = client.iex.get_prices('GOOG')

Fundamentals

from pytiingo import RESTClient

client = RESTClient(token='YOUR_API_TOKEN')
metrics = client.fundamentals.get_daily_metrics('GOOG')

News (Premium Endpoint)

from pytiingo import RESTClient

client = RESTClient(token='YOUR_API_TOKEN')
news = client.news.get_news(tickers=['AAPL', 'GOOG'],
                            tags=['election', 'argentina'])

Contributing

All contributors are welcome! Just make a pull request :)

TODOS:

  • Finish WebsocketClient for data streaming
  • Add Unit Tests
  • Integrate CI Pipeline
  • Add Integration Tests