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

BDS empty data response fails with IndexError #16

Open
gandhis1 opened this issue May 25, 2022 · 0 comments
Open

BDS empty data response fails with IndexError #16

gandhis1 opened this issue May 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@gandhis1
Copy link

To replicate, please query BDS("FNR 2021-2 AI Mtge", "HIST_LOSSES"). This is an agency CMO so that naturally should not return a real value, but I believe this should probably return None instead of failing.

    def collect_to_bds(self, responses: Iterable) -> pandas.DataFrame:
        """Collector for bds()."""
        rows = []
        field = None
        for response in responses:
            keys = list(response["data"].keys())
            if len(keys) > 1:
                raise ValueError(f"responses must have only one field, received {keys}")
            if field is not None and field != keys[0]:
                raise ValueError(f"responses contain different fields, {field} and {keys[0]}")
>           field = keys[0]
E           IndexError: list index out of range

envs\dd37b9a02dc1d7344d536c893525a5836cbe391f\lib\site-packages\blp\blp.py:868: IndexError

This is what response looks like (note I used the Bloomberg unique ID to query):

{'security': 'MG!!02QEYQ Mtge', 'fields': ['HIST_LOSSES'], 'data': {}}

@matthewgilbert matthewgilbert added the bug Something isn't working label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants