以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  高级功能研发区  (http://weistock.com/bbs/list.asp?boardid=5)
----  [求助]请教这个持仓量问题,测试了,但没有数据  (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=2397)

--  作者:明心
--  发布时间:2010/8/8 13:43:18
--  [求助]请教这个持仓量问题,测试了,但没有数据

Function mxcc(Formula)
    mxcc=0
    Set Grid = Technic.GetGridByName("Main")
    Set Market = grid.GetMarketinfo()
    sc = market.id

    
    \'得到该窗格所对应的动态行情对象
    Set ReportData = Grid.GetReportData()
    Label = ReportData.Label
    lab = Left(Label,2)

    
     \'得到市场所有品种
 Count = MarketData.GetReportCount(sc)
 
 For i = 0 To Count-1
  Set Report1 = MarketData.GetReportDataByIndex(sc,i)

  if Left(Report1.Label,2) = lab Then

   if Right(Report1.Label,2) >= "01" And Right(Report1.Label,2) <= "12" Then
    If Report1.Volume >0 Then
     mxcc = mxcc+Report1.Volume
    End if
   end if
  End if
 Next
   
End Function

 

公式中调用这个函数,没有数据显示

[此贴子已经被作者于2010-8-8 13:52:14编辑过]

--  作者:admin
--  发布时间:2010/8/8 17:59:19
--  

你需要显示什么


--  作者:明心
--  发布时间:2010/8/8 18:20:09
--  

想算出对应品种所有合约的持仓量之和。


--  作者:明心
--  发布时间:2010/8/9 16:42:58
--  

我的想法是这样的

1、通过获得目前合约的代码和该品种所在市场的代码

2、在该市场寻找符合条件的该品种所有合约

3、将这个品种的每个合约的持仓量相加

4、最后返回这个持仓量之和。

达到可以调用该品种的持仓量,共投资参考。

[此贴子已经被作者于2010-8-9 16:44:35编辑过]

--  作者:董小球
--  发布时间:2010/8/9 16:46:41
--  
基本相当于套利合约了