Skip to content

Commit

Permalink
Add tests for provider (#5583)
Browse files Browse the repository at this point in the history
* Add tests for provider

* Test standard models

* Lint

* Fix standard model issues.

Co-authored-by: @the-praxs

* linting

* `symbol` -> `is_symbol` in `economy.index_search`

* static

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
  • Loading branch information
IgorWounds and the-praxs committed Oct 19, 2023
1 parent bbd530e commit f69868d
Show file tree
Hide file tree
Showing 91 changed files with 886 additions and 476 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,8 @@ def test_economy_risk(params, headers):
@pytest.mark.parametrize(
"params",
[
({"query": "D", "symbol": True, "provider": "cboe"}),
(
{
"europe": True,
"provider": "cboe",
"query": "A",
"symbol": False,
}
),
({"query": "D", "is_symbol": True, "provider": "cboe"}),
({"europe": True, "provider": "cboe", "query": "A", "is_symbol": False}),
],
)
@pytest.mark.integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,8 @@ def test_economy_risk(params, obb):
@pytest.mark.parametrize(
"params",
[
({"query": "D", "symbol": True}),
(
{
"europe": True,
"provider": "cboe",
"query": "A",
"symbol": False,
}
),
({"query": "D", "is_symbol": True}),
({"europe": True, "provider": "cboe", "query": "A", "is_symbol": False}),
],
)
@pytest.mark.integration
Expand Down
19 changes: 1 addition & 18 deletions openbb_platform/openbb/package/__extensions__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
### 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):
Expand Down
26 changes: 7 additions & 19 deletions openbb_platform/openbb/package/crypto.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
### 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
from typing import List, Literal, Union

import typing_extensions
from openbb_core.app.utils import df_to_basemodel
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.model.obbject import OBBject
from openbb_core.app.static.container import Container
from openbb_core.app.static.decorators import validate

from openbb_core.app.static.filters import filter_inputs

from openbb_provider.abstract.data import Data
import openbb_core.app.model.command_context
import openbb_core.app.model.obbject
import types


class ROUTER_crypto(Container):
Expand All @@ -38,7 +26,7 @@ def load(
symbol: typing_extensions.Annotated[
Union[str, List[str]],
OpenBBCustomParameter(
description="Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format."
description="Symbol to get data for. Can use CURR1-CURR2 or CURR1CURR2 format."
),
],
start_date: typing_extensions.Annotated[
Expand All @@ -61,7 +49,7 @@ def load(
Parameters
----------
symbol : str
Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format.
Symbol to get data for. Can use CURR1-CURR2 or CURR1CURR2 format.
start_date : Union[datetime.date, None]
Start date of the data, in YYYY-MM-DD format.
end_date : Union[datetime.date, None]
Expand Down
21 changes: 5 additions & 16 deletions openbb_platform/openbb/package/econometrics.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
### 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
from typing import Dict, List, Literal, Union

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 annotated_types import Gt
from openbb_core.app.model.obbject import OBBject
from openbb_core.app.static.container import Container
from openbb_core.app.static.decorators import validate

from openbb_core.app.static.filters import filter_inputs

from openbb_provider.abstract.data import Data
import openbb_core.app.model.obbject
import typing


class ROUTER_econometrics(Container):
Expand Down
72 changes: 30 additions & 42 deletions openbb_platform/openbb/package/economy.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
### 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
from typing import List, Literal, Union

import typing_extensions
from openbb_core.app.utils import df_to_basemodel
from openbb_core.app.model.custom_parameter import OpenBBCustomParameter
from openbb_core.app.model.obbject import OBBject
from openbb_core.app.static.container import Container
from openbb_core.app.static.decorators import validate

from openbb_core.app.static.filters import filter_inputs

from openbb_provider.abstract.data import Data
import openbb_core.app.model.command_context
import openbb_core.app.model.obbject
import types


class ROUTER_economy(Container):
Expand Down Expand Up @@ -171,7 +159,7 @@ def const(
MajorIndicesConstituents
------------------------
symbol : str
Symbol to get data for.
Symbol representing the entity requested in the data.
name : str
Name of the constituent company in the index.
sector : str
Expand Down Expand Up @@ -356,7 +344,7 @@ def cot_search(
units : Optional[Union[str]]
The units for one contract.
symbol : Optional[Union[str]]
Trading symbol representing the underlying asset.
Symbol representing the entity requested in the data.
Example
-------
Expand Down Expand Up @@ -615,7 +603,7 @@ def econcal(
EconomicCalendar
----------------
date : Optional[Union[datetime]]
Date and time of event.
The date of the data.
country : Optional[Union[str]]
Country of event.
category : Optional[Union[str]]
Expand Down Expand Up @@ -799,7 +787,7 @@ def european_index_constituents(
EuropeanIndexConstituents
-------------------------
symbol : str
Symbol of the constituent company in the index.
Symbol representing the entity requested in the data. The symbol is the constituent company in the index.
price : float
Current price of the constituent company in the index.
open : float
Expand Down Expand Up @@ -948,7 +936,7 @@ def gdpforecast(
period: typing_extensions.Annotated[
Literal["quarter", "annual"],
OpenBBCustomParameter(
description="Units for nominal GDP period. Either quarter or annual."
description="Time period of the data to return. Units for nominal GDP period. Either quarter or annual."
),
] = "annual",
start_date: typing_extensions.Annotated[
Expand Down Expand Up @@ -977,7 +965,7 @@ def gdpforecast(
Parameters
----------
period : Literal['quarter', 'annual']
Units for nominal GDP period. Either quarter or annual.
Time period of the data to return. Units for nominal GDP period. Either quarter or annual.
start_date : Union[datetime.date, None]
Start date of the data, in YYYY-MM-DD format.
end_date : Union[datetime.date, None]
Expand Down Expand Up @@ -1042,7 +1030,7 @@ def gdpnom(
units: typing_extensions.Annotated[
Literal["usd", "usd_cap"],
OpenBBCustomParameter(
description="Units to get nominal GDP in. Either usd or usd_cap indicating per capita."
description="The data units. Units to get nominal GDP in. Either usd or usd_cap indicating per capita."
),
] = "usd",
start_date: typing_extensions.Annotated[
Expand All @@ -1065,7 +1053,7 @@ def gdpnom(
Parameters
----------
units : Literal['usd', 'usd_cap']
Units to get nominal GDP in. Either usd or usd_cap indicating per capita.
The data units. Units to get nominal GDP in. Either usd or usd_cap indicating per capita.
start_date : Union[datetime.date, None]
Start date of the data, in YYYY-MM-DD format.
end_date : Union[datetime.date, None]
Expand Down Expand Up @@ -1127,7 +1115,7 @@ def gdpreal(
units: typing_extensions.Annotated[
Literal["idx", "qoq", "yoy"],
OpenBBCustomParameter(
description="Units to get real GDP in. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)"
description="The data units. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)"
),
] = "yoy",
start_date: typing_extensions.Annotated[
Expand All @@ -1150,7 +1138,7 @@ def gdpreal(
Parameters
----------
units : Literal['idx', 'qoq', 'yoy']
Units to get real GDP in. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)
The data units. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)
start_date : Union[datetime.date, None]
Start date of the data, in YYYY-MM-DD format.
end_date : Union[datetime.date, None]
Expand Down Expand Up @@ -1341,8 +1329,8 @@ def index_search(
query: typing_extensions.Annotated[
str, OpenBBCustomParameter(description="Search query.")
] = "",
symbol: typing_extensions.Annotated[
Union[bool, List[str]],
is_symbol: typing_extensions.Annotated[
bool,
OpenBBCustomParameter(description="Whether to search by ticker symbol."),
] = False,
provider: Union[Literal["cboe"], None] = None,
Expand All @@ -1354,7 +1342,7 @@ def index_search(
----------
query : str
Search query.
symbol : bool
is_symbol : bool
Whether to search by ticker symbol.
provider : Union[Literal['cboe'], None]
The provider to use for the query, by default None.
Expand All @@ -1380,7 +1368,7 @@ def index_search(
IndexSearch
-----------
symbol : str
Symbol of the index.
Symbol representing the entity requested in the data.
name : str
Name of the index.
isin : Optional[Union[str]]
Expand Down Expand Up @@ -1418,7 +1406,7 @@ def index_search(
},
standard_params={
"query": query,
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
"is_symbol": is_symbol,
},
extra_params=kwargs,
)
Expand Down Expand Up @@ -1468,21 +1456,21 @@ def index_snapshots(
IndexSnapshots
--------------
symbol : str
Symbol of the index.
Symbol representing the entity requested in the data.
name : Optional[Union[str]]
Name of the index.
currency : Optional[Union[str]]
Currency of the index.
price : Optional[Union[float]]
Current price of the index.
open : Optional[Union[float]]
Opening price of the index.
The open price of the symbol.
high : Optional[Union[float]]
Highest price of the index.
The high price of the symbol.
low : Optional[Union[float]]
Lowest price of the index.
The low price of the symbol.
close : Optional[Union[float]]
Closing price of the index.
The close price of the symbol.
prev_close : Optional[Union[float]]
Previous closing price of the index.
change : Optional[Union[float]]
Expand Down Expand Up @@ -1621,13 +1609,13 @@ def sp500_multiples(
start_date: typing_extensions.Annotated[
Union[str, None],
OpenBBCustomParameter(
description="The start date of the time series. Format: YYYY-MM-DD"
description="Start date of the data, in YYYY-MM-DD format."
),
] = "",
end_date: typing_extensions.Annotated[
Union[str, None],
OpenBBCustomParameter(
description="The end date of the time series. Format: YYYY-MM-DD"
description="End date of the data, in YYYY-MM-DD format."
),
] = "",
collapse: typing_extensions.Annotated[
Expand All @@ -1650,9 +1638,9 @@ def sp500_multiples(
series_name : Literal['Shiller PE Ratio by Month', 'Shiller PE Ratio by Year', 'PE Rat...
The name of the series. Defaults to 'PE Ratio by Month'.
start_date : Union[str, None]
The start date of the time series. Format: YYYY-MM-DD
Start date of the data, in YYYY-MM-DD format.
end_date : Union[str, None]
The end date of the time series. Format: YYYY-MM-DD
End date of the data, in YYYY-MM-DD format.
collapse : Union[Literal['daily', 'weekly', 'monthly', 'quarterly', 'annual'...
Collapse the frequency of the time series.
transform : Union[Literal['diff', 'rdiff', 'cumul', 'normalize'], None]
Expand All @@ -1679,7 +1667,7 @@ def sp500_multiples(
SP500Multiples
--------------
date : str
The date data for the time series.
The date of the data.
value : float
The data value for the time series.
Expand Down
Loading

0 comments on commit f69868d

Please sign in to comment.