-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add Historical Market Cap (#6603)
* add historical market cap * add to equity view * chart things * raise not return * pass all kwargs to line_chart * tests.. * docstring * static assets * black * chart integration test --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
- Loading branch information
1 parent
d5dfe84
commit 4500132
Showing
14 changed files
with
670 additions
and
16 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
openbb_platform/core/openbb_core/provider/standard_models/historical_market_cap.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Historical Market Cap Model.""" | ||
|
||
from datetime import date as dateType | ||
from typing import Optional, 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 HistoricalMarketCapQueryParams(QueryParams): | ||
"""Historical Market Cap Query.""" | ||
|
||
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) | ||
start_date: Optional[dateType] = Field( | ||
default=None, description=QUERY_DESCRIPTIONS.get("start_date", "") | ||
) | ||
end_date: Optional[dateType] = Field( | ||
default=None, description=QUERY_DESCRIPTIONS.get("end_date", "") | ||
) | ||
|
||
@field_validator("symbol", mode="before", check_fields=False) | ||
@classmethod | ||
def to_upper(cls, v: str) -> str: | ||
"""Convert field to uppercase.""" | ||
return v.upper() | ||
|
||
|
||
class HistoricalMarketCapData(Data): | ||
"""Historical Market Cap Data.""" | ||
|
||
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) | ||
symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) | ||
market_cap: Union[int, float] = Field( | ||
description="Market capitalization of the security.", | ||
json_schema_extra={"x-unit_measurement": "currency"}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.