pdblp icon indicating copy to clipboard operation
pdblp copied to clipboard

Inconsistent behavior when passing list of fields for .ref request

Open gflores87 opened this issue 6 years ago • 3 comments

Code Sample

import pdblp

con = pdblp.BCon(debug=True, timeout=10000)
con.start()
test = con.ref(['IS7597250 Index'], ['VEGA_NOTIONAL', 'FIRST_TRADING_DATE'])
con.stop()
print(test)


con = pdblp.BCon(debug=True,timeout=10000)
con.start()
test = con.ref(['IS7597250 Index'], ['FIRST_TRADING_DATE'])
con.stop()
print(test)

Problem description

If I call .ref and pass one field to the request, it works. However, if I pass two fields to the request, the field that originally worked returns nan and the reason seems to be 'Field not applicable'. Since the other request works then the error suggest there might be a typo or syntax issue that is generating a faulty field but the debugger shows that everything is the same. I even changed the order of the fields in the list but the Vega Notional keeps working, while the First Trading Date still fails

pdblp.pdblp:INFO:Sending Request:
ReferenceDataRequest = {
    securities[] = {
        "IS7597250 Index"
    }
    fields[] = {
        "VEGA_NOTIONAL", "FIRST_TRADING_DATE"
    }
    overrides[] = {
    }
}
pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "IS7597250 Index"
            eidData[] = {
            }
            fieldExceptions[] = {
                fieldExceptions = {
                    fieldId = "FIRST_TRADING_DATE"
                    errorInfo = {
                        source = "65::bbdbl5"
                        code = 9
                        category = "BAD_FLD"
                        message = "Field not applicable to security"
                        subcategory = "NOT_APPLICABLE_TO_REF_DATA"
                    }
                }
            }
            sequenceNumber = 0
            fieldData = {
                VEGA_NOTIONAL = 100000.000000
            }
        }
    }
}
            ticker               field     value
0  IS7597250 Index       VEGA_NOTIONAL  100000.0
1  IS7597250 Index  FIRST_TRADING_DATE       NaN

But if I call only one field, I get the desired result:

pdblp.pdblp:INFO:Sending Request:
ReferenceDataRequest = {
    securities[] = {
        "IS7597250 Index"
    }
    fields[] = {
        "FIRST_TRADING_DATE"
    }
    overrides[] = {
    }
}
pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "IS7597250 Index"
            eidData[] = {
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
                FIRST_TRADING_DATE = "01/23/2019 16:48"
            }
        }
    }
}

I still don't discard a syntax error, but it must be very subtle

Version Information

0.1.8

gflores87 avatar Feb 25 '19 14:02 gflores87

Any update on this would be greatly appreciated!

gflores87 avatar Mar 21 '19 16:03 gflores87

I am unable to reproduce your error. When I attempt to query security IS7597250 Index I am getting a INVALID_SECURITY error. Since ultimately pdblp just wraps the messages coming back from Bloomberg not much can be done here. Probably best to reach out to Bloomberg Help about this because as you previously identified this looks like an inconsistent in their API.

pdblp.pdblp:INFO:Sending Request:
ReferenceDataRequest = {
    securities[] = {
        "IS7597250 Index"
    }
    fields[] = {
        "VEGA_NOTIONAL", "FIRST_TRADING_DATE"
    }
    overrides[] = {
    }
}

pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "IS7597250 Index"
            eidData[] = {
            }
            securityError = {
                source = "2981::bbdbd7"
                code = 3
                category = "BAD_SEC"
                message = "Unknown/Invalid Security  [nid:2981] "
                subcategory = "INVALID_SECURITY"
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
            }
        }
    }
}

matthewgilbert avatar Mar 22 '19 00:03 matthewgilbert

hi did you ever solve this issue? i am seeing something similar

fzhang1414 avatar Nov 22 '23 01:11 fzhang1414