Files
OpenBB/website/content/sdk/quickstart/api-keys.md
2023-02-15 15:00:47 -08:00

28 KiB
Vendored

title, sidebar_position, description, keywords
title sidebar_position description keywords
Obtain and Set API Keys for Data Providers 4 API (Application Programming Interface) keys are access credentials for accessing data from a particular source. They are a string of random characters assigned, by the data provider, to an individual account. Most vendors offer a free tier requiring only a valid email address. Each key is entered into the OpenBB SDk from the `openbb.keys` module, using the syntax described below. The docstrings for each source will also display the expected inputs.
api
keys
api keys
data provider
data
free
alpha vantage
fred
iex
twitter
degiro
binance
coinglass
polygon
intrinio
sdk

The Keys Module

API (Application Programming Interface) keys are access credentials for obtaining data from a particular source. They are a string of random characters assigned, by the data provider, to an individual account. Most vendors offer a free tier requiring only a valid email address, some will require an account with proper KYC (Know Your Customer). Each source is entered into the SDK with the openbb.keys module, using the syntax described in the sections below. Wrapping the command with help() will print the docstrings to the screen. For example:

help(openbb.keys.reddit)

Which prints:

    Set Reddit key
  
    Parameters
    ----------
    client_id: str
        Client ID
    client_secret: str
        Client secret
    password: str
        User password
    username: str
        User username
    useragent: str
        User useragent
    persist: bool, optional
        If False, api key change will be contained to where it was changed. For example, a Jupyter notebook session.
        If True, api key change will be global, i.e. it will affect terminal environment variables.
        By default, False.
    show_output: bool, optional

    Returns
    -------
    str
        Status of key set
  
    Examples
    --------
    >>> from openbb_terminal.sdk import openbb
    >>> openbb.keys.reddit(
            client_id="example_id",
            client_secret="example_secret",
            password="example_password",
            username="example_username",
            useragent="example_useragent"
        )

A message similar to the one below will be printed when a function requesting data from an API is called but the key has not yet been entered.

openbb.stocks.quote("AAPL")
API_KEY_FINANCIALMODELINGPREP not defined. Set API Keys in ~/.openbb_terminal/.env or under keys menu.

The menu also provides a method for testing the validity of a key upon entry. It can be easy to copy & paste the string with a missing character; so, if the test fails, check that the values were correctly recorded with the command:

openbb.keys.mykeys(show = True)

We recommend gradually obtaining keys, when the use of a specific function requires it.

Summary List

Click to expand the list of data providers
Command Name URL
av AlphaVantage https://www.alphavantage.co/support/#api-key
binance Binance https://binance.com
bitquery Bitquery https://bitquery.io/
cmc CoinMarketCap https://coinmarketcap.com/api/
coinbase Coinbase https://help.coinbase.com/en/exchange/managing-my-account/how-to-create-an-api-key
coinglass Coinglass https://coinglass.github.io/API-Reference/#api-key
cpanic Crypto Panic https://cryptopanic.com/developers/api/
degiro DeGiro https://www.degiro.com/
eodhd EODHD https://eodhistoricaldata.com/r/?ref=869U7F4J
ethplorer Ethplorer https://github.com/EverexIO/Ethplorer/wiki/Ethplorer-API
finnhub Finnhub https://finnhub.io/
fmp Financial Modelling Prep https://site.financialmodelingprep.com/developer/docs/
fred Federal Reserve Economic Database (FRED) https://fred.stlouisfed.org
github GitHub https://docs.github.com/en/rest/guides/getting-started-with-the-rest-api
glassnode Glassnode https://docs.glassnode.com/basic-api/api-key#how-to-get-an-api-key/
iex IEX Cloud https://iexcloud.io/
intrinio Intrinio https://intrinio.com/
messari Messari https://messari.io/api/docs
news News API https://newsapi.org/
oanda Oanda https://developer.oanda.com
polygon Polygon https://polygon.io
quandl Quandl https://www.quandl.com
reddit Reddit https://www.reddit.com/wiki/api
rh Robinhood https://robinhood.com/us/en/
santiment Santiment https://app.santiment.net/
shroom ShroomDK https://sdk.flipsidecrypto.xyz/shroomdk
smartstake Smartstake https://www.smartstake.io
stocksera Stocksera https://stocksera.pythonanywhere.com/
tokenterminal Token Terminal https://tokenterminal.com/
tradier Tradier https://documentation.tradier.com/
twitter Twitter https://developer.twitter.com
walert Whale Alert https://docs.whale-alert.io/

Instructions by Source

This section covers all API keys listed above and include detailed instructions how to obtain each API key. By clicking on each name, the section will expand and instructions are provided. Include, persist = True in the syntax to permanently store the key on the machine.

AlphaVantage

Go to: https://www.alphavantage.co/support/#api-key

AlphaVantage

Fill out the form, pass Captcha, and click on, "GET FREE API KEY". The issued key can be entered into the OpenBB SDK with:

openbb.keys.av(key = 'REPLACE_WITH_KEY', persist = True)

Binance

Go to: https://www.binance.com/en/support/faq/how-to-create-api-360002502072

Binance

These instructions should provide clear guidance for obtaining an API Key. Enter the issued credentials into the OpenBB SDK with:

openbb.keys.binance(
    key = 'REPLACE_WITH_KEY',
    secret = 'REPLACE_WITH_SECRET',
    persist = True
)

Bitquery

Go to: https://bitquery.io/

Bitquery

Click "Try GraphQL API", which opens the following screen:

Try GraphQL API

After creating an account and verifying the email address, get the value for the key by clicking on the "API Key" tab.

Get Bitquery API Key

Enter this API key into the OpenBB SDK with:

openbb.keys.bitquery(key = 'REPLACE_WITH_KEY', persist = True)

CoinMarketCap

Go to: https://coinmarketcap.com/api

CoinMarketCap

Click on, "Get Your Free API Key Now", which opens to the page:

CoinMarketCap

Once the account has been created, copy the API key displayed within the dashboard.

CoinMarketCap

Enter the API key into the OpenBB SDK with:

openbb.keys.cmc(key = 'REPLACE_WITH_KEY', persist = True)

Coinbase

Go to: https://help.coinbase.com/en/exchange/managing-my-account/how-to-create-an-api-key

Coinbase

Follow the instructions to obtain the credentials for the specific account. Enter the three values into the OpenBB SDK with:

openbb.keys.coinbase(
    key = 'REPLACE_WITH_KEY',
    secret = 'REPLACE_WITH_SECRET',
    passphrase = 'REPLACE_WITH_PASSPHRASE',
    persist = True
)

Coinglass

Go to: https://www.coinglass.com/

Coinglass

Click, "Log in", and then sign up for an account. This opens the page:

Coinglass

With the account created, find the assigned API key within the account profile page. Enter this value into the OpenBB SDK with:

openbb.keys.coinglass(key = 'REPLACE_WITH_KEY', persist = True)

Crypto Panic

Go to: https://cryptopanic.com/developers/api/

Crypto Panic

Click on, "Sign up", and after creating, the API Key will be displayed on the documentation page, "Your free API auth token".

Crypto Panic

Enter that value in the OpenBB SDK with:

openbb.keys.cpanic(key = 'REPLACE_WITH_KEY', persist = True)

Degiro

Go to: https://www.degiro.com/

Degiro

Click on, "Open an account", and then go through the registration process. After setting up the account, the login credentials can be entered in the OpenBB SDK with:

openbb.keys.degiro(
    username = 'USERNAME',
    password = 'PASSWORD',
    persist = True
)

Instructions for setting up 2FA authorization are here.

EODHD

Go to: https://eodhistoricaldata.com/r/?ref=869U7F4J

EODHD

Clicking on, "Registration", opens the page:

EODHD

Once registered, the API Key will be next to "API TOKEN".

EODHD

Enter this string into the OpenBB SDK with:

openbb.keys.eodhd(key = 'REPLACE_WITH_KEY', persist = True)

Finnhub

Go to: https://finnhub.io/

Finnhub

Click on, "Get free api key", to open the page:

Finnhub

Once the account has been created, find the API key in the account dashboard.

Finnhub

Add this key to the OpenBB SDK with:

openbb.keys.finnhub(key = 'REPLACE_WITH_KEY', persist = True)

Financial Modeling Prep

Go to: https://site.financialmodelingprep.com/developer/docs

FinancialModelingPrep

Click on, "Get my API KEY here", and sign up for a free account.

FinancialModelingPrep

With an account created, sign in and navigate to the Dashboard, which shows the assigned token. by pressing the "Dashboard" button which will show the API key.

FinancialModelingPrep

Enter the key into the OpenBB SDK with:

openbb.keys.fmp(key = 'REPLACE_WITH_KEY', persist = True)

FRED

Go to: https://fred.stlouisfed.org

FRED

Click on, "My Account", create a new account or sign in with Google:

FRED

After completing the sign-up, go to "My Account", and select "API Keys". Then, click on, "Request API Key".

FRED

Fill in the box for information about the use-case for FRED, and by clicking, "Request API key", at the bottom of the page, the API key will be issued.

FRED

Enter the API key into the OpenBB SDK with:

openbb.keys.fred(key = 'REPLACE_WITH_KEY', persist = True)

GitHub

Go to: https://github.com

GitHub

Sign up for, or sign in to, GitHub. Once logged in, navigate to the apps page, under account settings.

GitHub

Select, "New GitHub App":

GitHub

After creating the app, the key will be issued. Enter this token into the OpenBB SDK with:

openbb.keys.github(key = 'REPLACE_WITH_KEY', persist = True)

Glassnode

Go to: https://studio.glassnode.com

Glassnode

Click on, "Sign up", and create an account:

Glassnode

After creating an account, navigate to the account settings and generate an API Key.

Glassnode

Enter this key in the OpenBB SDK with:

openbb.keys.glassnode(key = 'REPLACE_WITH_KEY', persist = True)

IEX Cloud

Go to: https://iexcloud.io

IEX Cloud

Click on, "Sign in", and then create a new account.

IEX Cloud

After signing up, select a plan. There is a choice for a free plan at the bottom.

IEX Cloud

After completing the sign-up process, the API Keyis found under the, "Access & Security", tab.

IEX Cloud

Add this API key to the OpenBB SDK with:

openbb.keys.iex(key = 'REPLACE_WITH_KEY', persist = True)

Intrinio

Go to: https://intrinio.com/starter-plan

Intrinio

An API key will be issued with a subscription. Find the token value within the account dashboard, and enter it into the OpenBB SDK with:

openbb.keys.intrinio(key = 'REPLACE_WITH_KEY', persist = True)

Messari

Go to: https://messari.io

Messari

Click on, "Sign up", and create an account.

Messari

After creating the account, navigate to the account page, and click on the tab for, API Access.

Messari

Copy the API key and add it to the OpenBB SDK with:

openbb.keys.messari(key = 'REPLACE_WITH_KEY', persist = True)

News API

Go to: https://newsapi.org

News API

Click on, "Get API Key", and fill out the form.

News API

Register for an account and the next screen will provide the API Key.

News API

Add this API key into the OpenBB SDK with:

openbb.keys.news(key = 'REPLACE_WITH_KEY', persist = True)

Oanda

Go to: https://developer.oanda.com

Oanda

After creating an account, follow the steps below.

Oanda

Upon completion of the account setup, enter the credentials into the OpenBB SDK with:

openbb.keys.oanda(
    account = 'REPLACE_WITH_ACCOUNT',
    access_token = 'REPLACE_WITH_TOKEN',
    account_type = 'REPLACE_WITH_LIVE_OR_PRACTICE',
    persist = True
)

Polygon

Go to: https://polygon.io

Polygon

Click on, "Get your Free API Key".

Polygon

After signing up, the API Key is found at the bottom of the account dashboard page.

Polygon

Enter the key into the OpenBB SDK with:

openbb.keys.polygon(key = 'REPLACE_WITH_KEY', persist = True)

Quandl

Go to: https://www.quandl.com

Quandl

Click on, "Sign Up", and register a new account.

Quandl

Follow the sign-up instructions, and upon completion the API key will be assigned.

Quandl

Enter the key into the OpenBB SDK with:

openbb.keys.quandl(key = 'REPLACE_WITH_KEY', persist = True)

Reddit

Sign in to Reddit, and then go to: https://old.reddit.com/prefs/apps/

Reddit

Scroll down and click on "create application", selecting "script".

Reddit

Once the application is created, you must register it here

Reddit

Click on, "Read the full API terms and sign up for usage", and fill out the form.

Reddit

After submitting the form, check for a confirmation email. The credentials will be displayed here, add them to the OpenBB SDK with:

openbb.keys.reddit(
    client_id = 'REPLACE_WITH_CLIENT_ID',
    client_secret = 'REPLACE_WITH_CLIENT_SECRET',
    username = 'REPLACE_WITH_REDDIT_USERNAME',
    password = 'REPLACE_WITH_REDDIT_PASSWORD',
    useragent = 'REPLACE_WITH_USER_AGENT',
    persist = True
)

Robinhood

Go to: https://robinhood.com/us/en

Robinhood

After registering for an account, it can be added to the OpenBB SDK with:

openbb.keys.rb(
    username = 'REPLACE_WITH_USERNAME',
    password = 'REPLACE_WITH_PASSWORD',
    persist = True

The first login will request 2FA authorization from the device connected to the account.

Santiment

Go to: https://app.santiment.net

Santiment

Click on, "Sign up", and register for an account.

Santiment

Navigate to the account dashboard and generate a key.

Santiment

Add it to the OpenBB SDK with:

openbb.keys.santiment(key = 'REPLACE_WITH_KEY', persist = True)

ShroomDK

Go to: https://sdk.flipsidecrypto.xyz/shroomdk

ShroomDK

Click "Mint Your ShroomDK API Key", and sign up for an account.

ShroomDK

Once created, connect a wallet to complete minting the NFT license. The API key will be displayed under the account.

ShroomDK

Enter it into the OpenBB SDK with:

openbb.keys.shroom(key = 'REPLACE_WITH_KEY', persist = True)

Stocksera

Go to: https://stocksera.pythonanywhere.com

Stocksera

Click on, "Log in", and create an account.

Stocksera

Once logged in, navigate to the "Developers" tab and copy the API key.

Stocksera

Add the key to the OpenBB SDK with:

openbb.keys.stocksera(key = 'REPLACE_WITH_KEY', persist = True)

Token Terminal

Go to: https://tokenterminal.com

Token Terminal

Click on, "Log in" and sign up for an account.

Token Terminal

Verify the email address, and then navigate go to the "API" tab and copy the API key to the clipboard.

Token Terminal

Add the key to the OpenBB SDK with:

openbb.keys.tokenterminal(key = 'REPLACE_WITH_KEY', persist = True)

Tradier

Go to: https://documentation.tradier.com

Tradier

Click on, "Open Account", to start the sign-up process. After the account has been setup, navigate to Tradier Broker Dash and create the application. Request a sandbox access token, and enter this key into the OpenBB SDK with:

openbb.keys.tradier(key = 'REPLACE_WITH_KEY', persist = True)

Twitter

Upcoming changes to the Twitter API will deprecate the current functionality, it is uncertain if the features will continue to work.

Twitter API

Whale Alert

Go to: https://docs.whale-alert.io

Whale Alert

Click on, "sign up here".

Whale Alert

After creating the account, click on, "Create", to issue the API Key.

Whale Alert

Enter the key into the OpenBB SDK with:

openbb.keys.walert(key = 'REPLACE_WITH_KEY', persist = True)