这个例子展示了如何从Bloomberg检索实时数据®.在这里,要在命令行显示彭博股票报价数据,请使用事件处理程序disp
.您可以创建自己的事件处理函数来处理Bloomberg数据,而不是使用默认的事件处理函数。
使用Bloomberg Desktop c++接口创建Bloomberg连接。
c =彭博社;
验证Bloomberg连接。
v = isconnection (c)
v = 1
v
返回真正的
显示彭博连接是有效的。
检索IBM的最后价格和数量®福特汽车公司®证券。
[~ t] =实时(c, {“IBM美国股票”,“F美国股票”},...{“LAST_PRICE”,“体积”},“disp”)
t = Timer对象:Timer -4 Timer Settings ExecutionMode: fixedRate Period: 0.05 BusyMode: drop Running: off Callbacks TimerFcn: 1x5 cell array ErrorFcn: " StartFcn: " StopFcn:" column 1 - 6 {'SecurityID'} {'SecurityID'} {'SecurityID'} {'SecurityID'} {'SecurityID'} {'SecurityID'} {'LAST_PRICE'} {'LAST_PRICE'} {'F US Equity'} {'8.960000'} {'F US Equity'} {'13423731'} {'IBM US Equity'} {'118.490000'}} column 7 - 8 {'SecurityID'} {'VOLUME'} {'IBM US Equity'}{'744066'}…
实时
返回MATLAB®定时器对象及其属性。然后,实时
返回IBM和福特汽车公司股票的最新价格和成交量。
停止实时数据显示。
停止(t) c.Session.stopSubscriptions
关闭(c)