This commit is contained in:
Igor Radovanovic
2023-09-07 16:30:31 +02:00
parent 5c0e820834
commit e012aa82da
26 changed files with 134 additions and 288 deletions

View File

@@ -5,14 +5,14 @@ import os
from pathlib import Path
from typing import List, Optional, Union
from openbb_core.app.static.app_factory import (
BaseApp as _BaseApp,
create_app as _create_app,
)
from openbb_core.app.static.build_utils import (
auto_build as _auto_build,
build as _build,
)
from openbb_core.app.static.app_factory import (
create_app as _create_app,
BaseApp as _BaseApp,
)
_this_dir = Path(os.path.dirname(os.path.realpath(__file__)))
@@ -44,7 +44,7 @@ try:
# pylint: disable=import-outside-toplevel
from openbb.package.__extensions__ import Extensions as _Extensions
obb: Union[_BaseApp, _Extensions] = _create_app(_Extensions)
obb: Union[_BaseApp, _Extensions] = _create_app(_Extensions) # type: ignore
sdk = obb
except (ImportError, ModuleNotFoundError):
print("Failed to import extensions.")

View File

@@ -41,7 +41,7 @@ class CLASS_crypto(Container):
provider: Optional[Literal["fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[List]:
"""Crypto Historical Price.
r"""Crypto Historical Price.
Parameters
----------
@@ -115,11 +115,11 @@ class CLASS_crypto(Container):
change : Optional[float]
Change in the price of the symbol from the previous day. (provider: fmp)
change_percent : Optional[float]
Change \\% in the price of the symbol. (provider: fmp)
Change \% in the price of the symbol. (provider: fmp)
label : Optional[str]
Human readable format of the date. (provider: fmp)
change_over_time : Optional[float]
Change \\% in the price of the symbol over a period of time. (provider: fmp)
Change \% in the price of the symbol over a period of time. (provider: fmp)
n : Optional[PositiveInt]
Number of transactions for the symbol in the time period. (provider: polygon)
""" # noqa: E501

View File

@@ -382,7 +382,7 @@ class CLASS_economy(Container):
EuropeanIndexHistorical
-----------------------
date : Union[date, datetime]
date : Optional[datetime]
The date of the data.
close : Optional[float]
The close price of the symbol.
@@ -517,7 +517,7 @@ class CLASS_economy(Container):
provider: Optional[Literal["cboe", "fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[List]:
"""Get historical levels for an index.
r"""Get historical levels for an index.
Parameters
----------
@@ -595,11 +595,11 @@ class CLASS_economy(Container):
change : Optional[float]
Change in the price of the symbol from the previous day. (provider: fmp)
change_percent : Optional[float]
Change \\% in the price of the symbol. (provider: fmp)
Change \% in the price of the symbol. (provider: fmp)
label : Optional[str]
Human readable format of the date. (provider: fmp)
change_over_time : Optional[float]
Change \\% in the price of the symbol over a period of time. (provider: fmp)
Change \% in the price of the symbol over a period of time. (provider: fmp)
""" # noqa: E501
inputs = filter_inputs(

View File

@@ -1,25 +1,22 @@
{
"openbb_core_extension": [
"crypto@0.1.0",
"economy@0.1.0",
"fixedincome@0.1.0",
"forex@0.1.0",
"futures@0.1.0",
"news@0.1.0",
"crypto@0.1.1",
"economy@0.1.1",
"fixedincome@0.1.1",
"forex@0.1.1",
"futures@0.1.1",
"news@0.1.1",
"openbb_charting@0.1.0",
"qa@0.1.0",
"stocks@0.1.0",
"ta@0.1.0"
],
"openbb_provider_extension": [
"alpha_vantage@0.1.0",
"benzinga@0.1.0",
"cboe@0.1.0",
"fmp@0.1.0",
"fred@0.1.0",
"intrinio@0.1.0",
"polygon@0.1.0",
"quandl@0.1.0",
"yfinance@0.1.0"
"benzinga@0.1.1",
"cboe@0.1.1",
"fmp@0.1.1",
"fred@0.1.1",
"polygon@0.1.1",
"yfinance@0.1.1"
]
}

View File

@@ -42,7 +42,7 @@ class CLASS_forex(Container):
provider: Optional[Literal["fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[List]:
"""Forex Intraday Price.
r"""Forex Intraday Price.
Parameters
----------
@@ -114,11 +114,11 @@ class CLASS_forex(Container):
change : Optional[float]
Change in the price of the symbol from the previous day. (provider: fmp)
change_percent : Optional[float]
Change \\% in the price of the symbol. (provider: fmp)
Change \% in the price of the symbol. (provider: fmp)
label : Optional[str]
Human readable format of the date. (provider: fmp)
change_over_time : Optional[float]
Change \\% in the price of the symbol over a period of time. (provider: fmp)
Change \% in the price of the symbol over a period of time. (provider: fmp)
n : Optional[PositiveInt]
Number of transactions for the symbol in the time period. (provider: polygon)
""" # noqa: E501
@@ -142,13 +142,13 @@ class CLASS_forex(Container):
@validate_arguments
def pairs(
self, provider: Optional[Literal["fmp", "intrinio", "polygon"]] = None, **kwargs
self, provider: Optional[Literal["fmp", "polygon"]] = None, **kwargs
) -> OBBject[List]:
"""Forex Available Pairs.
Parameters
----------
provider : Optional[Literal['fmp', 'intrinio', 'polygon']]
provider : Optional[Literal['fmp', 'polygon']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
@@ -172,7 +172,7 @@ class CLASS_forex(Container):
OBBject
results : List[ForexPairs]
Serializable results.
provider : Optional[Literal['fmp', 'intrinio', 'polygon']]
provider : Optional[Literal['fmp', 'polygon']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -193,12 +193,6 @@ class CLASS_forex(Container):
Stock exchange of the currency pair. (provider: fmp)
exchange_short_name : Optional[str]
Short name of the stock exchange of the currency pair. (provider: fmp)
code : Optional[str]
Code of the currency pair. (provider: intrinio)
base_currency : Optional[str]
ISO 4217 currency code of the base currency. (provider: intrinio)
quote_currency : Optional[str]
ISO 4217 currency code of the quote currency. (provider: intrinio)
market : Optional[str]
The name of the trading market. Always 'fx'. (provider: polygon)
locale : Optional[str]

View File

@@ -26,7 +26,7 @@ class CLASS_news(Container):
pydantic.types.NonNegativeInt,
OpenBBCustomParameter(description="Page of the global news."),
] = 0,
provider: Optional[Literal["benzinga", "fmp", "intrinio"]] = None,
provider: Optional[Literal["benzinga", "fmp"]] = None,
**kwargs
) -> OBBject[List]:
"""Global News.
@@ -35,7 +35,7 @@ class CLASS_news(Container):
----------
page : NonNegativeInt
Page of the global news.
provider : Optional[Literal['benzinga', 'fmp', 'intrinio']]
provider : Optional[Literal['benzinga', 'fmp']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'benzinga' if there is
no default.
@@ -69,19 +69,13 @@ class CLASS_news(Container):
Authors of the news to retrieve. (provider: benzinga)
content_types : Optional[str]
Content types of the news to retrieve. (provider: benzinga)
next_page : str
Token to get the next page of data from a previous API call. (provider: intrinio)
limit : Optional[int]
The number of data entries to return. (provider: intrinio)
all_pages : Optional[bool]
Returns all pages of data from the API call at once. (provider: intrinio)
Returns
-------
OBBject
results : List[GlobalNews]
Serializable results.
provider : Optional[Literal['benzinga', 'fmp', 'intrinio']]
provider : Optional[Literal['benzinga', 'fmp']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -111,11 +105,7 @@ class CLASS_news(Container):
teaser : Optional[str]
Teaser of the news. (provider: benzinga)
site : Optional[str]
Site of the news. (provider: fmp)
id : Optional[str]
Intrinio ID for the news article. (provider: intrinio)
company : Optional[Mapping[str, Any]]
Company details related to the news article. (provider: intrinio)""" # noqa: E501
Site of the news. (provider: fmp)""" # noqa: E501
inputs = filter_inputs(
provider_choices={

View File

@@ -183,12 +183,10 @@ class CLASS_stocks(Container):
),
] = None,
chart: bool = False,
provider: Optional[
Literal["alpha_vantage", "cboe", "fmp", "intrinio", "polygon", "yfinance"]
] = None,
provider: Optional[Literal["cboe", "fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[List]:
"""Load stock data for a specific ticker.
r"""Load stock data for a specific ticker.
Parameters
----------
@@ -200,46 +198,26 @@ class CLASS_stocks(Container):
End date of the data, in YYYY-MM-DD format.
chart : bool
Whether to create a chart or not, by default False.
provider : Optional[Literal['alpha_vantage', 'cboe', 'fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['cboe', 'fmp', 'polygon', 'yfinance']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'alpha_vantage' if there is
If None, the provider specified in defaults is selected or 'cboe' if there is
no default.
period : Union[Literal['intraday', 'daily', 'weekly', 'monthly'], Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max'], NoneType]
interval : Union[Literal['1d', '1m'], NoneType, Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]
None
interval : Union[Literal['1min', '5min', '15min', '30min', '60min'], NoneType, Literal['1d', '1m'], Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]
None
adjusted : Optional[bool]
None
extended_hours : Optional[bool]
Extended trading hours during pre-market and after-hours. (provider: alpha_vantage)
month : Optional[str]
Query a specific month in history (in YYYY-MM format). (provider: alpha_vantage)
outputsize : Optional[Literal['compact', 'full']]
Compact returns only the latest 100 data points in the intraday time series; full returns trailing 30 days of the most recent intraday data if the month parameter (see above) is not specified, or the full intraday data for a specific month in history if the month parameter is specified. (provider: alpha_vantage)
timeseries : Optional[pydantic.types.NonNegativeInt]
Number of days to look back. (provider: fmp)
timezone : Optional[Literal['Africa/Algiers', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Monrovia', 'Africa/Nairobi', 'America/Argentina/Buenos_Aires', 'America/Bogota', 'America/Caracas', 'America/Chicago', 'America/Chihuahua', 'America/Denver', 'America/Godthab', 'America/Guatemala', 'America/Guyana', 'America/Halifax', 'America/Indiana/Indianapolis', 'America/Juneau', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Mazatlan', 'America/Mexico_City', 'America/Monterrey', 'America/Montevideo', 'America/New_York', 'America/Phoenix', 'America/Regina', 'America/Santiago', 'America/Sao_Paulo', 'America/St_Johns', 'America/Tijuana', 'Asia/Almaty', 'Asia/Baghdad', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Chongqing', 'Asia/Colombo', 'Asia/Dhaka', 'Asia/Hong_Kong', 'Asia/Irkutsk', 'Asia/Jakarta', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kathmandu', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuwait', 'Asia/Magadan', 'Asia/Muscat', 'Asia/Novosibirsk', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tokyo', 'Asia/Ulaanbaatar', 'Asia/Urumqi', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Cape_Verde', 'Atlantic/South_Georgia', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Darwin', 'Australia/Hobart', 'Australia/Melbourne', 'Australia/Perth', 'Australia/Sydney', 'Etc/UTC', 'UTC', 'Europe/Amsterdam', 'Europe/Athens', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Helsinki', 'Europe/Istanbul', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Madrid', 'Europe/Minsk', 'Europe/Moscow', 'Europe/Paris', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/Sarajevo', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Majuro', 'Pacific/Midway', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Port_Moresby', 'Pacific/Tongatapu']]
Returns trading times in this timezone. (provider: intrinio)
source : Optional[Literal['realtime', 'delayed', 'nasdaq_basic']]
The source of the data. (provider: intrinio)
start_time : Optional[datetime.time]
Return intervals starting at the specified time on the `start_date` formatted as 'hh:mm:ss'. (provider: intrinio)
end_time : Optional[datetime.time]
Return intervals stopping at the specified time on the `end_date` formatted as 'hh:mm:ss'. (provider: intrinio)
interval_size : Optional[Literal['1m', '5m', '10m', '15m', '30m', '60m', '1h']]
The data time frequency. (provider: intrinio)
limit : Union[pydantic.types.NonNegativeInt, NoneType, pydantic.types.PositiveInt]
None
next_page : Optional[str]
Token to get the next page of data from a previous API call. (provider: intrinio)
all_pages : Optional[bool]
Returns all pages of data from the API call at once. (provider: intrinio)
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
Timespan of the data. (provider: polygon)
sort : Literal['asc', 'desc']
Sort order of the data. (provider: polygon)
limit : PositiveInt
The number of data entries to return. (provider: polygon)
adjusted : bool
Whether the data is adjusted. (provider: polygon)
multiplier : PositiveInt
Multiplier of the timespan. (provider: polygon)
period : Optional[Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]
Period of the data to return. (provider: yfinance)
prepost : bool
Include Pre and Post market data. (provider: yfinance)
adjust : bool
@@ -252,7 +230,7 @@ class CLASS_stocks(Container):
OBBject
results : List[StockHistorical]
Serializable results.
provider : Optional[Literal['alpha_vantage', 'cboe', 'fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['cboe', 'fmp', 'polygon', 'yfinance']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -277,12 +255,6 @@ class CLASS_stocks(Container):
The volume of the symbol.
vwap : Optional[PositiveFloat]
Volume Weighted Average Price of the symbol.
adjusted_close : Optional[PositiveFloat]
The adjusted close price of the symbol. (provider: alpha_vantage)
dividend_amount : Optional[NonNegativeFloat]
Dividend amount paid for the corresponding date. (provider: alpha_vantage)
split_coefficient : Optional[NonNegativeFloat]
Split coefficient for the corresponding date. (provider: alpha_vantage)
calls_volume : Optional[float]
Number of calls traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
puts_volume : Optional[float]
@@ -296,17 +268,11 @@ class CLASS_stocks(Container):
change : Optional[float]
Change in the price of the symbol from the previous day. (provider: fmp)
change_percent : Optional[float]
Change \\% in the price of the symbol. (provider: fmp)
Change \% in the price of the symbol. (provider: fmp)
label : Optional[str]
Human readable format of the date. (provider: fmp)
change_over_time : Optional[float]
Change \\% in the price of the symbol over a period of time. (provider: fmp)
close_time : Optional[datetime]
The timestamp that represents the end of the interval span. (provider: intrinio)
interval : Optional[str]
The data time frequency. (provider: intrinio)
average : Optional[float]
Average trade price of an individual stock during the interval. (provider: intrinio)
Change \% in the price of the symbol over a period of time. (provider: fmp)
transactions : Optional[PositiveInt]
Number of transactions for the symbol in the time period. (provider: polygon)
""" # noqa: E501
@@ -530,9 +496,7 @@ class CLASS_stocks(Container):
OpenBBCustomParameter(description="Number of results to return per page."),
] = 15,
chart: bool = False,
provider: Optional[
Literal["benzinga", "fmp", "intrinio", "polygon", "yfinance"]
] = None,
provider: Optional[Literal["benzinga", "fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[BaseModel]:
"""Get news for one or more stock tickers.
@@ -547,7 +511,7 @@ class CLASS_stocks(Container):
Number of results to return per page.
chart : bool
Whether to create a chart or not, by default False.
provider : Optional[Literal['benzinga', 'fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['benzinga', 'fmp', 'polygon', 'yfinance']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'benzinga' if there is
no default.
@@ -577,10 +541,6 @@ class CLASS_stocks(Container):
Authors of the news to retrieve. (provider: benzinga)
content_types : Optional[str]
Content types of the news to retrieve. (provider: benzinga)
next_page : Optional[str]
Token to get the next page of data from a previous API call. (provider: intrinio)
all_pages : Optional[bool]
Returns all pages of data from the API call at once. (provider: intrinio)
ticker_lt : Optional[str]
Less than, by default None (provider: polygon)
ticker_lte : Optional[str]
@@ -607,7 +567,7 @@ class CLASS_stocks(Container):
OBBject
results : List[StockNews]
Serializable results.
provider : Optional[Literal['benzinga', 'fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['benzinga', 'fmp', 'polygon', 'yfinance']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -642,12 +602,12 @@ class CLASS_stocks(Container):
URL to the image of the news source. (provider: fmp)
site : Optional[str]
Name of the news source. (provider: fmp)
id : Optional[str]
Intrinio ID for the news article. (provider: intrinio)
amp_url : Optional[str]
AMP URL. (provider: polygon)
author : Optional[str]
Author of the article. (provider: polygon)
id : Optional[str]
Article ID. (provider: polygon)
image_url : Optional[str]
Image URL. (provider: polygon)
keywords : Optional[List[str]]
@@ -696,7 +656,7 @@ class CLASS_stocks(Container):
Union[str, List[str]],
OpenBBCustomParameter(description="Symbol to get data for."),
],
provider: Optional[Literal["fmp", "intrinio"]] = None,
provider: Optional[Literal["fmp"]] = None,
**kwargs
) -> OBBject[List]:
"""Load stock data for a specific ticker.
@@ -705,19 +665,17 @@ class CLASS_stocks(Container):
----------
symbol : Union[str, List[str]]
Symbol to get data for.
provider : Optional[Literal['fmp', 'intrinio']]
provider : Optional[Literal['fmp']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
source : Literal['iex', 'bats', 'bats_delayed', 'utp_delayed', 'cta_a_delayed', 'cta_b_delayed', 'intrinio_mx', 'intrinio_mx_plus', 'delayed_sip']
Source of the data. (provider: intrinio)
Returns
-------
OBBject
results : List[StockQuote]
Serializable results.
provider : Optional[Literal['fmp', 'intrinio']]
provider : Optional[Literal['fmp']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -771,47 +729,7 @@ class CLASS_stocks(Container):
earnings_announcement : Optional[str]
Earnings announcement date of the stock. (provider: fmp)
shares_outstanding : Optional[int]
Number of shares outstanding of the stock. (provider: fmp)
last_price : Optional[float]
Price of the last trade. (provider: intrinio)
last_time : Optional[datetime]
Date and Time when the last trade occurred. (provider: intrinio)
last_size : Optional[int]
Size of the last trade. (provider: intrinio)
bid_price : Optional[float]
Price of the top bid order. (provider: intrinio)
bid_size : Optional[int]
Size of the top bid order. (provider: intrinio)
ask_price : Optional[float]
Price of the top ask order. (provider: intrinio)
ask_size : Optional[int]
Size of the top ask order. (provider: intrinio)
open_price : Optional[float]
Open price for the trading day. (provider: intrinio)
close_price : Optional[float]
Closing price for the trading day (IEX source only). (provider: intrinio)
high_price : Optional[float]
High Price for the trading day. (provider: intrinio)
low_price : Optional[float]
Low Price for the trading day. (provider: intrinio)
exchange_volume : Optional[int]
Number of shares exchanged during the trading day on the exchange. (provider: intrinio)
market_volume : Optional[int]
Number of shares exchanged during the trading day for the whole market. (provider: intrinio)
updated_on : Optional[datetime]
Date and Time when the data was last updated. (provider: intrinio)
source : Optional[str]
Source of the data. (provider: intrinio)
listing_venue : Optional[str]
Listing venue where the trade took place (SIP source only). (provider: intrinio)
sales_conditions : Optional[str]
Indicates any sales condition modifiers associated with the trade. (provider: intrinio)
quote_conditions : Optional[str]
Indicates any quote condition modifiers associated with the trade. (provider: intrinio)
market_center_code : Optional[str]
Market center character code. (provider: intrinio)
is_darkpool : Optional[bool]
Whether or not the current trade is from a darkpool. (provider: intrinio)""" # noqa: E501
Number of shares outstanding of the stock. (provider: fmp)""" # noqa: E501
inputs = filter_inputs(
provider_choices={

View File

@@ -62,7 +62,7 @@ class CLASS_stocks_fa(Container):
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 12,
provider: Optional[Literal["fmp", "intrinio", "polygon", "yfinance"]] = None,
provider: Optional[Literal["fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[BaseModel]:
"""Balance Sheet.
@@ -75,14 +75,10 @@ class CLASS_stocks_fa(Container):
Period of the data to return.
limit : Optional[pydantic.types.NonNegativeInt]
The number of data entries to return.
provider : Optional[Literal['fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
type : Literal['reported', 'standardized']
Type of the statement to be fetched. (provider: intrinio)
year : Optional[int]
Year of the statement to be fetched. (provider: intrinio)
company_name : Optional[str]
Name of the company. (provider: polygon)
company_name_search : Optional[str]
@@ -121,7 +117,7 @@ class CLASS_stocks_fa(Container):
OBBject
results : List[BalanceSheet]
Serializable results.
provider : Optional[Literal['fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -497,7 +493,7 @@ class CLASS_stocks_fa(Container):
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 12,
provider: Optional[Literal["fmp", "intrinio", "polygon", "yfinance"]] = None,
provider: Optional[Literal["fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[BaseModel]:
"""Cash Flow Statement.
@@ -510,14 +506,10 @@ class CLASS_stocks_fa(Container):
Period of the data to return.
limit : Optional[pydantic.types.NonNegativeInt]
The number of data entries to return.
provider : Optional[Literal['fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
type : Literal['reported', 'standardized']
Type of the statement to be fetched. (provider: intrinio)
year : Optional[int]
Year of the statement to be fetched. (provider: intrinio)
company_name : Optional[str]
Name of the company. (provider: polygon)
company_name_search : Optional[str]
@@ -556,7 +548,7 @@ class CLASS_stocks_fa(Container):
OBBject
results : List[CashFlowStatement]
Serializable results.
provider : Optional[Literal['fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -1300,7 +1292,7 @@ class CLASS_stocks_fa(Container):
Optional[pydantic.types.NonNegativeInt],
OpenBBCustomParameter(description="The number of data entries to return."),
] = 12,
provider: Optional[Literal["fmp", "intrinio", "polygon", "yfinance"]] = None,
provider: Optional[Literal["fmp", "polygon", "yfinance"]] = None,
**kwargs
) -> OBBject[BaseModel]:
"""Income Statement.
@@ -1313,14 +1305,10 @@ class CLASS_stocks_fa(Container):
Period of the data to return.
limit : Optional[pydantic.types.NonNegativeInt]
The number of data entries to return.
provider : Optional[Literal['fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'fmp' if there is
no default.
type : Literal['reported', 'standardized']
Type of the statement to be fetched. (provider: intrinio)
year : Optional[int]
Year of the statement to be fetched. (provider: intrinio)
company_name : Optional[str]
Name of the company. (provider: polygon)
company_name_search : Optional[str]
@@ -1359,7 +1347,7 @@ class CLASS_stocks_fa(Container):
OBBject
results : List[IncomeStatement]
Serializable results.
provider : Optional[Literal['fmp', 'intrinio', 'polygon', 'yfinance']]
provider : Optional[Literal['fmp', 'polygon', 'yfinance']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.

View File

@@ -25,7 +25,7 @@ class CLASS_stocks_options(Container):
Union[str, List[str]],
OpenBBCustomParameter(description="Symbol to get data for."),
],
provider: Optional[Literal["cboe", "intrinio"]] = None,
provider: Optional[Literal["cboe"]] = None,
**kwargs
) -> OBBject[List]:
"""Get the complete options chain for a ticker.
@@ -34,19 +34,17 @@ class CLASS_stocks_options(Container):
----------
symbol : Union[str, List[str]]
Symbol to get data for.
provider : Optional[Literal['cboe', 'intrinio']]
provider : Optional[Literal['cboe']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'cboe' if there is
no default.
date : Union[datetime.date, str, NoneType]
Date for which the options chains are returned. (provider: intrinio)
Returns
-------
OBBject
results : List[OptionsChains]
Serializable results.
provider : Optional[Literal['cboe', 'intrinio']]
provider : Optional[Literal['cboe']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
@@ -110,26 +108,7 @@ class CLASS_stocks_options(Container):
last_trade_timestamp : Optional[datetime]
Last trade timestamp of the option. (provider: cboe)
dte : Optional[int]
Days to expiration for the option. (provider: cboe)
mark : Optional[float]
The mid-price between the latest bid-ask spread. (provider: intrinio)
open_bid : Optional[float]
The lowest bid price for the option that day. (provider: intrinio)
open_ask : Optional[float]
The lowest ask price for the option that day. (provider: intrinio)
bid_low : Optional[float]
The lowest bid price for the option that day. (provider: intrinio)
ask_low : Optional[float]
The lowest ask price for the option that day. (provider: intrinio)
bid_high : Optional[float]
The highest bid price for the option that day. (provider: intrinio)
ask_high : Optional[float]
The highest ask price for the option that day. (provider: intrinio)
close : Optional[float]
The close price for the option that day. (provider: intrinio)
eod_date : Optional[date]
Historical date for which the options chains data is from. (provider: intrinio)
""" # noqa: E501
Days to expiration for the option. (provider: cboe)""" # noqa: E501
inputs = filter_inputs(
provider_choices={

View File

@@ -3,6 +3,7 @@
from datetime import time
from typing import Any, Dict, List, Optional
from openbb_cboe.utils.helpers import Europe, get_cboe_index_directory
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.available_indices import (
AvailableIndicesData,
@@ -10,8 +11,6 @@ from openbb_provider.standard_models.available_indices import (
)
from pydantic import Field
from openbb_cboe.utils.helpers import Europe, get_cboe_index_directory
class CboeAvailableIndicesQueryParams(AvailableIndicesQueryParams):
"""CBOE Available Indices query.
@@ -76,7 +75,7 @@ class CboeAvailableIndicesData(AvailableIndicesData):
class CboeAvailableIndicesFetcher(
Fetcher[
CboeAvailableIndicesQueryParams,
CboeAvailableIndicesData,
List[CboeAvailableIndicesData],
]
):
"""Transform the query, extract and transform the data from the CBOE endpoints"""
@@ -84,7 +83,6 @@ class CboeAvailableIndicesFetcher(
@staticmethod
def transform_query(params: Dict[str, Any]) -> CboeAvailableIndicesQueryParams:
"""Transform the query params."""
return CboeAvailableIndicesQueryParams(**params)
@staticmethod
@@ -93,14 +91,12 @@ class CboeAvailableIndicesFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
"""Return the raw data from the CBOE endpoint"""
"""Return the raw data from the CBOE endpoint."""
if query.europe is True:
return Europe.list_indices()
return get_cboe_index_directory().sort_index().reset_index().to_dict("records")
@staticmethod
def transform_data(data: List[Dict]) -> List[CboeAvailableIndicesData]:
"""Transform the data to the standard format"""
"""Transform the data to the standard format."""
return [CboeAvailableIndicesData.parse_obj(d) for d in data]

View File

@@ -4,6 +4,11 @@ from datetime import datetime, timedelta
from typing import Any, Dict, List, Literal, Optional
import pandas as pd
from openbb_cboe.utils.helpers import (
TICKER_EXCEPTIONS,
get_cboe_index_directory,
get_ticker_info,
)
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.major_indices_historical import (
MajorIndicesHistoricalData,
@@ -12,12 +17,6 @@ from openbb_provider.standard_models.major_indices_historical import (
from openbb_provider.utils.helpers import make_request
from pydantic import Field, validator
from openbb_cboe.utils.helpers import (
TICKER_EXCEPTIONS,
get_cboe_index_directory,
get_ticker_info,
)
class CboeMajorIndicesHistoricalQueryParams(MajorIndicesHistoricalQueryParams):
"""CBOE Stock end of day query.
@@ -53,10 +52,10 @@ class CboeMajorIndicesHistoricalData(MajorIndicesHistoricalData):
class CboeMajorIndicesHistoricalFetcher(
Fetcher[
CboeMajorIndicesHistoricalQueryParams,
CboeMajorIndicesHistoricalData,
List[CboeMajorIndicesHistoricalData],
]
):
"""Transform the query, extract and transform the data from the CBOE endpoints"""
"""Transform the query, extract and transform the data from the CBOE endpoints."""
@staticmethod
def transform_query(
@@ -71,8 +70,7 @@ class CboeMajorIndicesHistoricalFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
"""Return the raw data from the CBOE endpoint"""
"""Return the raw data from the CBOE endpoint."""
# Synbol directories are cached for seven days and are used for error handling and URL generation.
INDEXES = get_cboe_index_directory().index.to_list()
query.symbol = query.symbol.upper()
@@ -183,18 +181,19 @@ class CboeMajorIndicesHistoricalFetcher(
puts_volume: List[float] = []
total_options_volume: List[float] = []
for i in range(0, len(data_list)):
date.append(data_list[i]["datetime"])
open.append(data_list[i]["price"]["open"])
high.append(data_list[i]["price"]["high"])
low.append(data_list[i]["price"]["low"])
close.append(data_list[i]["price"]["close"])
volume.append(data_list[i]["volume"]["stock_volume"])
calls_volume.append(data_list[i]["volume"]["calls_volume"])
puts_volume.append(data_list[i]["volume"]["puts_volume"])
for i in enumerate(data_list):
date.append(data_list[i[0]]["datetime"])
open.append(data_list[i[0]]["price"]["open"])
high.append(data_list[i[0]]["price"]["high"])
low.append(data_list[i[0]]["price"]["low"])
close.append(data_list[i[0]]["price"]["close"])
volume.append(data_list[i[0]]["volume"]["stock_volume"])
calls_volume.append(data_list[i[0]]["volume"]["calls_volume"])
puts_volume.append(data_list[i[0]]["volume"]["puts_volume"])
total_options_volume.append(
data_list[i]["volume"]["total_options_volume"]
data_list[i[0]]["volume"]["total_options_volume"]
)
data = pd.DataFrame()
data["date"] = pd.to_datetime(date)
data["open"] = open
@@ -213,5 +212,5 @@ class CboeMajorIndicesHistoricalFetcher(
@staticmethod
def transform_data(data: List[Dict]) -> List[CboeMajorIndicesHistoricalData]:
"""Transform the data to the standard format"""
"""Transform the data to the standard format."""
return [CboeMajorIndicesHistoricalData.parse_obj(d) for d in data]

View File

@@ -4,6 +4,12 @@ from datetime import datetime, timedelta
from typing import Any, Dict, List, Literal, Optional
import pandas as pd
from openbb_cboe.utils.helpers import (
TICKER_EXCEPTIONS,
get_cboe_directory,
get_cboe_index_directory,
get_ticker_info,
)
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.stock_historical import (
StockHistoricalData,
@@ -12,13 +18,6 @@ from openbb_provider.standard_models.stock_historical import (
from openbb_provider.utils.helpers import make_request
from pydantic import Field, validator
from openbb_cboe.utils.helpers import (
TICKER_EXCEPTIONS,
get_cboe_directory,
get_cboe_index_directory,
get_ticker_info,
)
class CboeStockHistoricalQueryParams(StockHistoricalQueryParams):
"""CBOE Stock end of day query.
@@ -57,10 +56,10 @@ class CboeStockHistoricalData(StockHistoricalData):
class CboeStockHistoricalFetcher(
Fetcher[
CboeStockHistoricalQueryParams,
CboeStockHistoricalData,
List[CboeStockHistoricalData],
]
):
"""Transform the query, extract and transform the data from the CBOE endpoints"""
"""Transform the query, extract and transform the data from the CBOE endpoints."""
@staticmethod
def transform_query(params: Dict[str, Any]) -> CboeStockHistoricalQueryParams:
@@ -73,8 +72,7 @@ class CboeStockHistoricalFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
"""Return the raw data from the CBOE endpoint"""
"""Return the raw data from the CBOE endpoint."""
# Synbol directories are cached for seven days and are used for error handling and URL generation.
SYMBOLS = get_cboe_directory()
INDEXES = get_cboe_index_directory().index.to_list()
@@ -183,18 +181,19 @@ class CboeStockHistoricalFetcher(
puts_volume: List[float] = []
total_options_volume: List[float] = []
for i in range(0, len(data_list)):
date.append(data_list[i]["datetime"])
open.append(data_list[i]["price"]["open"])
high.append(data_list[i]["price"]["high"])
low.append(data_list[i]["price"]["low"])
close.append(data_list[i]["price"]["close"])
volume.append(data_list[i]["volume"]["stock_volume"])
calls_volume.append(data_list[i]["volume"]["calls_volume"])
puts_volume.append(data_list[i]["volume"]["puts_volume"])
for i in enumerate(data_list):
date.append(data_list[i[0]]["datetime"])
open.append(data_list[i[0]]["price"]["open"])
high.append(data_list[i[0]]["price"]["high"])
low.append(data_list[i[0]]["price"]["low"])
close.append(data_list[i[0]]["price"]["close"])
volume.append(data_list[i[0]]["volume"]["stock_volume"])
calls_volume.append(data_list[i[0]]["volume"]["calls_volume"])
puts_volume.append(data_list[i[0]]["volume"]["puts_volume"])
total_options_volume.append(
data_list[i]["volume"]["total_options_volume"]
data_list[i[0]]["volume"]["total_options_volume"]
)
data = pd.DataFrame()
data["date"] = pd.to_datetime(date)
data["open"] = open

View File

@@ -1,12 +1,10 @@
"""FMP Income Statement Fetcher."""
from datetime import (
date as dateType,
datetime,
)
from datetime import date as dateType, datetime
from typing import Any, Dict, List, Literal, Optional
from openbb_fmp.utils.helpers import get_data_many
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.income_statement import (
IncomeStatementData,
@@ -14,8 +12,6 @@ from openbb_provider.standard_models.income_statement import (
)
from pydantic import Field, root_validator
from openbb_fmp.utils.helpers import get_data_many
PeriodType = Literal["annual", "quarter"]
@@ -141,7 +137,7 @@ class FMPIncomeStatementFetcher(
"""Return the raw data from the FMP endpoint."""
api_key = credentials.get("fmp_api_key") if credentials else ""
symbol = query.symbol or query.cik
symbol = query.symbol
base_url = "https://financialmodelingprep.com/api/v3"
url = (

View File

@@ -1,11 +1,7 @@
"""Intrinio Options Chains fetcher."""
import concurrent.futures
from datetime import (
date as dateType,
datetime,
timedelta,
)
from datetime import date as dateType, datetime, timedelta
from typing import Any, Dict, List, Optional, Union
import pandas as pd
@@ -313,11 +309,11 @@ class IntrinioOptionsChainsFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
"""Return the raw data from the Intrinio endpoint"""
"""Return the raw data from the Intrinio endpoint."""
api_key = credentials.get("intrinio_api_key") if credentials else ""
data = get_historical_chain_with_greeks(
symbol=query.symbol, date=query.date, api_key=api_key
symbol=query.symbol, date=query.date, api_key=api_key # type: ignore
)
return data.to_dict("records")

View File

@@ -3,6 +3,8 @@
from datetime import datetime
from typing import Any, Dict, List, Optional
from openbb_intrinio.utils.helpers import get_data_one
from openbb_intrinio.utils.references import SOURCES
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.stock_quote import (
StockQuoteData,
@@ -10,9 +12,6 @@ from openbb_provider.standard_models.stock_quote import (
)
from pydantic import Field, validator
from openbb_intrinio.utils.helpers import get_data_one
from openbb_intrinio.utils.references import SOURCES
class IntrinioStockQuoteQueryParams(StockQuoteQueryParams):
"""Intrinio Stock Quote Query.
@@ -92,7 +91,7 @@ class IntrinioStockQuoteData(StockQuoteData):
class IntrinioStockQuoteFetcher(
Fetcher[
IntrinioStockQuoteQueryParams,
List[IntrinioStockQuoteData],
IntrinioStockQuoteData,
]
):
"""Transform the query, extract and transform the data from the Intrinio endpoints."""
@@ -100,7 +99,6 @@ class IntrinioStockQuoteFetcher(
@staticmethod
def transform_query(params: Dict[str, Any]) -> IntrinioStockQuoteQueryParams:
"""Transform the query params."""
return IntrinioStockQuoteQueryParams(**params)
@staticmethod
@@ -110,7 +108,6 @@ class IntrinioStockQuoteFetcher(
**kwargs: Any,
) -> Dict:
"""Return the raw data from the Intrinio endpoint."""
api_key = credentials.get("intrinio_api_key") if credentials else ""
base_url = "https://api-v2.intrinio.com"
@@ -121,7 +118,6 @@ class IntrinioStockQuoteFetcher(
@staticmethod
def transform_data(data: Dict) -> IntrinioStockQuoteData:
"""Return the transformed data."""
del data["messages"]
del data["security"]

View File

@@ -34,7 +34,7 @@ class YFinanceBalanceSheetData(BalanceSheetData):
class YFinanceBalanceSheetFetcher(
Fetcher[
YFinanceBalanceSheetQueryParams,
YFinanceBalanceSheetData,
List[YFinanceBalanceSheetData],
]
):
@staticmethod
@@ -47,7 +47,7 @@ class YFinanceBalanceSheetFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[YFinanceBalanceSheetData]:
query.period = "yearly" if query.period == "annually" else "quarterly"
query.period = "yearly" if query.period == "annually" else "quarterly" # type: ignore
data = Ticker(query.symbol).get_balance_sheet(
as_dict=True, pretty=False, freq=query.period
)

View File

@@ -34,7 +34,7 @@ class YFinanceCashFlowStatementData(CashFlowStatementData):
class YFinanceCashFlowStatementFetcher(
Fetcher[
YFinanceCashFlowStatementQueryParams,
YFinanceCashFlowStatementData,
List[YFinanceCashFlowStatementData],
]
):
@staticmethod
@@ -47,7 +47,7 @@ class YFinanceCashFlowStatementFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[YFinanceCashFlowStatementData]:
query.period = "yearly" if query.period == "annually" else "quarterly"
query.period = "yearly" if query.period == "annually" else "quarterly" # type: ignore
data = Ticker(query.symbol).get_cash_flow(
as_dict=True, pretty=False, freq=query.period
)

View File

@@ -7,8 +7,6 @@ from sys import exc_info
from time import perf_counter_ns
from typing import Any, Callable, ContextManager, Dict, List, Optional, Tuple, Union
from pydantic import BaseConfig, Extra, create_model
from openbb_core.app.charting_service import ChartingService
from openbb_core.app.logs.logging_service import LoggingService
from openbb_core.app.model.abstract.error import OpenBBError
@@ -22,6 +20,7 @@ from openbb_core.app.router import CommandMap
from openbb_core.app.service.system_service import SystemService
from openbb_core.app.service.user_service import UserService
from openbb_core.env import Env
from pydantic import BaseConfig, Extra, create_model
class ExecutionContext:
@@ -151,7 +150,7 @@ class ParametersBuilder:
)
if route_default:
return route_default.get("provider", None) or command_cov_provider
return route_default.get("provider", None) or command_cov_provider # type: ignore
return command_cov_provider

View File

@@ -17,11 +17,6 @@ from typing import (
from fastapi import APIRouter, Depends
from importlib_metadata import entry_points
from pydantic import BaseModel
from pydantic.config import BaseConfig
from pydantic.validators import find_validators
from typing_extensions import Annotated, ParamSpec, _AnnotatedAlias
from openbb_core.app.model.abstract.warning import OpenBBWarning
from openbb_core.app.model.command_context import CommandContext
from openbb_core.app.model.obbject import OBBject
@@ -32,6 +27,10 @@ from openbb_core.app.provider_interface import (
StandardParams,
)
from openbb_core.env import Env
from pydantic import BaseModel
from pydantic.config import BaseConfig
from pydantic.validators import find_validators
from typing_extensions import Annotated, ParamSpec, _AnnotatedAlias
P = ParamSpec("P")
@@ -292,7 +291,7 @@ class SignatureInspector:
Also updates __name__ and __doc__ for API schemas."""
ReturnModel = inner_type
if get_origin(outer_type) == list:
ReturnModel = List[inner_type]
ReturnModel = List[inner_type] # type: ignore
return_type = OBBject[ReturnModel] # type: ignore
return_type.__name__ = f"OBBject[{inner_type.__name__}]"