matlab code snippet #3
来源:互联网 发布:抓包软件有哪几种 编辑:程序博客网 时间:2024/06/05 04:44
%%% bloomberg: intraday tick
VALUE_TRADE=1;
VALUE_BESTBID=31;
VALUE_BESTASK=32;
c=bloomberg;
% value_type,timestamp,price,size
raw=fetch(c,'NIX1 Index', 'TIMESERIES','11/15/2011');
I = (raw(:,1) == VALUE_TRADE | raw(:,1) == VALUE_BESTBID | raw(:,1) == VALUE_BESTASK);
raw(~I,:) = [];
raw(isnan(raw(:,3)),:)=[];
close(c);
x = dftool('ticktypes')
returns the list of tick types that can be converted to numeric tick type values with, for example,
find(strcmp('Trade',x))
Trade == 1, Bid Best == 31 and Ask Best == 32.
%%% bloomberg: daily data
fmdt=datenum(2000,1,1);
todt=datenum(2011,1,1);
c=bloomberg;
d1=fetch(c, '1 HK Equity', 'HISTORY', {'OPEN','HIGH','LOW','LAST_PRICE'},fmdt,todt,'d');
close(c);
%%% bloomberg: meta information
c=bloomberg;
ret=fetch(c,'1 HK Equity','GETDATA',{'SECURITY_TYP','CUR_MKT_CAP','GICS_SECTOR_NAME'});
type=ret.SECURITY_TYP{1};
mkt_cap=ret.CUR_MKT_CAP;
sector=ret.GICS_SECTOR_NAME{1};
close(c);
%%% calc time elapsed
etime(datevec(calc_end), datevec(calc_start))
%%% show datenum in report
%data(:,1) is datenum column
[cellstr(datestr(data(:,1))) num2cell(data)]
VALUE_TRADE=1;
VALUE_BESTBID=31;
VALUE_BESTASK=32;
c=bloomberg;
% value_type,timestamp,price,size
raw=fetch(c,'NIX1 Index', 'TIMESERIES','11/15/2011');
I = (raw(:,1) == VALUE_TRADE | raw(:,1) == VALUE_BESTBID | raw(:,1) == VALUE_BESTASK);
raw(~I,:) = [];
raw(isnan(raw(:,3)),:)=[];
close(c);
x = dftool('ticktypes')
returns the list of tick types that can be converted to numeric tick type values with, for example,
find(strcmp('Trade',x))
Trade == 1, Bid Best == 31 and Ask Best == 32.
%%% bloomberg: daily data
fmdt=datenum(2000,1,1);
todt=datenum(2011,1,1);
c=bloomberg;
d1=fetch(c, '1 HK Equity', 'HISTORY', {'OPEN','HIGH','LOW','LAST_PRICE'},fmdt,todt,'d');
close(c);
%%% bloomberg: meta information
c=bloomberg;
ret=fetch(c,'1 HK Equity','GETDATA',{'SECURITY_TYP','CUR_MKT_CAP','GICS_SECTOR_NAME'});
type=ret.SECURITY_TYP{1};
mkt_cap=ret.CUR_MKT_CAP;
sector=ret.GICS_SECTOR_NAME{1};
close(c);
%%% calc time elapsed
etime(datevec(calc_end), datevec(calc_start))
%%% show datenum in report
%data(:,1) is datenum column
[cellstr(datestr(data(:,1))) num2cell(data)]
- matlab code snippet #3
- Code Snippet
- code snippet
- Code Snippet
- Investigating Code Snippet Technology
- cv::kmeans code snippet
- Frequently used code snippet
- xcode Code Snippet Library
- C# code snippet
- vs使用Code Snippet提高工作效率
- C# frequently use code snippet
- Snippetvs中的code snippet技术
- [Erlang 0043] Erlang Code Snippet
- xCode:code snippet library 备份
- 使用 Code Snippet 简化 Coding
- xcode code snippet使用方式
- Javascript - code snippet - function 1
- VS.NET2005不能使用Code Snippet功能
- 转载:JAVA自学之路
- Hadoop0.21.0源码编译流程
- 内建函数
- 绑定网关mac地址防止arp攻击
- Android核心分析
- matlab code snippet #3
- 第14章——C++的代码重用
- 使用JDBC如何获取数据库自动生成的主键
- Java编程解析节省内存效率高的方法
- 5.3例题--日历问题--2964
- 最近时间安排
- Sqlserver 游标 慢
- Evernote推出Clearly:让您享受阅读(含视频)
- 前端脚本爱好者