欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件高级功能研发区 → 请问 大师能否把这个代码做一个注释啊?

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2723人关注过本帖树形打印复制链接

主题:请问 大师能否把这个代码做一个注释啊?

帅哥哟,离线,有人找我吗?
lszxy
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:5 积分:0 威望:0 精华:0 注册:2014/10/30 9:56:31
请问 大师能否把这个代码做一个注释啊?  发帖心情 Post By:2014/10/31 11:20:34 [只看该作者]

offset=3

 count = order.ordernum2

 for i = 0 to count-1
  call order.orderinfo2(index, orderid, consign, filled, remaining, action, ordertype, lmtprice,auxprice, account, code, market)
  if ordertype=0 then 
   order.contract code,market,multiplier,mintick,shortpercent,longpercent
   set report1 = marketdata.getreportdata(code,market)
   
   if abs(report1.newprice-lmtprice)>=offset*mintick then
    call order.cancelorder(orderid)
        
    if action=0 and kaiping=0 then
     order.buy 0,remaining,report1.newprice,0,code,market,account,0
    end if
    
    if action=0 and kaiping=1 then
     order.sell 0,remaining,report1.newprice,0,code,market,account,0
    end if
    
    if action=1 and kaiping=0 then
     order.buyshort 0,remaining,report1.newprice,0,code,market,account,0
    end if
    
    if action=1 and kaiping=1 then
     order.sellshort 0,remaining,report1.newprice,0,code,market,account,0
    end if    
   end if
  end if  
 next




这些参数貌似都没有地方查。或者给一个可以查的链接。非常感谢


 回到顶部
帅哥哟,离线,有人找我吗?
lszxy
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:5 积分:0 威望:0 精华:0 注册:2014/10/30 9:56:31
  发帖心情 Post By:2014/10/31 11:42:08 [只看该作者]

Public ExcelApp, iRowNo, iStartPingDuo, iStartPingKong, AccountCount
Public iMultipliter


Sub ORDER_OrderStatusEx2(OrderID, Status, Filled, Remaining, Price, Code, Market, OrderType, Aspect, Kaiping, Account, AccountType)
    '账户类型 0 IB 1 CTP 2 金仕达
    Dim sStatus                         '成交状态

    If AccountType = 0 Then
        sAccType = "0.IB"
    ElseIf AccountType = 1 Then
        sAccType = "1.CTP"
    ElseIf AccountType = 2 Then
        sAccType = "2.金士达"
    End If
        
    If AccountType = 0 Then
        sStatus = "FILLED"
    ElseIf AccountType = 1 Then
        sStatus = "TRADEING"
    ElseIf AccountType = 2 Then
        sStatus = "FILLED"
    End If
    If UCase(Status) = sStatus Then     '只跟踪成交的单
        WriteTradeLog OrderID, Status, Filled, Remaining, Price, Code, Market, OrderType, Aspect, Kaiping, Account
    End If
End Sub
''''''''''''''''''''''''''''''''''''''''''
Sub WriteTradeLog(OrderID, Status, Filled, Remaining, Price, Code, Market, OrderType, Aspect, Kaiping, AccountCode)
    Dim i, j
    Dim sSheetName, TradeSxf
    On Error Resume Next

              
            If iStartPingDuo = 0 Then
                iStartPingDuo = 1
            End If
            If iStartPingKong = 0 Then
                iStartPingKong = 1
            End If
            If Kaiping = 0 Then     '开仓
               TBUY(1,Filled,Code)    
            Else            '平仓
                If Aspect = 1 And Kaiping >= 1 Then '平多
                   
                    
                End If
                If Aspect = 0 And Kaiping >= 1 Then '平空
                 
                End If
            End If
       

End Sub


TBUY(1,Filled,Code)    我想开仓,截获的品种和数量,但是系统提示,这样是不行。请问大神,这个代码要怎么写?

[此贴子已经被作者于2014/10/31 11:43:37编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
guotx2010
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:蜘蛛侠 帖子:1366 积分:5210 威望:0 精华:7 注册:2010/12/11 18:00:33
  发帖心情 Post By:2014/11/1 18:02:25 [只看该作者]

TBUY(1,Filled,Code) 是perl后台语句,不能用在vba代码段中,在vba代码中得用Order对象的buy方法

建议学习一下我发布的vba代码范例中的order对象

http://www.weistock.com/bbs/dispbbs.asp?boardid=5&Id=11642

 

[此贴子已经被作者于2014/11/1 18:03:36编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
lszxy
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:5 积分:0 威望:0 精华:0 注册:2014/10/30 9:56:31
  发帖心情 Post By:2014/11/3 9:52:09 [只看该作者]

谢谢

 回到顶部