pdblp allows daily historical Bloomberg requests via:
con = pdblp.BCon(debug=False)
con = start()
df = con.bdh([\'SPY Equity\'], \'PX_LAST\', \'20150103\', \
Have you looked at the intraday request python example? You need to specify the timing in your request.
def sendIntradayTickRequest(session, options):
refDataService = session.getService("//blp/refdata")
request = refDataService.createRequest("IntradayTickRequest")
# only one security/eventType per request
request.set("security", options.security)
# Add fields to request
eventTypes = request.getElement("eventTypes")
for event in options.events:
eventTypes.appendValue(event)
# All times are in GMT
if not options.startDateTime or not options.endDateTime:
tradedOn = getPreviousTradingDate()
if tradedOn:
startTime = datetime.datetime.combine(tradedOn,
datetime.time(15, 30))
request.set("startDateTime", startTime)
endTime = datetime.datetime.combine(tradedOn,
datetime.time(15, 35))
request.set("endDateTime", endTime)
else:
if options.startDateTime and options.endDateTime:
request.set("startDateTime", options.startDateTime)
request.set("endDateTime", options.endDateTime)
if options.conditionCodes:
request.set("includeConditionCodes", True)
print "Sending Request:", request
session.sendRequest(request)
I'm not exactly sure what you're trying to do, if you want historical intra-day then use the above and add the parameters for intra-day timing in your request. Then parse the output. However, if you're looking to do some function based on the live feed, the way I've done it is to set a cron job on the python script that grabs the rate/security every X minutes and save it into a database. Not sure if you're looking to do a real-time function, or just pull historicals.
IntradayTickRequests are not currently supported in pdblp, but if you don't want to use the main api, within pdblp try this and it should work:
df3 = con.bdib('SPY Equity', '2015-06-19T09:30:00', '2015-06-19T15:30:00', eventType='TRADE', interval=15)
df3.head()
Let me know if I misread your question.
Start time and end time must be in UTC timezone. So a bit of conversions should be made - and need to account for daylight savings as well.
Using xbbg instead is much easier:
In [1]: from xbbg import blp
In [2]: blp.bdib(ticker='SPY US Equity', dt='2018-11-20').tail()
Out[2]:
ticker SPY US Equity
field open high low close volume num_trds
2018-11-20 15:57:00-05:00 264.42 264.49 264.35 264.41 590775 2590
2018-11-20 15:58:00-05:00 264.42 264.42 264.26 264.27 1005241 3688
2018-11-20 15:59:00-05:00 264.26 264.48 264.12 264.15 4227150 7886
2018-11-20 16:09:00-05:00 264.12 264.12 264.12 264.12 0 1
2018-11-20 16:15:00-05:00 264.12 264.12 264.12 264.12 0 1
Need the full equity ticker here to find the timezone of exchange.