Skip to content

Commit

Permalink
Merge pull request #5289 from OpenBB-finance/release/3.2.1
Browse files Browse the repository at this point in the history
Release 3.2.1
  • Loading branch information
jmaslek authored Aug 16, 2023
2 parents 08a4fab + 6a3aeb5 commit c04cf95
Show file tree
Hide file tree
Showing 170 changed files with 55,577 additions and 4,023 deletions.
5 changes: 0 additions & 5 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ tag-template: 'v$NEXT_MINOR_VERSION'
exclude-contributors:
- 'jmaslek'
- 'DidierRLopes'
- 'JerBouma'
- 'deeleeramone'
- 'hjoaquim'
- 'jose-donato'
- 'luqmanbello'
- 'martinb-bb'
- 'montezdesousa'
- 'tehcoderer'
- 'Chavithra'
- 'colin99d'
- 'northern-64bit'
- 'piiq'
- 'andrewkenreich'
- 'IgorWounds'
- 'jerryduluk'
- 'minhhoang1023'

template: |
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ jobs:
uses: docker://avtodev/markdown-lint:v1
with:
args: "./*.md ./changelogs/*.md ./openbb_terminal/**/*.md ./discordbot/**/*.md"

json-yaml-validate:
name: JSON Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: json-yaml-validate
id: json-yaml-validate
uses: GrantBirki/json-yaml-validate@v2.0.0
with:
exclude_file: json_validate_exclude.txt
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,9 @@ In order to do that, you'll simply need to choose from one the following files:
1. [local_credentials.json](openbb_terminal/miscellaneous/models/local_credentials.json) --> credentials that should only be stored locally and not pushed to the [OpenBB Hub](https://my.openbb.co/) like brokerage keys or other very sensitive or personal to the user.
2. [hub_credentials.json](openbb_terminal/miscellaneous/models/hub_credentials.json) --> credentials that should be stored in the [OpenBB Hub](https://my.openbb.co/) like API keys to access your favorite providers.

Then just update [all_api_keys.json](openbb_terminal/miscellaneous/models/all_api_keys.json) with the instructions to get
the api key from the data source website. Make sure that this file has the correct `.json` format, otherwise the API keys page in the Hub will break (e.g. in json the last element key-value pair shouldn't be followed by a comma, and the last object in a list of dictionaries should also not be followed by a comma).

> Note: By differentiating between local and hub credentials, we can ensure that the user's credentials are not pushed to the [OpenBB Hub](https://my.openbb.co/) and are only stored locally. This does not mean that the credentials are not secure in the OpenBB Hub, but rather that the user can choose to store them locally if they wish.
### Setting and checking API key
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ Any of our social media platforms: [openbb.co/links](https://openbb.co/links)

## 6. Star History

This is a proxy of our growth and that we are just getting started. But for more metrics important to us check [openbb.co/open](https://openbb.co/open).
This is a proxy of our growth and that we are just getting started.

But for more metrics important to us check [openbb.co/open](https://openbb.co/open).

[![Star History Chart](https://api.star-history.com/svg?repos=openbb-finance/OpenBBTerminal&type=Date)](https://star-history.com/#openbb-finance/OpenBBTerminal&Date)

Expand Down
2 changes: 1 addition & 1 deletion build/docker/compose.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
OPENBBTERMINAL_DOCKER_REGISTRY="ghcr.io"
OPENBBTERMINAL_DOCKER_RELEASE_VERSION="3.2.0"
OPENBBTERMINAL_DOCKER_RELEASE_VERSION="3.2.1"
6 changes: 3 additions & 3 deletions build/nsis/setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
!define NAME "OpenBB Terminal"
!define COMPANY "OpenBB"
!define APPFILE "OpenBBTerminal.exe"
!define VERSION "3.2.0"
!define VERSION "3.2.1"
!define SLUG "${NAME} v${VERSION}"

;--------------------------------
Expand All @@ -20,8 +20,8 @@
VIAddVersionKey Comments "An installer for OpenBB Terminal. For additional details, visit OpenBB.co"
VIAddVersionKey CompanyName OpenBB.co
VIAddVersionKey FileDescription "OpenBB Terminal Program"
VIAddVersionKey FileVersion 3.2.0.0
VIAddVersionKey ProductVersion 3.2.0.0
VIAddVersionKey FileVersion 3.2.1.0
VIAddVersionKey ProductVersion 3.2.1.0
VIAddVersionKey InternalName "OpenBB Terminal"

;--------------------------------
Expand Down
4 changes: 2 additions & 2 deletions build/pyinstaller/version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ VSVersionInfo(
[StringStruct('Comments', 'The OpenBB Terminal. For additional details, visit OpenBB.co'),
StringStruct('CompanyName', 'OpenBB'),
StringStruct('FileDescription', 'OpenBB Terminal Program'),
StringStruct('FileVersion', '3.2.0.0'),
StringStruct('FileVersion', '3.2.1.0'),
StringStruct('InternalName', 'OpenBB Terminal'),
StringStruct('ProductName', 'OpenBB Terminal'),
StringStruct('ProductVersion', '3.2.0.0')])
StringStruct('ProductVersion', '3.2.1.0')])
]),
VarFileInfo([VarStruct('Translation', [1033, 1200])])
]
Expand Down
23 changes: 15 additions & 8 deletions frontend-components/tables/src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ export default function Table({
: columns[0];
const indexValue = indexLabel ? row[indexLabel] : null;
const value = row[column];
const only_numbers = value?.toString().replace(/[^0-9]/g, "") ?? "";
const only_numbers =
value?.toString()?.split(".")?.[0]?.replace(/[^0-9]/g, "") ?? "";
const probablyDate =
only_numbers?.length >= 4 &&
(includesDateNames(column) ||
Expand All @@ -197,7 +198,11 @@ export default function Table({
indexValue.toLowerCase().includes("hour") ||
indexValue.toLowerCase().includes("minute"))));

if (probablyDate && isoYearRegex.test(value?.toString()))
if (
probablyDate &&
value?.length === 4 &&
isoYearRegex.test(value?.toString())
)
return value;

if (probablyDate) {
Expand All @@ -219,7 +224,8 @@ export default function Table({
const indexValue = indexLabel ? row.original[indexLabel] : null;
const value = row.original[column];
const valueType = typeof value;
const only_numbers = value?.toString().replace(/[^0-9]/g, "") ?? "";
const only_numbers =
value?.toString()?.split(".")?.[0]?.replace(/[^0-9]/g, "") ?? "";
const probablyDate =
only_numbers?.length >= 4 &&
(includesDateNames(column) ||
Expand All @@ -246,14 +252,15 @@ export default function Table({
</a>
);
}
if (probablyDate && isoYearRegex.test(value?.toString())) {
return <p>{value}</p>;
}

if (
probablyDate &&
!isNaN(new Date(value).getTime()) &&
!isoYearRegex.test(value?.toString())
value?.length === 4 &&
isoYearRegex.test(value?.toString())
) {
return <p>{value}</p>;
}
if (probablyDate && !isNaN(new Date(value).getTime())) {
if (typeof value === "string") {
const date = value.split("T")[0];
const time = value.split("T")[1]?.split(".")[0];
Expand Down
3 changes: 3 additions & 0 deletions json_validate_exclude.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests/
openbb_terminal/miscellaneous/gpt_index/index_0.4.json
.devcontainer/devcontainer.json
43 changes: 28 additions & 15 deletions openbb_terminal/account/account_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
from pathlib import Path
from typing import Dict, List, Optional
from uuid import UUID

from openbb_terminal.account.account_view import (
display_default_routines,
Expand Down Expand Up @@ -55,12 +56,12 @@ def __init__(self, queue: Optional[List[str]] = None):
"""Constructor"""
super().__init__(queue)
self.LOCAL_ROUTINES: Dict[str, Path] = {}
self.REMOTE_CHOICES: List[str] = []
self.REMOTE_CHOICES: Dict[str, UUID] = {}

self.DEFAULT_ROUTINES: List[Dict[str, str]] = self.fetch_default_routines()
self.DEFAULT_CHOICES: List[str] = [
r["name"] for r in self.DEFAULT_ROUTINES if "name" in r
]
self.DEFAULT_CHOICES: Dict[str, None] = {
r["name"]: None for r in self.DEFAULT_ROUTINES if "name" in r
}

if session and get_current_user().preferences.USE_PROMPT_TOOLKIT:
self.choices: dict = self.choices_default
Expand All @@ -75,7 +76,11 @@ def update_runtime_choices(self):
{c: {} for c in self.LOCAL_ROUTINES}
)
self.choices["download"]["--name"].update(
{c: {} for c in self.DEFAULT_CHOICES + self.REMOTE_CHOICES}
{
c: {}
for c in list(self.DEFAULT_CHOICES.keys())
+ list(self.REMOTE_CHOICES.keys())
}
)
self.choices["delete"]["--name"].update(
{c: {} for c in self.REMOTE_CHOICES}
Expand Down Expand Up @@ -250,10 +255,12 @@ def call_list(self, other_args: List[str]):
auth_header=get_current_user().profile.get_auth_header(),
page=ns_parser.page,
size=ns_parser.size,
base_url=Hub.BackendEnvironment.BASE_URL,
)
df, page, pages = get_personal_routines_info(response)
if not df.empty:
self.REMOTE_CHOICES += list(df["name"])
temp_dict = dict(zip(df["name"], df["uuid"]))
self.REMOTE_CHOICES = {**self.REMOTE_CHOICES, **temp_dict}
self.update_runtime_choices()
display_personal_routines(df, page, pages)
else:
Expand Down Expand Up @@ -350,6 +357,7 @@ def call_upload(self, other_args: List[str]):
"routine": routine,
"tags": tags,
"public": ns_parser.public,
"base_url": Hub.BackendEnvironment.BASE_URL,
}
response = Hub.upload_routine(**kwargs) # type: ignore

Expand All @@ -366,7 +374,8 @@ def call_upload(self, other_args: List[str]):
console.print("[info]Aborted.[/info]")

if response and response.status_code == 200:
self.REMOTE_CHOICES.append(name)
the_uuid = response.json()["uuid"]
self.REMOTE_CHOICES[name] = the_uuid
self.update_runtime_choices()

# store data in list with "personal/default" to identify data's routine type
Expand Down Expand Up @@ -401,12 +410,14 @@ def call_download(self, other_args: List[str]):
data = []
name = " ".join(ns_parser.name)
# Personal routines
response = Hub.download_routine(
auth_header=get_current_user().profile.get_auth_header(),
name=name,
)
if response and response.status_code == 200:
data = [response.json(), "personal"]
if name in self.REMOTE_CHOICES:
response = Hub.download_routine(
auth_header=get_current_user().profile.get_auth_header(),
uuid=self.REMOTE_CHOICES[name],
base_url=Hub.BackendEnvironment.BASE_URL,
)
if response and response.status_code == 200:
data = [response.json(), "personal"]
# Default routine
elif name in self.DEFAULT_CHOICES:
data = [
Expand Down Expand Up @@ -490,14 +501,15 @@ def call_delete(self, other_args: List[str]):
if i.lower() in ["y", "yes"]:
response = Hub.delete_routine(
auth_header=get_current_user().profile.get_auth_header(),
name=name,
uuid=self.REMOTE_CHOICES[name],
base_url=Hub.BackendEnvironment.BASE_URL,
)
if (
response
and response.status_code == 200
and name in self.REMOTE_CHOICES
):
self.REMOTE_CHOICES.remove(name)
self.REMOTE_CHOICES.pop(name)
self.update_runtime_choices()
else:
console.print("[info]Aborted.[/info]")
Expand Down Expand Up @@ -543,6 +555,7 @@ def call_generate(self, other_args: List[str]) -> None:

response = Hub.generate_personal_access_token(
auth_header=get_current_user().profile.get_auth_header(),
base_url=Hub.BackendEnvironment.BASE_URL,
days=ns_parser.days,
)
if response and response.status_code == 200:
Expand Down
43 changes: 35 additions & 8 deletions openbb_terminal/account/account_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@
from openbb_terminal.rich_config import console


def clean_df(df: pd.DataFrame) -> pd.DataFrame:
"""
Cleans the dataframe before displaying it.
Parameters
----------
df : pd.DataFrame
The dataframe to clean.
Returns
-------
pd.DataFrame
The cleaned dataframe.
"""
df["updated_date"] = pd.to_datetime(df["updated_date"])
df["updated_date"] = df["updated_date"].dt.strftime("%Y-%m-%d %H:%M:%S")
df.replace(to_replace=[None], value="-", inplace=True)
to_rename = {
"name": "Name",
"description": "Description",
"version": "Version",
"updated_date": "Last Update",
}
df = df.rename(columns=to_rename)
df = df[["Name", "Description", "Version", "Last Update"]]
return df


def display_personal_routines(df: pd.DataFrame, page: int, pages: int):
"""Display the routines.
Expand All @@ -20,18 +48,17 @@ def display_personal_routines(df: pd.DataFrame, page: int, pages: int):
title = f"Personal routines - page {page}"
if pages:
title += f" of {pages}"
df = clean_df(df)

df["updated_date"] = pd.to_datetime(df["updated_date"])
df["updated_date"] = df["updated_date"].dt.strftime("%Y-%m-%d %H:%M:%S")
df.replace(to_replace=[None], value="-", inplace=True)
print_rich_table(
df=df,
title=title,
headers=["Name", "Description", "Version", "Last update"],
headers=list(df.columns),
show_index=True,
index_name="#",
)
except Exception:
except Exception as exc:
print(exc)
console.print("Failed to display personal routines.")


Expand All @@ -44,9 +71,9 @@ def display_default_routines(df: pd.DataFrame):
The default routines list.
"""
try:
df["date_updated"] = pd.to_datetime(df["date_updated"])
df["date_updated"] = df["date_updated"].dt.strftime("%Y-%m-%d %H:%M:%S")
df.replace(to_replace=[None], value="-", inplace=True)
df = df.rename(columns={"date_updated": "updated_date"})
print(df)
df = clean_df(df)
print_rich_table(
df=df,
title="Default routines",
Expand Down
11 changes: 6 additions & 5 deletions openbb_terminal/common/behavioural_analysis/reddit_view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Reddit View."""
__docformat__ = "numpy"

import io
import logging
import os
import textwrap
Expand Down Expand Up @@ -212,10 +213,10 @@ def display_wsb_community(limit: int = 10, new: bool = False):
Flag to sort by new instead of hot, by default False
"""
subs = reddit_model.get_wsb_community(limit, new)
# I am not proud of this, but it works to eliminate the max recursion bug
subs = pd.read_csv(io.StringIO(subs.to_csv()), index_col=0).fillna("-")
if not subs.empty:
# for sub in subs.iterrows():
# print_reddit_post(sub)
print(print_rich_table(subs))
print_rich_table(subs)


@log_start_end(log=logger)
Expand Down Expand Up @@ -282,8 +283,8 @@ def display_redditsent(
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
external_axes: Optional[List[plt.Axes]]
If supplied, expect 1 external axis
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
fig = OpenBBFigure()

Expand Down
Loading

0 comments on commit c04cf95

Please sign in to comment.