matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
240 stars 69 forks source link

con.bdh() does not return field values for subset of underlyings #81

Open WladimirOstrovsky opened 4 years ago

WladimirOstrovsky commented 4 years ago

Code Sample, a copy-pastable example if possible

def create_bbg_con():
    con = pdblp.BCon(debug=True, port=8194, timeout=5000)
    con.start()
    return con

ticker = ['BGAM0P 122.0 Curncy', 'BGAN0P 119.5 Curncy', 'DAX 05/15/20 P10000 Index']
field = 'PX_CLOSE_1D'
start_date_str = '20200430'
end_date_str = '20200430'

result_temp = con.bdh(ticker, field, start_date_str, end_date_str, longdata=True)

Problem description

For some reason con.bdh() does not return field values for all ticker supplied. I found out that these are only equity index options (see above). It works for FX Future options and Bond Future options.

my output:

        date               ticker        field  value
0 2020-04-30  BGAM0P 122.0 Curncy  PX_CLOSE_1D   0.67
1 2020-04-30  BGAN0P 119.5 Curncy  PX_CLOSE_1D   0.64

debugger:

pdblp.pdblp:INFO:Sending Request:
HistoricalDataRequest = {
    securities[] = {
        "BGAM0P 122.0 Curncy", "BGAN0P 119.5 Curncy", "DAX 05/15/20 P10000 Index"
    }
    fields[] = {
        "PX_CLOSE_1D"
    }
    startDate = "20200430"
    endDate = "20200430"
    overrides[] = {
    }
}
pdblp.pdblp:INFO:Event Type: 'PARTIAL_RESPONSE'
pdblp.pdblp:INFO:Message Received:
HistoricalDataResponse = {
    securityData = {
        security = "BGAM0P 122.0 Curncy"
        eidData[] = {
        }
        sequenceNumber = 0
        fieldExceptions[] = {
        }
        fieldData[] = {
            fieldData = {
                date = 2020-04-30
                PX_CLOSE_1D = 0.670000
            }
        }
    }
}
pdblp.pdblp:INFO:Event Type: 'PARTIAL_RESPONSE'
pdblp.pdblp:INFO:Message Received:
HistoricalDataResponse = {
    securityData = {
        security = "BGAN0P 119.5 Curncy"
        eidData[] = {
        }
        sequenceNumber = 1
        fieldExceptions[] = {
        }
        fieldData[] = {
            fieldData = {
                date = 2020-04-30
                PX_CLOSE_1D = 0.640000
            }
        }
    }
}
pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
HistoricalDataResponse = {
    securityData = {
        security = "DAX 05/15/20 P10000 Index"
        eidData[] = {
        }
        sequenceNumber = 2
        fieldExceptions[] = {
        }
        fieldData[] = {
        }
    }
}

Expected Output

        date               ticker        field  value
0 2020-04-30  BGAM0P 122.0 Curncy  PX_CLOSE_1D   0.67
1 2020-04-30  BGAN0P 119.5 Curncy  PX_CLOSE_1D   0.64
1 2020-04-30  DAX 05/15/20 P10000 Index  PX_CLOSE_1D   some number

Version Information

'0.1.8'