Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disc endpoints #5660

Merged
merged 14 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions openbb_platform/dev_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
openbb-fmp = { path = "./providers/fmp", develop = true }
openbb-fred = { path = "./providers/fred", develop = true }
openbb-intrinio = { path = "./providers/intrinio", develop = true }
openbb-polygon = { path = "./providers/polygon", develop = true }
openbb-wsj = { path = "./providers/wsj", develop = true }
openbb-tradingeconomics = { path = "./providers/tradingeconomics", develop = true }
openbb-oecd = { path = "./providers/oecd", develop = true }
openbb-polygon = { path = "./providers/polygon", develop = true }
openbb-sec = { path = "./providers/sec", develop = true }
openbb-tradingeconomics = { path = "./providers/tradingeconomics", develop = true }
openbb-wsj = { path = "./providers/wsj", develop = true }

openbb-crypto = { path = "./extensions/crypto", develop = true }
openbb-economy = { path = "./extensions/economy", develop = true }
Expand All @@ -42,6 +42,7 @@
openbb-cboe = { path = "./providers/cboe", optional = true, develop = true }
openbb-nasdaq = { path = "./providers/nasdaq", optional = true, develop = true }
openbb-quandl = { path = "./providers/quandl", optional = true, develop = true }
openbb-seeking-alpha = { path = "./providers/seeking_alpha", optional = true, develop = true }
openbb-yfinance = { path = "./providers/yfinance", optional = true, develop = true }

openbb-charting = { path = "./extensions/charting", optional = true, develop = true }
Expand Down
45 changes: 45 additions & 0 deletions openbb_platform/extensions/stocks/integration/test_stocks_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,3 +1141,48 @@ def test_stocks_disc_growth_tech_equities(params, headers):
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"limit": 10, "provider": "nasdaq"})],
)
@pytest.mark.integration
def test_stocks_disc_top_retail(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/stocks/disc/top_retail?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"limit": 5, "start_date": "2023-01-01"})],
)
@pytest.mark.integration
def test_stocks_disc_upcoming_release_days(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/stocks/disc/upcoming_release_days?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200


@pytest.mark.parametrize(
"params",
[({"pages": 1, "limit": 5, "today": True, "provider": "fmp"})],
)
@pytest.mark.integration
def test_stocks_disc_filings(params, headers):
params = {p: v for p, v in params.items() if v}

query_str = get_querystring(params, [])
url = f"http://0.0.0.0:8000/api/v1/stocks/disc/filings?{query_str}"
result = requests.get(url, headers=headers, timeout=10)
assert isinstance(result, requests.Response)
assert result.status_code == 200
Original file line number Diff line number Diff line change
Expand Up @@ -1071,3 +1071,45 @@ def test_stocks_disc_growth_tech_equities(params, obb):
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"limit": 10})],
)
@pytest.mark.integration
def test_stocks_disc_top_retail(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.stocks.disc.top_retail(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"limit": 5, "start_date": "2023-01-01"})],
)
@pytest.mark.integration
def test_stocks_disc_upcoming_release_days(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.stocks.disc.upcoming_release_days(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0


@pytest.mark.parametrize(
"params",
[({"pages": 1, "limit": 5, "today": True})],
)
@pytest.mark.integration
def test_stocks_disc_filings(params, obb):
params = {p: v for p, v in params.items() if v}

result = obb.stocks.disc.filings(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Disc router for Equities."""
# pylint: disable=unused-argument
from openbb_core.app.model.command_context import CommandContext
from openbb_core.app.model.obbject import OBBject
from openbb_core.app.provider_interface import (
Expand Down Expand Up @@ -88,3 +89,40 @@ def growth_tech_equities(
) -> OBBject[BaseModel]:
"""Get growth tech Equities."""
return OBBject(results=Query(**locals()).execute())


@router.command(model="TopRetail")
def top_retail(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Tracks over $30B USD/day of individual investors trades.

It gives a daily view into retail activity and sentiment for over 9,500 US traded stocks,
ADRs, and ETPs.
"""
return OBBject(results=Query(**locals()).execute())


@router.command(model="UpcomingReleaseDays")
def upcoming_release_days(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Get upcoming release days."""
return OBBject(results=Query(**locals()).execute())


@router.command(model="DiscFilings")
def filings(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Get the most-recent filings submitted to the SEC."""
return OBBject(results=Query(**locals()).execute())
50 changes: 37 additions & 13 deletions openbb_platform/openbb/package/__extensions__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###


from openbb_core.app.static.container import Container

from openbb_core.app.model.obbject import OBBject
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
import openbb_provider
import pandas
import datetime
import pydantic
from pydantic import BaseModel
from inspect import Parameter
import typing
from typing import List, Dict, Union, Optional, Literal
from annotated_types import Ge, Le, Gt, Lt
import typing_extensions
from openbb_core.app.utils import df_to_basemodel
from openbb_core.app.static.decorators import validate

from openbb_core.app.static.filters import filter_inputs

from openbb_provider.abstract.data import Data

class Extensions(Container):
# fmt: off
Expand All @@ -11,24 +27,28 @@ class Extensions(Container):
/crypto
/econometrics
/economy
/etf
/fixedincome
/forex
/futures
/news
/qa
/regulators
/stocks
/ta

Extensions:
- crypto@0.1.0a4
- econometrics@0.1.0a4
- economy@0.1.0a4
- etf@0.1.0a3
- fixedincome@0.1.0a4
- forex@0.1.0a4
- futures@0.1.0a4
- news@0.1.0a4
- openbb_charting@0.1.0a4
- qa@0.1.0a4
- regulators@0.1.0a4
- stocks@0.1.0a4
- ta@0.1.0a4

Expand All @@ -39,71 +59,75 @@ class Extensions(Container):
- fmp@0.1.0a4
- fred@0.1.0a4
- intrinio@0.1.0a4
- nasdaq@0.1.0a4
- oecd@0.1.0a4
- polygon@0.1.0a4
- quandl@0.1.0a4
- sec@0.1.0a4
- seeking_alpha@0.1.0a4
- tradingeconomics@0.1.0a4
- wsj@0.1.0a4
- yfinance@0.1.0a4 """
# fmt: on
# fmt: on
def __repr__(self) -> str:
return self.__doc__ or ""

@property
def crypto(self): # route = "/crypto"
from . import crypto

return crypto.ROUTER_crypto(command_runner=self._command_runner)

@property
def econometrics(self): # route = "/econometrics"
from . import econometrics

return econometrics.ROUTER_econometrics(command_runner=self._command_runner)

@property
def economy(self): # route = "/economy"
from . import economy

return economy.ROUTER_economy(command_runner=self._command_runner)

@property
def etf(self): # route = "/etf"
from . import etf
return etf.ROUTER_etf(command_runner=self._command_runner)

@property
def fixedincome(self): # route = "/fixedincome"
from . import fixedincome

return fixedincome.ROUTER_fixedincome(command_runner=self._command_runner)

@property
def forex(self): # route = "/forex"
from . import forex

return forex.ROUTER_forex(command_runner=self._command_runner)

@property
def futures(self): # route = "/futures"
from . import futures

return futures.ROUTER_futures(command_runner=self._command_runner)

@property
def news(self): # route = "/news"
from . import news

return news.ROUTER_news(command_runner=self._command_runner)

@property
def qa(self): # route = "/qa"
from . import qa

return qa.ROUTER_qa(command_runner=self._command_runner)

@property
def regulators(self): # route = "/regulators"
from . import regulators
return regulators.ROUTER_regulators(command_runner=self._command_runner)

@property
def stocks(self): # route = "/stocks"
from . import stocks

return stocks.ROUTER_stocks(command_runner=self._command_runner)

@property
def ta(self): # route = "/ta"
from . import ta

return ta.ROUTER_ta(command_runner=self._command_runner)
Loading
Loading