summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-03-27 06:12:54 -0700
committerGitHub <noreply@github.com>2024-03-27 13:12:54 +0000
commit657fd1fbcca1ccf908e7c9cc31b34a985c2d4e0e (patch)
treeaedcb59044b94b68016420ac691350dd633ea10b
parentc39d14e2d6d718f9b2218e1d1f7f681895d21dfa (diff)
[Docs] Break Out Usage Section In Docs Pages (#6258)
* break out the Usage section in docs pages * codespell
-rw-r--r--website/content/platform/installation.md11
-rw-r--r--website/content/platform/usage/api_keys.md91
-rw-r--r--website/content/platform/usage/basic_response.md138
-rw-r--r--website/content/platform/usage/basic_syntax.md2
-rw-r--r--website/content/platform/usage/explanation/_category_.json4
-rw-r--r--website/content/platform/usage/explanation/commitment_of_traders.md (renamed from website/content/platform/usage/commitment_of_traders.md)0
-rw-r--r--website/content/platform/usage/explanation/financial_statements.md (renamed from website/content/platform/usage/financial_statements.md)0
-rw-r--r--website/content/platform/usage/explanation/find_symbols.md (renamed from website/content/platform/usage/find_symbols.md)0
-rw-r--r--website/content/platform/usage/explanation/historical_prices.md (renamed from website/content/platform/usage/historical_prices.md)0
-rw-r--r--website/content/platform/usage/explanation/index.md35
-rw-r--r--website/content/platform/usage/explanation/market_calendars.md (renamed from website/content/platform/usage/market_calendars.md)0
-rw-r--r--website/content/platform/usage/index.md319
-rw-r--r--website/content/platform/usage/rest_api.md2
-rw-r--r--website/content/platform/usage/settings_and_environment_variables.md105
-rw-r--r--website/content/terminal/installation/pypi.md303
15 files changed, 400 insertions, 610 deletions
diff --git a/website/content/platform/installation.md b/website/content/platform/installation.md
index 20a1cc2c6ec..2db5639e2f6 100644
--- a/website/content/platform/installation.md
+++ b/website/content/platform/installation.md
@@ -254,6 +254,17 @@ obb.account.login(pat='my_pat_here')
The documentation and packages are kept in the `/website` folder, at the base of the repository. Navigate there to install the dependencies and start the development server.
+### Generate Markdown Files
+
+Markdown files for the Reference and Data Models pages need to be generated.
+This will generate content based on what is actually installed and contained locally, so it may appear different than what is on this website.
+
+Open a terminal command line to the `/OpenBBTerminal/website` folder, then enter:
+
+```bash
+python generate_platform_v4_markdown.py
+```
+
### Node.js
- [Node.js](https://nodejs.org/en/) >= 16.13.0
diff --git a/website/content/platform/usage/api_keys.md b/website/content/platform/usage/api_keys.md
new file mode 100644
index 00000000000..bcb05dccf40
--- /dev/null
+++ b/website/content/platform/usage/api_keys.md
@@ -0,0 +1,91 @@
+---
+title: API Keys
+sidebar_position: 1
+description: An overview for setting up the OpenBB Platform Python client and Fast API with data provider API keys.
+keywords:
+- OpenBB Platform
+- Python client
+- Fast API
+- getting started
+- authorization
+- data providers
+- OpenBB Hub
+- local environment
+- environment variables
+---
+
+import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
+
+<HeadTitle title="API Keys - Usage | OpenBB Platform Docs" />
+
+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 can be stored locally and they can also be securely saved to your OpenBB Hub [account](https://my.openbb.co) for convenient remote access.
+
+### OpenBB Hub
+
+:::info
+The OpenBB Hub is only accessible via the Python Interface. For REST API, store credentials and preferences in the `user_settings.json` file [local](api_keys#local-environment) to the deployment.
+:::
+
+
+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](https://my.openbb.co/) to manage this method of remote authorization.
+
+The OpenBB Hub is a convenient solution for accessing data in temporary Python environments, like Google Colab ([example notebook](https://github.com/OpenBB-finance/OpenBBTerminal/blob/develop/examples/googleColab.ipynb)). Login with:
+
+```python
+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.
+
+
+:::tip
+With `remember_me=True`, credentials will be permanently stored in the environment.
+Wrapping this sequence before deploying an API server is one (insecure) way to authorize data providers for remote access.
+:::
+
+### 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:
+
+```json
+{
+ "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:
+
+```python
+obb.user.credentials.intrinio_api_key = "my_api_key"
+```
diff --git a/website/content/platform/usage/basic_response.md b/website/content/platform/usage/basic_response.md
new file mode 100644
index 00000000000..42623fe110a
--- /dev/null
+++ b/website/content/platform/usage/basic_response.md
@@ -0,0 +1,138 @@
+---
+title: Basic Response & Command Coverage
+sidebar_position: 4
+description: This page details the basic response and output that can be expected to be received from the the OpenBB Platform, as well as instructions for determining the command coverage provided by the installed extensions.
+keywords:
+- standardized output
+- OBBject
+- basic response
+- provider
+- results
+- warnings
+- chart
+- extra
+- command coverage
+---
+
+import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
+
+<HeadTitle title="Basic Response - Usage | OpenBB Platform Docs" />
+
+The output of every command is an object which contains the results of the request, along with additional information. It is a custom class, `OBBject`, and always returns with the fields listed below:
+
+```console
+id: ... # UUID Tag
+results: ... # Serializable results.
+provider: ... # Provider name.
+warnings: ... # List of warnings.
+chart: ... # Chart object.
+extra: ... # Extra info.
+```
+
+```python
+from openbb import obb
+
+data = obb.equity.price.historical("SPY", provider="polygon")
+
+data
+```
+
+```console
+OBBject
+
+id: 06520558-d54a-7e53-8000-7aafc8a42694
+results: [{'date': datetime.datetime(2022, 10, 5, 0, 0), 'open': 375.62, 'high': 37...
+provider: polygon
+warnings: None
+chart: None
+extra: {'metadata': {'arguments': {'provider_choices': {'provider': 'polygon'}, 'st...
+```
+
+Additional class methods are helpers for converting the results to a variety of formats.
+
+- `to_dict()`: converts to a dictionary, accepting all standard "orientation" parameters, i.e., "records"
+- `to_df()` / `to_dataframe()`: converts to a Pandas DataFrame.
+- `to_numpy()`: converts to a Numpy array.
+- `to_polars()`: converts to a Polars table.
+
+The output from the Fast API is a serialized version of this object, and these methods are lost on conversion. OBBject can be reconstructed to recover the helpers by importing the model and validating the data.
+
+```python
+import requests
+from openbb_core.app.model.obbject import OBBject
+
+data = []
+symbol="SPY"
+url = f"http://127.0.0.1:8000/api/v1/equity/price/historical?provider=polygon&symbol={symbol}"
+headers = {"accept": "application/json"}
+
+response = requests.get(url, headers=headers, timeout=3)
+
+if response.status_code == 200:
+ data = OBBject.model_validate(response.json())
+
+data.to_df()
+```
+
+:::info
+The preferred output type can be set with a user preference.
+
+```python
+obb.user.preferences.output_type="dataframe"
+```
+:::
+
+## Dynamic Command Execution
+
+Dynamic execution provides an alternate entry point to functions. This method requires formatting the query as demonstrated below.
+
+```python
+from openbb_core.app.command_runner import CommandRunner
+runner = CommandRunner()
+output = await runner.run(
+ "/equity/fundamental/ratios",
+ provider_choices={
+ "provider": "fmp",
+ },
+ standard_params={
+ "symbol" : "TSLA",
+ "period" : "quarter",
+ },
+ extra_params={}
+)
+```
+
+```console
+>>> output
+OBBject
+
+id: 065241b7-bd9d-7313-8000-9406d8afab75
+results: [{'symbol': 'TSLA', 'date': '2023-06-30', 'period': 'Q2', 'current_ratio':...
+provider: fmp
+warnings: None
+chart: None
+extra: {'metadata': {'arguments': {'provider_choices': {'provider': 'fmp'}, 'standa...
+```
+
+## Commands and Provider Coverage
+
+The installed commands and data providers are found under, `obb.coverage`.
+
+```python
+obb.coverage
+```
+
+```console
+/coverage
+
+ providers
+ commands
+ command_model
+ command_schemas
+```
+
+`obb.coverage.providers` is a dictionary of the installed provider extensions, each with its own list of available commands.
+
+`obb.coverage.commands` is a dictionary of commands, each with its own list of available providers for the data.
+
+`obb.coverage.command_model` is a dictionary where the keys are the command paths and the values is a nested dictionary of QueryParams and Data models associated with that function.
diff --git a/website/content/platform/usage/basic_syntax.md b/website/content/platform/usage/basic_syntax.md
index 777935cd244..7036a9a2290 100644
--- a/website/content/platform/usage/basic_syntax.md
+++ b/website/content/platform/usage/basic_syntax.md
@@ -1,6 +1,6 @@
---
title: Basic Syntax
-sidebar_position: 2
+sidebar_position: 5
description: This page provides comprehensive information about standardized command
syntax for an open-source platform. Topics discussed include the structure of command
syntax, use of standardized parameters, usage of provider and symbol parameters,
diff --git a/website/content/platform/usage/explanation/_category_.json b/website/content/platform/usage/explanation/_category_.json
new file mode 100644
index 00000000000..43f047c48dd
--- /dev/null
+++ b/website/content/platform/usage/explanation/_category_.json
@@ -0,0 +1,4 @@
+{
+ "label": "Explanation",
+ "position": 6
+ }
diff --git a/website/content/platform/usage/commitment_of_traders.md b/website/content/platform/usage/explanation/commitment_of_traders.md
index 085b0207b5b..085b0207b5b 100644
--- a/website/content/platform/usage/commitment_of_traders.md
+++ b/website/content/platform/usage/explanation/commitment_of_traders.md
diff --git a/website/content/platform/usage/financial_statements.md b/website/content/platform/usage/explanation/financial_statements.md
index dd4a121f658..dd4a121f658 100644
--- a/website/content/platform/usage/financial_statements.md
+++ b/website/content/platform/usage/explanation/financial_statements.md
diff --git a/website/content/platform/usage/find_symbols.md b/website/content/platform/usage/explanation/find_symbols.md
index ab71c8da32e..ab71c8da32e 100644
--- a/website/content/platform/usage/find_symbols.md
+++ b/website/content/platform/usage/explanation/find_symbols.md
diff --git a/website/content/platform/usage/historical_prices.md b/website/content/platform/usage/explanation/historical_prices.md
index 5244f2955dd..5244f2955dd 100644
--- a/website/content/platform/usage/historical_prices.md
+++ b/website/content/platform/usage/explanation/historical_prices.md
diff --git a/website/content/platform/usage/explanation/index.md b/website/content/platform/usage/explanation/index.md
new file mode 100644
index 00000000000..5dbc13c7d7e
--- /dev/null
+++ b/website/content/platform/usage/explanation/index.md
@@ -0,0 +1,35 @@
+---
+title: Explanation
+sidebar_position: 1
+description: This section provides explanations of concepts related to usage and getting started with the OpenBB Platform.
+ The pages include example syntax and outline what you can expect while working with the OpenBB Python interface and REST API.
+keywords:
+- getting started
+- explanation
+- guide
+- syntax
+- examples
+- symbols
+- calendars
+- commitment of traders
+- financial statements
+- time series
+- historical prices
+---
+
+import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
+
+<HeadTitle title="Explanation - Usage | OpenBB Platform Docs" />
+
+This section provides explanations for getting started using the OpenBB Platform.
+Pages outline things to expect and include example syntax for use.
+
+Subjects covered include:
+
+- [Finding Ticker Symbols](explanation/find_symbols)
+- [Loading Historical Price Data](explanation/historical_prices)
+- [Market Calendars](explanation/market_calendars)
+- [Financial Statements](explanations/financial_statements)
+- [Commitment of Traders](explanations/commitment_of_traders)
+
+Jupyter Notebook examples are also hosted in the OpenBB GitHub repository [here](https://github.com/OpenBB-finance/OpenBBTerminal/tree/develop/examples)
diff --git a/website/content/platform/usage/market_calendars.md b/website/content/platform/usage/explanation/market_calendars.md
index f129838fc67..f129838fc67 100644
--- a/website/content/platform/usage/market_calendars.md
+++ b/website/content/platform/usage/explanation/market_calendars.md
diff --git a/website/content/platform/usage/index.md b/website/content/platform/usage/index.md
index cd051093274..ee0ddcfba88 100644
--- a/website/content/platform/usage/index.md
+++ b/website/content/platform/usage/index.md
@@ -27,316 +27,25 @@ import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
<HeadTitle title="Overview - Usage | OpenBB Platform Docs" />
-At its base, the OpenBB Platform supplies core architecture and services for connecting data providers and extensions, consumable through the Python client or the Fast API. The extension framework provides interoperability between as many, or few, services required. Optional extras are not included with the base installation, and these include:
+At its base, the OpenBB Platform supplies core architecture and services for connecting data providers and extensions, consumable through the Python client or the Fast API.
+The extension framework provides interoperability between as many, or few, services required.
+
+Optional extras are not included with the base installation, and these include:
- Charting libraries and views
-- Data cleaning
+- Data processing and calculations
- Technical/Quantitative Analysis
- Community data providers
+- Toolkit extensions
- CLI Terminal
-## Authorization
-
-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. The API keys can be stored locally, or securely on the OpenBB Hub for convenient remote access. Refer to our Developer Guidelines for best practices within a production environment.
-
-### OpenBB Hub
-
-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](https://my.openbb.co/) to manage this method of remote authorization.
-
-The OpenBB Hub is a convenient solution for accessing data in temporary Python environments, like Google Colab ([example notebook](https://github.com/OpenBB-finance/OpenBBTerminal/blob/develop/examples/googleColab.ipynb)). Login with:
-
-```python
-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, create it with any text editor. The schema below can be copy/pasted if required, providers not listed here are added using the same format:
-
-```json
-{
- "credentials": {
- "fmp_api_key": "REPLACE_ME",
- "polygon_api_key": "REPLACE_ME",
- "benzinga_api_key": "REPLACE_ME",
- "fred_api_key": "REPLACE_ME",
- "nasdaq_api_key": "REPLACE_ME",
- "intrinio_api_key": "REPLACE_ME",
- "alpha_vantage_api_key": "REPLACE_ME",
- }
-}
-```
-
-To set keys from the Python client for the current session only, access the Credentials class:
-
-```python
-obb.user.credentials.intrinio_api_key = "my_api_key"
-```
-
-## Environment Variables
-
-Environment variables are defined in a `.env` file. If this file does not exist, create it inside the same folder `user_settings.json` is located.
-
-- `OPENBB_DEBUG_MODE`: enables verbosity while running the program
-- `OPENBB_DEVELOP_MODE`: points hub service to .co or .dev
-- `OPENBB_AUTO_BUILD`: enables automatic SDK package build on import
-- `OPENBB_CHARTING_EXTENSION`: specifies which charting extension to use
-- `OPENBB_API_AUTH_EXTENSION`: specifies which authentication extension to use
-- `OPENBB_API_AUTH`: enables API authentication for command endpoints
-- `OPENBB_API_USERNAME`: sets API username
-- `OPENBB_API_PASSWORD`: sets API password
-
-Variables can be defined for current session only.
-
-```python
-import os
-os.environ["OPENBB_DEBUG_MODE"] = "True"
-from openbb import obb
-```
-
-### Proxy Networks
-
-An environment variable can be set, in the `.env` file, to direct the Requests library to a specific address and port.
-
-```env
-HTTP_PROXY="<ADDRESS>" or HTTPS_PROXY="<ADDRESS>”
-```
-
-For example:
-
-```env
-HTTP_PROXY="http://10.10.10.10:8000"
-```
-
-## User Settings
-
-| **Preference** | **Default** | **Options** | **Description** |
-|-----------------------|----------------------------------|------------------------|---------------|
-| data_directory | /home/OpenBBUserData | Any path. | When launching the application for the first time this directory will be created. It serves as the default location where the application stores usage artifacts such as logs and exports. |
-| export_directory | /home/OpenBBUserData/exports | Any path. | The OpenBB Charting Extension provides the capability to export images in various formats. This is the directory where it attempts to save such exports. |
-| cache_directory | /home/OpenBBUserData/cache | Any path. | The directory where http requests and database caches are stored, for functions with caching. |
-| user_styles_directory | /home/OpenBBUserData/styles/user | Any path. | The OpenBB Charting Extension supports custom stylization. This directory is the location where it looks for user-defined styles. If no user styles are found in this directory the application will proceed with the default styles. |
-| charting_extension | openbb_charting | ["openbb_charting"] | Name of the charting extension to be used with the application. |
-| chart_style | dark | ["dark", "light"] | The default color style to use with the OpenBB Charting Extension plots. Options include "dark" and "light". |
-| plot_enable_pywry | True | [True, False] | Whether the application should enable PyWry. If PyWry is disabled the image will open in your default browser otherwise it will be displayed within your editor or in a separate PyWry window. |
-| plot_pywry_width | 1400 | Any positive integer. | PyWry window width. |
-| plot_pywry_height | 762 | Any positive integer. | PyWry window height. |
-| plot_open_export | False | [True, False] | Controls whether the "Save As" window should pop up as soon as the image is displayed." |
-| table_style | dark | ["dark", "light"] | "The default color style to use with the OpenBB Charting Extension tables. Options are "dark" and "light"" |
-| request_timeout | 15 | Any positive integer. | Specifies the timeout duration for HTTP requests. |
-| metadata | True | [True, False] | Enables or disables the collection of metadata which provides information about operations including arguments duration route and timestamp. Disabling this feature may improve performance in cases where contextual information is not needed or when the additional computation time and storage space are a concern. |
-| output_type | OBBject | ["OBBject", "dataframe", "numpy", "dict", "chart", "polars"] | Specifies the type of data the application will output when a command or endpoint is accessed. Note that choosing data formats only available in Python such as `dataframe`, `numpy` or `polars` will render the application's API non-functional. |
-| show_warnings | True | [True, False] | Enables or disables the display of warnings. |
-
-User settings can be set from the Python interface directly.
-
-```python
-from openbb import obb
-
-obb.user.profile
-obb.user.credentials
-obb.user.preferences
-obb.user.defaults
-```
-
-Notably, `obb.user.defaults`, defines default providers for any command. They are stored in the `user_settings.json` file, under `routes`. Below is an example of what it might look like.
-
-```json
-{
- "credentials": {
- "benzinga_api_key": null,
- "fmp_api_key": null,
- "polygon_api_key": null,
- "fred_api_key": null
- },
- "defaults": {
- "routes": {
- "/equity/fundamental/balance": {
- "provider": "polygon"
- },
- "/equity/price/historical": {
- "provider": "fmp"
- },
- "/equity/news": {
- "provider": "benzinga"
- }
- }
- },
- {
- "preferences": {
- "data_directory": "~/OpenBBUserData", // Where to store data
- "export_directory": "~/OpenBBUserData/exports", // Where to store exports
- "cache_directory": "~/OpenBBUserData/cache", // Where to store the cache
- "user_styles_directory": "~/OpenBBUserData/styles/user", // Where to store user styles
- "charting_extension": "openbb_charting", // Charting extension to use
- "chart_style": "dark", // Chart style to use (dark or light)
- "plot_enable_pywry": true, // Whether to enable PyWry
- "plot_pywry_width": 1400, // PyWry width
- "plot_pywry_height": 762, // PyWry height
- "plot_open_export": false, // Whether to open plot image exports after they are created
- "table_style": "dark", // Table style to use (dark or light)
- "request_timeout": 15, // Request timeout
- "metadata": true, // Whether to include metadata in the output
- "output_type": "OBBject" // Our default output type (OBBject, dataframe, polars, numpy, dict, chart)
- }
- }
-}
-```
-
-:::note
-
-### **Notes on Preferences**
-
-- If a `OpenBBUserData` folder in not in the home directory, the application will create one on first run. The user preferences with paths all default to this folder, be it exports, styles or data - this can be changed at any time to suit.
-- The `OpenBBUserData` will still be created even if preferences are not pointing to it, this is because the application needs a place to store logs and other artifacts.
-- One way of exporting files or images on the OpenBB Platform is to leverage that functionality from the OpenBB Charting Extension. The `export_directory` preference is the location where the extension will attempt to save such exports.
-
-:::
-
-## Basic Response
-
-The output of every command is an object which contains the results of the request, along with additional information. It is a custom class, `OBBject`, and always returns with the fields listed below:
-
-```console
-id: ... # UUID Tag
-results: ... # Serializable results.
-provider: ... # Provider name.
-warnings: ... # List of warnings.
-chart: ... # Chart object.
-extra: ... # Extra info.
-```
-
-```python
-from openbb import obb
-
-data = obb.equity.price.historical("SPY", provider="polygon")
-
-data
-```
-
-```console
-OBBject
-
-id: 06520558-d54a-7e53-8000-7aafc8a42694
-results: [{'date': datetime.datetime(2022, 10, 5, 0, 0), 'open': 375.62, 'high': 37...
-provider: polygon
-warnings: None
-chart: None
-extra: {'metadata': {'arguments': {'provider_choices': {'provider': 'polygon'}, 'st...
-```
-
-Additional class methods are helpers for converting the results to a variety of formats.
-
-- `to_dict()`: converts to a dictionary, accepting all standard "orientation" parameters, i.e., "records"
-- `to_df()` / `to_dataframe()`: converts to a Pandas DataFrame.
-- `to_numpy()`: converts to a Numpy array.
-- `to_polars()`: converts to a Polars table.
-
-The output from the Fast API is a serialized version of this object, and these methods are lost on conversion. OBBject can be reconstructed to recover the helpers by importing the model and validating