0
votes

I have a Java code that uses blpapi to request specific fields of specific securities. My code runs fine now. However, I have thought of a case that is not being handled by my current code.

Say, for example, I am requesting 'CUR_MKT_CAP', 'PX_LAST', and 'EQY_SH_OUT' for a specific security. What if Bloomberg does not have the value for 'PX_LAST'? What will Bloomberg give me then? (a) Will it give me a field Element where PX_LAST = 0? (b) Will it give me a field Element where PX_LAST = NULL? (c) Will it not include PX_LAST to the response that I will receive? Thus, the response will look like this?

HistoricalDataResponse (choice) = {
    securityData = {
        security = XXXXX Equity
        sequenceNumber = 0
        fieldData[] = {
            fieldData = {
                date = YYYY-MM-DD
                CUR_MKT_CAP = XX.XXXX
                EQY_SH_OUT = XX.XXXX
            }
        }
    } }

Basically, I just want to know how I should handle if one of the fields I need is not given by Bloomberg.

3

3 Answers

1
votes

You are correct, if a field returns no data, it will be omitted from the fieldData element. If none of the fields returns data, the fieldData will be empty:

ReferenceDataResponse = {
    securityData[] = {
        securityData = {
            security = "MSFT US Equity"
            eidData[] = {
            }
            fieldExceptions[] = {
            }
            sequenceNumber = 0
            fieldData = {
            }
        }
    }
}

You can easily test this, for example using MSFT US Equity / YAS_BOND_YLD.

0
votes

I tested it using @assylias's answer. It gave me the following results.

MSFT US Equity

HistoricalDataResponse (choice) = {
    securityData = {
        security = MSFT US Equity
        sequenceNumber = 0
    }
}

YAS_BOND_YLD

HistoricalDataResponse (choice) = {
    securityData = {
        security = YAS_BOND_YLD
        sequenceNumber = 0
        securityError = {
            source = 500::bbdbh5
            code = 15
            category = BAD_SEC
            message = Unknown/Invalid securityInvalid Security [nid:500] 
            subcategory = INVALID_SECURITY
        }
    }
}
0
votes

As per @assylias comment, I used YAS_BOND_YLD as a field. And blpapi returned the following as a response.

My input to the request:

Ticker: XXX XX Equity Start/End Date: 20160818 Fields: CUR_MKT_CAP YAS_BOND_YLD PX_LAST EQY_SH_OUT

BLPAPI's response is,

HistoricalDataResponse (choice) = {
    securityData = {
        security = XXX XX Equity
        sequenceNumber = 0
        fieldData[] = {
            fieldData = {
                date = 2016-08-18
                CUR_MKT_CAP = 117.7144
                PX_LAST = 1.06
                EQY_SH_OUT = 111.051
            }
        }
    }
}

Note: I changed the ticker to XXX XX on purpose. =D