Skip to content

Commit

Permalink
[Feature] Add IMF Provider Extension and Extend `obb.economic.indicat…
Browse files Browse the repository at this point in the history
…ors` (OpenBB-finance#6666)

* add imf provider extension and extend economic.indicators

* ruff

* mypy

* more mypy

* provider.json
  • Loading branch information
deeleeramone authored Sep 20, 2024
1 parent 57dd66c commit 39e30e8
Show file tree
Hide file tree
Showing 28 changed files with 7,827 additions and 657 deletions.
8 changes: 8 additions & 0 deletions assets/extensions/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@
"credentials": [],
"website": "https://data.gov"
},
{
"packageName": "openbb-imf",
"optional": false,
"reprName": "International Monetary Fund (IMF) Public Data API",
"description": "This provider allows you to access International Monetary Fund data through the IMF Public Data API.",
"credentials": [],
"website": "https://datahelp.imf.org/knowledgebase/articles/667681-using-json-restful-web-service"
},
{
"packageName": "openbb-intrinio",
"optional": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
class EconomicIndicatorsQueryParams(QueryParams):
"""Economic Indicators Query."""

symbol: str = Field(
description=QUERY_DESCRIPTIONS.get("symbol", "")
+ " The base symbol for the indicator (e.g. GDP, CPI, etc.).",
)
country: Optional[str] = Field(
default=None,
description=QUERY_DESCRIPTIONS.get("country", "")
Expand Down
1 change: 1 addition & 0 deletions openbb_platform/dev_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
openbb-federal-reserve = { path = "./providers/federal_reserve", develop = true }
openbb-fmp = { path = "./providers/fmp", develop = true }
openbb-fred = { path = "./providers/fred", develop = true }
openbb-imf = { path = "./providers/imf", develop = true }
openbb-intrinio = { path = "./providers/intrinio", develop = true }
openbb-oecd = { path = "./providers/oecd", develop = true }
openbb-polygon = { path = "./providers/polygon", develop = true }
Expand Down
20 changes: 20 additions & 0 deletions openbb_platform/extensions/economy/integration/test_economy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,26 @@ def test_economy_fred_regional(params, headers):
"frequency": "quarter",
}
),
(
{
"provider": "imf",
"country": "us,uk,jp",
"symbol": "gold_reserves",
"start_date": "2022-01-01",
"end_date": "2023-12-31",
"frequency": "annual",
}
),
(
{
"provider": "imf",
"country": "all",
"symbol": "derivative_assets",
"start_date": "2022-01-01",
"end_date": "2023-12-31",
"frequency": "annual",
}
),
],
)
@pytest.mark.integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,26 @@ def test_economy_available_indicators(params, obb):
"frequency": "quarter",
}
),
(
{
"provider": "imf",
"country": "us,uk,jp",
"symbol": "gold_reserves",
"start_date": "2022-01-01",
"end_date": "2023-12-31",
"frequency": "annual",
}
),
(
{
"provider": "imf",
"country": "all",
"symbol": "derivative_assets",
"start_date": "2022-01-01",
"end_date": "2023-12-31",
"frequency": "annual",
}
),
],
)
@pytest.mark.integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,29 @@ async def available_indicators(
description="Use the `main` symbol to get the group of main indicators for a country.",
parameters={"provider": "econdb", "symbol": "main", "country": "eu"},
),
APIEx(
description="When the provider is 'imf', the absence of a symbol will default to 'irfcl_top_lines'."
+ " Use 'IRFCL' to get all the data from the set of indicators.",
parameters={"provider": "imf"},
),
APIEx(
description="When the provider is 'imf', complete tables are returned by using a 'preset'."
+ " Refer to the function's docstring for descriptions of each preset."
+ " When no country is supplied, the data is returned for all countries.",
parameters={"provider": "imf", "symbol": "gold_reserves"},
),
APIEx(
description="When the provider is 'imf', multiple countries and symbols can be supplied."
+ " Enter countries as a two-letter ISO country code, or the country name in lower_snake_case.",
parameters={
"provider": "imf",
"symbol": "RAFA_USD,RAPFA_USD,RAFA_RAPFA_RO",
"country": "us,china,jp,4f,gb",
"start_date": "2010-01-01",
"end_date": "2020-12-31",
"frequency": "annual",
},
),
],
)
async def indicators(
Expand Down
Loading

0 comments on commit 39e30e8

Please sign in to comment.