Skip to main content

OpenBB Platform API: Launch script and widgets builder for the OpenBB Platform API and Terminal Pro Connector.

Project description

OpenBB Platform API Meta Package

This is a meta package for installing a command line script to launch the OpenBB Platform API, and the OpenBB Terminal Pro data connector widgets build script.

Installation

Install this package within an existing OpenBB Platform Python environment.

pip install openbb-platform-api

Usage

The script is run from the command line, with the environment active, by entering:

openbb-api

This will launch a Fast API instance, via uvicorn, at http://127.0.0.1:6900

Keyword Arguments

The behavior of the script can be configured with the use of arguments and keyword arguments.

Launcher specific arguments:

--build                         Build the widgets.json file.
--no-build                      Do not build the widgets.json file.
--login                         Login to the OpenBB Platform.
--no-filter                     Do not filter the widgets.json file.

All other arguments will be passed to uvicorn. Here are the most common ones:

--host TEXT                     Host IP address or hostname.
                                  [default: 127.0.0.1]
--port INTEGER                  Port number.
                                  [default: 6900]
--ssl-keyfile TEXT              SSL key file.
--ssl-certfile TEXT             SSL certificate file.
--ssl-keyfile-password TEXT     SSL keyfile password.
--ssl-version INTEGER           SSL version to use.
                                  (see stdlib ssl module's)
                                  [default: 17]
--ssl-cert-reqs INTEGER         Whether client certificate is required.
                                  (see stdlib ssl module's)
                                  [default: 0]
--ssl-ca-certs TEXT             CA certificates file.
--ssl-ciphers TEXT              Ciphers to use.
                                  (see stdlib ssl module's)
                                  [default: TLSv1]

Run uvicorn --help to get the full list of arguments.

API Over HTTPS

To run the API over the HTTPS protocol, you must first create a self-signed certificate and the associated key. After activating the environment, you can generate the files by entering this to the command line:

openssl req -x509 -days 3650 -out localhost.crt -keyout localhost.key   -newkey rsa:4096 -nodes -sha256   -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

Two files will be created, in the current working directory, that are passed as keyword arguments to the openbb-api entry point.

openbb-api --ssl_keyfile localhost.key --ssl_certfile localhost.crt

Note: Adjust the command to include the full path to the file if the current working directory is not where they are located.

The certificate - localhost.crt - will need to be added to system's trust store. The process for this will depend on the operating system and the user account privilege.

A quick solution is to visit the server's URL, show the details of the warning, and choose to continue anyways.

Contact the system administrator if you are using a work device and require additional permissions to complete the configuration.

This Connection Is Not Private

Location of widgets.json

An OpenBB Terminal Pro data connector requires a file, widgets.json, to be served by the API. It contains the configuration for each widget available to be added to a dashboard. The file is stored, and served from, the environment's assets folder.

/Path/to/environments/envs/obb/assets/widgets.json

It can be manually edited and served without the build process by passing --no-build to the API launch script.

openbb-api --no-build

If you would like to construct this file manually for a custom backend configuration, save the file in the path above.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openbb_platform_api-1.0.2.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

openbb_platform_api-1.0.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file openbb_platform_api-1.0.2.tar.gz.

File metadata

  • Download URL: openbb_platform_api-1.0.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0

File hashes

Hashes for openbb_platform_api-1.0.2.tar.gz
Algorithm Hash digest
SHA256 674a3e5726b318e59968bc586c7acb31110b29273a968cfc3b13040c2e4493a4
MD5 ab5dd483a2e6b4d24fc7a4f0423cc51e
BLAKE2b-256 143561ab3b747fdbf3ec9288967363a1899da63219e1ed5256098f3be124399c

See more details on using hashes here.

File details

Details for the file openbb_platform_api-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for openbb_platform_api-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2de9f40d1f09a8a1c317411b39a57f0af1c95c8158d67cc91264a901157f064c
MD5 4bba1e0b57c92099bc1d2414a7e80bfe
BLAKE2b-256 46e6873ca44a3722bed85d34bfed5477f17bd97b92e8146eedc07d338dc78184

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page