Welcome to finflux API!#

Introduction#

finflux is a Python library that aggregates financial and market data from multiple publicly available RESTful JSON APIs. It currently covers equities, bonds, and U.S. economic indicators, offering a consistent and lightweight way to access and work with this data using straightforward code.

finflux leverages both first-party and third-party APIs sourced from the data providers listed below:

Install#

$ pip install finflux

Quick start#

First, import the library.

import finflux as ff

Before using data retrieval functions, you must configure your API keys and email address for specific endpoints that require user identification. If a required identifier is missing when calling a function, a MissingConfigObject error will be raised.

Currently, functions that access Twelve Data, FRED, BEA, BLS, and SEC data require identifiers: API keys for all except the SEC, which requires an email address. Use the links below to obtain the necessary credentials for each provider.

Once you have obtained all required credentials, configure your API keys and email address using the set_config function.

ff.set_config(
   td = 'your_twelve_data_api_key',
   email = 'example@example.com',
   fred = 'your_FRED_api_key',
   bea = 'your_BEA_api_key',
   bls = 'your_BLS_api_key',
)

Use Case Examples#

EXAMPLE #1: Retrieving dataframe formatted annual income statement data in EUR in millions excluding units past the decimals for Apple Inc. (AAPL).

ff.equity('AAPL').statement(display='table', statement='income', currency='EUR', unit='million', decimal=False, interval='annual')

EXAMPLE #2: Retrieving dataframe formatted monthly timeseries of the US high quality market (A, AA, AAA credit ratings) 7 year maturity corporate bond yield for the past 10 years.

ff.bond().US_HQM_corporate(maturity='7y', period='10y')