Skip to content

[BugFix] openbb-famafrench: Select the 'Not Reqd' tables when all_data_items_required=False - #7823

Open
b84330808 wants to merge 1 commit into
openbq-org:developfrom
b84330808:bugfix/famafrench-not-reqd-filter
Open

b84330808 wants to merge 1 commit into
openbq-org:developfrom
b84330808:bugfix/famafrench-not-reqd-filter

Conversation

@b84330808

Copy link
Copy Markdown

Pull Request the OpenBB Platform

Description

  • Summary of the change/ bug fix.

The second documented example of country_portfolio_returns fails:

obb.famafrench.country_portfolio_returns(provider="famafrench", frequency="annual", measure="local", country="japan", dividends=False, all_data_items_required=False)
# OpenBBError: [Unexpected Error] -> IndexError -> list index out of range

In get_international_portfolio, the all_data_items_required is False branch filters the frames and their metadata with different conditions:

  • the frames keep tables without "Not Reqd" in the description, which are the "Required" tables;
  • the metadata keeps descriptions that end with "Not Reqd", which the ex-dividend files never do (their descriptions end with " - Ex-Dividends").

So with dividends=False the metadata list is empty and transform_data raises IndexError, for any country or index. With dividends=True the call succeeds but returns the "All 4 Data Items Required" returns under the "Not Reqd" description. For Japan, annual, local, with dividends, the 1975 mkt value is 25.14 for both all_data_items_required=True and False on develop; this branch returns 21.81 for False (the "Not Reqd" table) and 25.14 for True.

The fix filters both lists on "Not Reqd" in description.

How has this been tested?

  • New test test_get_international_portfolio_all_data_items_not_required (with and without the " - Ex-Dividends" suffix). Both cases fail on develop (assert [2.0] == [1.0], the "Required" frame comes back) and pass with the change.
  • The famafrench test suite passes: 132 passed.
  • Live: the example above and the same call for France, monthly, USD and with dividends all return 51 annual / 612 monthly rows.

Checklist

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have adhered to the GitFlow naming convention and my branch name is in the format of feature/feature-name or hotfix/hotfix-name.
  • I ensure that I am following the CONTRIBUTING guidelines.

…uired=False

get_international_portfolio filtered the frames and their metadata with
different conditions when all_data_items_required is False. The frames
kept the tables without "Not Reqd" in the description, which are the
"Required" tables, and the metadata kept descriptions ending with
"Not Reqd", which the ex-dividend files never do because their
descriptions end with " - Ex-Dividends".

So with dividends=True the call returned the "All 4 Data Items
Required" returns under the "Not Reqd" description, and with
dividends=False the metadata list was empty and transform_data raised
IndexError. The documented example
obb.famafrench.country_portfolio_returns(frequency="annual",
measure="local", country="japan", dividends=False,
all_data_items_required=False) fails with
"[Unexpected Error] -> IndexError -> list index out of range".

Filter both lists on "Not Reqd" in the description.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant