OpenBB Platform – A Complete Guide

13 min read

Get 10-day Free Algo Trading Course

Last Updated on January 31, 2024

Table of contents:

  1. What is the OpenBB Platform?
  2. What are the OpenBB Platform main features?
  3. Why should I use the OpenBB Platform?
  4. Why shouldn’t I use the OpenBB Platform?
  5. Is the OpenBB Platform free?
  6. What interfaces does the OpenBB Platform have?
  7. What are the OpenBB Platform alternatives?
  8. How to get started with the OpenBB Platform?
  9. How to explore OpenBB Platform commands?
  10. What is the OBBject?
  11. How does the OpenBB Platform perform standardization?
  12. What providers does the OpenBB Platform support?
  13. How to get stock data with the OpenBB Platform?
  14. How to get fundamental data with the OpenBB Platform?
  15. How to get currency data with the OpenBB Platform?
  16. How to get news data with the OpenBB Platform?
  17. How to get derivatives data with the OpenBB Platform?
  18. How to get fixed-income data with the OpenBB Platform?
  19. How to get ETF data with the OpenBB Platform?
  20. How to get index data with the OpenBB Platform?
  21. How to perform quantitative analysis with the OpenBB Platform?
  22. How to perform technical analysis with the OpenBB Platform?
  23. How to perform econometrics analysis with the OpenBB Platform?
  24. How to create your own OpenBB Platform extension?
  25. Where can I learn more about the OpenBB Platform?
  26. Full code

What is the OpenBB Platform?

The OpenBB Platform is an open-source modular financial analysis ecosystem.

It integrates with close to 100 different data sources from asset classes such as equity, options, crypto, forex, macro economy, fixed income, alternative datasets, and more.

Before we dive in deeper, take note that I’m the OpenBB Platform engineering team lead and that I will do my best to make sure this article isn’t biased.

Website: https://openbb.co/products/platform

GitHub: https://github.com/OpenBB-finance/OpenBBTerminal

What are the OpenBB Platform main features?

The main OpenBB Platform features come from its architecture which consists of the OpenBB Core and various Extensions, including Providers and Toolkits. The Core facilitates the development of custom applications with streamlined data provider connections, while the Extensions offer categorized data access and enhanced functionalities.

This design ensures a flexible, lightweight platform that easily integrates into different environments, avoiding the complexity and dependency issues of its predecessor.

Thus, the main features are these:

  • lightweight
  • modular
  • supports a Python and Web API interface
  • offers data standardization between providers
  • easily extendable
  • great documentation
  • free and open-sourced
  • secure

Why should I use the OpenBB Platform?

  • The OpenBB Platform is easy to use.
  • Is actively maintained.
  • Provides access to many data classes.
  • Is modular in its design and easily extendable.
  • Integrates multiple data provider endpoints under a single consistent command.
  • Is open-sourced and free to use.
  • Implements data standardization between different financial data providers.
  • Features a Python and Web API interface.
  • Has a very good documentation system.

Why shouldn’t I use the OpenBB Platform?

  • The OpenBB Platform might not yet provide the data you need.
  • Your core data provider might not yet be supported.
  • It will require effort to switch your code to the OpenBB Platform API.

Is the OpenBB Platform free?

Yes, the OpenBB Platform is free to use and all the code is open-sourced. The only fees that might happen are the ones that you define with your data providers for their API keys and usage.

What interfaces does the OpenBB Platform have?

The OpenBB Platform features two interfaces which are the Python and Web API interface. The Python interface allows Python devs a seamless developing experience with robust and extendable code, type hinting, good documentation, etc.

The Web API allows any frontend to easily incorporate the available endpoints of the OpenBB Platform and integrate them into any programming language or framework of choice.

The only difference you might notice is that some endpoints will be available on the Python interface and not on the Web API interface. This is because the Web API interface requires everything to be serializable.

There are only a handful of econometrics endpoints that aren’t present on the Web API interface and the econometrics package is an optional one.

What are the OpenBB Platform alternatives?

At the time of writing this article, there aren’t any direct OpenBB Platform alternatives. You can use the data providers and follow their different endpoints and command schemas without the standardization.

The closest alternatives depending on your workflow and needs could be:

  • Koyfin
  • FactSet
  • yCharts
  • TradingView
  • CCXT
  • QuantConnect
  • Interactive Brokers

How to get started with the OpenBB Platform?

To get started with the OpenBB Platform, you will need to install it into a fresh environment. Having an OpenBB Hub account is highly advisable so that you can have all of your API keys in one place across all OpenBB products.

For this article, I’ll be installing only the base providers and extensions so that we can gradually pick what we need. You can also install everything that there is by adding the [all] flag. The version of openbb that I’ll be demoing in this article is openbb-4.1.2.

pip install openbb

Now, let us go over and create an OpenBB Hub account that we can log into from the OpenBB Platform and thus have our API keys recognized. For those who want to follow along, providers such as CBOE and Yahoo Finance provide data and don’t require API keys.

To get our OpenBB Hub account ready, navigate to the website that is found on the following URL: https://my.openbb.co/login

Then either choose to register manually or log in with your Google account or equivalent. When you log in, you will be greeted by the landing page of the Hub and be able to see all of the OpenBB products.

Select the OpenBB Platform and then on the left side of the screen you will see the API Keys section. Please navigate there and add your API keys. For this article, I’ll only be using FMP, Polygon, FRED, Intrinio, and Benzinga as providers that require an API key.

Now, one final step that we can do is to create a PAT (Personal Access Token) that we can use to log into our OpenBB Hub from the Python interface. To create a PAT, click on its title on the left side of your screen and then click the “Generate” button with a preferred expiry date.

You will be presented with your key and with the command that we want to run now to log in:

from openbb import obb
obb.account.login(pat="<YOUR_TOKEN>")

On first import, the extensions will be building their Python static assets that are used to provide a good Python development experience. Once built, you will have everything you need to get going.

The OpenBB Platform is comprised of several “menus” that are either utility ones or routers that serve as entry points into different asset classes and their commands. Because it is modular, your available commands, routers, and installed extensions will look different depending on what you installed.

Here is what the current core environment looks like:

obb
OpenBB Platform v4.1.2

Utilities:
    /account
    /user
    /system
    /coverage

Routers:
    /crypto
    /currency
    /derivatives
    /economy
    /equity
    /etf
    /fixedincome
    /index
    /news
    /regulators

Extensions:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]

    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]    

A full list of available OpenBB Platform extensions can be found here: https://my.openbb.co/app/platform/extensions

From the utilities, you can access your user by navigating to the namespace of the obb.user. You can control your account and log out from the obb.account namespace and view your system settings from the obb.system namespace.

obb.user
obb.account
obb.user.credentials

In the following headers, we will be exploring some of the things that the OpenBB Platform has to offer and the goal will be to get comfortable with using it and exploring.

How to explore OpenBB Platform commands?

There are several ways of exploring the OpenBB Platform commands. You can visit the documentation that is found on the following URL and explore the reference section that will show you all the menus and their commands.

Each command will have documentation on how to use it, what are the standard query parameters and what are the specific ones to each provider that supports the command. The same will be shown for the command outputs.

These standards are a product of the standardization framework, but more about that later.

Another way of exploring the commands is through your Python interface. You can simply do obb. and your intelisense should be picking up on what is available. Then you can go one layer deeper and do obb.equity. and see what is there.

Once you get to a particular command that you would like to try out, you can add a question mark at its end to get its signature, the docstring of the command, and all the details. For example:

obb.equity.price.performance?
Price performance as a return, over different periods.

Parameters
----------
symbol : str
    Symbol to get data for.
provider : Optional[Literal['fmp']]
    The provider to use for the query, by default None.
    If None, the provider specified in defaults is selected or 'fmp' if there is
    no default.

Returns
-------
OBBject
    results : List[PricePerformance]
        Serializable results.
    provider : Optional[Literal['fmp']]
        Provider name.
    warnings : Optional[List[Warning_]]
        List of warnings.
    chart : Optional[Chart]
        Chart object.
    extra: Dict[str, Any]
        Extra info.

PricePerformance
----------------
one_day : Optional[float]
    One-day return. 
wtd : Optional[float]
    Week to date return. 
one_week : Optional[float]
    One-week return. 
mtd : Optional[float]
    Month to date return. 
one_month : Optional[float]
    One-month return. 
qtd : Optional[float]
    Quarter to date return. 
three_month : Optional[float]
    Three-month return. 
six_month : Optional[float]
    Six-month return. 
ytd : Optional[float]
    Year to date return. 
one_year : Optional[float]
    One-year return. 
three_year : Optional[float]
    Three-year return. 
five_year : Optional[float]
    Five-year return. 
ten_year : Optional[float]
    Ten-year return. 
max : Optional[float]
    Return from the beginning of the time series. 
symbol : Optional[str]
    The ticker symbol. (provider: fmp)

Example
-------
>>> from openbb import obb
>>> obb.equity.price.performance(symbol="AAPL")

Here you will see a detailed presentation of the command parameters at your disposal, the structure of the OBBject, and the outputs of the model that you can expect. It is also provided with an example that you can use.

What is the OBBject?

The OBBject is the OpenBB result object (hence OBBject 😀 ) which is a standardized object that will be returned on every call execution. It will hold your results, warnings during the command execution, any extra info, charts, or something that an OBBject extension might add.

OBBject
    results : List[PricePerformance]
        Serializable results.
    provider : Optional[Literal['fmp']]
        Provider name.
    warnings : Optional[List[Warning_]]
        List of warnings.
    chart : Optional[Chart]
        Chart object.
    extra: Dict[str, Any]
        Extra info.

The OBBject also comes with custom helpers that can present your data in different ways such as to_df(), to_dict(), to_json(), etc.

How does the OpenBB Platform perform standardization?

The OpenBB Platform performs standardization by utilizing Pydantic v2 and standard data models that define the standard set of query parameters and resulting output fields for a particular command.

The standard is defined based on the intersection of fields that are shared between two or more providers that can fuel the same command. It is also based on the financial knowledge of the OpenBB team.

These standard models ensure that you can easily switch out a provider and compare apples to apples by just changing the provider query parameter. It will also guarantee a set of fields that are expected to always be returned by any of the supported providers and a set of query parameters that will work for all of them.

Saying this, the OpenBB Platform will always allow you to use any provider-specific query parameters, and all provider-specific fields that aren’t a part of the standard are documented and returned too.

To illustrate this, we can see what the standard query parameters for this command look like and how they change when SEC is the provider:

We can also observe the difference between the output of the same command and when the provider is Intrinio:

This is a very powerful feature and it will allow for seamless switching between different data providers and you won’t need to worry about different API conventions, naming, libraries, etc.

What providers does the OpenBB Platform support?

Official providers that the OpenBB Platform supports can be found here:

https://my.openbb.co/app/platform/data-providers

There are also “community” providers that one can install and use such as:

  • Biztoc
  • Quandl
  • StockGrid
  • Seeking Alpha
  • Wall Street Journal
  • and more

To see the coverage of your installed providers over the available commands, you can do:

obb.coverage.providers

You can also view it in a transposed way:

obb.coverage.commands

How to get stock data with the OpenBB Platform?

To get stock data with the OpenBB Platform, you will need to access the equity router under which you will find the data for that sector. It will consist of commands and/or sub-routers that you can access. To view what is available we can do:

obb.equity
/equity
    /calendar
    /compare
    /discovery
    /estimates
    /fundamental
    market_snapshots
    /ownership
    /price
    profile
    screener
    search
    /shorts

Now, let us get historical price data by navigating to the price sub-router and using the historical command.

obb.equity.price.historical("LUV")
OBBject

id: 065abf67-8e3b-71af-8000-3b73cf8eb7f7
results: [{'date': datetime.datetime(2024, 1, 19, 0, 0), 'open': 30.14, 'high': 30....
provider: fmp
warnings: None
chart: None
extra: {'metadata': {'arguments': {'provider_choices': {'provider': None}, 'standar...

Here you will see the OBBject with your results and other information. To get this data as a dataframe we can write it as:

obb.equity.price.historical("LUV").to_df().head()

You can now easily change the default provider which is FMP to another one such as Intrinio:

obb.equity.price.historical("LUV", provider="intrinio").to_df().head()

You can install matplotlib, plotly, or any preferred charting library to create charts. The OpenBB Platform also features a charting extension that can do this. It is currently in the reworks so I won’t be demoing it here.

How to get fundamental data with the OpenBB Platform?

To get fundamental data with the OpenBB Platform, you can visit the equity.fundamental router and get fundamental data such as balance sheets, cash flow statements, income statements, and more.

obb.equity.fundamental
/equity/fundamental
    balance
    balance_growth
    cash
    cash_growth
    dividends
    employee_count
    filings
    historical_attributes
    historical_eps
    historical_splits
    income
    income_growth
    latest_attributes
    management
    management_compensation
    metrics
    multiples
    overview
    ratios
    reported_financials
    revenue_per_geography
    revenue_per_segment
    search_attributes
    trailing_dividend_yield
    transcript

Now, we will get the revenue per geography and the annual cash flow statement:

obb.equity.fundamental.revenue_per_geography("LUV").to_df()
	period_ending	fiscal_period	fiscal_year	filing_date	geographic_segment
0	2018-12-31	FY	2018	2019-02-05	{'Latin America': 566000000, 'North America': ...
1	2019-12-31	FY	2019	2020-02-04	{'Latin America': 615000000, 'North America': ...
2	2020-12-31	FY	2020	2021-02-08	{'Latin America': 184000000, 'North America': ...
3	2021-12-31	FY	2021	2022-02-07	{'Latin America': 475000000, 'North America': ...
4	2022-12-31	FY	2022	2023-02-07	{'Latin America': 811000000, 'North America': ...
obb.equity.fundamental.cash("LUV", provider="intrinio").to_df().transpose()

How to get currency data with the OpenBB Platform?

To get currency data with the OpenBB Platform, you can access the obb.currency router and utilize its commands. For example, let us get the USD to GBP historical data:

obb.currency.price.historical("USDGBP").to_df().head()

We can also search for all the available pairs for a particular data provider:

obb.currency.search("fmp").to_df().head()
     name	symbolcurrency	stock_exchange	exchange_short_name
0	ARS/MXN	ARSMXN	MXN	CCY	FOREX
1	TND/ZAR	TNDZAR	ZAR	CCY	FOREX
2	XAG/RUB	XAGRUB	RUB	CCY	FOREX
3	ILS/NOK	ILSNOK	NOK	CCY	FOREX
4	COP/CLP	COPCLP	CLP	CCY	FOREX

How to get news data with the OpenBB Platform?

To get news data with the OpenBB Platform, you will access the obb.news router from where you will be able to stay on top of the latest news on a global or company-specific level. For example, let us get the latest 5 news pieces where LUV is mentioned:

obb.news.company("LUV", limit=5).to_df()

How to get derivatives data with the OpenBB Platform?

To get derivatives data with the OpenBB Platform such as option chains, we can access the obb.derivatives router. To get all unusual options trading activity for a particular asset we can do:

obb.derivatives.options.unusual("LUV").to_df()

How to get fixed-income data with the OpenBB Platform?

To get fixed-income data with the OpenBB Platform, we will use the obb.fixedincome router that is split into several categories such as rates, corporate, spreads, government, etc.

obb.fixedincome
/fixedincome
    /corporate
    /government
    /rate
    sofr
    /spreads

For example, let us obtain the US government treasury rates since the start of 2024:

obb.fixedincome.government.treasury_rates(start_date="2024-01-02").to_df().dropna()

How to get ETF data with the OpenBB Platform?

To get ETF data with the OpenBB Platform, we can utilize the obb.etf router and the commands within it. For example, the ETF data router has access to the following commands:

obb.etf
/etf
    countries
    holdings
    holdings_date
    holdings_performance
    info
    price_performance
    search
    sectors

Let us obtain the price performance of SPY and QQ:

obb.etf.price_performance(["SPY", "QQQ"]).to_df().transpose()
	        0	        1
one_day	        0.012466	0.019831
one_week	0.015087	0.03152
one_month	0.030261	0.044904
three_month	0.145398	0.187761
six_month	0.066898	0.1179
ytd	        0.020692	0.046176
one_year	0.218627	0.489953
three_year	0.256688	0.300862
five_year	0.835312	1.60084
ten_year	1.61934	        3.756409
max	        9.97929	        7.248727
symbol	        SPY	        QQQ

Now, let us also see the weight of an ETF across different sectors:

obb.etf.sectors("QQQ").to_df()
	sector	weight
0	Cash	0.000496
1	Commercial Services	0.005482
2	Communications	0.014800
3	Consumer Durables	0.030500
4	Consumer Non-Durables	0.039200
5	Consumer Services	0.054000
6	Distribution Services	0.003061
7	Electronic Technology	0.294000
8	Energy Minerals	0.002089
9	Health Technology	0.069300
10	Industrial Services	0.002386
11	Producer Manufacturing	0.023200
12	Retail Trade	0.104600
13	Technology Services	0.334200
14	Transportation	0.011600
15	Utilities	0.011200

How to get index data with the OpenBB Platform?

To get index data with the OpenBB Platform, navigate to the obb.index router and you will have access to commands such as search, constituents, price data, and more.

obb.index
/index
    available
    constituents
    market
    /price

For example, we will grab all the constituents of the Dow Jones index:

obb.index.constituents("dowjones").to_df()

How to perform quantitative analysis with the OpenBB Platform?

To perform quantitative analysis with the OpenBB Platform, you will need to make sure that the openbb-quantitative library is installed. By having it installed, you will unlock a new pathway which is the obb.quantitative router and its endpoints.

Let us install it by running:

pip install openbb-quantitative

After installing it, make sure to restart the notebook and import again obb so that it builds the Python static assets for the added extension.

obb.quantitative
/quantitative
    capm
    kurtosis
    normality
    omega_ratio
    quantile
    sharpe_ratio
    skewness
    sortino_ratio
    summary
    unitroot_test

Now, let us run a normality test on the adjusted close data:

luv_historical = obb.equity.price.historical("LUV").to_df()
obb.quantitative.normality(data=luv_historical, target="adj_close").to_df()
0	kurtosis	statistic=-1.980922466143507 p_value=0.0475999...
1	skewness	statistic=-0.7194281764567769 p_value=0.471877...
2	jarque_bera	statistic=3.0962272128471486 p_value=0.2126487...
3	shapiro_wilk	statistic=0.98307204246521 p_value=0.004416265...
4	kolmogorov_smirnov	statistic=1.0 p_value=0.0

How to perform technical analysis with the OpenBB Platform?

To perform technical analysis with the OpenBB Platform, you will need to make sure that the openbb-technical library is installed. By having it installed, you will unlock a new pathway which is the obb.technical router and its endpoints.

Let us install it by running:

pip install openbb-technical

Whenever you add a new extension, you will need to restart and re-import the library so it gets picked up accordingly. Let us see what we have unlocked:

obb.technical
/technical
    ad
    adosc
    adx
    aroon
    atr
    bbands
    cci
    cg
    clenow
    cones
    demark
    donchian
    ema
    fib
    fisher
    hma
    ichimoku
    kc
    macd
    obv
    rsi
    sma
    stoch
    vwap
    wma
    zlma

Now, I will calculate the length of 14 RSI on the adjusted closing prices:

obb.technical.rsi(data=luv_historical, target="adj_close").to_df().tail(10)[
    "adj_close_RSI_14"
]
241    57.444245
242    57.199409
243    58.470221
244    60.907707
245    61.714351
246    50.706565
247    51.800099
248    47.213098
249    59.399720
250    59.093636

How to perform econometrics analysis with the OpenBB Platform?

To perform econometrics analysis with the OpenBB Platform, you will need to install the openbb.econometrics extension that will unlock the obb.econometrics router for usage.

Let us install it by running:

pip install openbb-econometrics

After restarting and re-importing obb, we can now start using the following set of functions:

obb.econometrics
/econometrics
    autocorrelation
    causality
    cointegration
    correlation_matrix
    ols_regression
    ols_regression_summary
    panel_between
    panel_first_difference
    panel_fixed
    panel_fmac
    panel_pooled
    panel_random_effects
    residual_autocorrelation
    unit_root

Now, we can do an autocorrelation test for the adjusted close column:

obb.econometrics.correlation_matrix(
    data=luv_historical,
).to_df()

We can also do an OLS Regression which will return a statsmodel object:

obb.econometrics.ols_regression(
    data=luv_historical,
    y_column="adj_close",
    x_columns=["high", "low", "open"],
).results["results"].summary()

How to create your own OpenBB Platform extension?

To create your own OpenBB Platform extension, there is a tool called the OpenBB Cookiecutter that allows you to easily create a custom extension that can be picked up and used by the OpenBB Platform. You can also publish it so other people can use it.

Here is the GitHub repo that will guide you through the process and a demo video:

https://github.com/OpenBB-finance/openbb-cookiecutter

https://youtu.be/cOh-bK81JRk

Where can I learn more about the OpenBB Platform?

To learn more about the OpenBB Platform, I highly recommend reading the documentation that can be found here and check out the notebook examples here. There are also some tutorials present on this page.

Full code

GitHub Link

Igor Radovanovic