以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://222.73.7.161/bbs/index.asp) -- 高级功能研发区 (http://222.73.7.161/bbs/list.asp?boardid=5) ---- 写一个次主力合约 (http://222.73.7.161/bbs/dispbbs.asp?boardid=5&id=10723) |
-- 作者:明心 -- 发布时间:2012/3/23 16:15:49 -- 写一个次主力合约 最近在研究跨期套利,想写一个次主力合约的数据输出,或者直接在指定板块新建一个“次主力”合约,写了好久还是没有搞定。高手们能指教一下吗?
|
-- 作者:明心 -- 发布时间:2012/3/23 16:18:20 -- Sub getcizhuli() pz = "cu "\'定义品种
以上红色部分数据输出有问题,请指教 |
-- 作者:solarhe2006 -- 发布时间:2020/7/21 14:50:56 -- 次主力合约这么久也没搞出来? |
-- 作者:solarhe2006 -- 发布时间:2020/7/25 18:11:49 -- Sub usgetdominantcontracts() On Error resume Next Dim block Dim market Set block = CreateObject("stock.block") For i = 0 To block.Count - 1 block.removeat (0) Next \'market = Array("CB","CM","NM","NB","HZ","SG")\'外盘石油、黄金、股指期货 market = Array("SQ","dq","zq","zj","IN")\'添加原油 c"> c"> contractopenint = 0 For i = 0 To UBound(market) n = marketdata.GetReportCount(market(i)) For j = 0 To n - 1 Set report1 = marketdata.GetReportDataByIndex(market(i), j) suffixlabel = Right(report1.Label, 2) If suffixlabel = "00" Then block.addstock contractmarket, contractlabel c"> c"> contractopenint00 = report1.OpenInt End If If (suffixlabel >= "01" And suffixlabel <= "12")and (report1.OPENINT<contractopenint00) Then If report1.OPENINT > contractopenint00/5 Then contractlabel = report1.Label contractmarket = market(i) contractopenint = report1.OPENINT End If End If Next Next block.addstock contractmarket, contractlabel block.tosave "自选","次主力合约" \'打开市场指定分类名称的板块 call block.open("次主力合约",0) application.msgout Now&" 次主力合约筛选完毕" End Sub
|