Rss & SiteMap

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

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

标题:单个品种周期持仓量汇总

1楼
明心 发表于:2011/1/25 16:12:25

各位计算机配置不是太好的兄弟有幅了

 

Sub lianxuchicang()
    ' 得到框架名称为"Technic",窗格名称为"Main"的窗格对象
    Set Grid = Technic.GetGridByName("Main")
    Market = Grid.Market
    StockName = Grid.StockName
    StockLabel = Grid.StockLabel
    CycType = Grid.CycType
    lenname = len(StockName)
    name = left(StockName,2)

 

if CycType=5 then '根据自己需要修改,一般的为0、1、5
    
    '寻找该品种连续合约
    Count = MarketData.GetReportCount(market)
    for w =0 to Count-1
        Set ReportData1 = MarketData.GetReportDataByIndex(market,w)
        if right(reportData1.Label,2) ="00" and  left(reportData1.StockName,2) = name  then
        lxLabel = reportData1.Label
        lxStockName = reportData1.StockName
        'application.MsgOut lxLabel&" "&lxStockName
        end if      
    next
    '计算该市场中该品种所有合约的持仓量
    Set History = marketdata.GetHistoryData(lxLabel,market,CycType)
            for k = 0 to History.Count-1
                date1 =  History.date(k)
               if Right(ReportData1.Label,2) >= "01" And Right(ReportData1.Label,2) <= "12" and  left(reportData1.StockName,2) =

name Then
                  Set History1 = marketdata.GetHistoryData(ReportData1.Label,market,CycType)
                      for i = 0 to History1.Count-1
                         if History1.Date(i) = date1  then
                            Openint = History1.Openint(i)
                           ccl = ccl+Openint
                         end if
                     next
               end if
               History.Openint(k) = ccl
               call History.SaveData(lxLabel,market,CycType)
           next
    application.MsgOut lxLabel&" "&lxStockName&" "&"持仓更新完毕!"
else
    application.MsgOut "该周期没有数据需要更新!"
end if
End Sub

[此贴子已经被作者于2011-1-25 16:13:34编辑过]
2楼
明心 发表于:2011/1/25 16:13:00
要求加精给金币。图片点击可在新窗口打开查看
3楼
明心 发表于:2011/1/25 17:02:17

Sub lianxuchicang()
    ' 得到框架名称为"Technic",窗格名称为"Main"的窗格对象
    Set Grid = Technic.GetGridByName("Main")
    Market = Grid.Market
    StockName = Grid.StockName
    StockLabel = Grid.StockLabel
    CycType = Grid.CycType
    lenname = len(StockName)
    name = left(StockName,2)

if CycType = 5 then
   
    '寻找该品种连续合约
    Count = MarketData.GetReportCount(market)
    for w =0 to Count-1
        Set ReportData1 = MarketData.GetReportDataByIndex(market,w)
        if right(reportData1.Label,2) ="00" and  left(reportData1.StockName,2) = name  then
        lxLabel = reportData1.Label
        lxStockName = reportData1.StockName
        application.MsgOut lxLabel&" "&lxStockName
        end if      
    next
    '计算该市场中该品种所有合约的持仓量
    Set History = marketdata.GetHistoryData(lxLabel,market,CycType)
            for k = 0 to History.Count-1
                date1 =  History.date(k)
                Count1 = MarketData.GetReportCount(market)
                for q = 0 to Count1-1
                Set ReportData2 = MarketData.GetReportDataByIndex(market,q)
                    if Right(ReportData2.Label,2) >= "01" And Right(ReportData2.Label,2) <= "12" and  left(reportData2.StockName,2) = name Then
                       Set History1 = marketdata.GetHistoryData(ReportData2.Label,market,CycType)
                           for i = 0 to History1.Count-1
                              if History1.Date(i) = date1  then
                                 Openint = History1.Openint(i)
                                 ccl = ccl+Openint
                             end if
                           next
                    end if
               next
               History.Openint(k) = ccl
               call History.SaveData(lxLabel,market,CycType)
           next
    application.MsgOut lxLabel&" "&lxStockName&" "&"持仓更新完毕!"
else
    application.MsgOut "该周期没有数据需要更新!"
end if
End Sub

4楼
明心 发表于:2011/1/25 17:03:02
修改后还是不行。网高手指教。3楼只最新的。
共4 条记录, 每页显示 10 条, 页签: [1]


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