以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  高级功能研发区  (http://www.weistock.com/bbs/list.asp?boardid=5)
----  [求助]代码中MaxOpenint的初始值和运行过程中的变化值是多少?  (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=149880)

--  作者:NaturalLaw
--  发布时间:2017/3/30 9:31:21
--  [求助]代码中MaxOpenint的初始值和运行过程中的变化值是多少?
\'该示例从郑州市场筛选SR合约得最大持仓量做为主力合约
Sub ScreenMaxOpenint()
 \'MaxCode主力合约代码;MaxOpenint最大持仓量
 Dim MaxCode,MaxOpenint,Count,i,Report
 Count = MarketData.GetReportCount("ZQ")\'得到市场所有品种数
 For i = 0 To Count - 1
 Set Report = MarketData.GetReportDataByIndex("ZQ",i)
 \'只处理SR合约
 If Left(Report.Label,2) = "SR" Then
  \'只处理有效合约
  If Right(Report.Label,2) >= "01" And Right(Report.Label,2) <= "12" Then
   If Report.Openint > MaxOpenint Then
    MaxCode = Report.Label
    MaxOpenint = Report.Openint
      End If
  End If
 End If
 Next
 \'显示成交量最大得合约
 MsgBox MaxCode
End Sub