summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-01-22 07:17:42 -0800
committerGitHub <noreply@github.com>2024-01-22 15:17:42 +0000
commite2f7e597fa51cbadc143a42e7955e3840ae3badd (patch)
treeb8e307c14c9e776e542a60dbd0a5c8790869bf6a
parenta9b4d2070faab977e9784a457afc195fc1a513e2 (diff)
feature/cboe-async: Refactor Cboe for Async (#5900)
* refactor cboe for async * codespell * unused imports * pylint * more pylint * platform metadata * classmethod decorator * test params * intrinio quote * test param names * date in test needs to be a datetime.date not string * make fmp unix timestamp tz-aware and normalize percent change * different way of parsing datetime string * recapture cboe equity historical test * unused import * index snapshot update * black * extension map * pylint * cboe pyproject.toml * proposal to standardize equity_quote * one more file * removing changes on static assets * index_historical * index_historical again * last_time -> last_timestamp * obsolete router path * fix tests * test param * restore market index deprecation that I forgot about * fixing tests --------- Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/equity_historical.py25
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/european_index_constituents.py50
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/european_indices.py44
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/index_constituents.py31
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/index_snapshots.py18
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/options_chains.py120
-rw-r--r--openbb_platform/extensions/derivatives/integration/test_derivatives_api.py4
-rw-r--r--openbb_platform/extensions/derivatives/integration/test_derivatives_python.py5
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_api.py5
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_python.py5
-rw-r--r--openbb_platform/extensions/index/integration/test_index_api.py81
-rw-r--r--openbb_platform/extensions/index/integration/test_index_python.py81
-rw-r--r--openbb_platform/extensions/index/openbb_index/index_router.py22
-rw-r--r--openbb_platform/poetry.lock48
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/__init__.py23
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/available_indices.py41
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/equity_historical.py319
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/equity_info.py140
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/equity_quote.py244
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/equity_search.py15
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/european_index_constituents.py116
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/european_indices.py142
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/futures_curve.py19
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/index_constituents.py130
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/index_historical.py286
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/index_search.py48
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/index_snapshots.py188
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/market_indices.py211
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/options_chains.py108
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/utils/helpers.py452
-rw-r--r--openbb_platform/providers/cboe/poetry.lock1052
-rw-r--r--openbb_platform/providers/cboe/pyproject.toml3
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_available_indices_fetcher.yaml1174
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_equity_historical_fetcher.yaml6018
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_equity_info_fetcher.yaml114
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_equity_quote_fetcher.yaml2255
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_equity_search_fetcher.yaml3027
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_european_index_constituents_fetcher.yaml424
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_european_indices_fetcher.yaml504
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_futures_curve_fetcher.yaml148
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_index_constituents_fetcher.yaml177
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_index_historical_fetcher.yaml1163
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_index_search_fetcher.yaml1178
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_index_snapshots_fetcher.yaml710
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_market_indices_fetcher.yaml346
-rw-r--r--openbb_platform/providers/cboe/tests/record/http/test_cboe_fetchers/test_cboe_options_chains_fetcher.yaml8236
-rw-r--r--openbb_platform/providers/cboe/tests/test_cboe_fetchers.py110
-rw-r--r--openbb_platform/providers/fmp/openbb_fmp/models/index_constituents.py42
-rw-r--r--openbb_platform/providers/intrinio/openbb_intrinio/models/options_chains.py52
-rw-r--r--openbb_platform/providers/intrinio/tests/record/http/test_intrinio_fetchers/test_intrinio_options_chains_fetcher.yaml5923
-rw-r--r--openbb_platform/providers/intrinio/tests/test_intrinio_fetchers.py2
-rw-r--r--website/content/platform/data_models/EuropeanIndexConstituents.md80
-rw-r--r--website/content/platform/data_models/EuropeanIndices.md79
-rw-r--r--website/metadata/platform_v4_seo_metadata.json47
54 files changed, 17524 insertions, 18361 deletions
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/equity_historical.py b/openbb_platform/core/openbb_core/provider/standard_models/equity_historical.py
index 1b2bf5e8b0f..d7463769c7c 100644
--- a/openbb_platform/core/openbb_core/provider/standard_models/equity_historical.py
+++ b/openbb_platform/core/openbb_core/provider/standard_models/equity_historical.py
@@ -8,7 +8,7 @@ from datetime import (
from typing import List, Optional, Set, Union
from dateutil import parser
-from pydantic import Field, PositiveFloat, field_validator
+from pydantic import Field, field_validator
from openbb_core.provider.abstract.data import Data
from openbb_core.provider.abstract.query_params import QueryParams
@@ -47,17 +47,24 @@ class EquityHistoricalQueryParams(QueryParams):
class EquityHistoricalData(Data):
"""Equity Historical Price Data."""
- date: datetime = Field(description=DATA_DESCRIPTIONS.get("date", ""))
- open: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("open", ""))
- high: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("high", ""))
- low: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("low", ""))
- close: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("close", ""))
- volume: Union[float, int] = Field(description=DATA_DESCRIPTIONS.get("volume", ""))
- vwap: Optional[PositiveFloat] = Field(
+ date: Union[dateType, datetime] = Field(
+ description=DATA_DESCRIPTIONS.get("date", "")
+ )
+ open: float = Field(description=DATA_DESCRIPTIONS.get("open", ""))
+ high: float = Field(description=DATA_DESCRIPTIONS.get("high", ""))
+ low: float = Field(description=DATA_DESCRIPTIONS.get("low", ""))
+ close: float = Field(description=DATA_DESCRIPTIONS.get("close", ""))
+ volume: Optional[Union[float, int]] = Field(
+ default=None, description=DATA_DESCRIPTIONS.get("volume", "")
+ )
+ vwap: Optional[float] = Field(
default=None, description=DATA_DESCRIPTIONS.get("vwap", "")
)
@field_validator("date", mode="before", check_fields=False)
def date_validate(cls, v): # pylint: disable=E0213
"""Return formatted datetime."""
- return parser.isoparse(str(v))
+ v = parser.isoparse(str(v))
+ if v.hour == 0 and v.minute == 0:
+ return v.date()
+ return v
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/european_index_constituents.py b/openbb_platform/core/openbb_core/provider/standard_models/european_index_constituents.py
deleted file mode 100644
index 94c00eff908..00000000000
--- a/openbb_platform/core/openbb_core/provider/standard_models/european_index_constituents.py
+++ /dev/null
@@ -1,50 +0,0 @@
-"""European Index Constituents Standard Model."""
-
-
-from typing import List, Set, Union
-
-from pydantic import Field, field_validator
-
-from openbb_core.provider.abstract.data import Data
-from openbb_core.provider.abstract.query_params import QueryParams
-from openbb_core.provider.utils.descriptions import (
- DATA_DESCRIPTIONS,
- QUERY_DESCRIPTIONS,
-)
-
-
-class EuropeanIndexConstituentsQueryParams(QueryParams):
- """European Index Constituents Query."""
-
- symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
-
- @field_validator("symbol", mode="before", check_fields=False)
- def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
- """Convert symbol to uppercase."""
- if isinstance(v, str):
- return v.upper()
- return ",".join([symbol.upper() for symbol in list(v)])
-
-
-class EuropeanIndexConstituentsData(Data):
- """European Index Constituents Data."""
-
- symbol: str = Field(
- description=DATA_DESCRIPTIONS.get("symbol", "")
- + " The symbol is the constituent company in the index."
- )
- price: float = Field(
- description="Current price of the constituent company in the index."
- )
- open: float = Field(description=DATA_DESCRIPTIONS.get("open", ""))
- high: float = Field(description=DATA_DESCRIPTIONS.get("high", ""))
- low: float = Field(description=DATA_DESCRIPTIONS.get("low", ""))
- close: float = Field(description=DATA_DESCRIPTIONS.get("close", ""))
- volume: float = Field(description=DATA_DESCRIPTIONS.get("volume", ""))
-
- @field_validator("symbol", mode="before", check_fields=False)
- def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
- """Convert symbol to uppercase."""
- if isinstance(v, str):
- return v.upper()
- return ",".join([symbol.upper() for symbol in list(v)])
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/european_indices.py b/openbb_platform/core/openbb_core/provider/standard_models/european_indices.py
deleted file mode 100644
index aef7d5f7f4f..00000000000
--- a/openbb_platform/core/openbb_core/provider/standard_models/european_indices.py
+++ /dev/null
@@ -1,44 +0,0 @@
-"""European Indices Standard Model."""
-
-
-from datetime import (
- date as dateType,
- datetime,
-)
-from typing import List, Optional, Set, Union
-
-from pydantic import Field, field_validator
-
-from openbb_core.provider.abstract.data import Data
-from openbb_core.provider.abstract.query_params import QueryParams
-from openbb_core.provider.utils.descriptions import (
- DATA_DESCRIPTIONS,
- QUERY_DESCRIPTIONS,
-)
-
-
-class EuropeanIndicesQueryParams(QueryParams):
- """European Indices Query."""
-
- symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
- start_date: Optional[dateType] = Field(
- description=QUERY_DESCRIPTIONS.get("start_date", ""), default=None
- )
- end_date: Optional[dateType] = Field(
- description=QUERY_DESCRIPTIONS.get("end_date", ""), default=None
- )
-
- @field_validator("symbol", mode="before", check_fields=False)
- @classmethod
- def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
- """Convert symbol to uppercase."""
- if isinstance(v, str):
- return v.upper()
- return ",".join([symbol.upper() for symbol in list(v)])
-
-
-class EuropeanIndicesData(Data):
- """European Indices Data."""
-
- date: datetime = Field(description=DATA_DESCRIPTIONS.get("date", ""))
- close: float = Field(description=DATA_DESCRIPTIONS.get("close", ""))
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/index_constituents.py b/openbb_platform/core/openbb_core/provider/standard_models/index_constituents.py
index 8b336eebc03..a29ca427c95 100644
--- a/openbb_platform/core/openbb_core/provider/standard_models/index_constituents.py
+++ b/openbb_platform/core/openbb_core/provider/standard_models/index_constituents.py
@@ -1,8 +1,7 @@
"""Index Constituents Standard Model."""
-from datetime import date
-from typing import List, Literal, Optional, Set, Union
+from typing import List, Optional, Set, Union
from pydantic import Field, field_validator
@@ -14,9 +13,8 @@ from openbb_core.provider.utils.descriptions import DATA_DESCRIPTIONS
class IndexConstituentsQueryParams(QueryParams):
"""Index Constituents Query."""
- index: Literal["nasdaq", "sp500", "dowjones"] = Field(
- default="dowjones",
- description="Index for which we want to fetch the constituents.",
+ index: str = Field(
+ description="Index to fetch the constituents of.",
)
@@ -24,27 +22,8 @@ class IndexConstituentsData(Data):
"""Index Constituents Data."""
symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", ""))
- name: str = Field(description="Name of the constituent company in the index.")
- sector: str = Field(
- description="Sector the constituent company in the index belongs to."
- )
- sub_sector: Optional[str] = Field(
- default=None,
- description="Sub-sector the constituent company in the index belongs to.",
- )
- headquarter: Optional[str] = Field(
- default=None,
- description="Location of the headquarter of the constituent company in the index.",
- )
- date_first_added: Optional[Union[date, str]] = Field(
- default=None, description="Date the constituent company was added to the index."
- )
- cik: int = Field(
- description=DATA_DESCRIPTIONS.get("cik", ""),
- )
- founded: Optional[Union[date, str]] = Field(
- default=None,
- description="Founding year of the constituent company in the index.",
+ name: Optional[str] = Field(
+ default=None, description="Name of the constituent company in the index."
)
@field_validator("symbol", mode="before", check_fields=False)
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/index_snapshots.py b/openbb_platform/core/openbb_core/provider/standard_models/index_snapshots.py
index bf5fac3a991..faba0cf1f4c 100644
--- a/openbb_platform/core/openbb_core/provider/standard_models/index_snapshots.py
+++ b/openbb_platform/core/openbb_core/provider/standard_models/index_snapshots.py
@@ -1,6 +1,6 @@
"""Index Snapshots Standard Model."""
-from typing import Literal, Optional
+from typing import Optional
from pydantic import Field
@@ -12,8 +12,8 @@ from openbb_core.provider.utils.descriptions import DATA_DESCRIPTIONS
class IndexSnapshotsQueryParams(QueryParams):
"""Index Snapshots Query."""
- region: Optional[Literal["US", "EU"]] = Field(
- description="The region to return. Currently supports US and EU.", default="US"
+ region: Optional[str] = Field(
+ default=None, description="The region to return data for - i.e. 'us' or 'eu'."
)
@@ -38,10 +38,16 @@ class IndexSnapshotsData(Data):
close: Optional[float] = Field(
default=None, description=DATA_DESCRIPTIONS.get("close", "")
)
+ volume: Optional[int] = Field(
+ default=None, description=DATA_DESCRIPTIONS.get("volume", "")
+ )
prev_close: Optional[float] = Field(
- default=None, description="Previous closing price of the index."
+ default=None, description=DATA_DESCRIPTIONS.get("prev_close", "")
+ )
+ change: Optional[float] = Field(
+ default=None, description="Change in value of the index."
)
- change: Optional[float] = Field(default=None, description="Change of the index.")
change_percent: Optional[float] = Field(
- default=None, description="Change percent of the index."
+ default=None,
+ description="Change, in normalized percentage points, of the index.",
)
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/options_chains.py b/openbb_platform/core/openbb_core/provider/standard_models/options_chains.py
index 6eec3e1bbe1..a0a9ef7e25b 100644
--- a/openbb_platform/core/openbb_core/provider/standard_models/options_chains.py
+++ b/openbb_platform/core/openbb_core/provider/standard_models/options_chains.py
@@ -1,6 +1,9 @@
"""Options Chains Standard Model."""
-from datetime import date as dateType
+from datetime import (
+ date as dateType,
+ datetime,
+)
from typing import List, Optional, Set, Union
from pydantic im