Skip to main content


Importing the SDK

Now that you have the SDK installed, the first step is to import the OpenBB SDK in your preferred code editor. Nearly everything required to interact with any function from the OpenBB Terminal gets imported in one line. Begin a Python script or Notebook file with:

from openbb_terminal.sdk import openbb

Example snippets used in the remainder of this guide will assume the code block above is used.

In the same way as operating the OpenBB Terminal, functions are divided into menus which are scrollable after importing into a jupyter notebook. Entering a period, ., after openbb, will display the Sub-menus available.


An alternate way to view the contents of a menu is to use Python's built-in help.



In addition to Python's built-in help, docstrings are also displayed in the Contextual Help window, within a Jupyter environment or by running help( in your code editor.


Help on Operation in module openbb_terminal.core.library.operation:

<openbb_terminal.core.library.operation.Operation object>
Get economic calendar for countries between specified dates

countries : [List[str],str]
List of countries to include in calendar. Empty returns all
start_date : str
Start date for calendar
end_date : str
End date for calendar

Economic calendar

How to use the SDK

Your First Function

To get started using the OpenBB SDK you can try the below code for your first function.
Time (GMT)CountryEventactualconsensuspreviousDate
001:30FranceFrench Unemployment Rate7.3%7.3%7.4%2022-11-15
102:00United KingdomAverage Earnings ex Bonus5.7%5.5%5.5%2022-11-15
202:00United KingdomAverage Earnings Index +Bonus6.0%5.9%6.1%2022-11-15
302:00United KingdomClaimant Count Change3.3K17.3K3.9K2022-11-15
402:00United KingdomEmployment Change 3M/3M-52K-25K-109K2022-11-15
- The results from data functions are not stored to memory unless explicitly instructed to. Most functions returning data are presented as a Pandas DataFrame.

Modify the syntax slightly to deliver the output into a DataFrame:

economic_calendar =

Defined as a variable, interacting with the results becomes a matter of manipulating tables. For example, the code block below will filter the results of the events function to display only events scheduled at a specific time.

economic_calendar =
economic_calendar.set_index(keys = ['Time (GMT)'], append = True, inplace = True)
events = economic_calendar.filter(like = '9:00', axis = 0)

09:00United StatesFed Governor Cook Speaks---2022-11-15
09:00GermanyGerman Buba Balz Speaks---2022-11-15
09:00GermanyGerman Buba Vice President Buch Speaks---2022-11-15

Passing Results to Another Function

Let's take a look at another example where the input to a function is a list. It may be desirable to derive that list from a different function. This can be useful for screening tickers, or analyzing particular industries or sectors. The Comparison Analysis sub-module, within Stocks, is one set of functions that can benefit from this kind of workflow. Instead of something like: = ['AAPL', 'NFLX', 'META', 'AMZN', 'MSFT', 'GOOGL', 'DIS', 'TSLA'], data_type = 'valuation')

Try,, to populate a list dynamically:

symbols ='DIA')
dia_symbols = list(symbols.index.drop(['N/A']))
dia_valuation = = dia_symbols, data_type = 'valuation')
dia_valuation = dia_valuation.sort_values(by = ['Price'], ascending = False).convert_dtypes()

TickerMarket CapP/EFwd P/EPEGP/SP/BP/CP/FCFEPS this YEPS next YEPS past 5YEPS next 5YSales past 5YPriceChangeVolume

Displaying Charts

The OpenBB SDK has built-in charting libraries for Matplotlib, for any chart available from the Terminal. User style sheets can be added to the folder (more on this in Importing and Exporting Data), ~/OpenBBUserData/styles/user. Styles are shared properties between the OpenBB Terminal and the SDK.

Displaying charts in Jupyter Notebooks requires an additional line of code. You can either render a static image with %matplotlib inline or add in pan/zoom functionality with %matplotlib widget.

Functions, such as candle, exist to display charts. Others, like those within the Technical Analysis module, have the option to return either, a chart or raw data. The next examples will outline a few different scenarios. First, let's get some data:

spy_daily = openbb.stocks.load(
symbol = 'SPY',
start_date = '1993-11-01',
monthly = True)

Data from the previous example, spy_daily, can be used in the openbb.stocks.candle function, for example:

data = spy_daily,
asset_type = 'SPY - Monthly Chart from November, 1993',
symbol = ''


The function will also respond to individual tickers without saving the data first as done with load:



Where functions in the Terminal display either a chart or raw data, the command will have an additional _chart component. For example, Donchian Channels:

openbb.ta.donchian(openbb.stocks.load('SPY', interval = 15))
2022-11-15 14:45:00394.49398.33402.17
2022-11-15 15:00:00394.49398.195401.9
2022-11-15 15:15:00394.49398.195401.9
2022-11-15 15:30:00394.49398.105401.72
2022-11-15 15:45:00394.49398.027401.565
data = openbb.stocks.load('SPY', interval = 15),
symbol = 'SPY 15 Minute Data'


Futures curves are another example where this syntax is applied:



The intros section for each module explore further functionality and provide sample code snippets. For example, an introduction to Stocks can be found here.