mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
markdown linting
This commit is contained in:
60
.github/workflows/lint-openbb-platform.yml
vendored
60
.github/workflows/lint-openbb-platform.yml
vendored
@@ -81,16 +81,55 @@ jobs:
|
||||
uv pip install --system -e "./$pkg" || echo "skip $pkg (install failed)"
|
||||
fi
|
||||
done
|
||||
- run: codespell --ignore-words=.codespell.ignore --skip="$(tr '\n' ',' < .codespell.skip | sed 's/,$//')" --quiet-level=2
|
||||
- run: |
|
||||
# Run linters for openbb_platform | cli
|
||||
if [ -n "${{ env.diff_files }}" ]; then
|
||||
ruff format --check ${{ env.diff_files }}
|
||||
ruff check ${{ env.diff_files }}
|
||||
ty check ${{ env.diff_files }}
|
||||
else
|
||||
echo "No Python files changed in openbb_platform | cli"
|
||||
fi
|
||||
|
||||
- name: Install openbb-core editable (resident, single identity for ty)
|
||||
run: |
|
||||
# Install core last and editable so the in-tree source is the resident
|
||||
# `openbb_core`. A published wheel pulled in as a transitive dep above
|
||||
# would otherwise shadow it and produce spurious type-identity errors.
|
||||
uv pip install --system -e "./openbb_platform/core[pandas]" numpy
|
||||
|
||||
- name: codespell
|
||||
run: codespell --ignore-words=.codespell.ignore --skip="$(tr '\n' ',' < .codespell.skip | sed 's/,$//')" --quiet-level=2
|
||||
|
||||
- name: ruff + ty (per package, from each package root)
|
||||
if: env.diff_files != ''
|
||||
run: |
|
||||
# ty must run from each package's own root. Invoked from the repo root,
|
||||
# an in-tree file like openbb_platform/core/openbb_core/app/router.py
|
||||
# resolves under a different module identity than the installed
|
||||
# `openbb_core`, yielding false "incompatible type" errors. Grouping
|
||||
# changed files by their nearest pyproject.toml ancestor makes each
|
||||
# package its own ty project root, so first-party imports resolve to a
|
||||
# single identity (matching how the per-package test-unit jobs run ty).
|
||||
status=0
|
||||
declare -A pkg_files
|
||||
for f in ${{ env.diff_files }}; do
|
||||
dir=$(dirname "$f")
|
||||
while [ "$dir" != "." ] && [ ! -f "$dir/pyproject.toml" ]; do
|
||||
dir=$(dirname "$dir")
|
||||
done
|
||||
if [ -f "$dir/pyproject.toml" ]; then
|
||||
pkg_files["$dir"]+="${f#"$dir"/} "
|
||||
else
|
||||
echo "::warning::no pyproject.toml ancestor for $f; checking from repo root"
|
||||
pkg_files["."]+="$f "
|
||||
fi
|
||||
done
|
||||
for pkg in "${!pkg_files[@]}"; do
|
||||
files=${pkg_files[$pkg]}
|
||||
echo "::group::Linting $pkg"
|
||||
(
|
||||
cd "$pkg"
|
||||
rc=0
|
||||
ruff format --check $files || rc=1
|
||||
ruff check $files || rc=1
|
||||
ty check $files || rc=1
|
||||
exit $rc
|
||||
) || status=1
|
||||
echo "::endgroup::"
|
||||
done
|
||||
exit $status
|
||||
|
||||
markdown-link-check:
|
||||
name: Markdown Linting
|
||||
@@ -103,6 +142,7 @@ jobs:
|
||||
- name: Lint Code Base
|
||||
uses: docker://avtodev/markdown-lint:v1
|
||||
with:
|
||||
ignore: "./openbb_platform/extensions/mcp_server/openbb_mcp_server/skills/**/*.md ./openbb_platform/providers/sec/openbb_sec/utils/STATEMENT_SCHEMA_README.md"
|
||||
args: "./*.md ./changelogs/*.md ./openbb_platform/**/*.md"
|
||||
|
||||
json-yaml-validate:
|
||||
|
||||
24
openbb_platform/CONTRIBUTING.md
vendored
24
openbb_platform/CONTRIBUTING.md
vendored
@@ -68,11 +68,13 @@ Throughout this document, we will be differentiating between two types of contri
|
||||
|
||||
**Why is this distinction important?**
|
||||
|
||||
The OpenBB Platform is designed as a foundation for further development. We anticipate a wide range of creative use cases for it. Some use cases may be highly specific or detail-oriented, solving particular problems that may not necessarily fit within the OpenBB Platform Github repository. This is entirely acceptable and even encouraged. This document provides a comprehensive guide on how to build your own extensions, add new data points, and more.
|
||||
The OpenBB Platform is designed as a foundation for further development. We anticipate a wide range of creative use cases for it. Some use cases may be highly specific or detail-oriented, solving particular problems that may not necessarily fit within the OpenBB Platform Github repository. This is entirely acceptable and even encouraged. This document
|
||||
provides a comprehensive guide on how to build your own extensions, add new data points, and more.
|
||||
|
||||
The **Developer** role, as defined in this document, can be thought of as the foundational role. Developers are those who use the OpenBB Platform as is or build upon it.
|
||||
|
||||
Conversely, the **Contributor** role refers to those who enhance the OpenBB Platform codebase (either by directly adding to the OpenBB Platform or by extending the [extension repository](/openbb_platform/extensions/)). Contributors are willing to go the extra mile, spending additional time on quality assurance, testing, or collaborating with the OpenBB development team to ensure adherence to standards, thereby giving back to the community.
|
||||
Conversely, the **Contributor** role refers to those who enhance the OpenBB Platform codebase (either by directly adding to the OpenBB Platform or by extending the [extension repository](/openbb_platform/extensions/)). Contributors are willing to go the extra mile, spending additional time on quality assurance, testing, or collaborating with the OpenBB
|
||||
development team to ensure adherence to standards, thereby giving back to the community.
|
||||
|
||||
### Quick look into the OpenBB Platform
|
||||
|
||||
@@ -390,7 +392,8 @@ class <ProviderName>EquityHistoricalFetcher(
|
||||
|
||||
> Make sure that you're following the TET pattern when building a `Fetcher` - **Transform, Extract, Transform**. See more on this [here](#the-tet-pattern).
|
||||
|
||||
By default the credentials declared on each `Provider` are required. This means that before a query is executed, we check that all the credentials are present and if not an exception is raised. If you want to make credentials optional on a given fetcher, even though they are declared on the `Provider`, you can add `require_credentials=False` to the `Fetcher` class. See the following example:
|
||||
By default the credentials declared on each `Provider` are required. This means that before a query is executed, we check that all the credentials are present and if not an exception is raised. If you want to make credentials optional on a given fetcher, even though they are declared on the `Provider`, you can add `require_credentials=False` to the `Fetcher`
|
||||
class. See the following example:
|
||||
|
||||
```python
|
||||
class <ProviderName>EquityHistoricalFetcher(
|
||||
@@ -435,7 +438,8 @@ After running `pip install .` on `openbb_platform/providers/<provider_name>` you
|
||||
|
||||
You will get your data either from a CSV file, local database or from an API endpoint.
|
||||
|
||||
If you don't want or don't need to partake in the data standardization framework, you have the option to add all the logic straight inside the router file. This is usually the case when you are returning custom data from your local CSV file, or similar. Keep in mind that we also serve the REST API and that you shouldn't send non-serializable objects as a response (e.g. a pandas dataframe).
|
||||
If you don't want or don't need to partake in the data standardization framework, you have the option to add all the logic straight inside the router file. This is usually the case when you are returning custom data from your local CSV file, or similar. Keep in mind that we also serve the REST API and that you shouldn't send non-serializable objects as a
|
||||
response (e.g. a pandas dataframe).
|
||||
|
||||
Saying that, we highly recommend following the standardization framework, as it will make your life easier in the long run and unlock a set of features that are only available to standardized data.
|
||||
|
||||
@@ -531,9 +535,11 @@ from openbb_core.app.router import Router
|
||||
The TET pattern is a pattern that we use to build the `Fetcher` classes. It stands for **Transform, Extract, Transform**.
|
||||
As the OpenBB Platform has its own standardization framework and the data fetcher are a very important part of it, we need to ensure that the data is transformed and extracted in a consistent way, to help us do that, we came up with the **TET** pattern, which helps us build and ship faster as we have a clear structure on how to build the `Fetcher` classes.
|
||||
|
||||
1. Transform - `transform_query(params: Dict[str, Any])`: transforms the query parameters. Given a `params` dictionary this method should return the transformed query parameters as a [`QueryParams`](core/openbb_core/provider/abstract/query_params.py) child so that we can leverage the pydantic model schemas and validation into the next step. This might also be the place do perform some transformations on any given parameter, i.e., if you want to transform an empty date into a `datetime.now().date()`.
|
||||
1. Transform - `transform_query(params: Dict[str, Any])`: transforms the query parameters. Given a `params` dictionary this method should return the transformed query parameters as a [`QueryParams`](core/openbb_core/provider/abstract/query_params.py) child so that we can leverage the pydantic model schemas and validation into the next step. This might also
|
||||
be the place do perform some transformations on any given parameter, i.e., if you want to transform an empty date into a `datetime.now().date()`.
|
||||
2. Extract - `extract_data(query: ExampleQueryParams,credentials: Optional[Dict[str, str]],**kwargs: Any,) -> Dict`: makes the request to the API endpoint and returns the raw data. Given the transformed query parameters, the credentials and any other extra arguments, this method should return the raw data as a dictionary.
|
||||
3. Transform - `transform_data(query: ExampleQueryParams, data: Dict, **kwargs: Any) -> List[ExampleHistoricalData]`: transforms the raw data into the defined data model. Given the transformed query parameters (might be useful for some filtering), the raw data and any other extra arguments, this method should return the transformed data as a list of [`Data`](core/openbb_core/provider/abstract/data.py) children.
|
||||
3. Transform - `transform_data(query: ExampleQueryParams, data: Dict, **kwargs: Any) -> List[ExampleHistoricalData]`: transforms the raw data into the defined data model. Given the transformed query parameters (might be useful for some filtering), the raw data and any other extra arguments, this method should return the transformed data as a list of
|
||||
[`Data`](core/openbb_core/provider/abstract/data.py) children.
|
||||
|
||||
#### Errors
|
||||
|
||||
@@ -651,7 +657,8 @@ We can easily deduct that the `ema` command accept data in the formats of `List[
|
||||
|
||||
##### API Interface
|
||||
|
||||
When using the OpenBB Platform on a API Interface, the types are a bit more limited than on the Python one, as, for example, we can't use `pandas.DataFrame` as a type. However the same principles apply for what `Data` means, i.e., any given data processing command, which are characterized as POST endpoints on the API, will accept data as a list of records on the **request body**, i.e.:
|
||||
When using the OpenBB Platform on a API Interface, the types are a bit more limited than on the Python one, as, for example, we can't use `pandas.DataFrame` as a type. However the same principles apply for what `Data` means, i.e., any given data processing command, which are characterized as POST endpoints on the API, will accept data as a list of records on
|
||||
the **request body**, i.e.:
|
||||
|
||||
```json
|
||||
|
||||
@@ -670,7 +677,8 @@ When using the OpenBB Platform on a API Interface, the types are a bit more limi
|
||||
|
||||
## Contributor Guidelines
|
||||
|
||||
The Contributor Guidelines are intended to be a continuation of the [Developer Guidelines](#developer-guidelines). They are not a replacement, but rather an expansion, focusing specifically on those who seek to directly enhance the OpenBB Platform's codebase. It's crucial for Contributors to be familiar with both sets of guidelines to ensure a harmonious and productive engagement with the OpenBB Platform.
|
||||
The Contributor Guidelines are intended to be a continuation of the [Developer Guidelines](#developer-guidelines). They are not a replacement, but rather an expansion, focusing specifically on those who seek to directly enhance the OpenBB Platform's codebase. It's crucial for Contributors to be familiar with both sets of guidelines to ensure a harmonious and
|
||||
productive engagement with the OpenBB Platform.
|
||||
|
||||
There are many ways to contribute to the OpenBB Platform. You can add a [new data point](#getting_started-add-a-new-data-point), add a [new command](#openbb-platform-commands), add a [new visualization](/openbb_platform/extensions/charting/README.md), add a [new extension](#getting_started-build-openbb-extensions), fix a bug, improve or create documentation, etc.
|
||||
|
||||
|
||||
2
openbb_platform/README.md
vendored
2
openbb_platform/README.md
vendored
@@ -68,7 +68,6 @@ These packages are not installed when `pip install openbb` is run. They are ava
|
||||
| openbb-tradier | [Tradier](https://tradier.com) data connector | pip install openbb-tradier | None |
|
||||
| openbb-wsj | [Wall Street Journal](https://www.wsj.com/) data connector | pip install openbb-wsj | None |
|
||||
|
||||
|
||||
```bash
|
||||
pip install openbb-equity openbb-yfinance
|
||||
```
|
||||
@@ -90,7 +89,6 @@ pip install openbb-equity openbb-yfinance
|
||||
| 2025-10-03 | 254.67 | 259.24 | 253.95 | 258.02 |
|
||||
| 2025-10-06 | 257.945 | 259.07 | 255.05 | 256.69 |
|
||||
|
||||
|
||||
## API keys
|
||||
|
||||
To fully leverage the OpenBB Platform you need to get some API keys to connect with data providers (listed above).
|
||||
|
||||
89
openbb_platform/extensions/mcp_server/README.md
vendored
89
openbb_platform/extensions/mcp_server/README.md
vendored
@@ -77,17 +77,15 @@ Enter `openbb-mcp --help` to see the docstring from the command line.
|
||||
Path to a JSON file with a list of server prompts.
|
||||
```
|
||||
|
||||
#### All other arguments will be passed to `uvicorn.run`.
|
||||
|
||||
#### All other arguments will be passed to `uvicorn.run`
|
||||
|
||||
## Configuration
|
||||
|
||||
The server can be configured through multiple methods, with settings applied in the following order of precedence:
|
||||
|
||||
1. **Command Line Arguments**: Highest priority, overriding all other methods.
|
||||
2. **Environment Variables**: Each setting can be controlled by an environment variable, which will override the configuration file.
|
||||
3. **Configuration File**: A JSON file at `~/.openbb_platform/mcp_settings.json` provides the base configuration.
|
||||
- If the configuration file does not exist, one will be populated with the defaults.
|
||||
1. **Command Line Arguments**: Highest priority, overriding all other methods.
|
||||
2. **Environment Variables**: Each setting can be controlled by an environment variable, which will override the configuration file.
|
||||
3. **Configuration File**: A JSON file at `~/.openbb_platform/mcp_settings.json` provides the base configuration. If the configuration file does not exist, one will be populated with the defaults.
|
||||
|
||||
> **Note:** For some data providers you need to set your API key in the `~/.openbb_platform/user_settings.json` file.
|
||||
|
||||
@@ -156,19 +154,19 @@ For settings that accept a list or a dictionary, you have two flexible formats f
|
||||
|
||||
This is a simple and readable way to define lists and simple dictionaries.
|
||||
|
||||
- **Lists**: Provide a string of comma-separated values.
|
||||
- Example: `equity,news,crypto`
|
||||
- **Dictionaries**: Provide a string of comma-separated `key:value` pairs.
|
||||
- Example: `host:0.0.0.0,port:9000`
|
||||
- **Lists**: Provide a string of comma-separated values.
|
||||
- Example: `equity,news,crypto`
|
||||
- **Dictionaries**: Provide a string of comma-separated `key:value` pairs.
|
||||
- Example: `host:0.0.0.0,port:9000`
|
||||
|
||||
#### 2. JSON-Encoded Strings
|
||||
|
||||
For more complex data structures, or to ensure precise type handling (e.g., for numbers and booleans), you can use a JSON-encoded string.
|
||||
|
||||
- **Lists**: A standard JSON array.
|
||||
- Example: `'["equity", "news", "crypto"]'`
|
||||
- **Dictionaries**: A standard JSON object.
|
||||
- Example: `'{"host": "0.0.0.0", "port": 9000}'`
|
||||
- **Lists**: A standard JSON array.
|
||||
- Example: `'["equity", "news", "crypto"]'`
|
||||
- **Dictionaries**: A standard JSON object.
|
||||
- Example: `'{"host": "0.0.0.0", "port": 9000}'`
|
||||
|
||||
**Important Note on Quoting**: When passing JSON-encoded strings on the command line, it is highly recommended to wrap the entire string in **single quotes (`'`)**. This prevents your shell from interpreting the double quotes (`"`) inside the JSON string, which can lead to parsing errors.
|
||||
|
||||
@@ -528,7 +526,7 @@ By using the `MCPConfigModel`, you can validate your configuration and access se
|
||||
|
||||
It can be imported with:
|
||||
|
||||
```
|
||||
```python
|
||||
from openbb_mcp_server.models.mcp_config import MCPConfigModel
|
||||
```
|
||||
|
||||
@@ -537,13 +535,13 @@ You only need to enter the values that you wish to customize.
|
||||
|
||||
Below are the properties you can define within `mcp_config`:
|
||||
|
||||
- **`expose`** (`Optional[bool]`): Set to `False` to completely hide a route from the MCP server. This is useful for internal or deprecated endpoints that should not be available as tools.
|
||||
- **`expose`** (`Optional[bool]`): Set to `False` to completely hide a route from the MCP server. This is useful for internal or deprecated endpoints that should not be available as tools.
|
||||
|
||||
- **`mcp_type`** (`Optional[MCPType]`): Classify the route as a specific MCP type. Valid options are `"tool"`, `"resource"`, or `"resource_template"`.
|
||||
- **`mcp_type`** (`Optional[MCPType]`): Classify the route as a specific MCP type. Valid options are `"tool"`, `"resource"`, or `"resource_template"`.
|
||||
|
||||
- **`methods`** (`Optional[list[HTTPMethod]]`): Specify which HTTP methods to expose for a route that supports multiple methods (e.g., GET, POST). If omitted, all supported methods are exposed. Valid methods include `"GET"`, `"POST"`, `"PUT"`, `"PATCH"`, `"DELETE"`, `"HEAD"`, `"OPTIONS"`, and `*` (for all).
|
||||
- **`methods`** (`Optional[list[HTTPMethod]]`): Specify which HTTP methods to expose for a route that supports multiple methods (e.g., GET, POST). If omitted, all supported methods are exposed. Valid methods include `"GET"`, `"POST"`, `"PUT"`, `"PATCH"`, `"DELETE"`, `"HEAD"`, `"OPTIONS"`, and `*` (for all).
|
||||
|
||||
- **`exclude_args`** (`Optional[list[str]]`): Provide a list of argument names to exclude from the tool’s signature. This is useful for filtering out parameters that are handled internally or are not relevant to the end-user.
|
||||
- **`exclude_args`** (`Optional[list[str]]`): Provide a list of argument names to exclude from the tool’s signature. This is useful for filtering out parameters that are handled internally or are not relevant to the end-user.
|
||||
|
||||
- **`prompts`** (`Optional[list[dict[str, str]]]`): List of prompts specific to the endpoint. Keys for a prompt are:
|
||||
- **`name`**: Name of the prompt.
|
||||
@@ -568,7 +566,6 @@ ERROR Invalid MCP config found in route, 'GET /equity/price'. Skipping tool c
|
||||
For further information visit https://errors.pydantic.dev/2.11/v/enum
|
||||
```
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
Here is an example demonstrating how to use these properties to fine-tune a tool’s behavior:
|
||||
@@ -616,36 +613,36 @@ openbb-mcp --allowed-categories equity,crypto,news
|
||||
openbb-mcp --tool-discovery
|
||||
```
|
||||
|
||||
### Claude Desktop:
|
||||
### Claude Desktop
|
||||
|
||||
To connect the OpenBB MCP server with Claude Desktop, you need to configure it as a custom tool server. Here are the steps:
|
||||
|
||||
1. Locate the settings or configuration file for Claude Desktop where you can define custom MCP servers.
|
||||
2. Add the following entry to your `mcpServers` configuration. This will configure Claude Desktop to launch the OpenBB MCP server automatically using `stdio` for communication.
|
||||
1. Locate the settings or configuration file for Claude Desktop where you can define custom MCP servers.
|
||||
2. Add the following entry to your `mcpServers` configuration. This will configure Claude Desktop to launch the OpenBB MCP server automatically using `stdio` for communication.
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"openbb-mcp": {
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"--from",
|
||||
"openbb-mcp-server",
|
||||
"--with",
|
||||
"openbb",
|
||||
"openbb-mcp",
|
||||
"--transport",
|
||||
"stdio"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"openbb-mcp": {
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"--from",
|
||||
"openbb-mcp-server",
|
||||
"--with",
|
||||
"openbb",
|
||||
"openbb-mcp",
|
||||
"--transport",
|
||||
"stdio"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. Ensure that `uvx`, is installed and available in your system's PATH. If not, follow the installation instructions.
|
||||
4. Restart Claude Desktop to apply the changes. You should now see "openbb-mcp" as an available tool source.
|
||||
3. Ensure that `uvx`, is installed and available in your system's PATH. If not, follow the installation instructions.
|
||||
4. Restart Claude Desktop to apply the changes. You should now see "openbb-mcp" as an available tool source.
|
||||
|
||||
### Cursor:
|
||||
### Cursor
|
||||
|
||||
To use OpenBB tools within Cursor, you first need to run the MCP server and then tell Cursor how to connect to it.
|
||||
|
||||
@@ -654,9 +651,11 @@ To use OpenBB tools within Cursor, you first need to run the MCP server and then
|
||||
Open your terminal and start the server. You can use the default settings or customize it.
|
||||
|
||||
For a default setup, run:
|
||||
|
||||
```bash
|
||||
openbb-mcp
|
||||
```
|
||||
|
||||
The server will start on `http://127.0.0.1:8001`.
|
||||
|
||||
**Step 2: Configure Cursor**
|
||||
@@ -688,9 +687,11 @@ Search for "mcp", and the item should show up under "Chat". Check the box to ena
|
||||
Open your terminal and start the server. You can use the default settings or customize it.
|
||||
|
||||
For a default setup, run:
|
||||
|
||||
```bash
|
||||
openbb-mcp
|
||||
```
|
||||
|
||||
The server will start on `http://127.0.0.1:8001`.
|
||||
|
||||
**Step 3: Add Server as HTTP**
|
||||
|
||||
@@ -21,7 +21,7 @@ See the [keyword arguments](#keyword-arguments) section for parameters and descr
|
||||
|
||||
To start the OpenBB Platform API, open a terminal, activate the environment where it is installed, and then enter:
|
||||
|
||||
```
|
||||
```sh
|
||||
openbb-api
|
||||
```
|
||||
|
||||
@@ -59,38 +59,41 @@ The behavior of the script can be configured with the use of arguments and keywo
|
||||
|
||||
Launcher specific arguments:
|
||||
|
||||
--app Absolute path to the Python file with the target FastAPI instance. Default is the installed OpenBB Platform API.
|
||||
--name Name of the FastAPI instance in the app file. Default is 'app'.
|
||||
--factory Flag to indicate if the app name is a factory function. Default is 'false'.
|
||||
--editable Flag to make widgets.json an editable file that can be modified during runtime. Default is 'false'.
|
||||
--build If the file already exists, changes prompt action to overwrite/append/ignore. Only valid when --editable true.
|
||||
--no-build Do not build the widgets.json file. Use this flag to load an existing widgets.json file without checking for updates.
|
||||
--exclude JSON encoded list of API paths to exclude from widgets.json. Disable entire routes with '*' - e.g. '["/api/v1/*"]'.
|
||||
--no-filter Do not filter out widgets in widget_settings.json file.
|
||||
--widgets-json Absolute/relative path to use as the widgets.json file. Default is ~/envs/{env}/assets/widgets.json, when --editable is 'true'.
|
||||
--apps-json Absolute/relative path to use as the apps.json file. Default is ~/OpenBBUserData/workspace_apps.json.
|
||||
--agents-json Absolute/relative path to use as the agents.json file. Including this will add the /agents endpoint to the API.
|
||||
|
||||
```text
|
||||
--app Absolute path to the Python file with the target FastAPI instance. Default is the installed OpenBB Platform API.
|
||||
--name Name of the FastAPI instance in the app file. Default is 'app'.
|
||||
--factory Flag to indicate if the app name is a factory function. Default is 'false'.
|
||||
--editable Flag to make widgets.json an editable file that can be modified during runtime. Default is 'false'.
|
||||
--build If the file already exists, changes prompt action to overwrite/append/ignore. Only valid when --editable true.
|
||||
--no-build Do not build the widgets.json file. Use this flag to load an existing widgets.json file without checking for updates.
|
||||
--exclude JSON encoded list of API paths to exclude from widgets.json. Disable entire routes with '*' - e.g. '["/api/v1/*"]'.
|
||||
--no-filter Do not filter out widgets in widget_settings.json file.
|
||||
--widgets-json Absolute/relative path to use as the widgets.json file. Default is ~/envs/{env}/assets/widgets.json, when --editable is 'true'.
|
||||
--apps-json Absolute/relative path to use as the apps.json file. Default is ~/OpenBBUserData/workspace_apps.json.
|
||||
--agents-json Absolute/relative path to use as the agents.json file. Including this will add the /agents endpoint to the API.
|
||||
```
|
||||
|
||||
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]
|
||||
```text
|
||||
--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.
|
||||
|
||||
@@ -121,7 +124,6 @@ Contact the system administrator if you are using a work device and require addi
|
||||
|
||||

|
||||
|
||||
|
||||
## Example Application
|
||||
|
||||
Examples below will assume this code block is at the start of the file.
|
||||
@@ -338,14 +340,12 @@ async def hello_data() -> list[MyData]:
|
||||
return [MyData(column_1=datetime.date.today(), column_2="Hello!")]
|
||||
```
|
||||
|
||||
|
||||
### PDF Widget
|
||||
|
||||
To create a PDF widget, import the custom response model below and define it as a return type.
|
||||
|
||||
The model handles conversion of the document, from a bytes object, to a base64 encoded string.
|
||||
|
||||
|
||||
```python
|
||||
from openbb_platform_api.response_models import PdfResponseModel
|
||||
|
||||
@@ -402,7 +402,6 @@ async def open_pdf(
|
||||
|
||||
To define a chart widget, update the widget "type" and return the content from the `Figure.to_plotly_json()` method.
|
||||
|
||||
|
||||
```python
|
||||
@app.get(
|
||||
"/hello_chart",
|
||||
@@ -437,7 +436,6 @@ The entry in `widgets.json` will be automatically created if the conditions belo
|
||||
- POST method takes 1 positional argument, a sub-class of Pydantic BaseModel.
|
||||
- Create a model, like annotated table fields, defining all inputs to the form.
|
||||
|
||||
|
||||
#### Example
|
||||
|
||||
The code below creates a widget with a form as the input, and an output table of all submitted forms, as processed through the `IntakeForm` model.
|
||||
@@ -600,7 +598,6 @@ async def create_omni_widget(item: TestOmniWidgetQueryModel):
|
||||
|
||||

|
||||
|
||||
|
||||
## Widget Config
|
||||
|
||||
Any value from the [`widgets.json`](https://docs.openbb.co/terminal/custom-backend/widgets-json-reference) structure can be passed into the `@app` decorator by including an `openapi_extra` dictionary with the key, `"widget_config"`.
|
||||
@@ -662,7 +659,6 @@ If you would like to construct this file manually, create the file and define th
|
||||
openbb-api --widgets-json /Users/some_user/path/to/widgets.json
|
||||
```
|
||||
|
||||
|
||||
### Location of `workspace_apps.json`
|
||||
|
||||
By default, the location is:
|
||||
|
||||
@@ -46,7 +46,7 @@ obb.quantitative.rolling.stdev(data=prices, target="close", window=21)
|
||||
obb.quantitative.performance.sharpe_ratio(data=prices, target="close")
|
||||
```
|
||||
|
||||
### Factor analysis
|
||||
### Working with factors
|
||||
|
||||
The factor endpoints take two payloads — a target series and a factor matrix —
|
||||
plus an optional risk-free column name. Pair with any factor source; for
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
This extension provides Technical Analysis tools for the OpenBB Platform.
|
||||
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
To install the extension, run the following command in this folder:
|
||||
@@ -14,8 +12,6 @@ pip install openbb-technical
|
||||
|
||||
Documentation available [here](https://docs.openbb.co/odp/python/extensions/data-processing/technical)
|
||||
|
||||
|
||||
|
||||
| Endpoint | Category | Description |
|
||||
|---|---|---|
|
||||
| `bbands` | overlay | Bollinger Bands — mean +/- N standard deviations. |
|
||||
|
||||
@@ -1444,4 +1444,3 @@ _Query parameters for the multi-symbol screen endpoint._
|
||||
| `as_of_date` | `str` | no | |
|
||||
| `matched_conditions` | `str` | no | |
|
||||
| `values` | `str` | no | |
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ To install, follow the instructions [here](installation). The sections below pro
|
||||
|
||||
It works by extending the `OBBject` class with a new attribute, `charting`. When it is installed, every response from the OpenBB Platform will be equipped with these tools.
|
||||
|
||||
For functions that have pre-defined views, it serves as an intermediary between the user request and the response, activated when `chart=True`. When a chart is created, it will populate the existing, `chart`, attribute of the `OBBject`. This is where it is served by the FAST API from the function request. In the Python Interface, charts can be generated post-request, regardless of `chart=True`.
|
||||
For functions that have pre-defined views, it serves as an intermediary between the user request and the response, activated when `chart=True`. When a chart is created, it will populate the existing, `chart`, attribute of the `OBBject`. This is where it is served by the FAST API from the function request. In the Python Interface, charts can be generated
|
||||
post-request, regardless of `chart=True`.
|
||||
|
||||
The `chart` attribute in the OBBject contains three items, responses from the API have two:
|
||||
|
||||
@@ -130,7 +131,8 @@ Setting as `False` will return the chart to itself, populating the `chart` attri
|
||||
|
||||
## What Endpoints Have Charts?
|
||||
|
||||
The OpenBB Platform router, open_api.json, function signatures, and documentation are all generated based on your specific configuration. When the `openbb-charting` extension is installed, any function found in the "[charting_router](https://github.com/OpenBB-finance/OpenBB/blob/develop/openbb_platform/obbject_extensions/charting/openbb_charting/charting_router.py)" adds `chart: bool = False` to the command on build. For example, `obb.index.price.historical?`
|
||||
The OpenBB Platform router, open_api.json, function signatures, and documentation are all generated based on your specific configuration. When the `openbb-charting` extension is installed, any function found in the
|
||||
"[charting_router](https://github.com/OpenBB-finance/OpenBB/blob/develop/openbb_platform/obbject_extensions/charting/openbb_charting/charting_router.py)" adds `chart: bool = False` to the command on build. For example, `obb.index.price.historical?`
|
||||
|
||||
```python
|
||||
Signature:
|
||||
|
||||
4
openbb_platform/providers/cftc/README.md
vendored
4
openbb_platform/providers/cftc/README.md
vendored
@@ -23,9 +23,9 @@ Credentials are not required, but your IP address may be subject to throttling l
|
||||
|
||||
API requests made using an application token are not throttled.
|
||||
|
||||
Create a free account here: https://evergreen.data.socrata.com/signup
|
||||
Create a free account here: <https://evergreen.data.socrata.com/signup>
|
||||
|
||||
Then, generate the app_token by signing in with the credentials here: https://publicreporting.cftc.gov/profile/edit/developer_settings.
|
||||
Then, generate the app_token by signing in with the credentials here: <https://publicreporting.cftc.gov/profile/edit/developer_settings>.
|
||||
|
||||
### Credentials Key
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ openbb-api
|
||||
|
||||
To use the Congress Bills and Bill Summaries endpoints, you need a Congress.gov API key:
|
||||
|
||||
1. Go to https://api.congress.gov/sign-up/
|
||||
1. Go to <https://api.congress.gov/sign-up/>
|
||||
2. Fill out the registration form
|
||||
3. Agree to the terms of service
|
||||
4. You will receive an API key via email
|
||||
@@ -108,7 +108,6 @@ The `bill_text` endpoint is a POST request from the API, and expects a dictionar
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Fetching Recent Bills
|
||||
|
||||
84
openbb_platform/providers/eia/README.md
vendored
84
openbb_platform/providers/eia/README.md
vendored
@@ -71,49 +71,53 @@ Tables from the WPSR are returned in a flat format in the same order as presente
|
||||
|
||||
Category choices are defined as:
|
||||
|
||||
balance_sheet
|
||||
inputs_and_production
|
||||
refiner_and_blender_net_production
|
||||
crude_petroleum_stocks
|
||||
gasoline_fuel_stocks
|
||||
total_gasoline_by_sub_padd
|
||||
distillate_fuel_oil_stocks
|
||||
imports
|
||||
imports_by_country
|
||||
weekly_estimates
|
||||
spot_prices_crude_gas_heating
|
||||
spot_prices_diesel_jet_fuel_propane
|
||||
retail_prices
|
||||
```text
|
||||
balance_sheet
|
||||
inputs_and_production
|
||||
refiner_and_blender_net_production
|
||||
crude_petroleum_stocks
|
||||
gasoline_fuel_stocks
|
||||
total_gasoline_by_sub_padd
|
||||
distillate_fuel_oil_stocks
|
||||
imports
|
||||
imports_by_country
|
||||
weekly_estimates
|
||||
spot_prices_crude_gas_heating
|
||||
spot_prices_diesel_jet_fuel_propane
|
||||
retail_prices
|
||||
```
|
||||
|
||||
### Short Term Energy Outlook
|
||||
|
||||
The Short Term Energy Outlook (STEO) is curated by table, and relies on the EIA V2 API. Tables are defined by their alphanumeric code, and return in the same format as the WPSR tables.
|
||||
|
||||
01: US Energy Markets Summary
|
||||
02: Nominal Energy Prices
|
||||
03a: World Petroleum and Other Liquid Fuels Production, Consumption, and Inventories
|
||||
03b: Non-OPEC Petroleum and Other Liquid Fuels Production
|
||||
03c: World Petroleum and Other Liquid Fuels Production
|
||||
03d: World Crude Oil Production
|
||||
03e: World Petroleum and Other Liquid Fuels Consumption
|
||||
04a: US Petroleum and Other Liquid Fuels Supply, Consumption, and Inventories
|
||||
04b: US Hydrocarbon Gas Liquids (HGL) and Petroleum Refinery Balances
|
||||
04c: US Regional Motor Gasoline Prices and Inventories
|
||||
04d: US Biofuel Supply, Consumption, and Inventories
|
||||
05a: US Natural Gas Supply, Consumption, and Inventories
|
||||
05b: US Regional Natural Gas Prices
|
||||
06: US Coal Supply, Consumption, and Inventories
|
||||
07a: US Electricity Industry Overview
|
||||
07b: US Regional Electricity Retail Sales
|
||||
07c: US Regional Electricity Prices
|
||||
07d1: US Regional Electricity Generation, Electric Power Sector
|
||||
07d2: US Regional Electricity Generation, Electric Power Sector, continued
|
||||
07e: US Electricity Generating Capacity
|
||||
08: US Renewable Energy Consumption
|
||||
09a: US Macroeconomic Indicators and CO2 Emissions
|
||||
09b: US Regional Macroeconomic Data
|
||||
09c: US Regional Weather Data
|
||||
10a: Drilling Productivity Metrics
|
||||
10b: Crude Oil and Natural Gas Production from Shale and Tight Formations
|
||||
```text
|
||||
01: US Energy Markets Summary
|
||||
02: Nominal Energy Prices
|
||||
03a: World Petroleum and Other Liquid Fuels Production, Consumption, and Inventories
|
||||
03b: Non-OPEC Petroleum and Other Liquid Fuels Production
|
||||
03c: World Petroleum and Other Liquid Fuels Production
|
||||
03d: World Crude Oil Production
|
||||
03e: World Petroleum and Other Liquid Fuels Consumption
|
||||
04a: US Petroleum and Other Liquid Fuels Supply, Consumption, and Inventories
|
||||
04b: US Hydrocarbon Gas Liquids (HGL) and Petroleum Refinery Balances
|
||||
04c: US Regional Motor Gasoline Prices and Inventories
|
||||
04d: US Biofuel Supply, Consumption, and Inventories
|
||||
05a: US Natural Gas Supply, Consumption, and Inventories
|
||||
05b: US Regional Natural Gas Prices
|
||||
06: US Coal Supply, Consumption, and Inventories
|
||||
07a: US Electricity Industry Overview
|
||||
07b: US Regional Electricity Retail Sales
|
||||
07c: US Regional Electricity Prices
|
||||
07d1: US Regional Electricity Generation, Electric Power Sector
|
||||
07d2: US Regional Electricity Generation, Electric Power Sector, continued
|
||||
07e: US Electricity Generating Capacity
|
||||
08: US Renewable Energy Consumption
|
||||
09a: US Macroeconomic Indicators and CO2 Emissions
|
||||
09b: US Regional Macroeconomic Data
|
||||
09c: US Regional Weather Data
|
||||
10a: Drilling Productivity Metrics
|
||||
10b: Crude Oil and Natural Gas Production from Shale and Tight Formations
|
||||
```
|
||||
|
||||
A "symbol" parameter allows lookup by individual series ID(s) within the dataset.
|
||||
A "symbol" parameter allows lookup by individual series ID(s) within the dataset.
|
||||
|
||||
@@ -39,7 +39,6 @@ Once added, click on the app to open the dashboard.
|
||||
|
||||
The dashboard contains widgets with metadata and information, as well ones for exploring and retrieving the data.
|
||||
|
||||
|
||||
## Coverage
|
||||
|
||||
This extension creates multiple OpenBB Workspace apps, along with individual widgets for each endpoint.
|
||||
|
||||
4
openbb_platform/providers/finviz/README.md
vendored
4
openbb_platform/providers/finviz/README.md
vendored
@@ -23,7 +23,7 @@ pip install openbb-finviz
|
||||
|
||||
## Screener
|
||||
|
||||
The screener is a faithful replication of the public-facing stock screener - https://finviz.com/screener.ashx?
|
||||
The screener is a faithful replication of the public-facing stock screener - <https://finviz.com/screener.ashx>
|
||||
|
||||
Some options are directly accessible through the function parameters, all others are exposed via `presets` or `filters_dict`.
|
||||
The filters list below are exposed in the function, with choices visible in the docstring:
|
||||
@@ -54,7 +54,7 @@ The `metric` parameter defines the type of data fields to return. Choices are:
|
||||
|
||||
Default is, "overview".
|
||||
|
||||
```
|
||||
```python
|
||||
res = obb.equity.screener(provider="finviz", metric="performance")
|
||||
```
|
||||
|
||||
|
||||
4
openbb_platform/providers/imf/README.md
vendored
4
openbb_platform/providers/imf/README.md
vendored
@@ -3,7 +3,7 @@
|
||||
This package adds the `openbb-imf` provider extension to the Open Data Platform by OpenBB.
|
||||
|
||||
It provides everything you need - endpoints, tools, and metadata - to access and explore the entirety of
|
||||
https://data.imf.org, without any previous experience working with it.
|
||||
<https://data.imf.org>, without any previous experience working with it.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -136,7 +136,7 @@ print(indicators.to_dict("records"))
|
||||
|
||||
## Coverage
|
||||
|
||||
All data available from https://data.imf.org/en/Data-Explorer can be retrieved, via `obb.economy.indicators(provider='imf', **kwargs)`. When `openbb-economy` is not installed, the same fetcher is aliased onto `obb.imf.indicators`.
|
||||
All data available from <https://data.imf.org/en/Data-Explorer> can be retrieved, via `obb.economy.indicators(provider='imf', **kwargs)`. When `openbb-economy` is not installed, the same fetcher is aliased onto `obb.imf.indicators`.
|
||||
|
||||
Additionally, the extension exposes IMF Port Watch endpoints under `obb.imf.portwatch.*` — these cover country activity, monthly TradeNow indices, container metrics, and disruption events / sankey / map data sourced from the UN Global Platform / IMF Port Watch (not part of the SDMX Data Explorer).
|
||||
|
||||
|
||||
4
openbb_platform/providers/multpl/README.md
vendored
4
openbb_platform/providers/multpl/README.md
vendored
@@ -1,10 +1,10 @@
|
||||
# Multpl Provider Extension
|
||||
|
||||
This is an implementation of the data published to (https://multpl.com)[https;//multpl.com]
|
||||
This is an implementation of the data published to [multpl.com](https://multpl.com)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
```bash
|
||||
pip install openbb-multpl
|
||||
```
|
||||
|
||||
|
||||
8
openbb_platform/providers/oecd/README.md
vendored
8
openbb_platform/providers/oecd/README.md
vendored
@@ -3,7 +3,7 @@
|
||||
This package adds the `openbb-oecd` provider extension to the Open Data Platform by OpenBB.
|
||||
|
||||
It provides everything you need — endpoints, tools, and metadata — to access and explore the entirety of
|
||||
https://data-explorer.oecd.org, without any previous experience working with it.
|
||||
<https://data-explorer.oecd.org>, without any previous experience working with it.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -73,7 +73,7 @@ The identifier can be either:
|
||||
- An indicator-like code, such as `CPI`, `LI`, or `B1GQ`
|
||||
- A presentation table identifier, such as `T0101`
|
||||
|
||||
```
|
||||
```text
|
||||
DF_PRICES_ALL::CPI — Consumer Price Index, all items
|
||||
DF_QNA::B1GQ — GDP, expenditure approach (Quarterly National Accounts)
|
||||
DF_CLI::LI — Composite Leading Indicator
|
||||
@@ -84,7 +84,7 @@ DF_QNA::T0101 — Quarterly National Accounts presentation table
|
||||
|
||||
Multiple indicators from the same dataflow can be comma-separated:
|
||||
|
||||
```
|
||||
```text
|
||||
DF_PRICES_ALL::CPI,DF_PRICES_ALL::HICP
|
||||
```
|
||||
|
||||
@@ -110,7 +110,7 @@ settings, the fallback location is `~/.openbb_platform/cache/oecd_cache.msgpack.
|
||||
|
||||
## Coverage
|
||||
|
||||
All data available from https://data-explorer.oecd.org can be retrieved via `obb.economy.indicators(provider='oecd', **kwargs)`.
|
||||
All data available from <https://data-explorer.oecd.org> can be retrieved via `obb.economy.indicators(provider='oecd', **kwargs)`.
|
||||
|
||||
The extension also exposes specialized fetchers for the most commonly used OECD datasets.
|
||||
|
||||
|
||||
3
openbb_platform/providers/tmx/README.md
vendored
3
openbb_platform/providers/tmx/README.md
vendored
@@ -57,7 +57,8 @@ Install with `pip install openbb-tmx`, or from the local directory, `pip install
|
||||
|
||||
## Symbology
|
||||
|
||||
No exchange suffix is required to handle Canadian listings. The extension accepts `.TO` and `.TSX` as well as no suffix. Additionally, a composite ticker symbol can be entered. For example, `AAPL` trades as a Canadian Depositary Receipt, under the symbol `AAPL:AQN`, on the NEO Exchange. The US listing is also found as `AAPL:US`. Some US and select European data is available from some functions, like `quote` and `historical`.
|
||||
No exchange suffix is required to handle Canadian listings. The extension accepts `.TO` and `.TSX` as well as no suffix. Additionally, a composite ticker symbol can be entered. For example, `AAPL` trades as a Canadian Depositary Receipt, under the symbol `AAPL:AQN`, on the NEO Exchange. The US listing is also found as `AAPL:US`. Some US and select
|
||||
European data is available from some functions, like `quote` and `historical`.
|
||||
|
||||
Indices all begin with `^`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user