以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  高级功能研发区  (http://weistock.com/bbs/list.asp?boardid=5)
----  现在只能搜索到上期夜市的主力品种。  (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=66471)

--  作者:qq代人发帖
--  发布时间:2014/6/23 9:53:27
--  现在只能搜索到上期夜市的主力品种。

请教:我是用程序交易,需要自动搜索板块的品种,以前各个交易所的都能搜到,现在只能找到上期夜市的品种了。

就是用金字塔哦论坛上的SearchCode代码搜索主力品种,现在只能搜索到上期夜市的主力品种了

--  作者:yukizzc
--  发布时间:2014/6/23 9:58:51
--  
是pel语言的吗?相关代码最好发下。
--  作者:torymiss
--  发布时间:2014/6/23 22:32:50
--  
Sub SearchStart()
 
  application.MsgOut Date &" " &Time& "检索主力合约"
 Dim marketName
 Set dominantContract=CreateObject("Scripting.Dictionary") \'创建一个字典
 marketName=Array("SQ","DQ","ZQ","ZJ","SY")
 prefixStockNameOld=""
 c"
 contractVol=0
 
 \'找到的主力合约代码放这里
 
  
 For j=0 To UBound(marketName)
  n=marketData.GetReportCount(marketName(j))
  For i=0 To n-1
   Set reportData=marketdata.GetReportDataByIndex(marketName(j),i)
   prefixStockNameCur=left(reportData.StockName,2)
   suffixStockNameCur=right(reportData.StockName,2)
   If suffixStockNameCur>="00" And suffixStockNameCur<"99" And reportData.Volume>0 Then
    If prefixStockNameCur<>prefixStockNameOld Then
     If contractLabel<>"" Then
      dominantContract.Add contractMarket & contractLabel, 0
     End If
     prefixStockNameOld=prefixStockNameCur
     contractLabel=reportData.Label
     contractMarket=marketName(j)
     contractVol=reportData.Volume
    ElseIf reportData.Volume>contractVol then
     contractLabel=reportData.Label
     contractVol=reportData.Volume
    End If
              
   End If
  Next  
 Next
 dominantContract.Add contractMarket & contractLabel,0
 
 
 labels=dominantContract.Keys
 markets=dominantContract.Keys
 
 FndCount = UBound(dominantContract.Keys)
 Application.MsgOut "共找到"&FndCount&"个合约"
 
 If FndCount > 0 Then
  \'整理一下数据,将市场和代码分开
  For j=0 To FndCount
      Application.MsgOut "分析"&labels(j)
   markets(j) = left(labels(j),2)
   labels(j) = right(labels(j),len(labels(j))-2)
  Next 
  SaveBlockAndOpen labels, markets
 Else
  MsgBox "没有找到主力合约"
 End if
 
End Sub

--  作者:torymiss
--  发布时间:2014/6/23 22:33:16
--  

楼上就是代码


--  作者:王锋
--  发布时间:2014/6/24 23:47:04
--  

你那个代码由于受到论坛安全限制无法显示全,去下载这个完整的吧

http://www.weistock.com/bbs/dispbbs.asp?BoardID=5&ID=2670&replyID=&skin=1