Renaming api to sdk (#2897)

* renamed api to sdk

* changing docstrings and comments

* changing documentation

* changing .md files

* sdk to SDK

* fix imports on dashboards

* fixed the website docs generator

* re-generate website docs

Co-authored-by: Chavithra <chavithra@gmail.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
hjoaquim
2022-10-18 17:02:40 +01:00
committed by GitHub
parent 99fc1be4cf
commit 7136806103
66 changed files with 1520 additions and 1257 deletions

View File

@@ -3,17 +3,17 @@
- [ ] Summary of the change / bug fix.
- [ ] Link # issue, if applicable.
- [ ] Screenshot of the feature or the bug before/after fix, if applicable.
- [ ] Relevant motivation and context.
- [ ] Relevant motivation and context.
- [ ] List any dependencies that are required for this change.
# How has this been tested?
* Please describe the tests that you ran to verify your changes.
* Provide instructions so we can reproduce.
* Please describe the tests that you ran to verify your changes.
* Provide instructions so we can reproduce.
* Please also list any relevant details for your test configuration.
- [ ] Make sure affected commands still run in terminal
- [ ] Ensure the api still works
- [ ] Ensure the SDK still works
- [ ] Check any related reports

34
CONTRIBUTING.md vendored
View File

@@ -12,7 +12,7 @@ Use your best judgment, and feel free to propose changes to this document in a p
- [Model](#model)
- [View](#view)
- [Controller](#controller)
- [Add API endpoint](#add-api-endpoint)
- [Add SDK endpoint](#add-sdk-endpoint)
- [Add Documentation](#add-documentation)
- [Open a Pull Request](#open-a-pull-request)
- [Review Process](#review-process)
@@ -305,11 +305,11 @@ The **import only occurs inside this menu call**, this is so that the loading ti
In addition, note the `self.load_class` which allows to not create a new DarkPoolShortsController instance but re-load the previous created one. Unless the arguments `self.ticker, self.start, self.stock` have changed since. The `self.queue` list of commands is passed around as it contains the commands that the terminal must perform.
### Add API endpoint
### Add SDK endpoint
In order to add a command to the API, follow these steps:
In order to add a command to the SDK, follow these steps:
1. Go to the `api.py` file and scroll to the `functions` dictionary, it should look like this:
1. Go to the `sdk.py` file and scroll to the `functions` dictionary, it should look like this:
```python
functions = {
@@ -327,7 +327,7 @@ In order to add a command to the API, follow these steps:
...
```
2. Add a new key to the dictionary, which corresponds to the way the added command shall be accessed from the api.
2. Add a new key to the dictionary, which corresponds to the way the added command shall be accessed from the sdk.
This is called the `virtual path`. In this case it should be `stocks.dps.shorted`.
3. Now it is time to add the value to the key. This key shall be another dictionary with a `model` key and possibly a
`view` key.
@@ -481,7 +481,7 @@ CLI :computer: → `_controller.py` :robot: →&nbsp;`_view.py` :art: &nbsp;&nbs
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&#8593;
&nbsp;&nbsp;
`api.py` :factory:
`sdk.py` :factory:
&nbsp;
&#8593;
@@ -490,7 +490,7 @@ CLI :computer: → `_controller.py` :robot: →&nbsp;`_view.py` :art: &nbsp;&nbs
| **_controller.py** :robot: | The router/input validator | The controller file should hold the least amount of logic possible. Its role is to be a stupid (no logic) router and redirect the command correctly while checking the input with argparser. |
| **_view.py** :art: | The artist | The view file should only output or visualise the data it gets from the `_model` file! The `_view` can limit the data coming from the `_model`, otherwise the data object should be identical in the `_view` and the `_model` files. |
| **_model.py** 🧠 |The brain | The model file is where everything fun happens. The data is gathered (external APIs), processed and returned here. |
| **api.py** 🏭 |The API Factory | The API file is where the callable functions are created for the API. There is only one api file in the openbb_terminal folder. |
| **sdk.py** 🏭 |The SDK Factory | The SDK file is where the callable functions are created for the SDK. There is only one SDK file in the openbb_terminal folder. |
### Frontend
@@ -550,7 +550,7 @@ With:
1. Each function should have default values for non critical kwargs
- Why? It increases code readability and acts as an input example for the functions arguments. This increases the ease of use of the functions through the api, but also just generally.
- Why? It increases code readability and acts as an input example for the functions arguments. This increases the ease of use of the functions through the SDK, but also just generally.
<br>
@@ -624,7 +624,7 @@ With:
3. Each function needs to have a docstring explaining what it does, its parameters and what it returns.
- Why? You can use the function without reading its source code. This improves the developing experience and api usage. The api factory also can’t handle functions with out docstrings.
- Why? You can use the function without reading its source code. This improves the developing experience and SDK usage. The SDK factory also can’t handle functions with out docstrings.
<br>
@@ -662,7 +662,7 @@ With:
- Why? Two reasons:
These calculations can then be used outside of the class with custom data; for example via the api or for tests.
These calculations can then be used outside of the class with custom data; for example via the sdk or for tests.
```python
from openbb_terminal.portfolio.portfolio_helper import get_gaintopain_ratio
@@ -671,18 +671,18 @@ With:
get_gaintopain_ratio(historical_trade_data, benchmark_trades, benchmark_returns)
```
The function can be loaded in API factory as an endpoint and user can get result by passing the class instance.
The function can be loaded in SDK factory as an endpoint and user can get result by passing the class instance.
```python
from openbb_terminal.api import openbb
from openbb_terminal.api import Portfolio
from openbb_terminal.sdk import openbb
from openbb_terminal.sdk import Portfolio
transactions = Portfolio.read_orderbook("../../portfolio/holdings/example.csv")
P = Portfolio(transactions)
P.generate_portfolio_data()
P.load_benchmark()
# API endpoint access
# SDK endpoint access
openbb.portfolio.gaintopain(P)
```
@@ -731,7 +731,7 @@ With:
6. Naming among related model and view functions should be obvious; just different prefix if possible
- Why? Eases API factory mapping and keeps code clean.
- Why? Eases SDK factory mapping and keeps code clean.
<br>
@@ -787,7 +787,7 @@ With:
1. No data altering in the view file or controller file (view and model with same args)
- Why? Consistency and good code structure. This also improves the api user experience. Thus follows that view and model files will have the same arguments (except for output options like raw, export, external_axes), since no data changes shall be done in the view file.
- Why? Consistency and good code structure. This also improves the SDK user experience. Thus follows that view and model files will have the same arguments (except for output options like raw, export, external_axes), since no data changes shall be done in the view file.
<br>
@@ -807,7 +807,7 @@ When in doubt, follow <https://www.python.org/dev/peps/pep-0008/>.
#### OpenBB Style Guide
The style guide is a reverse dictionary for argument names, where a brief definition is mapped to an OpenBB recommended argument name and type. When helpful a code snippet example is added below. Following this guide will help keep argument naming consistent and improve API users experience.
The style guide is a reverse dictionary for argument names, where a brief definition is mapped to an OpenBB recommended argument name and type. When helpful a code snippet example is added below. Following this guide will help keep argument naming consistent and improve SDK users experience.
Style guide structure:

View File

@@ -4,7 +4,7 @@ import importlib
import os
from ruamel.yaml import YAML
from openbb_terminal.api import functions
from openbb_terminal.sdk import functions
# NOTE: The main.yml and documentation _index.md files are automaticallty overridden
# every time this is ran. Folder level _index.md files are NOT overridden after creation
@@ -14,8 +14,8 @@ yaml.indent(mapping=2, sequence=4, offset=2)
def all_functions() -> List[Tuple[str, str, Callable[..., Any]]]:
"""Uses the base api functions dictionary to get a list of all functions we have linked
in our API.
"""Uses the base SDK functions dictionary to get a list of all functions we have linked
in our SDK.
Returns
----------
@@ -165,11 +165,11 @@ def generate_dict(paths: List):
final_dict: Dict[str, Any] = {}
added_paths = []
for path, subs in paths:
if not final_dict and path == "api":
final_dict = {"name": "api", "ref": "/api", "sub": []}
if not final_dict and path == "sdk":
final_dict = {"name": "sdk", "ref": "/sdk", "sub": []}
for sub in subs:
final_dict["sub"].append({"name": sub, "ref": f"/{path}/{sub}"})
added_paths.append("api")
added_paths.append("sdk")
if path not in added_paths:
final_dict = set_items(final_dict, path, subs)
added_paths.append(path)
@@ -189,9 +189,9 @@ def folder_documentation(path: str):
if __name__ == "__main__":
base_folder_path = os.path.realpath("./website/content/api")
base_folder_path = os.path.realpath("./website/content/sdk")
target_path = os.path.realpath("./website/data/menu/main.yml")
main_path = os.path.realpath("./website/content/api")
main_path = os.path.realpath("./website/content/sdk")
folder_list = crawl_folders(main_path)
for folder_path in [x[0] for x in folder_list]:
folder_documentation(folder_path)

View File

@@ -62,18 +62,18 @@ you are using conda.
First off, import OpenBB SDK into your python script or Jupyter Notebook with:
```python
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
```
This imports all Terminal commands at once. To see all the available commands, you can press `tab` in jupyter notebook.
Another approach is to check out [OpenBB SDK Documentation](https://openbb-finance.github.io/OpenBBTerminal/api/), where you can explore its capabilities
Another approach is to check out [OpenBB SDK Documentation](https://openbb-finance.github.io/OpenBBTerminal/sdk/), where you can explore its capabilities
### 2. Customize chart style
With OpenBB SDK, you can customize your chart style. You can switch between `dark` and `light` easily using this block of code:
```python
from openbb_terminal.api import TerminalStyle
from openbb_terminal.sdk import TerminalStyle
theme = TerminalStyle("light", "light", "light")
```
@@ -82,7 +82,7 @@ theme = TerminalStyle("light", "light", "light")
OR
```python
from openbb_terminal.api import TerminalStyle
from openbb_terminal.sdk import TerminalStyle
theme = TerminalStyle("dark", "dark", "dark")
```
@@ -178,7 +178,7 @@ Now, let's explore what OpenBB SDK can do. At a high level, you can break down O
### 1. Data Layer
### **Getting financial data from multiple data sources using one single API**
### **Getting financial data from multiple data sources using one single SDK**
OpenBB SDK provides you access to normalized financial data from dozens of data sources, without having to built your own integration or relying on multiple third-party packages. Let's explore how we can do that.
@@ -351,7 +351,7 @@ To display matplotlib charts inside the Jupyter notebook output cells, you can u
```python
import matplotlib.pyplot as plt
import matplotlib_inline.backend_inline
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
%matplotlib inline
matplotlib_inline.backend_inline.set_matplotlib_formats("svg")
```
@@ -362,7 +362,7 @@ The code below utilizes the `external_axes` parameter to get two axis in one cha
```python
import matplotlib.pyplot as plt
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1, figsize=(11, 5), dpi=150)
openbb.stocks.dps.dpotc(
"aapl",

View File

@@ -5,7 +5,7 @@ from inspect import signature
import streamlit as st
import pandas as pd
import yfinance as yf
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
from openbb_terminal.forecast import helpers
from openbb_terminal.rich_config import console

View File

@@ -24,10 +24,9 @@
"from IPython.display import display\n",
"import pandas as pd\n",
"\n",
"from openbb_terminal import api\n",
"openbb = api.openbb\n",
"from openbb_terminal.sdk import openbb, widgets\n",
"\n",
"ipw.HTML(f\"<style>{api.widgets.price_card_stylesheet()}</style>\")"
"ipw.HTML(f\"<style>{widgets.price_card_stylesheet()}</style>\")"
]
},
{
@@ -134,7 +133,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -148,10 +147,15 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.4"
},
"voila": {
"theme": "dark"
},
"vscode": {
"interpreter": {
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},
"nbformat": 4,

View File

@@ -19,10 +19,10 @@
"import matplotlib_inline.backend_inline\n",
"from openbb_terminal.dashboards.widget_helpers import price_card, stylesheet\n",
"\n",
"from openbb_terminal import api as openbb\n",
"from openbb_terminal.sdk import openbb, theme\n",
"\n",
"%matplotlib widget\n",
"openbb.theme.applyMPLstyle()\n",
"theme.applyMPLstyle()\n",
"ipw.HTML(f\"<style>{stylesheet()}</style>\")"
]
},
@@ -259,7 +259,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -273,10 +273,15 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.4"
},
"voila": {
"theme": "dark"
},
"vscode": {
"interpreter": {
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},
"nbformat": 4,

View File

@@ -54,12 +54,11 @@
"import pandas as pd\n",
"from IPython.display import display\n",
"\n",
"from openbb_terminal import api\n",
"openbb = api.openbb\n",
"from openbb_terminal.sdk import openbb, theme\n",
"\n",
"%matplotlib inline\n",
"matplotlib_inline.backend_inline.set_matplotlib_formats(\"svg\")\n",
"api.theme.applyMPLstyle()"
"theme.applyMPLstyle()"
]
},
{
@@ -365,7 +364,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -379,12 +378,17 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.4"
},
"metadata": {
"interpreter": {
"hash": "e896a00ead8b521528d79ac9ef24990696f2b751eb283ab8e0d078c9c4971ffc"
}
},
"vscode": {
"interpreter": {
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},
"nbformat": 4,

View File

@@ -22,7 +22,7 @@
"if module_path not in sys.path:\n",
" sys.path.append(module_path)\n",
"\n",
"from openbb_terminal.api import openbb"
"from openbb_terminal.sdk import openbb"
]
},
{
@@ -140,7 +140,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -154,7 +154,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.4"
},
"vscode": {
"interpreter": {
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},
"nbformat": 4,

View File

@@ -31,8 +31,8 @@
"# import sys\n",
"# sys.path.append('../../')\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"\n",
"%matplotlib inline\n",
@@ -1218,7 +1218,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -1232,11 +1232,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.4"
},
"vscode": {
"interpreter": {
"hash": "ab0e87f2bc73919b75956d1b3e303320699d53da895be1bb46287d7dc67c6497"
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},

View File

@@ -30,9 +30,9 @@
"\n",
"from IPython.display import HTML\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import helper\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import helper\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"\n",
"\n",
@@ -775,7 +775,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3.9.13 ('obb')",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -789,11 +789,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.4"
},
"vscode": {
"interpreter": {
"hash": "ab0e87f2bc73919b75956d1b3e303320699d53da895be1bb46287d7dc67c6497"
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},

View File

@@ -31,8 +31,8 @@
"# import sys\n",
"# sys.path.append('../../')\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal import config_terminal as cfg\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"from openbb_terminal.core.config.paths import USER_ENV_FILE\n",
@@ -1597,7 +1597,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.4"
},
"vscode": {
"interpreter": {

View File

@@ -30,8 +30,8 @@
"# import sys\n",
"# sys.path.append('../../')\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"\n",
"%matplotlib inline\n",

View File

@@ -27,8 +27,8 @@
"\n",
"from IPython.display import HTML\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"\n",
"%matplotlib inline\n",
@@ -273,7 +273,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -287,11 +287,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
"version": "3.10.4"
},
"vscode": {
"interpreter": {
"hash": "ab0e87f2bc73919b75956d1b3e303320699d53da895be1bb46287d7dc67c6497"
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},

View File

@@ -31,8 +31,8 @@
"# import sys\n",
"# sys.path.append('../../')\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"\n",
"%matplotlib inline\n",
@@ -757,7 +757,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3.9.13 ('obb')",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -771,11 +771,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.4"
},
"vscode": {
"interpreter": {
"hash": "ab0e87f2bc73919b75956d1b3e303320699d53da895be1bb46287d7dc67c6497"
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},

View File

@@ -33,10 +33,10 @@
"# import sys\n",
"# sys.path.append('../../')\n",
"\n",
"from openbb_terminal.api import widgets\n",
"from openbb_terminal.api import helper\n",
"from openbb_terminal.api import openbb\n",
"from openbb_terminal.api import Portfolio\n",
"from openbb_terminal.sdk import widgets\n",
"from openbb_terminal.sdk import helper\n",
"from openbb_terminal.sdk import openbb\n",
"from openbb_terminal.sdk import Portfolio\n",
"from openbb_terminal.helper_classes import TerminalStyle\n",
"\n",
"%matplotlib inline\n",
@@ -480,7 +480,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3.9.13 ('obb')",
"display_name": "Python 3.10.4 ('obb')",
"language": "python",
"name": "python3"
},
@@ -494,11 +494,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.4"
},
"vscode": {
"interpreter": {
"hash": "ab0e87f2bc73919b75956d1b3e303320699d53da895be1bb46287d7dc67c6497"
"hash": "1a8cc6b6e60740679b24fc1ea93bdeb94d949a22102a80c99b7fd3f0d572afd6"
}
}
},

View File

@@ -1,4 +1,4 @@
"""OpenBB Terminal API."""
"""OpenBB Terminal SDK."""
# flake8: noqa
# pylint: disable=unused-import,wrong-import-order
# pylint: disable=C0302,W0611,not-callable,ungrouped-imports
@@ -2098,7 +2098,7 @@ def change_docstring(api_callable, model: Callable, view=None):
if view.__doc__ is not None:
index = view.__doc__.find("Parameters")
all_parameters = (
"\nAPI function, use the chart kwarg for getting the view model and it's plot. "
"\nSDK function, use the chart kwarg for getting the view model and it's plot. "
"See every parameter below:\n\n "
+ view.__doc__[index:]
+ """chart: bool
@@ -2132,7 +2132,7 @@ def change_docstring(api_callable, model: Callable, view=None):
class FunctionFactory:
"""The API Function Factory, which creates the callable instance."""
"""The SDK Function Factory, which creates the callable instance."""
def __init__(
self, model: Callable, view: Optional[Callable] = None, virtual_path: str = ""
@@ -2205,10 +2205,10 @@ class MainMenu:
def __repr__(self):
"""Get human readable representation."""
return """This is the API of the OpenBB Terminal.
Use the API to get data directly into your jupyter notebook or directly use it in your application.
return """This is the OpenBB Terminal SDK.
Use the SDK to get data directly into your jupyter notebook or directly use it in your application.
...
For more information see the official documentation at: https://openbb-finance.github.io/OpenBBTerminal/api/
For more information see the official documentation at: https://openbb-finance.github.io/OpenBBTerminal/sdk/
"""
@@ -2218,7 +2218,7 @@ class Loader:
def __init__(self, funcs: dict):
print(
"WARNING! Breaking changes incoming! Especially avoid using kwargs, since some of them will change.\n"
"For more information see the official documentation at: https://openbb-finance.github.io/OpenBBTerminal/api/"
"For more information see the official documentation at: https://openbb-finance.github.io/OpenBBTerminal/sdk/"
)
self.__function_map = self.build_function_map(funcs=funcs)
self.__initialize_logging()
@@ -2230,8 +2230,8 @@ class Loader:
def __repr__(self):
"""Get human readable representation."""
return """This is the API of the OpenBB Terminal.
Use the API to get data directly into your jupyter notebook or directly use it in your application.
return """This is the OpenBB Terminal SDK.
Use the SDK to get data directly into your jupyter notebook or directly use it in your application.
...
For more information see the official documentation at: https://openbb-finance.github.io/OpenBBTerminal/api/
"""
@@ -2242,7 +2242,7 @@ class Loader:
# pass
def load_menus(self):
"""Create the API structure by setting attributes and saving the functions.
"""Create the SDK structure by setting attributes and saving the functions.
See openbb.stocks.command
"""
@@ -2268,7 +2268,7 @@ class Loader:
filtered_dict = {k: v for (k, v) in function_map.items() if path_str in k}
def f():
string = menu.upper() + " Menu\n\nThe api commands of the the menu:"
string = menu.upper() + " Menu\n\nThe SDK commands of the the menu:"
for command in filtered_dict:
string += "\n\t<openbb>." + command
return string
@@ -2407,6 +2407,6 @@ class Loader:
return function_map
# TO USE THE API DIRECTLY JUST IMPORT IT:
# from openbb_terminal.api import openbb (or: from openbb_terminal.api import openbb as api)
# TO USE THE SDK DIRECTLY JUST IMPORT IT:
# from openbb_terminal.sdk import openbb (or: from openbb_terminal.sdk import openbb as sdk)
openbb = Loader(funcs=functions).openbb

View File

@@ -6,7 +6,6 @@
def test_load_api():
# pylint: import-outside-toplevel
from openbb_terminal import api
from openbb_terminal import sdk
print(api)
print(sdk)

View File

@@ -27,18 +27,18 @@ So that you can focus on designing and building your financial reports and appli
First off, import OpenBB SDK into your python script or Jupyter Notebook with:
```python
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
```
This imports all Terminal commands at once. To see all the available commands, you can press `tab` in jupyter notebook.
Another approach is to check out [OpenBB SDK Documentation](https://openbb-finance.github.io/OpenBBTerminal/api/), where you can explore its capabilities
Another approach is to check out [OpenBB SDK Documentation](https://openbb-finance.github.io/OpenBBTerminal/sdk/), where you can explore its capabilities
### 2. Customize chart style
With OpenBB SDK, you can customize your chart style. You can switch between `dark` and `light` easily using this block of code:
```python
from openbb_terminal.api import TerminalStyle
from openbb_terminal.sdk import TerminalStyle
theme = TerminalStyle("light", "light", "light")
```
@@ -47,7 +47,7 @@ theme = TerminalStyle("light", "light", "light")
OR
```python
from openbb_terminal.api import TerminalStyle
from openbb_terminal.sdk import TerminalStyle
theme = TerminalStyle("dark", "dark", "dark")
```
@@ -316,7 +316,7 @@ To display matplotlib charts inside the Jupyter notebook output cells, you can u
```python
import matplotlib.pyplot as plt
import matplotlib_inline.backend_inline
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
%matplotlib inline
matplotlib_inline.backend_inline.set_matplotlib_formats("svg")
```
@@ -327,7 +327,7 @@ The code below utilizes the `external_axes` parameter to get two axis in one cha
```python
import matplotlib.pyplot as plt
from openbb_terminal.api import openbb
from openbb_terminal.sdk import openbb
fig, (ax1, ax2) = plt.subplots(nrows=2, ncols=1, figsize=(11, 5), dpi=150)
openbb.stocks.dps.dpotc(
"aapl",

View File

@@ -13,7 +13,7 @@ Center of gravity
Length for indicator window
Returns
----------
d.DataFrame
pd.DataFrame
Dataframe of technical indicator
## Getting charts

View File

@@ -1,5 +1,5 @@
## Get underlying data
### crypto.candles(candles_df: 'pd.DataFrame', volume: 'bool' = True, ylabel: 'str' = '', title: 'str' = '', external_axes: 'list[plt.Axes] | None' = None) -> 'None'
### crypto.candles(candles_df: 'pd.DataFrame', volume: 'bool' = True, ylabel: 'str' = '', title: 'str' = '', external_axes: 'list[plt.Axes] | None' = None, yscale: 'str' = 'linear') -> 'None'
Plot candle chart from dataframe. [Source: Binance]
@@ -15,3 +15,5 @@ Plot candle chart from dataframe. [Source: Binance]
Title of graph, by default ""
external_axes : Optional[List[plt.Axes]], optional
External axes (1 axis is expected in the list), by default None
yscale : str
Scaling for y axis. Either linear or log

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.chart(prices_df: 'pd.DataFrame', to_symbol: 'str' = '', from_symbol: 'str' = '', source: 'str' = '', exchange: 'str' = '', interval: 'str' = '', external_axes: 'list[plt.Axes] | None' = None) -> 'None'
### crypto.chart(prices_df: 'pd.DataFrame', to_symbol: 'str' = '', from_symbol: 'str' = '', source: 'str' = '', exchange: 'str' = '', interval: 'str' = '', external_axes: 'list[plt.Axes] | None' = None, yscale: 'str' = 'linear') -> 'None'
Load data for Technical Analysis
@@ -13,9 +13,11 @@ Load data for Technical Analysis
Coin (only used for chart title), by default ""
from_symbol: str
Currency (only used for chart title), by default ""
yscale: str
Scale for y axis of plot Either linear or log
## Getting charts
### crypto.chart(prices_df: 'pd.DataFrame', to_symbol: 'str' = '', from_symbol: 'str' = '', source: 'str' = '', exchange: 'str' = '', interval: 'str' = '', external_axes: 'list[plt.Axes] | None' = None, chart=True) -> 'None'
### crypto.chart(prices_df: 'pd.DataFrame', to_symbol: 'str' = '', from_symbol: 'str' = '', source: 'str' = '', exchange: 'str' = '', interval: 'str' = '', external_axes: 'list[plt.Axes] | None' = None, yscale: 'str' = 'linear', chart=True) -> 'None'
Load data for Technical Analysis
@@ -27,3 +29,5 @@ Load data for Technical Analysis
Coin (only used for chart title), by default ""
from_symbol: str
Currency (only used for chart title), by default ""
yscale: str
Scale for y axis of plot Either linear or log

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.active(symbol: str, interval: str = '24h', start_date: int = 1262304000, end_date: int = 1665471332) -> pandas.core.frame.DataFrame
### crypto.dd.active(symbol: str, interval: str = '24h', start_date: int = 1262304000, end_date: int = 1666094607) -> pandas.core.frame.DataFrame
Returns active addresses of a certain symbol
[Source: https://glassnode.com]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.btcrb(start_date: str = '2010-01-01', end_date: str = '2022-10-11')
### crypto.dd.btcrb(start_date: str = '2010-01-01', end_date: str = '2022-10-18')
Get bitcoin price data
[Price data from source: https://glassnode.com]
@@ -15,7 +15,7 @@ Get bitcoin price data
Final date, format YYYY-MM-DD
## Getting charts
### crypto.dd.btcrb(start_date: str = '2010-01-01', end_date: str = '2022-10-11', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### crypto.dd.btcrb(start_date: str = '2010-01-01', end_date: str = '2022-10-18', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Displays bitcoin rainbow chart
[Price data from source: https://glassnode.com]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.change(symbol: str, exchange: str = 'binance', start_date: int = 1262304000, end_date: int = 1665471332) -> pandas.core.frame.DataFrame
### crypto.dd.change(symbol: str, exchange: str = 'binance', start_date: int = 1262304000, end_date: int = 1666094607) -> pandas.core.frame.DataFrame
Returns 30d change of the supply held in exchange wallets of a certain symbol.
[Source: https://glassnode.com]

View File

@@ -1,5 +1,5 @@
## Get underlying data
### crypto.dd.close(symbol: str, start_date: str = '2010-01-01', end_date: str = '2022-10-11', print_errors: bool = True) -> pandas.core.frame.DataFrame
### crypto.dd.close(symbol: str, start_date: str = '2010-01-01', end_date: str = '2022-10-18', print_errors: bool = True) -> pandas.core.frame.DataFrame
Returns the price of a cryptocurrency
[Source: https://glassnode.com]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.eb(symbol: str, exchange: str = 'binance', start_date: int = 1262304000, end_date: int = 1665471332) -> pandas.core.frame.DataFrame
### crypto.dd.eb(symbol: str, exchange: str = 'binance', start_date: int = 1262304000, end_date: int = 1666094607) -> pandas.core.frame.DataFrame
Returns the total amount of coins held on exchange addresses in units and percentage.
[Source: https://glassnode.com]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.gh(symbol: str, dev_activity: bool = False, interval: str = '1d', start_date: str = '2021-10-11T07:55:32Z', end_date: str = '2022-10-11T07:55:32Z') -> pandas.core.frame.DataFrame
### crypto.dd.gh(symbol: str, dev_activity: bool = False, interval: str = '1d', start_date: str = '2021-10-18T13:03:27Z', end_date: str = '2022-10-18T13:03:27Z') -> pandas.core.frame.DataFrame
Returns a list of developer activity for a given coin and time interval.
@@ -26,7 +26,7 @@ Returns a list of developer activity for a given coin and time interval.
developer activity over time
## Getting charts
### crypto.dd.gh(symbol: str, start_date: str = '2021-10-11T07:55:32Z', dev_activity: bool = False, end_date: str = '2022-10-11T07:55:32Z', interval: str = '1d', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
### crypto.dd.gh(symbol: str, start_date: str = '2021-10-18T13:03:27Z', dev_activity: bool = False, end_date: str = '2022-10-18T13:03:27Z', interval: str = '1d', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Returns a list of github activity for a given coin and time interval.

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.mcapdom(symbol: str, interval: str = '1d', start_date: str = '2021-10-11', end_date: str = '2022-10-11') -> pandas.core.frame.DataFrame
### crypto.dd.mcapdom(symbol: str, interval: str = '1d', start_date: str = '2021-10-18', end_date: str = '2022-10-18') -> pandas.core.frame.DataFrame
Returns market dominance of a coin over time
[Source: https://messari.io/]
@@ -23,7 +23,7 @@ Returns market dominance of a coin over time
market dominance percentage over time
## Getting charts
### crypto.dd.mcapdom(symbol: str, start_date: str = '2021-10-11', end_date: str = '2022-10-11', interval: str = '1d', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
### crypto.dd.mcapdom(symbol: str, start_date: str = '2021-10-18', end_date: str = '2022-10-18', interval: str = '1d', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Display market dominance of a coin over time
[Source: https://messari.io/]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.mt(symbol: str, timeseries_id: str, interval: str = '1d', start_date: str = '2021-10-11', end_date: str = '2022-10-11') -> Tuple[pandas.core.frame.DataFrame, str]
### crypto.dd.mt(symbol: str, timeseries_id: str, interval: str = '1d', start_date: str = '2021-10-18', end_date: str = '2022-10-18') -> Tuple[pandas.core.frame.DataFrame, str]
Returns messari timeseries
[Source: https://messari.io/]
@@ -27,7 +27,7 @@ Returns messari timeseries
timeserie title
## Getting charts
### crypto.dd.mt(symbol: str, timeseries_id: str, start_date: str = '2021-10-11', end_date: str = '2022-10-11', interval: str = '1d', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
### crypto.dd.mt(symbol: str, timeseries_id: str, start_date: str = '2021-10-18', end_date: str = '2022-10-18', interval: str = '1d', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Display messari timeseries
[Source: https://messari.io/]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.dd.nonzero(symbol: str, start_date: int = 1262304000, end_date: int = 1665471332) -> pandas.core.frame.DataFrame
### crypto.dd.nonzero(symbol: str, start_date: int = 1262304000, end_date: int = 1666094607) -> pandas.core.frame.DataFrame
Returns addresses with non-zero balance of a certain symbol
[Source: https://glassnode.com]

View File

@@ -1,17 +1,26 @@
## Get underlying data
### crypto.load(symbol: 'str', start_date: 'datetime' = datetime.datetime(2019, 10, 7, 7, 55, 32, 347659), interval: 'str' = '1440', exchange: 'str' = 'binance', vs_currency: 'str' = 'usdt', end_date: 'datetime' = datetime.datetime(2022, 10, 11, 7, 55, 32, 347665), source: 'str' = 'CCXT') -> 'pd.DataFrame'
### crypto.load(symbol: 'str', start_date: 'datetime' = datetime.datetime(2019, 10, 14, 13, 3, 27, 439509), interval: 'str' = '1440', exchange: 'str' = 'binance', vs_currency: 'str' = 'usdt', end_date: 'datetime' = datetime.datetime(2022, 10, 18, 13, 3, 27, 439515), source: 'str' = 'CCXT') -> 'pd.DataFrame'
Load crypto currency to perform analysis on CoinGecko is used as source for price and
YahooFinance for volume.
Load crypto currency to get data for.
Parameters
----------
symbol: str
Coin to get
vs: str
Quote Currency (usd or eur), by default usd
days: int
Data up to number of days ago, by default 365
start_date: datetime
The datetime to start at
interval: str
The interval between data points in minutes.
Choose from: 1, 15, 30, 60, 240, 1440, 10080, 43200
exchange: str:
The exchange to get data from.
vs_currency: str
Quote Currency (Defaults to usdt)
end_date: datetime
The datetime to end at
source: str
The source of the data
Choose from: CCXT, CoinGecko, YahooFinance
Returns
-------

View File

@@ -11,7 +11,7 @@ Returns BTC circulating supply [Source: https://api.blockchain.info/]
BTC circulating supply
## Getting charts
### crypto.onchain.btc_supply(start_date: int = 1262304000, end_date: int = 1665471332, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
### crypto.onchain.btc_supply(start_date: int = 1262304000, end_date: int = 1666094607, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Returns BTC circulating supply [Source: https://api.blockchain.info/]

View File

@@ -11,7 +11,7 @@ Returns BTC confirmed transactions [Source: https://api.blockchain.info/]
BTC confirmed transactions
## Getting charts
### crypto.onchain.btc_transac(start_date: int = 1262304000, end_date: int = 1665471332, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
### crypto.onchain.btc_transac(start_date: int = 1262304000, end_date: int = 1666094607, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Returns BTC confirmed transactions [Source: https://api.blockchain.info/]

View File

@@ -0,0 +1,44 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.onchain.hr(symbol: str, interval: str = '24h', start_date: int = 1287662607, end_date: int = 1666094607) -> pandas.core.frame.DataFrame
Returns dataframe with mean hashrate of btc or eth blockchain and symbol price
[Source: https://glassnode.com]
Parameters
----------
symbol : str
Blockchain to check hashrate (BTC or ETH)
start_date : int
Initial date timestamp (e.g., 1_614_556_800)
end_date : int
End date timestamp (e.g., 1_614_556_800)
interval : str
Interval frequency (e.g., 24h)
Returns
-------
pd.DataFrame
mean hashrate and symbol price over time
## Getting charts
### crypto.onchain.hr(symbol: str, start_date: int = 1634558607, end_date: int = 1666094607, interval: str = '24h', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Display dataframe with mean hashrate of btc or eth blockchain and symbol price.
[Source: https://glassnode.org]
Parameters
----------
symbol : str
Blockchain to check mean hashrate (BTC or ETH)
start_date : int
Initial date timestamp (e.g., 1_614_556_800)
end_date : int
End date timestamp (e.g., 1_614_556_800)
interval : str
Interval frequency (possible values are: 24, 1w, 1month)
export : str
Export dataframe data to csv,json,xlsx file
external_axes : Optional[List[plt.Axes]], optional
External axes (2 axes are expected in the list), by default None

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### crypto.ov.altindex(period: int = 30, start_date: int = 1262304000, end_date: int = 1665471332) -> pandas.core.frame.DataFrame
### crypto.ov.altindex(period: int = 30, start_date: int = 1262304000, end_date: int = 1666094607) -> pandas.core.frame.DataFrame
Get altcoin index overtime
[Source: https://blockchaincenter.net]
@@ -23,7 +23,7 @@ Get altcoin index overtime
Date, Value (Altcoin Index)
## Getting charts
### crypto.ov.altindex(period: int = 365, start_date: int = 1262304000, end_date: int = 1665471332, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
### crypto.ov.altindex(period: int = 365, start_date: int = 1262304000, end_date: int = 1666094607, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> None
Displays altcoin index overtime
[Source: https://blockchaincenter.net]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### economy.bigmac(country_codes: List[str]) -> pandas.core.frame.DataFrame
### economy.bigmac(country_codes: List[str] = None) -> pandas.core.frame.DataFrame
Display Big Mac Index for given countries
@@ -16,7 +16,7 @@ Display Big Mac Index for given countries
Dataframe with Big Mac indices converted to USD equivalent.
## Getting charts
### economy.bigmac(country_codes: List[str], raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### economy.bigmac(country_codes: List[str] = None, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display Big Mac Index for given countries

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### economy.fred_yield_curve(date: datetime.datetime = None) -> Tuple[pandas.core.frame.DataFrame, str]
### economy.fred_yield_curve(date: datetime.datetime = None) -> Tuple[pandas.core.frame.DataFrame, datetime.datetime]
Gets yield curve data from FRED
@@ -18,7 +18,7 @@ Gets yield curve data from FRED
Date for which the yield curve is obtained
## Getting charts
### economy.fred_yield_curve(date: datetime.datetime = datetime.datetime(2022, 10, 11, 7, 55, 32, 575569, chart=True), external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False, export: str = '')
### economy.fred_yield_curve(date: datetime.datetime = None, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False, export: str = '', chart=True)
Display yield curve based on US Treasury rates for a specified date.

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### economy.macro(parameters: list = None, countries: list = None, transform: str = '', start_date: str = '1900-01-01', end_date=datetime.date(2022, 10, 11), symbol: str = '') -> Tuple[Any, Dict[Any, Dict[Any, Any]], str]
### economy.macro(parameters: list = None, countries: list = None, transform: str = '', start_date: str = '1900-01-01', end_date=datetime.date(2022, 10, 18), symbol: str = '') -> Tuple[Any, Dict[Any, Dict[Any, Any]], str]
This functions groups the data queried from the EconDB database [Source: EconDB]
@@ -30,7 +30,7 @@ This functions groups the data queried from the EconDB database [Source: EconDB]
Denomination which can be Trillions, Billions, Millions, Thousands
## Getting charts
### economy.macro(parameters: list = None, countries: list = None, transform: str = '', start_date: str = '1900-01-01', end_date: str = '2022-10-11', symbol: str = '', raw: bool = False, external_axes: Optional[List[axes]] = None, export: str = '', chart=True)
### economy.macro(parameters: list = None, countries: list = None, transform: str = '', start_date: str = '1900-01-01', end_date: str = '2022-10-18', symbol: str = '', raw: bool = False, external_axes: Optional[List[axes]] = None, export: str = '', chart=True)
Show the received macro data about a company [Source: EconDB]

View File

@@ -0,0 +1,44 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### economy.spread(countries: Union[str, List[str]] = 'G7', maturity: str = '10Y', change: bool = False) -> pandas.core.frame.DataFrame
Get spread matrix. [Source: Investing.com]
Parameters
----------
countries: Union[str, List[str]]
Countries or group of countries. List of available countries is accessible through get_ycrv_countries().
maturity: str
Maturity to get data. By default 10Y.
change: bool
Flag to use 1 day change or not. By default False.
Returns
-------
pd.DataFrame
Spread matrix.
## Getting charts
### economy.spread(countries: Union[str, List[str]] = 'G7', maturity: str = '10Y', change: bool = False, color: str = 'openbb', raw: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, export: str = '', chart=True)
Display spread matrix. [Source: Investing.com]
Parameters
----------
countries: Union[str, List[str]]
Countries or group of countries. List of available countries is accessible through get_ycrv_countries().
maturity: str
Maturity to get data. By default 10Y.
change: bool
Flag to use 1 day change or not. By default False.
color: str
Color theme to use on heatmap, from rgb, binary or openbb By default, openbb.
raw : bool
Output only raw data.
export : str
Export dataframe data to csv,json,xlsx file
external_axes : Optional[List[plt.Axes]], optional
External axes (1 axis is expected in the list), by default None

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### economy.treasury(instruments: list = None, maturities: list = None, frequency: str = 'monthly', start_date: str = '1900-01-01', end_date: str = '2022-10-11') -> pandas.core.frame.DataFrame
### economy.treasury(instruments: list = None, maturities: list = None, frequency: str = 'monthly', start_date: str = '1900-01-01', end_date: str = '2022-10-18') -> pandas.core.frame.DataFrame
Get U.S. Treasury rates [Source: EconDB]
@@ -25,7 +25,7 @@ Get U.S. Treasury rates [Source: EconDB]
Holds data of the selected types and maturities
## Getting charts
### economy.treasury(instruments: list = None, maturities: list = None, frequency: str = 'monthly', start_date: str = '1900-01-01', end_date: str = '2022-10-11', raw: bool = False, external_axes: Optional[List[axes]] = None, export: str = '', chart=True)
### economy.treasury(instruments: list = None, maturities: list = None, frequency: str = 'monthly', start_date: str = '1900-01-01', end_date: str = '2022-10-18', raw: bool = False, external_axes: Optional[List[axes]] = None, export: str = '', chart=True)
Display U.S. Treasury rates [Source: EconDB]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### economy.ycrv(country: str) -> pandas.core.frame.DataFrame
### economy.ycrv(country: str = 'United States') -> pandas.core.frame.DataFrame
Get yield curve for specified country. [Source: Investing.com]
@@ -16,7 +16,7 @@ Get yield curve for specified country. [Source: Investing.com]
Country yield curve
## Getting charts
### economy.ycrv(country: str, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False, export: str = '', chart=True)
### economy.ycrv(country: str = 'United States', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False, export: str = '', chart=True)
Display yield curve for specified country. [Source: Investing.com]

View File

@@ -1,5 +1,5 @@
## Get underlying data
### etf.candle(symbol: str, data: pandas.core.frame.DataFrame = None, use_matplotlib: bool = True, intraday: bool = False, add_trend: bool = False, ma: Optional[Iterable[int]] = None, asset_type: str = '', start_date: datetime.datetime = datetime.datetime(2019, 10, 7, 7, 55, 32, 432614), interval: int = 1440, end_date: datetime.datetime = datetime.datetime(2022, 10, 11, 7, 55, 32, 432619), prepost: bool = False, source: str = 'YahooFinance', iexrange: str = 'ytd', weekly: bool = False, monthly: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False)
### etf.candle(symbol: str, data: pandas.core.frame.DataFrame = None, use_matplotlib: bool = True, intraday: bool = False, add_trend: bool = False, ma: Optional[Iterable[int]] = None, asset_type: str = '', start_date: datetime.datetime = datetime.datetime(2019, 10, 14, 13, 3, 27, 493186), interval: int = 1440, end_date: datetime.datetime = datetime.datetime(2022, 10, 18, 13, 3, 27, 493190), prepost: bool = False, source: str = 'YahooFinance', iexrange: str = 'ytd', weekly: bool = False, monthly: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False, yscale: str = 'linear')
Shows candle plot of loaded ticker. [Source: Yahoo Finance, IEX Cloud or Alpha Vantage]
@@ -41,3 +41,5 @@ Shows candle plot of loaded ticker. [Source: Yahoo Finance, IEX Cloud or Alpha V
Flag to get monthly data
raw : bool, optional
Flag to display raw data, by default False
yscale: str
Linear or log for yscale

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### etf.news(query: str, limit: int = 10, start_date: str = '2022-10-04', show_newest: bool = True, sources: str = '') -> List[Tuple[Any, Any]]
### etf.news(query: str, limit: int = 10, start_date: str = '2022-10-11', show_newest: bool = True, sources: str = '') -> List[Tuple[Any, Any]]
Get news for a given term. [Source: NewsAPI]
@@ -22,7 +22,7 @@ Get news for a given term. [Source: NewsAPI]
List of tuples containing news df in first index and dict containing title of news df
## Getting charts
### etf.news(query: str, limit: int = 3, start_date: str = '2022-10-04', show_newest: bool = True, sources: str = '', export: str = '', chart=True) -> None
### etf.news(query: str, limit: int = 3, start_date: str = '2022-10-11', show_newest: bool = True, sources: str = '', export: str = '', chart=True) -> None
Display news for a given term. [Source: NewsAPI]

View File

@@ -11,5 +11,7 @@ Show candle plot for fx data.
To forex symbol
from_symbol : str
From forex symbol
ma : Optional[Iterable[int]]
Moving averages
external_axes: Optional[List[plt.Axes]]
External axes (1 axis is expected in the list), by default None

View File

@@ -1,5 +1,5 @@
## Get underlying data
### forex.load(to_symbol: str, from_symbol: str, resolution: str = 'd', interval: str = '1day', start_date: str = '2021-10-11', source: str = 'YahooFinance') -> pandas.core.frame.DataFrame
### forex.load(to_symbol: str, from_symbol: str, resolution: str = 'd', interval: str = '1day', start_date: str = '2021-10-18', source: str = 'YahooFinance') -> pandas.core.frame.DataFrame
Loads forex for two given symbols

View File

@@ -0,0 +1,17 @@
## Get underlying data
### keys.shroom(key: str, persist: bool = False, show_output: bool = False) -> str
Set Shroom key
Parameters
----------
key: str
API key
persist: bool
If False, api key change will be contained to where it was changed. For example, Jupyter notebook.
If True, api key change will be global, i.e. it will affect terminal environment variables.
By default, False.
show_output: bool
Display status string or not. By default, False.
Returns
-------
status: str

View File

@@ -0,0 +1,20 @@
## Get underlying data
### keys.tokenterminal(key: str, persist: bool = False, show_output: bool = False) -> str
Set Token Terminal key.
Parameters
----------
key: str
API key
persist: bool
If False, api key change will be contained to where it was changed. For example, Jupyter notebook.
If True, api key change will be global, i.e. it will affect terminal environment variables.
By default, False.
show_output: bool
Display status string or not. By default, False.
Returns
-------
status: str

View File

@@ -1,5 +1,5 @@
## Get underlying data
### stocks.ba.cnews(symbol: str, start_date: str = '2022-09-11', end_date: str = '2022-10-11') -> List[Dict]
### stocks.ba.cnews(symbol: str, start_date: str = '2022-09-18', end_date: str = '2022-10-18') -> List[Dict]
Get news from a company. [Source: Finnhub]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.ba.hist(symbol: str, start_date: str = '2022-10-04', end_date: str = '2022-10-11', number: int = 100) -> pandas.core.frame.DataFrame
### stocks.ba.hist(symbol: str, start_date: str = '2022-10-11', end_date: str = '2022-10-18', number: int = 100) -> pandas.core.frame.DataFrame
Get hour-level sentiment data for the chosen symbol
@@ -25,7 +25,7 @@ Get hour-level sentiment data for the chosen symbol
Dataframe of historical sentiment
## Getting charts
### stocks.ba.hist(symbol: str, start_date: str = '2022-10-04', end_date: str = '2022-10-11', number: int = 100, raw: bool = False, limit: int = 10, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.ba.hist(symbol: str, start_date: str = '2022-10-11', end_date: str = '2022-10-18', number: int = 100, raw: bool = False, limit: int = 10, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display historical sentiment data of a ticker,
and plot a chart with RHI and AHI.

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.ba.sentiment(symbol: str, n_tweets: int = 15, n_days_past: int = 2)
### stocks.ba.sentiment(symbol: str, n_tweets: int = 15, n_days_past: int = 2) -> pandas.core.frame.DataFrame
Get sentiments from symbol

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.ba.trend(start_date: datetime.datetime = datetime.datetime(2022, 10, 11, 7, 55, 31, 933096), hour: int = 0, number: int = 10) -> pandas.core.frame.DataFrame
### stocks.ba.trend(start_date: datetime.datetime = datetime.datetime(2022, 10, 18, 13, 3, 27, 112924), hour: int = 0, number: int = 10) -> pandas.core.frame.DataFrame
Get sentiment data on the most talked about tickers
within the last hour
@@ -24,7 +24,7 @@ Get sentiment data on the most talked about tickers
Dataframe of trending data
## Getting charts
### stocks.ba.trend(start_date: datetime.datetime = datetime.datetime(2022, 10, 11, 7, 55, 31, 933301, chart=True), hour: int = 0, number: int = 10, limit: int = 10, export: str = '')
### stocks.ba.trend(start_date: datetime.datetime = datetime.datetime(2022, 10, 18, 13, 3, 27, 113091, chart=True), hour: int = 0, number: int = 10, limit: int = 10, export: str = '')
Display most talked about tickers within
the last hour together with their sentiment data.

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.ca.hcorr(similar: List[str], start_date: str = '2021-10-10', candle_type: str = 'a')
### stocks.ca.hcorr(similar: List[str], start_date: str = '2021-10-17', candle_type: str = 'a')
Get historical price correlation. [Source: Yahoo Finance]
@@ -18,7 +18,7 @@ To obtain charts, make sure to add `chart=True` as the last parameter
OHLCA column to use for candles or R for returns, by default "a" for Adjusted Close
## Getting charts
### stocks.ca.hcorr(similar: List[str], start_date: str = '2021-10-10', candle_type: str = 'a', display_full_matrix: bool = False, raw: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, export: str = '', chart=True)
### stocks.ca.hcorr(similar: List[str], start_date: str = '2021-10-17', candle_type: str = 'a', display_full_matrix: bool = False, raw: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, export: str = '', chart=True)
Correlation heatmap based on historical price comparison

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.ca.hist(similar: List[str], start_date: str = '2021-10-10', candle_type: str = 'a') -> pandas.core.frame.DataFrame
### stocks.ca.hist(similar: List[str], start_date: str = '2021-10-17', candle_type: str = 'a') -> pandas.core.frame.DataFrame
Get historical prices for all comparison stocks
@@ -22,7 +22,7 @@ Get historical prices for all comparison stocks
Dataframe containing candle type variable for each ticker
## Getting charts
### stocks.ca.hist(similar: List[str], start_date: str = '2021-10-10', candle_type: str = 'a', normalize: bool = True, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.ca.hist(similar: List[str], start_date: str = '2021-10-17', candle_type: str = 'a', normalize: bool = True, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display historical stock prices. [Source: Yahoo Finance]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.ca.volume(similar: List[str], start_date: str = '2021-10-10') -> pandas.core.frame.DataFrame
### stocks.ca.volume(similar: List[str], start_date: str = '2021-10-17') -> pandas.core.frame.DataFrame
Get stock volume. [Source: Yahoo Finance]
@@ -15,7 +15,7 @@ Get stock volume. [Source: Yahoo Finance]
Start date of comparison, by default 1 year ago
## Getting charts
### stocks.ca.volume(similar: List[str], start_date: str = '2021-10-10', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.ca.volume(similar: List[str], start_date: str = '2021-10-17', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display stock volume. [Source: Yahoo Finance]

View File

@@ -1,5 +1,5 @@
## Get underlying data
### stocks.candle(symbol: str, data: pandas.core.frame.DataFrame = None, use_matplotlib: bool = True, intraday: bool = False, add_trend: bool = False, ma: Optional[Iterable[int]] = None, asset_type: str = '', start_date: datetime.datetime = datetime.datetime(2019, 10, 7, 7, 55, 32, 432614), interval: int = 1440, end_date: datetime.datetime = datetime.datetime(2022, 10, 11, 7, 55, 32, 432619), prepost: bool = False, source: str = 'YahooFinance', iexrange: str = 'ytd', weekly: bool = False, monthly: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False)
### stocks.candle(symbol: str, data: pandas.core.frame.DataFrame = None, use_matplotlib: bool = True, intraday: bool = False, add_trend: bool = False, ma: Optional[Iterable[int]] = None, asset_type: str = '', start_date: datetime.datetime = datetime.datetime(2019, 10, 14, 13, 3, 27, 493186), interval: int = 1440, end_date: datetime.datetime = datetime.datetime(2022, 10, 18, 13, 3, 27, 493190), prepost: bool = False, source: str = 'YahooFinance', iexrange: str = 'ytd', weekly: bool = False, monthly: bool = False, external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, raw: bool = False, yscale: str = 'linear')
Shows candle plot of loaded ticker. [Source: Yahoo Finance, IEX Cloud or Alpha Vantage]
@@ -41,3 +41,5 @@ Shows candle plot of loaded ticker. [Source: Yahoo Finance, IEX Cloud or Alpha V
Flag to get monthly data
raw : bool, optional
Flag to display raw data, by default False
yscale: str
Linear or log for yscale

View File

@@ -16,7 +16,7 @@ Get analysts' price targets for a given stock. [Source: Business Insider]
Analysts data
## Getting charts
### stocks.dd.pt(symbol: str, data: pandas.core.frame.DataFrame, start_date: str = '2022-10-11', limit: int = 10, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.dd.pt(symbol: str, data: pandas.core.frame.DataFrame, start_date: str = '2022-10-18', limit: int = 10, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display analysts' price targets for a given stock. [Source: Business Insider]

View File

@@ -1,5 +1,5 @@
## Get underlying data
### stocks.disc.dividends(date: str = '2022-10-11') -> pandas.core.frame.DataFrame
### stocks.disc.dividends(date: str = '2022-10-18') -> pandas.core.frame.DataFrame
Gets dividend calendar for given date. Date represents Ex-Dividend Date

View File

@@ -1,5 +1,5 @@
## Get underlying data
### stocks.disc.ipo(start_date: str = '2022-10-06', end_date: str = '2022-10-11') -> pandas.core.frame.DataFrame
### stocks.disc.ipo(start_date: str = '2022-10-13', end_date: str = '2022-10-18') -> pandas.core.frame.DataFrame
Get IPO calendar

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.dps.ftd(symbol: str, start_date: str = '2022-08-12', end_date: str = '2022-10-11', limit: int = 0) -> pandas.core.frame.DataFrame
### stocks.dps.ftd(symbol: str, start_date: str = '2022-08-19', end_date: str = '2022-10-18', limit: int = 0) -> pandas.core.frame.DataFrame
Display fails-to-deliver data for a given ticker. [Source: SEC]
@@ -22,7 +22,7 @@ Display fails-to-deliver data for a given ticker. [Source: SEC]
Fail to deliver data
## Getting charts
### stocks.dps.ftd(symbol: str, data: pandas.core.frame.DataFrame, start_date: str = '2022-08-12', end_date: str = '2022-10-11', limit: int = 0, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.dps.ftd(symbol: str, data: pandas.core.frame.DataFrame, start_date: str = '2022-08-19', end_date: str = '2022-10-18', limit: int = 0, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display fails-to-deliver data for a given ticker. [Source: SEC]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.fa.mktcap(symbol: str, start_date: str = '2019-10-09') -> Tuple[pandas.core.frame.DataFrame, str]
### stocks.fa.mktcap(symbol: str, start_date: str = '2019-10-16') -> Tuple[pandas.core.frame.DataFrame, str]
Get market cap over time for ticker. [Source: Yahoo Finance]
@@ -20,7 +20,7 @@ Get market cap over time for ticker. [Source: Yahoo Finance]
Currency of ticker
## Getting charts
### stocks.fa.mktcap(symbol: str, start_date: str = '2019-10-09', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.fa.mktcap(symbol: str, start_date: str = '2019-10-16', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display market cap over time. [Source: Yahoo Finance]

View File

@@ -16,7 +16,7 @@ Get insider activity. [Source: Business Insider]
Get insider activity data
## Getting charts
### stocks.ins.act(data: pandas.core.frame.DataFrame, symbol: str, start_date: str = '2019-10-07', interval: str = '1440min', limit: int = 10, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.ins.act(data: pandas.core.frame.DataFrame, symbol: str, start_date: str = '2019-10-14', interval: str = '1440min', limit: int = 10, raw: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display insider activity. [Source: Business Insider]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.options.pcr(symbol: str, window: int = 30, start_date: str = '2021-10-10') -> pandas.core.frame.DataFrame
### stocks.options.pcr(symbol: str, window: int = 30, start_date: str = '2021-10-17') -> pandas.core.frame.DataFrame
Gets put call ratio over last time window [Source: AlphaQuery.com]
@@ -15,7 +15,7 @@ Gets put call ratio over last time window [Source: AlphaQuery.com]
Start date to plot, by default last 366 days
## Getting charts
### stocks.options.pcr(symbol: str, window: int = 30, start_date: str = '2021-10-10', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
### stocks.options.pcr(symbol: str, window: int = 30, start_date: str = '2021-10-17', export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)
Display put call ratio [Source: AlphaQuery.com]

View File

@@ -1,7 +1,7 @@
To obtain charts, make sure to add `chart=True` as the last parameter
## Get underlying data
### stocks.screener.historical(preset_loaded: str = 'top_gainers', limit: int = 10, start_date: str = '2022-04-14', type_candle: str = 'a', normalize: bool = True)
### stocks.screener.historical(preset_loaded: str = 'top_gainers', limit: int = 10, start_date: str = '2022-04-21', type_candle: str = 'a', normalize: bool = True)
View historical price of stocks that meet preset
@@ -28,7 +28,7 @@ View historical price of stocks that meet preset
Whether some random stock selection due to limitations
## Getting charts
### stocks.screener.historical(preset_loaded: str = 'top_gainers', limit: int = 10, start_date: str = '2022-04-14', type_candle: str = 'a', normalize: bool = True, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> List[str]
### stocks.screener.historical(preset_loaded: str = 'top_gainers', limit: int = 10, start_date: str = '2022-04-21', type_candle: str = 'a', normalize: bool = True, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True) -> List[str]
View historical price of stocks that meet preset

View File

@@ -0,0 +1,19 @@
## Get underlying data
### stocks.tob(symbol: str, exchange: str = 'BZX') -> Tuple[pandas.core.frame.DataFrame, pandas.core.frame.DataFrame]
Get top of book bid and ask for ticker on exchange [CBOE.com]
Parameters
----------
symbol: str
Ticker to get
exchange: str
Exchange to look at. Can be `BZX`,`EDGX`, `BYX`, `EDGA`
Returns
-------
pd.DatatFrame
Dataframe of Bids
pd.DataFrame
Dataframe of asks

File diff suppressed because it is too large Load Diff