Skip to content

Commit

Permalink
format w new black
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoaquim committed Jan 29, 2024
1 parent 2d7c5c6 commit 74b9619
Show file tree
Hide file tree
Showing 47 changed files with 191 additions and 169 deletions.
6 changes: 3 additions & 3 deletions openbb_platform/core/openbb_core/app/model/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class Preferences(BaseModel):
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.")
)
output_type: Literal[
"OBBject", "dataframe", "polars", "numpy", "dict", "chart"
] = Field(default="OBBject", description="Python default output type.")

model_config = ConfigDict(validate_assignment=True)

Expand Down
6 changes: 3 additions & 3 deletions openbb_platform/core/openbb_core/app/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ def command(
if deprecation_message:
kwargs["summary"] = deprecation_message
else:
kwargs["summary"] = (
"This functionality will be deprecated in the future releases."
)
kwargs[
"summary"
] = "This functionality will be deprecated in the future releases."

api_router.add_api_route(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class EUYieldCurveQueryParams(QueryParams):
date: Optional[dateType] = Field(
default=None, description=QUERY_DESCRIPTIONS.get("date", "")
)
yield_curve_type: Literal["spot_rate", "instantaneous_forward", "par_yield"] = (
Field(
default="spot_rate",
description="The yield curve type.",
)
yield_curve_type: Literal[
"spot_rate", "instantaneous_forward", "par_yield"
] = Field(
default="spot_rate",
description="The yield curve type.",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
class BiztocWorldNewsQueryParams(WorldNewsQueryParams):
"""Biztoc World News Query."""

filter: Literal["crypto", "hot", "latest", "main", "media", "source", "tag"] = (
Field(default="latest", description="Filter by type of news.")
)
filter: Literal[
"crypto", "hot", "latest", "main", "media", "source", "tag"
] = Field(default="latest", description="Filter by type of news.")
source: str = Field(
description="Filter by a specific publisher. Only valid when filter is set to source.",
default="bloomberg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ def _generate_historical_prices_url(
)
url += f"{symbol.replace('^', '')}.json"
else:
base_url: str = (
f"https://cdn.cboe.com/api/global/delayed_quotes/charts/{interval_type}"
)
base_url: str = f"https://cdn.cboe.com/api/global/delayed_quotes/charts/{interval_type}"
url = (
base_url + f"/_{symbol.replace('^', '')}.json"
if symbol.replace("^", "") in TICKER_EXCEPTIONS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class FMPCryptoHistoricalQueryParams(CryptoHistoricalQueryParams):
timeseries: Optional[NonNegativeInt] = Field(
default=None, description="Number of days to look back."
)
interval: Literal["1min", "5min", "15min", "30min", "1hour", "4hour", "1day"] = (
Field(default="1day", description="Data granularity.")
)
interval: Literal[
"1min", "5min", "15min", "30min", "1hour", "4hour", "1day"
] = Field(default="1day", description="Data granularity.")


class FMPCryptoHistoricalData(CryptoHistoricalData):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class FMPCurrencyHistoricalQueryParams(CurrencyHistoricalQueryParams):

__alias_dict__ = {"start_date": "from", "end_date": "to"}

interval: Literal["1min", "5min", "15min", "30min", "1hour", "4hour", "1day"] = (
Field(default="1day", description="Data granularity.")
)
interval: Literal[
"1min", "5min", "15min", "30min", "1hour", "4hour", "1day"
] = Field(default="1day", description="Data granularity.")


class FMPCurrencyHistoricalData(CurrencyHistoricalData):
Expand Down
10 changes: 5 additions & 5 deletions openbb_platform/providers/fmp/openbb_fmp/models/etf_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
class FMPEtfSearchQueryParams(EtfSearchQueryParams):
"""FMP ETF Search Query."""

exchange: Optional[Literal["AMEX", "NYSE", "NASDAQ", "ETF", "TSX", "EURONEXT"]] = (
Field(
description="The exchange code the ETF trades on.",
default=None,
)
exchange: Optional[
Literal["AMEX", "NYSE", "NASDAQ", "ETF", "TSX", "EURONEXT"]
] = Field(
description="The exchange code the ETF trades on.",
default=None,
)
is_active: Optional[Literal[True, False]] = Field(
description="Whether the ETF is actively trading.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class FMPIndexHistoricalQueryParams(IndexHistoricalQueryParams):
timeseries: Optional[NonNegativeInt] = Field(
default=None, description="Number of days to look back."
)
interval: Literal["1min", "5min", "15min", "30min", "1hour", "4hour", "1day"] = (
Field(default="1day", description="Data granularity.")
)
interval: Literal[
"1min", "5min", "15min", "30min", "1hour", "4hour", "1day"
] = Field(default="1day", description="Data granularity.")
sort: Literal["asc", "desc"] = Field(
default="desc", description="Sort the data in ascending or descending order."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class FMPMarketIndicesQueryParams(MarketIndicesQueryParams):
timeseries: Optional[NonNegativeInt] = Field(
default=None, description="Number of days to look back."
)
interval: Literal["1min", "5min", "15min", "30min", "1hour", "4hour", "1day"] = (
Field(default="1day", description="Data granularity.")
)
interval: Literal[
"1min", "5min", "15min", "30min", "1hour", "4hour", "1day"
] = Field(default="1day", description="Data granularity.")
sort: Literal["asc", "desc"] = Field(
default="desc", description="Sort the data in ascending or descending order."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
class FREDDiscountWindowPrimaryCreditRateParams(DiscountWindowPrimaryCreditRateParams):
"""FRED Discount Window Primary Credit Rate Query."""

parameter: Literal["daily_excl_weekend", "monthly", "weekly", "daily", "annual"] = (
Field(default="daily_excl_weekend", description="FRED series ID of DWPCR data.")
)
parameter: Literal[
"daily_excl_weekend", "monthly", "weekly", "daily", "annual"
] = Field(default="daily_excl_weekend", description="FRED series ID of DWPCR data.")


class FREDDiscountWindowPrimaryCreditRateData(DiscountWindowPrimaryCreditRateData):
Expand Down
10 changes: 5 additions & 5 deletions openbb_platform/providers/fred/openbb_fred/models/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ class FredSeriesQueryParams(SeriesQueryParams):
eop = End of Period
""",
)
transform: Literal[None, "chg", "ch1", "pch", "pc1", "pca", "cch", "cca", "log"] = (
Field(
default=None,
description="""
transform: Literal[
None, "chg", "ch1", "pch", "pc1", "pca", "cch", "cca", "log"
] = Field(
default=None,
description="""
Transformation type
None = No transformation
chg = Change
Expand All @@ -93,7 +94,6 @@ class FredSeriesQueryParams(SeriesQueryParams):
cca = Continuously Compounded Annual Rate of Change
log = Natural Log
""",
)
)
limit: int = Field(description=QUERY_DESCRIPTIONS.get("limit", ""), default=100000)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class IntrinioEquityHistoricalQueryParams(EquityHistoricalQueryParams):
_interval_size: Literal["1m", "5m", "10m", "15m", "30m", "60m", "1h"] = PrivateAttr(
default=None
)
_frequency: Literal["daily", "weekly", "monthly", "quarterly", "yearly"] = (
PrivateAttr(default=None)
)
_frequency: Literal[
"daily", "weekly", "monthly", "quarterly", "yearly"
] = PrivateAttr(default=None)

# pylint: disable=protected-access
@model_validator(mode="after")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ class IntrinioIncomeStatementData(IncomeStatementData):
deposits_interest_expense: Optional[float] = Field(
default=None, description="Deposits interest expense"
)
federal_funds_purchased_and_securities_sold_interest_expense: Optional[float] = (
Field(
default=None,
description="Federal funds purchased and securities sold interest expense",
)
federal_funds_purchased_and_securities_sold_interest_expense: Optional[
float
] = Field(
default=None,
description="Federal funds purchased and securities sold interest expense",
)
other_interest_expense: Optional[float] = Field(
default=None, description="Other interest expense"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
class NasdaqSP500MultiplesQueryParams(SP500MultiplesQueryParams):
"""Nasdaq SP500 Multiples Query."""

collapse: Optional[Literal["daily", "weekly", "monthly", "quarterly", "annual"]] = (
Field(
description="Collapse the frequency of the time series.",
default="monthly",
)
collapse: Optional[
Literal["daily", "weekly", "monthly", "quarterly", "annual"]
] = Field(
description="Collapse the frequency of the time series.",
default="monthly",
)
transform: Optional[Literal["diff", "rdiff", "cumul", "normalize"]] = Field(
description="The transformation of the time series.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class PolygonCryptoHistoricalQueryParams(CryptoHistoricalQueryParams):
multiplier: PositiveInt = Field(
default=1, description="Multiplier of the timespan."
)
timespan: Literal["minute", "hour", "day", "week", "month", "quarter", "year"] = (
Field(default="day", description="Timespan of the data.")
)
timespan: Literal[
"minute", "hour", "day", "week", "month", "quarter", "year"
] = Field(default="day", description="Timespan of the data.")
sort: Literal["asc", "desc"] = Field(
default="desc", description="Sort order of the data."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class PolygonCurrencyHistoricalQueryParams(CurrencyHistoricalQueryParams):
multiplier: PositiveInt = Field(
default=1, description="Multiplier of the timespan."
)
timespan: Literal["minute", "hour", "day", "week", "month", "quarter", "year"] = (
Field(default="day", description="Timespan of the data.")
)
timespan: Literal[
"minute", "hour", "day", "week", "month", "quarter", "year"
] = Field(default="day", description="Timespan of the data.")
sort: Literal["asc", "desc"] = Field(
default="desc", description="Sort order of the data."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ class PolygonIncomeStatementData(IncomeStatementData):
default=None,
description="Participating Securities Distributed And Undistributed Earnings Loss Basic",
)
undistributed_earnings_allocated_to_participating_securities: Optional[float] = (
Field(
default=None,
description="Undistributed Earnings Allocated To Participating Securities",
)
undistributed_earnings_allocated_to_participating_securities: Optional[
float
] = Field(
default=None,
description="Undistributed Earnings Allocated To Participating Securities",
)
common_stock_dividends: Optional[float] = Field(
default=None, description="Common Stock Dividends"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class PolygonIndexHistoricalQueryParams(IndexHistoricalQueryParams):
Source: https://polygon.io/docs/indices/getting-started
"""

timespan: Literal["minute", "hour", "day", "week", "month", "quarter", "year"] = (
Field(default="day", description="Timespan of the data.")
)
timespan: Literal[
"minute", "hour", "day", "week", "month", "quarter", "year"
] = Field(default="day", description="Timespan of the data.")
sort: Literal["asc", "desc"] = Field(
default="desc", description="Sort order of the data."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class PolygonMarketIndicesQueryParams(MarketIndicesQueryParams):
Source: https://polygon.io/docs/indices/getting-started
"""

timespan: Literal["minute", "hour", "day", "week", "month", "quarter", "year"] = (
Field(default="day", description="Timespan of the data.")
)
timespan: Literal[
"minute", "hour", "day", "week", "month", "quarter", "year"
] = Field(default="day", description="Timespan of the data.")
sort: Literal["asc", "desc"] = Field(
default="desc", description="Sort order of the data."
)
Expand Down
24 changes: 12 additions & 12 deletions openbb_platform/providers/sec/openbb_sec/models/etf_holdings.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@ def transform_data(
option_swaption_warrant_deriv = derivative_info[
"optionSwaptionWarrantDeriv"
]
df.loc[i, "derivative_category"] = (
option_swaption_warrant_deriv.get("@derivCat")
)
df.loc[
i, "derivative_category"
] = option_swaption_warrant_deriv.get("@derivCat")
df.loc[i, "counterparty"] = option_swaption_warrant_deriv[
"counterparties"
].get("counterpartyName")
Expand Down Expand Up @@ -462,21 +462,21 @@ def transform_data(
df.loc[i, "option_type"] = option_swaption_warrant_deriv.get(
"putOrCall"
)
df.loc[i, "derivative_payoff"] = (
option_swaption_warrant_deriv.get("writtenOrPur")
)
df.loc[
i, "derivative_payoff"
] = option_swaption_warrant_deriv.get("writtenOrPur")
df.loc[i, "expiry_date"] = option_swaption_warrant_deriv.get(
"expDt"
)
df.loc[i, "exercise_price"] = option_swaption_warrant_deriv.get(
"exercisePrice"
)
df.loc[i, "exercise_currency"] = (
option_swaption_warrant_deriv.get("exercisePriceCurCd")
)
df.loc[i, "shares_per_contract"] = (
option_swaption_warrant_deriv.get("shareNo")
)
df.loc[
i, "exercise_currency"
] = option_swaption_warrant_deriv.get("exercisePriceCurCd")
df.loc[
i, "shares_per_contract"
] = option_swaption_warrant_deriv.get("shareNo")
if option_swaption_warrant_deriv.get("delta") != "XXXX":
df.loc[i, "delta"] = option_swaption_warrant_deriv.get(
"delta"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class TiingoCryptoHistoricalQueryParams(CryptoHistoricalQueryParams):
"end_date": "endDate",
}

interval: Literal["1min", "5min", "15min", "30min", "1hour", "4hour", "1day"] = (
Field(default="1day", description="Data granularity.", alias="resampleFreq")
)
interval: Literal[
"1min", "5min", "15min", "30min", "1hour", "4hour", "1day"
] = Field(default="1day", description="Data granularity.", alias="resampleFreq")

exchanges: Optional[List[str]] = Field(
default=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class TiingoCurrencyHistoricalQueryParams(CurrencyHistoricalQueryParams):
"end_date": "endDate",
}

interval: Literal["1min", "5min", "15min", "30min", "1hour", "4hour", "1day"] = (
Field(default="1day", description="Data granularity.", alias="resampleFreq")
)
interval: Literal[
"1min", "5min", "15min", "30min", "1hour", "4hour", "1day"
] = Field(default="1day", description="Data granularity.", alias="resampleFreq")


class TiingoCurrencyHistoricalData(CurrencyHistoricalData):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class TiingoEquityHistoricalQueryParams(EquityHistoricalQueryParams):
interval: Literal["1d", "1W", "1M", "1Y"] = Field(
default="1d", description=QUERY_DESCRIPTIONS.get("interval", "")
)
_frequency: Literal["daily", "weekly", "monthly", "quarterly", "yearly"] = (
PrivateAttr(default=None)
)
_frequency: Literal[
"daily", "weekly", "monthly", "quarterly", "yearly"
] = PrivateAttr(default=None)

# pylint: disable=protected-access
@model_validator(mode="after") # type: ignore[arg-type]
Expand Down
4 changes: 3 additions & 1 deletion openbb_terminal/core/sdk/sdk_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def clean_attr_desc(attr: Optional[Any] = None) -> Optional[str]:
return (
attr.__doc__.splitlines()[1].lstrip()
if not attr.__doc__.splitlines()[0]
else attr.__doc__.splitlines()[0].lstrip() if attr.__doc__ else ""
else attr.__doc__.splitlines()[0].lstrip()
if attr.__doc__
else ""
)


Expand Down
4 changes: 3 additions & 1 deletion openbb_terminal/cryptocurrency/overview/pycoingecko_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ def display_crypto_heatmap(
)
fig.add_trace(treemap["data"][0], row=1, col=1)

fig.data[0].texttemplate = (
fig.data[
0
].texttemplate = (
"<br> <br> <b>%{label}<br> %{customdata[0]:.2f}% <br> <br> <br><br><b>"
)
fig.data[0].insidetextfont = dict(
Expand Down
Loading

0 comments on commit 74b9619

Please sign in to comment.