Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:通过vba可以查出来,连续合约是哪个具体的合约吗?

1楼
pyd 发表于:2014/7/16 11:10:43
请教:通过vba可以查出来,连续合约是哪个具体的合约吗?
2楼
王锋 发表于:2014/7/16 11:13:11
做遍历即可查到
3楼
guotx2010 发表于:2014/7/16 12:14:19

Function GetContractCode(sMarketCode,sStockPre)    '根据市场编码取得主力合约编码
 GetCAX" then sStockPre="AY"
 if sStockPre="SRX" then sStockPre="SRY"
  
 For j = 1 To 12
  if j<10 then
   m="0" & cstr(j)
  else
   m=cstr(j)
  end if 
  Stock=ucase(sStockPre & m)
  'application.MsgOut sMarketCode & "," & Stock
  on error resume next    
'  Set report1 = marketdata.GetReportData(Stock,sMarketCode)
'  if cdbl(report1.volume)>contractvolume then
'   contractvolume=cdbl(report1.volume)
'   ZhuLiCode = report1.Label
'  end if 
  if marketdata.IsExistStock(Stock,sMarketCode) then
   set report1=marketdata.GetReportData(Stock,sMarketCode)
   if report1.IsMainInstrument=1 then
    GetContractCode=Stock
    exit function
   end if 
  end if 
 Next
End Function

 

以上函数返回主力合约代码,调用方法是:aaa=GetContractCode("ZJ","IF00"),aaa就是IF对应的主力合约

 

共3 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.01563 s, 2 queries.