//下属例子为订阅两支指数的最新价格,价格到达则回调hello函数。
a:=array();
a[0]:=array("FSSTI Index", "LAST_PRICE");
a[1]:=array("DAX Index", "LAST_PRICE");
blpcall(array("maxEvent":300),"//blp/mktdata","subscription",a,"hello");
function hello(b);
begin
echo "-----------------------------------\r\n";
if b["type"]=8 and b["msgs"][0,"id"]="FSSTI Index" then
c[0,1]:=b["msgs"][0,"value"]["LAST_PRICE"];
else if b["type"]=8 and b["msgs"][0,"id"]="DAX Index" then
c[1,1]:=b["msgs"][0,"value"]["LAST_PRICE"];
echo tostn(c),"\r\n";
return 1; //return false退出,如果一直返回真,就等到接收到系统结束的事件或者事件数达到maxEvent的规定。
end;