问题
How do you get intraday 1 minute data from Bloomberg please? I want bid & ask for 5 futures saved as a data frame please.
Thanks.
回答1:
I believe you are looking for the Intraday 1-minute bar data, Open, High, Low, Close, etc. You will need to use IntradayBarRequest to //blp/refdata service.
Revised answer:
Send two IntradayBarRequest's, one for BID and the other for ASK event type, with interval = 1 minute to //blp/refdata service. Extract the "Open" element from each data point in response message(s).
IntradayBarRequest = {
security = "IBM UN Equity"
eventType = BID
startDateTime = 2019-02-13T00:00:00.000
endDateTime = 2019-02-14T23:59:59.000
interval = 1
gapFillInitialBar = false
adjustmentNormal = false
adjustmentAbnormal = false
adjustmentSplit = false
adjustmentFollowDPDF = false
}
Sample data point:
barTickData = {
time = 2019-02-13T14:30:00.000
open = 136.45
high = 136.87
low = 136.25
close = 136.76
volume = 91
numEvents = 45
value = 12424.061
}
See the IntradayBarExample code example in the SDK.
回答2:
Dan, if you are looking to work with Pandas I would suggest using TIA: https://github.com/bpsmith/tia
You mentioned you are working with Python 3. At the moment, TIA is only compatible with Python 2, but here https://github.com/bpsmith/tia/issues/11 has a Python 3 conversion. I've been using this recently and it's pretty good. An example:
from tia.bbg import LocalTerminal
import tia.bbg.datamgr as dm
import datetime
sid = 'IBM US EQUITY'
event = 'TRADE'
dt = pd.datetools.BDay(-1).apply(pd.datetime.now())
start = pd.datetime.combine(dt, datetime.time(13, 30))
end = pd.datetime.combine(dt, datetime.time(21, 30))
f = LocalTerminal.get_intraday_bar(sid, event, start, end,
interval=60).as_frame()
f.head(1)
close high low numEvents open time value volume
0 162.2500 162.70 161.51 4005 162.4900 2015-02-24 14:30:00 110345672 680888
The github link above has loads of examples, too.
回答3:
You can use xbbg:
In [1]: from xbbg import blp
In [2]: blp.bdib(ticker='SPY US Equity', dt='2019-01-17').tail()
Out[2]:
ticker SPY US Equity
field open high low close volume num_trds
time
2019-01-17 15:57:00-05:00 262.82 262.92 262.70 262.88 644947 2744
2019-01-17 15:58:00-05:00 262.87 262.89 262.77 262.86 713451 3152
2019-01-17 15:59:00-05:00 262.87 263.05 262.74 263.00 2248033 5616
2019-01-17 16:09:00-05:00 262.96 262.96 262.96 262.96 0 1
2019-01-17 16:15:00-05:00 262.96 262.96 262.96 262.96 0 1
来源:https://stackoverflow.com/questions/54715306/how-do-you-download-bloomberg-intraday-data