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

[Feature] Add IMF Provider Extension and Extend obb.economic.indicators #6666

Merged
merged 9 commits into from
Sep 20, 2024

Conversation

deeleeramone
Copy link
Contributor

@deeleeramone deeleeramone commented Sep 10, 2024

  1. Why?:

    • The IMF provides a public API for their database, and time series data is widely used across macroeconomics.
    • No credentials are required.
    • Reference
  2. What?:

    • New provider extension: openbb-imf
    • Extends endpoints:
      • obb.economy.available_indicators
        • Serviced by a static JSON file.
      • obb.economy.indicators
        • Currently only supports data from the International Reserves and Foreign Currency Liquidity collection.
    • The data is returned in a flat-format suitable for pivot tables and SQL.
  3. Impact:

    • The symbol parameter in obb.economy.indicators has been moved to provider definitions to allow varying docstrings with helpful information about the symbols which will vary by provider.
  4. Testing Done:

    • Unit/Integration tests.
    • Sampled a large cross section of data
res = obb.economy.indicators(
    symbol="RAMFDA_USD",  # This is the symbol called by the preset 'derivative_assets'
    provider="imf",
    country="all",
    frequency="month",
    start_date="2015-01-01",
)
df = (
    res.to_df(index=None)
    .pivot_table(
        index="date",
        columns=["symbol", "country"],
        values="value",
        observed=True,
        sort=False,
    )
    .RAMFDA_USD
)
chart_params = {
    "x": "date",
    "y": ["Japan", "China", "Mexico", "Brazil"],
    "index": "date",
    "barmode": "overlay",
    "title": "Financial Derivative Assets (Net, Marked to Market)",
    "ytitle": "Nominal Value In Millions of USD",
    "layout_kwargs": {
        "legend": {
            "orientation": "v",
            "y": 0.95,
            "x": -0.01,
            "xanchor": "right",
            "yanchor": "top",
        }
    },
    "external": True,
}
fig = res.charting.create_bar_chart(data=df.reset_index(), **chart_params)
for trace in fig.data:
    trace.update(hovertemplate="<b>$</b>%{y:,.1f} M", opacity=0.75, width=0.8)
fig.show()
Screenshot 2024-09-10 at 5 49 52 PM

@deeleeramone deeleeramone added enhancement Enhancement platform OpenBB Platform v4 PRs for v4 labels Sep 10, 2024
@deeleeramone deeleeramone added this pull request to the merge queue Sep 20, 2024
Merged via the queue into develop with commit 39e30e8 Sep 20, 2024
10 checks passed
@IgorWounds IgorWounds deleted the feature/imf-provider branch September 26, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking_change enhancement Enhancement platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants