Skip to content

Commit

Permalink
[Feature] Add Intrinio to obb.equity.market_snapshots() (#6232)
Browse files Browse the repository at this point in the history
* add intrinio to equity market snapshots

* field definitions

* map date

* static files

* black

* date check

* test cassette

* pylint

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
  • Loading branch information
deeleeramone and IgorWounds authored Mar 18, 2024
1 parent c5c7ade commit 9dcad44
Show file tree
Hide file tree
Showing 9 changed files with 4,775 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,8 @@ def test_equity_darkpool_otc(params, headers):
"params",
[
({"provider": "fmp", "market": "euronext"}),
# ({"provider": "polygon"}), # premium endpoint
({"provider": "polygon"}),
({"provider": "intrinio", "date": "2022-06-30"}),
],
)
@pytest.mark.integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,8 @@ def test_equity_darkpool_otc(params, obb):
"params",
[
({"provider": "fmp", "market": "euronext"}),
# ({"provider": "polygon"}), # premium endpoint
({"provider": "polygon"}),
({"provider": "intrinio", "date": "2022-06-30"}),
],
)
@pytest.mark.integration
Expand Down
85 changes: 83 additions & 2 deletions openbb_platform/openbb/assets/reference.json
Original file line number Diff line number Diff line change
Expand Up @@ -18912,7 +18912,7 @@
"standard": [
{
"name": "provider",
"type": "Literal['fmp', 'polygon']",
"type": "Literal['fmp', 'intrinio', 'polygon']",
"description": "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.",
"default": "fmp",
"optional": true
Expand All @@ -18927,6 +18927,15 @@
"optional": true
}
],
"intrinio": [
{
"name": "date",
"type": "Union[Union[date, datetime, str], str]",
"description": "The date of the data. Can be a datetime or an ISO datetime string. Historical data appears to go back to mid-June 2022. Example: '2024-03-08T12:15:00+0400'",
"default": null,
"optional": true
}
],
"polygon": []
},
"returns": {
Expand All @@ -18938,7 +18947,7 @@
},
{
"name": "provider",
"type": "Optional[Literal['fmp', 'polygon']]",
"type": "Optional[Literal['fmp', 'intrinio', 'polygon']]",
"description": "Provider name."
},
{
Expand Down Expand Up @@ -19124,6 +19133,78 @@
"optional": true
}
],
"intrinio": [
{
"name": "last_price",
"type": "float",
"description": "The last trade price.",
"default": null,
"optional": true
},
{
"name": "last_size",
"type": "int",
"description": "The last trade size.",
"default": null,
"optional": true
},
{
"name": "last_volume",
"type": "int",
"description": "The last trade volume.",
"default": null,
"optional": true
},
{
"name": "last_trade_timestamp",
"type": "datetime",
"description": "The timestamp of the last trade.",
"default": null,
"optional": true
},
{
"name": "bid_size",
"type": "int",
"description": "The size of the last bid price. Bid price and size is not always available.",
"default": null,
"optional": true
},
{
"name": "bid_price",
"type": "float",
"description": "The last bid price. Bid price and size is not always available.",
"default": null,
"optional": true
},
{
"name": "ask_price",
"type": "float",
"description": "The last ask price. Ask price and size is not always available.",
"default": null,
"optional": true
},
{
"name": "ask_size",
"type": "int",
"description": "The size of the last ask price. Ask price and size is not always available.",
"default": null,
"optional": true
},
{
"name": "last_bid_timestamp",
"type": "datetime",
"description": "The timestamp of the last bid price. Bid price and size is not always available.",
"default": null,
"optional": true
},
{
"name": "last_ask_timestamp",
"type": "datetime",
"description": "The timestamp of the last ask price. Ask price and size is not always available.",
"default": null,
"optional": true
}
],
"polygon": [
{
"name": "vwap",
Expand Down
40 changes: 29 additions & 11 deletions openbb_platform/openbb/package/equity.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def fundamental(self):
def market_snapshots(
self,
provider: Annotated[
Optional[Literal["fmp", "polygon"]],
Optional[Literal["fmp", "intrinio", "polygon"]],
OpenBBCustomParameter(
description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'fmp' if there is\n no default."
),
Expand All @@ -88,19 +88,21 @@ def market_snapshots(
Parameters
----------
provider : Optional[Literal['fmp', 'polygon']]
provider : Optional[Literal['fmp', 'intrinio', '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.
market : Literal['amex', 'ams', 'ase', 'asx', 'ath', 'bme', 'bru', 'bud', 'bue', 'cai', 'cnq', 'cph', 'dfm', 'doh', 'etf', 'euronext', 'hel', 'hkse', 'ice', 'iob', 'ist', 'jkt', 'jnb', 'jpx', 'kls', 'koe', 'ksc', 'kuw', 'lse', 'mex', 'mutual_fund', 'nasdaq', 'neo', 'nse', 'nyse', 'nze', 'osl', 'otc', 'pnk', 'pra', 'ris', 'sao', 'sau', 'set', 'sgo', 'shh', 'shz', 'six', 'sto', 'tai', 'tlv', 'tsx', 'two', 'vie', 'wse', 'xetra']
The market to fetch data for. (provider: fmp)
date : Optional[Union[datetime.date, datetime.datetime, str]]
The date of the data. Can be a datetime or an ISO datetime string. Historical data appears to go back to mid-June 2022. Example: '2024-03-08T12:15:00+0400' (provider: intrinio)
Returns
-------
OBBject
results : List[MarketSnapshots]
Serializable results.
provider : Optional[Literal['fmp', 'polygon']]
provider : Optional[Literal['fmp', 'intrinio', 'polygon']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
Expand Down Expand Up @@ -130,7 +132,8 @@ def market_snapshots(
change_percent : Optional[float]
The change in price from the previous close, as a normalized percent.
last_price : Optional[float]
The last price of the stock. (provider: fmp)
The last price of the stock. (provider: fmp);
The last trade price. (provider: intrinio)
last_price_timestamp : Optional[Union[date, datetime]]
The timestamp of the last price. (provider: fmp)
ma50 : Optional[float]
Expand All @@ -157,6 +160,27 @@ def market_snapshots(
The exchange of the stock. (provider: fmp)
earnings_date : Optional[Union[date, datetime]]
The upcoming earnings announcement date. (provider: fmp)
last_size : Optional[int]
The last trade size. (provider: intrinio)
last_volume : Optional[int]
The last trade volume. (provider: intrinio)
last_trade_timestamp : Optional[datetime]
The timestamp of the last trade. (provider: intrinio);
The last trade timestamp. (provider: polygon)
bid_size : Optional[int]
The size of the last bid price. Bid price and size is not always available. (provider: intrinio);
The current bid size. (provider: polygon)
bid_price : Optional[float]
The last bid price. Bid price and size is not always available. (provider: intrinio)
ask_price : Optional[float]
The last ask price. Ask price and size is not always available. (provider: intrinio)
ask_size : Optional[int]
The size of the last ask price. Ask price and size is not always available. (provider: intrinio);
The current ask size. (provider: polygon)
last_bid_timestamp : Optional[datetime]
The timestamp of the last bid price. Bid price and size is not always available. (provider: intrinio)
last_ask_timestamp : Optional[datetime]
The timestamp of the last ask price. Ask price and size is not always available. (provider: intrinio)
vwap : Optional[float]
The volume weighted average price of the stock on the current trading day. (provider: polygon)
prev_open : Optional[float]
Expand All @@ -173,10 +197,6 @@ def market_snapshots(
The last time the data was updated. (provider: polygon)
bid : Optional[float]
The current bid price. (provider: polygon)
bid_size : Optional[int]
The current bid size. (provider: polygon)
ask_size : Optional[int]
The current ask size. (provider: polygon)
ask : Optional[float]
The current ask price. (provider: polygon)
quote_timestamp : Optional[datetime]
Expand All @@ -189,8 +209,6 @@ def market_snapshots(
The last trade condition codes. (provider: polygon)
last_trade_exchange : Optional[int]
The last trade exchange ID code. (provider: polygon)
last_trade_timestamp : Optional[datetime]
The last trade timestamp. (provider: polygon)
Examples
--------
Expand All @@ -205,7 +223,7 @@ def market_snapshots(
"provider": self._get_provider(
provider,
"/equity/market_snapshots",
("fmp", "polygon"),
("fmp", "intrinio", "polygon"),
)
},
standard_params={},
Expand Down
8 changes: 6 additions & 2 deletions openbb_platform/openbb/package/equity_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ def performance(
PricePerformance
----------------
symbol : Optional[str]
Symbol representing the entity requested in the data.
one_day : Optional[float]
One-day return.
wtd : Optional[float]
Expand All @@ -374,16 +376,18 @@ def performance(
Year to date return.
one_year : Optional[float]
One-year return.
two_year : Optional[float]
Two-year return.
three_year : Optional[float]
Three-year return.
four_year : Optional[float]
Four-year
five_year : Optional[float]
Five-year return.
ten_year : Optional[float]
Ten-year return.
max : Optional[float]
Return from the beginning of the time series.
symbol : Optional[str]
The ticker symbol. (provider: fmp)
Examples
--------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
# )
from openbb_intrinio.models.key_metrics import IntrinioKeyMetricsFetcher
from openbb_intrinio.models.latest_attributes import IntrinioLatestAttributesFetcher
from openbb_intrinio.models.market_snapshots import IntrinioMarketSnapshotsFetcher
from openbb_intrinio.models.options_chains import IntrinioOptionsChainsFetcher
from openbb_intrinio.models.options_unusual import IntrinioOptionsUnusualFetcher
from openbb_intrinio.models.reported_financials import IntrinioReportedFinancialsFetcher
Expand Down Expand Up @@ -76,6 +77,7 @@
"KeyMetrics": IntrinioKeyMetricsFetcher,
"LatestAttributes": IntrinioLatestAttributesFetcher,
"MarketIndices": IntrinioIndexHistoricalFetcher,
"MarketSnapshots": IntrinioMarketSnapshotsFetcher,
"OptionsChains": IntrinioOptionsChainsFetcher,
"OptionsUnusual": IntrinioOptionsUnusualFetcher,
"ReportedFinancials": IntrinioReportedFinancialsFetcher,
Expand Down
Loading

0 comments on commit 9dcad44

Please sign in to comment.