This commit is contained in:
hjoaquim
2024-01-29 14:07:15 +00:00
parent 41c9ca3820
commit 7288b59f87
24 changed files with 91 additions and 93 deletions

View File

@@ -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)

View File

@@ -284,9 +284,9 @@ class Router:
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)

View File

@@ -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.",
)

View File

@@ -17,9 +17,9 @@ from pydantic import Field, field_validator
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",

View File

@@ -137,9 +137,7 @@ class CboeIndexHistoricalFetcher(
)
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

View File

@@ -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):

View File

@@ -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):

View File

@@ -15,11 +15,11 @@ from pydantic import Field
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.",

View File

@@ -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."
)

View File

@@ -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."
)

View File

@@ -22,9 +22,9 @@ DWPCR_PARAMETER_TO_FRED_ID = {
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):

View File

@@ -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
@@ -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)

View File

@@ -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")

View File

@@ -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"

View File

@@ -15,11 +15,11 @@ from pydantic import Field
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.",

View File

@@ -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."
)

View File

@@ -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."
)

View File

@@ -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"

View File

@@ -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."
)

View File

@@ -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."
)

View File

@@ -431,9 +431,9 @@ class SecEtfHoldingsFetcher(
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")
@@ -461,21 +461,21 @@ class SecEtfHoldingsFetcher(
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"

View File

@@ -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,

View File

@@ -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):

View File

@@ -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]