Files
OpenBB/website/content/platform/faqs/platform_vs_sdk.md
Danglewood 70633e37a0 docs/platform-faq: Start Platform FAQ page with bullet points on Platform vs SDK (#5914)
* platform vs sdk faq page

* add data and data providers faq section and some style cards

* typo

* makes changes as per reviews

* openbb-nightly as a way to install everything

* jupyter-lab instead of jupyter

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
2024-01-05 23:17:42 +00:00

4.8 KiB
Vendored

title, sidebar_position, description, keywords
title sidebar_position description keywords
Platform vs SDK 1 The OpenBB SDK has evolved to become the OpenBB Platform. This page describes some of the key differences between the legacy version and the new architecture.
what's new
v3
legacy
sdk
platform
api
FastAPI

import HeadTitle from '@site/src/components/General/HeadTitle.tsx';

If you're already an OpenBB user, you may be familiar with some of the legacy pain points. As this blog post highlights, there were many challenges with maintaining the existing codebase. We needed to refresh the architecture to make it modular, resilient, and scalable. The core components have been trimmed substantially to be lean and efficient - the number of dependencies has reduced from nearly four-hundred down to about twenty. The result is a much smoother installation procedure, with the tradeoff being some breaking changes for those transitioning from V3 SDK to the V4 Platform. The major differences are described below.

Terminal Application

The OpenBB Terminal is not installed with the Platform. The Terminal will be reimagined with the new extension framework, it won't get left behind for long!

Extension Framework

The extension framework lets users install or uninstall individual data and toolkit extensions. No more bloated environments.

pip install openbb-yfinance

pip uninstall openbb-yfinance

Import Statement

Initialize the OpenBB Platform with a shorter statement and reduced import time.

from openbb import obb

REST API Compliant

The OpenBB Platform is built for REST API deployments, out-of-the-box. Outputs are JSON serializable, and this is a major difference between the SDK and Platform.

Start the API on localhost with:

uvicorn openbb_core.api.rest_api:app

Verbose Namespaces

After careful consideration, the decision was made to name functions with more verbosity. This adds clarity to the functions and lets the user better understand its purpose. It also improves the performance of AI tooling built on top of the Platform.

obb.equity.fundamental.employee_count("AAPL")

Asset Class Names

Some asset classes have been renamed:

  • stocks -> equity
  • forex -> currency
  • stocks.options -> derivatives.options
  • futures -> derivatives.futures

Source -> Provider

V3 SDK users should note that the source parameter is now, provider.

:::note OpenBB Hub Preferences for default sources do not currently sync with V4 Platform, and some API keys not used in the Terminal application are not able to be saved to the Hub. :::

API Key Management

API keys and user preferences are stored in a JSON file - $HOME/.openbb_platform/user_settings.json - instead of the ENV file in $HOME/.openbb_sdk/.env.

Credentials can be entered directly from the Python interface:

from openbb import obb
obb.user.credentials.fmp_api_key="REPLACE_WITH_YOUR_KEY"

OpenBB Hub Login

Login to your OpenBB Hub account with an email/password combo or a revokable Personal Access Token (recommended):

from openbb import obb
obb.account.login()

Function Outputs

The default output format can be selected by the user, and all outputs are Pydantic models. If you are transitioning from V3 SDK and like working with Pandas DataFrames, set the preference to "dataframe" to get a V3-like response.

from openbb import obb
obb.user.preferences.output_type="dataframe"
df = obb.equity.price.historical("AAPL", provider="yfinance")

When the output_type is set to, OBBject, DataFrames are created from the response object after it is returned.

from openbb import obb
data = obb.equity.price.historical("AAPL", provider="yfinance")
df = data.to_df()

:::warning DataFrames are not JSON serializable. Changing this preference will remove REST API compatibility. :::

Jupyter

Jupyter does not get installed with the OpenBB Platform. Install from pip in the environment containing the Platform.

pip install jupyter-lab

Views

Most of the development has been on the core architecture and data providers. Most views from the V3 SDK and Terminal have yet to be ported over to the V4 Platform, although some charts are already available with the openbb-charting toolkit extension - which includes PyWry for window creation.

Install the charting extension with:

pip install openbb-charting

The equivalent to openbb.stocks.candle("AAPL") is, obb.equity.price.historical("AAPL", chart=True).show().

More views to come soon!

Getting Started

See the usage page for examples on getting started using the OpenBB Platform.