mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Merge branch 'develop' into feature/news-date
This commit is contained in:
2
.github/workflows/linting.yml
vendored
2
.github/workflows/linting.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- run: |
|
||||
pip install bandit black codespell==2.2.5 mypy==1.5.1 pylint==2.17.0 ruff==0.0.285
|
||||
pip install openbb-devtools
|
||||
pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six
|
||||
- run: bandit -x ./tests -r . || true
|
||||
- run: black --diff --check .
|
||||
|
||||
@@ -338,6 +338,35 @@ class StaticCommandRunner:
|
||||
route=route,
|
||||
**kwargs,
|
||||
)
|
||||
try:
|
||||
if (
|
||||
obbject.results
|
||||
and execution_context.user_settings.preferences.field_order
|
||||
):
|
||||
if isinstance(obbject.results, list):
|
||||
fields = obbject.results[0].model_dump().keys()
|
||||
else:
|
||||
fields = obbject.results.model_dump().keys()
|
||||
|
||||
obbject.extra["field_order"] = list(fields)
|
||||
except Exception as e:
|
||||
if Env().DEBUG_MODE:
|
||||
raise OpenBBError(e) from e
|
||||
|
||||
try:
|
||||
if (
|
||||
obbject.results
|
||||
and execution_context.user_settings.preferences.field_order
|
||||
):
|
||||
if isinstance(obbject.results, list):
|
||||
fields = obbject.results[0].model_dump().keys()
|
||||
else:
|
||||
fields = obbject.results.model_dump().keys()
|
||||
|
||||
obbject.extra["field_order"] = list(fields)
|
||||
except Exception as e:
|
||||
if Env().DEBUG_MODE:
|
||||
raise OpenBBError(e) from e
|
||||
|
||||
except Exception as e:
|
||||
raise OpenBBError(e) from e
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
"""Preferences for the OpenBB platform."""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
|
||||
@@ -5,6 +7,8 @@ from pydantic import BaseModel, ConfigDict, Field, PositiveInt
|
||||
|
||||
|
||||
class Preferences(BaseModel):
|
||||
"""Preferences for the OpenBB platform."""
|
||||
|
||||
data_directory: str = str(Path.home() / "OpenBBUserData")
|
||||
export_directory: str = str(Path.home() / "OpenBBUserData" / "exports")
|
||||
user_styles_directory: str = str(Path.home() / "OpenBBUserData" / "styles" / "user")
|
||||
@@ -20,6 +24,9 @@ class Preferences(BaseModel):
|
||||
table_style: Literal["dark", "light"] = "dark"
|
||||
request_timeout: PositiveInt = 15
|
||||
metadata: bool = True
|
||||
field_order: bool = (
|
||||
False # Whether to display the field order by which the data was defined
|
||||
)
|
||||
output_type: Literal["OBBject", "dataframe", "polars", "numpy", "dict", "chart"] = (
|
||||
Field(default="OBBject", description="Python default output type.")
|
||||
)
|
||||
@@ -27,6 +34,7 @@ class Preferences(BaseModel):
|
||||
model_config = ConfigDict(validate_assignment=True)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Return a string representation of the model."""
|
||||
return f"{self.__class__.__name__}\n\n" + "\n".join(
|
||||
f"{k}: {v}" for k, v in self.model_dump().items()
|
||||
)
|
||||
|
||||
1174
openbb_platform/extensions/devtools/poetry.lock
generated
vendored
1174
openbb_platform/extensions/devtools/poetry.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "openbb-devtools"
|
||||
version = "1.1.1"
|
||||
version = "1.1.2"
|
||||
description = "Tools for OpenBB Platform Developers"
|
||||
authors = ["OpenBB Team <hello@openbb.co>"]
|
||||
readme = "README.md"
|
||||
@@ -12,8 +12,9 @@ ruff = "^0.1.5"
|
||||
pylint = "^3.0.2"
|
||||
mypy = "^1.6.1"
|
||||
pydocstyle = "^6.3.0"
|
||||
black = "^23.11.0"
|
||||
black = "^24.1.0"
|
||||
bandit = "^1.7.5"
|
||||
codespell = "^2.2.5"
|
||||
pre-commit = "^3.5.0"
|
||||
tox = "^4.11.3"
|
||||
pytest = "^7.4.3"
|
||||
|
||||
@@ -945,7 +945,7 @@ def check_finnhub_key(show_output: bool = False) -> str:
|
||||
if current_user.credentials.API_FINNHUB_KEY == "REPLACE_ME":
|
||||
status = KeyStatus.NOT_DEFINED
|
||||
else:
|
||||
r = r = request(
|
||||
r = request(
|
||||
f"https://finnhub.io/api/v1/quote?symbol=AAPL&token={current_user.credentials.API_FINNHUB_KEY}"
|
||||
)
|
||||
if r.status_code in [403, 401, 400]:
|
||||
|
||||
@@ -293,9 +293,10 @@ def get_financials(symbol: str, statement: str, ratios: bool = False) -> pd.Data
|
||||
)
|
||||
|
||||
# Making the website believe that you are accessing it using a Mozilla browser
|
||||
req = Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
req = Request(url, headers={"User-Agent": "Mozilla/5.0"}) # noqa: S310
|
||||
|
||||
webpage = urlopen(req).read() # pylint: disable= R1732 # noqa: S310
|
||||
with urlopen(req) as response: # noqa: S310
|
||||
webpage = response.read()
|
||||
soup = BeautifulSoup(webpage, "html.parser")
|
||||
|
||||
features = soup.find_all("div", class_="D(tbr)")
|
||||
|
||||
@@ -178,7 +178,7 @@ After installation, the Python interface will automatically rebuild on initializ
|
||||
|
||||
## Technical
|
||||
|
||||
The `openbb-technical` extension is for performing technical analysis on time series data. It installs a new router path (`obb.techincal`) and some additional Python libraries:
|
||||
The `openbb-technical` extension is for performing technical analysis on time series data. It installs a new router path (`obb.technical`) and some additional Python libraries:
|
||||
|
||||
- pandas-ta
|
||||
- scikit-learn
|
||||
|
||||
1
website/content/platform/usage/index.md
vendored
1
website/content/platform/usage/index.md
vendored
@@ -145,6 +145,7 @@ HTTP_PROXY="http://10.10.10.10:8000"
|
||||
| table_style | dark | ["dark", "light"] | "The default color style to use with the OpenBB Charting Extension tables. Options are "dark" and "light"" |
|
||||
| request_timeout | 15 | Any positive integer. | Specifies the timeout duration for HTTP requests. |
|
||||
| metadata | True | [True, False] | Enables or disables the collection of metadata which provides information about operations including arguments duration route and timestamp. Disabling this feature may improve performance in cases where contextual information is not needed or when the additional computation time and storage space are a concern. |
|
||||
| field_order | False | [True, False] | Enables or disables the information on the field order defined with Pydantic models. Useful for frontend as the API returns JSON which is an unordered collection. |
|
||||
| output_type | OBBject | ["OBBject", "dataframe", "numpy", "dict", "chart", "polars"] | Specifies the type of data the application will output when a command or endpoint is accessed. Note that choosing data formats only available in Python such as `dataframe` | `numpy` or `polars` will render the application's API non-functional. |
|
||||
|
||||
User settings can be set from the Python interface directly.
|
||||
|
||||
@@ -73,7 +73,7 @@ add mu
|
||||
|
||||
### Technical
|
||||
|
||||
With a list of similar companies populated, the `techincal` command will compare recent price performance metrics.
|
||||
With a list of similar companies populated, the `technical` command will compare recent price performance metrics.
|
||||
|
||||
```console
|
||||
technical
|
||||
|
||||
@@ -27,7 +27,7 @@ import TutorialVideo from '@site/src/components/General/TutorialVideo.tsx';
|
||||
|
||||
<TutorialVideo
|
||||
youtubeLink="https://www.youtube.com/embed/cgeN3Ep2nEw?si=YR6l4AfhhJjxzH0H"
|
||||
videoLegend="Long video on using VIA to configre my Keychron keyboard for OpenBB"
|
||||
videoLegend="Long video on using VIA to configure my Keychron keyboard for OpenBB"
|
||||
/>
|
||||
|
||||
This document will explain how you can set hotkeys macros on your customizable keyboard which allow you to perform investment research in a few seconds.
|
||||
|
||||
Reference in New Issue
Block a user