Credentials
By default, authorization is not required to initialize and use the core services. Most data providers, however, require an API key to access their data. Keys are stored locally, in the ~/.openbb_platform/user_settings.json
file, under the credentials
object.
OpenBB Hub
The OpenBB Hub is deprecated and support for remote credential storage will be phased out. Please transition to use the configuration files.
Data provider credentials and user preferences can be securely stored on the OpenBB Hub and accessed in Python using a revokable Personal Access Token (PAT). Login to the Hub to manage this method of remote authorization.
from openbb import obb
# Login with personal access token
obb.account.login(pat="my_pat", remember_me=True)
# Alternatively, login with email and password
obb.account.login(email="my_email", password="my_password", remember_me=True)
# Change a credential
obb.user.credentials.polygon_api_key = "my_api_key"
# Save account changes to the Hub
obb.account.save()
# Refresh account with latest changes
obb.account.refresh()
# Logout
obb.account.logout()
Set remember_me
as False
to discard all credentials at the end of the session.
Local Environment
Credentials and user preferences are stored locally, ~/.openbb_platform/
, as a JSON file, user_settings.json
. It is read upon initializing the Python client, or when the Fast API is authorized. If the file does not exist, it will be created on the first run. The schema below can be copy/pasted as a template:
{
"credentials": {
"fmp_api_key": "REPLACE",
"polygon_api_key": "REPLACE",
"benzinga_api_key": "REPLACE",
"fred_api_key": "REPLACE",
"nasdaq_api_key": "REPLACE",
"intrinio_api_key": "REPLACE",
"alpha_vantage_api_key": "REPLACE",
"biztoc_api_key": "REPLACE",
"tradier_api_key": "REPLACE",
"tradier_account_type": "sandbox OR live",
"tradingeconomics_api_key": "REPLACE",
"tiingo_token": "REPLACE"
}
}
To set keys from the Python client for the current session only, access the Credentials class:
obb.user.credentials.intrinio_api_key = "my_api_key"
See Environment Variables & System Settings for more information on configuring the installation via user_settings.json
.
See Extensions for a current list of data provider extensions.