question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Another BDH Override Returning Error

See original GitHub issue

Hi Matthew,

First of all, thank you for developing this package - I find it very useful. I am trying to override the standard bdh formula to return all working days (or all calendar days) by using the fields from the Bloomberg Open API - Core Developer Guide on page 93:

df = con.bdh("IBM US Equity", "PX_LAST", "20150101", "20150630", ovrds=[("nonTradingDayFillOption", "ALL_CALENDAR_DAYS"), ("nonTradingDayFillMethod", "NIL_VALUE")])

Unfortunately this override is returning an error message:

DEBUG:root:Sending Request:
 HistoricalDataRequest = {
    securities[] = {
        "IBM US Equity"
    }
    fields[] = {
        "PX_LAST"
    }
    startDate = "20150101"
    endDate = "20150630"
    overrides[] = {
        overrides = {
            fieldId = "nonTradingDayFillOption"
            value = "ALL_CALENDAR_DAYS"
        }
        overrides = {
            fieldId = "nonTradingDayFillMethod"
            value = "NIL_VALUE"
        }
    }
}
DEBUG:root:Message Received:
 HistoricalDataResponse = {
    responseError = {
        source = "bbdbh7"
        code = 27
        category = "BAD_ARGS"
        message = "Invalid override field id specified [nid:3626] "
        subcategory = "INVALID_OVERRIDE_FIELD"
    }
}
Traceback (most recent call last):
  File "<input>", line 2, in <module>
  File "C:\Users\nelly\Anaconda3\Lib\site-packages\pdblp\pdblp.py", line 165, in bdh
    elms, ovrds)
  File "C:\Users\nelly\Anaconda3\Lib\site-packages\pdblp\pdblp.py", line 202, in _bdh_list
    if msg.getElement('securityData').hasElement('securityError') or (msg.getElement('securityData').getElement("fieldExceptions").numValues() > 0):  # NOQA
  File "C:\Users\nelly\Anaconda3\Lib\site-packages\blpapi\message.py", line 135, in getElement
    return self.asElement().getElement(name)
  File "C:\Users\nelly\Anaconda3\Lib\site-packages\blpapi\element.py", line 347, in getElement
    _ExceptionUtil.raiseOnError(res[0])
  File "C:\Users\nelly\Anaconda3\Lib\site-packages\blpapi\exception.py", line 145, in raiseOnError
    _ExceptionUtil.raiseException(errorCode, description)
  File "C:\Users\nelly\Anaconda3\Lib\site-packages\blpapi\exception.py", line 137, in raiseException
    raise errorClass(description, errorCode)
blpapi.exception.InvalidArgumentException: Choice sub-element not found for name 'securityData'. (0x00020002)

Any idea how to make it work?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
matthewgilbertcommented, Mar 20, 2018

These are not overrides, they are elements associated with the query to set. Something like this seems to work

df = con.bdh("IBM US Equity", "PX_LAST", "20150101", "20150630",
             elms=[("nonTradingDayFillOption", "ALL_CALENDAR_DAYS"),
                   ("nonTradingDayFillMethod", "NIL_VALUE")])

You can see a description of these in the users guide in a terminal by using WAPI <GO> -> API Developer’s Guide -> Reference Guide: Services and Schemas

A less up to date version of the User’s Guide which also has schemas is available on the internet here, refer to page 166.

0reactions
nellyt00commented, Mar 21, 2018

Hi Matthew, I’ve tested your solution on my side and it works fine. Thanks a lot for your kind help and prompt replies!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Q. Help! I got an error trying to download data ... - Ask a Librarian
Any of the following error messages indicate that downloading via the Excel Plugin API is disabled: #N/A Authorization; #N/A Limit ...
Read more >
Bloomberg data retrieval in R : Invalid override field id ...
This returns an empty variable for me, but it doesn't throw an error so it might get you on the right track. The...
Read more >
Bloomberg Excel BDH function troubles : r/quant - Reddit
I'm running into an error with the Bloomberg Excel function BDH, which is used to pull historical data on a variety of fields....
Read more >
bdp: Run 'Bloomberg Data Point' Queries in Rblpapi - Rdrr.io
This function uses the Bloomberg API to retrieve 'bdp' (Bloomberg Data Point) ... bdp(securities, fields, options = NULL, overrides = NULL, ...
Read more >
How can I turn #N/A N/A into "0"? | MrExcel Message Board
Dear all, The following function is returning #N/A N/A: =BDP($D22,$BD$19) This ... an NA Error, maybe the resulting value from the BDP formula...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found