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

economy.calendar nasdaq #5628

Merged
merged 37 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d70ccdd
add quandl econcal
montezdesousa Oct 30, 2023
4728994
unittest
montezdesousa Oct 30, 2023
b3f9b31
add integration tests
montezdesousa Oct 30, 2023
859dd6c
replace &nbsp
montezdesousa Oct 30, 2023
d524575
fix bug TE importance
montezdesousa Oct 30, 2023
940e803
small fix
montezdesousa Oct 31, 2023
2e23f43
remove stuff from quandl
montezdesousa Oct 31, 2023
8eb2efc
add nasdaq provider
montezdesousa Oct 31, 2023
6182d0a
add nasdaq to install files
montezdesousa Oct 31, 2023
823c449
Update test_economy_api.py
montezdesousa Oct 31, 2023
ef88284
test
montezdesousa Oct 31, 2023
3e8abbb
quandl leftovers
montezdesousa Oct 31, 2023
873e07a
remove quandl econcal test
montezdesousa Oct 31, 2023
b2de32a
lint
montezdesousa Oct 31, 2023
dc54551
replace &nbsp
montezdesousa Oct 31, 2023
7304af5
Merge branch 'feature/openbb-sdk-v4' into feature/econcal_quandl
montezdesousa Oct 31, 2023
33a39de
ruff
montezdesousa Oct 31, 2023
0aad369
lint
montezdesousa Oct 31, 2023
7873237
update nasdaq gmt
montezdesousa Oct 31, 2023
33818f5
validate countries
montezdesousa Oct 31, 2023
a819aac
here
montezdesousa Oct 31, 2023
80951f8
no need for this
montezdesousa Oct 31, 2023
3939cc0
fix calendar tests
montezdesousa Oct 31, 2023
305c6e1
static
montezdesousa Oct 31, 2023
f539914
static
montezdesousa Oct 31, 2023
018d5ed
remove error
montezdesousa Oct 31, 2023
b7dd3d5
static
montezdesousa Oct 31, 2023
5ef135b
readme + website
montezdesousa Oct 31, 2023
ecb816c
readme
montezdesousa Oct 31, 2023
6d7942a
remove changes TE
montezdesousa Oct 31, 2023
40b2055
typo
montezdesousa Oct 31, 2023
7fc550c
fix unittest
montezdesousa Oct 31, 2023
ff27e32
fix tests
montezdesousa Oct 31, 2023
51a955f
Update __init__.py
montezdesousa Oct 31, 2023
6c4394c
Update economic_calendar.py
montezdesousa Oct 31, 2023
644d4bc
Merge branch 'feature/openbb-sdk-v4' into feature/econcal_quandl
the-praxs Nov 3, 2023
5aff971
revamped model and added helpers for date range
the-praxs Nov 3, 2023
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
15 changes: 11 additions & 4 deletions openbb_platform/extensions/economy/integration/test_economy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,21 @@ def test_economy_gdpforecast(params, headers):
[
(
{
"provider": "quandl",
"start_date": "2023-05-01",
"end_date": "2023-05-10",
"country": "Spain",
}
),
(
{
"importance": "high",
"provider": "tradingeconomics",
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"country": "portugal",
"group": "gdp",
"importance": "Low",
"country": "United States",
}
)
),
],
)
@pytest.mark.integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,19 @@ def test_economy_gdpforecast(params, obb):
[
(
{
"start_date": "2023-01-01",
"end_date": "2023-06-06",
"country": "portugal",
"importance": "Low",
"provider": "quandl",
"start_date": "2023-10-01",
"end_date": "2023-10-20",
"country": "France",
}
),
(
{
"importance": "high",
"provider": "tradingeconomics",
"start_date": "2023-08-01",
"end_date": "2023-09-06",
"country": "Germany",
"group": "gdp",
}
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,5 @@ def econcal(
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""GDP Data."""
"""Economic Calendar Data."""
return OBBject(results=Query(**locals()).execute())
103 changes: 45 additions & 58 deletions openbb_platform/openbb/package/economy.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
### 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
from typing import List, Literal, Union

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.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.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
import openbb_core.app.model.command_context
import openbb_core.app.model.obbject
import types


class ROUTER_economy(Container):
Expand Down Expand Up @@ -545,65 +557,38 @@ def econcal(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
importance: typing_extensions.Annotated[
Literal[1, 2, 3],
OpenBBCustomParameter(
description="Importance of the event. (1-Low, 2-Medium, 3-High)"
),
] = 3,
group: typing_extensions.Annotated[
Union[
Literal[
"interest rate",
"inflation",
"bonds",
"consumer",
"gdp",
"government",
"housing",
"labour",
"markets",
"money",
"prices",
"trade",
"business",
],
None,
],
OpenBBCustomParameter(description="Grouping of events"),
] = None,
country: typing_extensions.Annotated[
Union[List[str], str, None],
OpenBBCustomParameter(description="Country of the event"),
] = None,
provider: Union[Literal["tradingeconomics"], None] = None,
provider: Union[Literal["quandl", "tradingeconomics"], None] = None,
**kwargs
) -> OBBject[List[Data]]:
"""GDP Data.
"""Economic Calendar Data.

Parameters
----------
start_date : Union[datetime.date, None]
Start date of the data, in YYYY-MM-DD format.
end_date : Union[datetime.date, None]
End date of the data, in YYYY-MM-DD format.
importance : Literal[1, 2, 3]
Importance of the event. (1-Low, 2-Medium, 3-High)
group : Union[Literal['interest rate', 'inflation', 'bonds', 'consumer', ...
Grouping of events
country : Union[List[str], str, None]
Country of the event
provider : Union[Literal['tradingeconomics'], None]
provider : Union[Literal['quandl', 'tradingeconomics'], None]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'tradingeconomics' if there is
If None, the provider specified in defaults is selected or 'quandl' if there is
no default.
importance : Literal['low', 'medium', 'high']
Importance of the event. (provider: tradingeconomics)
group : Optional[Union[Literal['interest rate', 'inflation', 'bonds', 'consumer', 'gdp', 'government', 'housing', 'labour', 'markets', 'money', 'prices', 'trade', 'business']]]
Grouping of events (provider: tradingeconomics)

Returns
-------
OBBject
results : Union[List[EconomicCalendar]]
Serializable results.
provider : Union[Literal['tradingeconomics'], None]
provider : Union[Literal['quandl', 'tradingeconomics'], None]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
Expand All @@ -618,37 +603,41 @@ def econcal(
The date of the data.
country : Optional[Union[str]]
Country of event.
category : Optional[Union[str]]
Category of event.
event : Optional[Union[str]]
Event name.
reference : Optional[Union[str]]
Abbreviated period for which released data refers to.
source : Optional[Union[str]]
Source of the data.
sourceurl : Optional[Union[str]]
Source URL.
actual : Optional[Union[str]]
Latest released value.
previous : Optional[Union[str]]
Value for the previous period after the revision (if revision is applicable).
consensus : Optional[Union[str]]
Average forecast among a representative group of economists.
time : Optional[Union[str]]
GMT of release (in HH:MM format). (provider: quandl)
description : Optional[Union[str]]
Event description. (provider: quandl)
category : Optional[Union[str]]
Category of event. (provider: tradingeconomics)
reference : Optional[Union[str]]
Abbreviated period for which released data refers to. (provider: tradingeconomics)
source : Optional[Union[str]]
Source of the data. (provider: tradingeconomics)
sourceurl : Optional[Union[str]]
Source URL. (provider: tradingeconomics)
forecast : Optional[Union[str]]
Trading Economics projections
Trading Economics projections (provider: tradingeconomics)
url : Optional[Union[str]]
Trading Economics URL
importance : Optional[Union[Literal[0, 1, 2, 3]]]
Importance of the event. 1-Low, 2-Medium, 3-High
Trading Economics URL (provider: tradingeconomics)
importance : Optional[Union[Literal['Low', 'Medium', 'High']]]
Importance of the event. (provider: tradingeconomics)
currency : Optional[Union[str]]
Currency of the data.
Currency of the data. (provider: tradingeconomics)
unit : Optional[Union[str]]
Unit of the data.
Unit of the data. (provider: tradingeconomics)

Example
-------
>>> from openbb import obb
>>> obb.economy.econcal(importance=3)
>>> obb.economy.econcal()
""" # noqa: E501

inputs = filter_inputs(
Expand All @@ -658,8 +647,6 @@ def econcal(
standard_params={
"start_date": start_date,
"end_date": end_date,
"importance": importance,
"group": group,
"country": country,
},
extra_params=kwargs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
date as dateType,
datetime,
)
from typing import List, Literal, Optional, Union
from typing import List, Optional, Union

from pydantic import Field

Expand All @@ -25,27 +25,6 @@ class EconomicCalendarQueryParams(QueryParams):
default=None,
description=QUERY_DESCRIPTIONS.get("end_date", ""),
)
importance: Literal[1, 2, 3] = Field(
default=3,
description="Importance of the event. (1-Low, 2-Medium, 3-High)",
)
group: Optional[
Literal[
"interest rate",
"inflation",
"bonds",
"consumer",
"gdp",
"government",
"housing",
"labour",
"markets",
"money",
"prices",
"trade",
"business",
]
] = Field(default=None, description="Grouping of events")
# TODO: Probably want to figure out the list we can use.
country: Optional[Union[str, List[str]]] = Field(
default=None,
Expand All @@ -60,14 +39,7 @@ class EconomicCalendarData(Data):
default=None, description=DATA_DESCRIPTIONS.get("date", "")
)
country: Optional[str] = Field(default=None, description="Country of event.")
category: Optional[str] = Field(default=None, description="Category of event.")
event: Optional[str] = Field(default=None, description="Event name.")
reference: Optional[str] = Field(
default=None,
description="Abbreviated period for which released data refers to.",
)
source: Optional[str] = Field(default=None, description="Source of the data.")
sourceurl: Optional[str] = Field(default=None, description="Source URL.")
actual: Optional[str] = Field(default=None, description="Latest released value.")
previous: Optional[str] = Field(
default=None,
Expand All @@ -77,12 +49,3 @@ class EconomicCalendarData(Data):
default=None,
description="Average forecast among a representative group of economists.",
)
forecast: Optional[str] = Field(
default=None, description="Trading Economics projections"
)
url: Optional[str] = Field(default=None, description="Trading Economics URL")
importance: Optional[Literal[0, 1, 2, 3]] = Field(
default=None, description="Importance of the event. 1-Low, 2-Medium, 3-High"
)
currency: Optional[str] = Field(default=None, description="Currency of the data.")
unit: Optional[str] = Field(default=None, description="Unit of the data.")
2 changes: 2 additions & 0 deletions openbb_platform/providers/quandl/openbb_quandl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from openbb_provider.abstract.provider import Provider
from openbb_quandl.models.cot import QuandlCotFetcher
from openbb_quandl.models.cot_search import QuandlCotSearchFetcher
from openbb_quandl.models.economic_calendar import QuandlEconomicCalendarFetcher
from openbb_quandl.models.sp500_multiples import QuandlSP500MultiplesFetcher

quandl_provider = Provider(
Expand All @@ -18,5 +19,6 @@
"SP500Multiples": QuandlSP500MultiplesFetcher,
"COT": QuandlCotFetcher,
"COTSearch": QuandlCotSearchFetcher,
"EconomicCalendar": QuandlEconomicCalendarFetcher,
},
)
Loading
Loading