mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-12 20:31:18 +00:00
Feature/charting obbject (#5938)
* fix circular import issues on the obbject extension framework * settings available on the obbject * extension init * charting assets and code * introduce to_chart functionality * removes the to_chart method from obbject in detriment of the one from the obbject extension * Update openbb_platform/obbject_extensions/charting/charting/__init__.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * fix on the show method * adding the example to the to_chart docstring * copying the exsting README from charting extension - needs to be revamped * moving to openbb_charting instead * update the pyproject.toml file * pydocstyle * versions * better docstrings * making accessors public * removing unnecessary credentials variable cc @montezdesousa * removing access to extra/metadata and use designated private attrs instead * Fixes linting for the logging service (#5992) * lints * typing.Type instead * deprecating ChartingService to use the new extension instead - adding function discovery capabilities using it * tests for the obbject charting extension * removing charting service from command runner * filter functions not implemented in the module * remove charting service tests * removing charting service on the tests for int tests * charting integration tests * removing charting service file * removing old charting extension code * revamp builder * fix obbject tests * fix command_runner tests * removing openbb_figure_table * better website docs * reviewed readme * unsetting api key for posthog (pywry) windows * added debug_mode to the system settings * removing api key * update nightly script * fix tests * black * black * Revert "black" This reverts commit21d76ad689. * Revert "black" This reverts commit0904653fd7. * black for henrique * returning a list instead * better docstrings * removing unnecessary indicators docstring * typo * black * intentional access to protected member * changes to publish script * filtering deleted files * black * adding render argument * fixing the df_to_basemodel function: it should include the index in the columns either if flagged or if the index is named * adding the hability to add you own data to to_chart method * tests * black * disable protected access * accept kwargs to eg. save image * adjustment cc Igor * add if statement for protection * remove unused return typing * fix technical charting views * better error message cc @IgorWounds * better structure and fix test * Revert "better structure and fix test" This reverts commit612ea6117c. * Revert "better error message cc @IgorWounds" This reverts commit3d7ee53878. --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
@@ -30,6 +30,23 @@ The OBBject (OpenBB Object) is at the heart of developing around the OpenBB Plat
|
||||
- Extra
|
||||
- Additional metadata about the command run, including any arguments, the route, the timestamp, etc.
|
||||
|
||||
Additionally, the OBBject class contains a class variable, `accessors`, which is used to register extensions to the class. This is done by using the `@obbject_accessor` decorator. This decorator will register the class as an accessor to the OBBject class, and will be available on every OBBject returned by a command.
|
||||
|
||||
```python
|
||||
|
||||
from openbb import obb
|
||||
res = obb.equity.price.historical("AAPL")
|
||||
res.accessors
|
||||
```
|
||||
|
||||
An example with the `openbb-charting` extension would output:
|
||||
|
||||
```console
|
||||
{'charting'}
|
||||
```
|
||||
|
||||
> Find more about `OBBject` extensions [here](/website/content/platform/development/developer-guidelines/obbject_extensions.md).
|
||||
|
||||
## Example
|
||||
|
||||
In the python interface, the OBBject class is returned by every command. The following example shows how to access the results of a command:
|
||||
@@ -130,6 +147,6 @@ Returns numpy arrays of the results. Note that this loses the column names, so y
|
||||
|
||||
Growing in popularity, polars is a blazingly fast dataframe library. This method will return a polars dataframe. Note that we do not include polars in the core dependency tree, so it needs to be installed separately.
|
||||
|
||||
---
|
||||
#### show()
|
||||
|
||||
More information can be found on the [OpenBB Core Readme](https://github.com/OpenBB-finance/OpenBBTerminal/blob/develop/openbb_platform/core/README.md)
|
||||
This method will display the chart if it was computed during the execution of the command, by setting the `chart` parameter to `True`.
|
||||
|
||||
@@ -56,7 +56,7 @@ class Example:
|
||||
self._obbject = obbject
|
||||
|
||||
def hello(self):
|
||||
api_key = self._obbject._credentials.some_api_key.get_secret_value()
|
||||
api_key = self._obbject._user_settings.credentials.some_api_key.get_secret_value()
|
||||
print(f"Hello, this is my credential: {api_key}!")
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user