-- 作者:jingcha
-- 发布时间:2013/8/29 10:57:57
--
if not hangqing is nothing then
ctp=Order.StockType(symbol,matketID) if ctp=1 then strDate = Cstr(hangqing.Date) \'test_tuoke_Label5.caption = strDate dim num dim orderid dim ConSign dim Filled dim R1 dim Action dim OrderType dim LmtPrice dim Account dim Kaiping num = Order.OrderInfoByCode2(hangqing.Label,hangqing.marketName, orderid, ConSign, Filled, R1, Action, OrderType, LmtPrice, Account, Kaiping) application.MsgOut num if num > 1 then if lastOrderID = orderid then CancelCount = CancelCount + 1 else CancelCount = 0 lastOrderID = orderid end if if (CancelCount > 2) then call Document.DebugFile("D:\\OrderLog.Txt", "CancelOrder:%.2f",orderid ) call Order.CancelOrder(orderid) CancelCount = 0 end if end if if CountIndex > 5 then dim BuyHoding dim BuyTodayHoding dim SellHoding dim SellTodayHoding dim BuyCost dim SellCost dim PNL Dim UseMargin call Order.HoldingInfoByCode2(hangqing.label,hangqing.marketname,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin) if BuyHoding > 0 then application.MsgOut hangqing.LowerLimitPrice application.MsgOut hangqing.NewPrice msg = "Sell= " & hangqing.LowerLimitPrice msg = msg & " BuyHoding=" & BuyHoding msg = msg & " num= " & num call Document.DebugFile("D:\\OrderLog.Txt", msg,1) call Order.Sell(0,BuyHoding,hangqing.LowerLimitPrice,0,hangqing.label,hangqing.marketname,"",0) CountIndex = 0 end if end if txt = " Buy= " & hangqing.UpperLimitPrice call Document.DebugFile("D:\\OrderLog.Txt", txt, 1) call Order.Buy(0,lots,hangqing.UpperLimitPrice,0,hangqing.label,hangqing.marketname,"",0) CountIndex = CountIndex + 1 elseif ctp=0 then msgbox "IB账户不支持交易" end if end if
|
-- 作者:jingcha
-- 发布时间:2013/8/29 10:58:18
--
if not hangqing is nothing then \'test_tuoke_Label1.caption = hangqing.NewPrice ctp=Order.StockType(symbol,matketID) if ctp=1 then strDate = Cstr(hangqing.Date) \'test_tuoke_Label5.caption = strDate \'dim num \'dim orderid \'dim ConSign \'dim Filled \'dim R1 \'dim Action \'dim OrderType \'dim LmtPrice \'dim Account \'dim Kaiping \'num = Order.OrderInfoByCode2(hangqing.Label,hangqing.marketName, orderid, ConSign, Filled, R1, Action, OrderType, LmtPrice, Account, Kaiping) \'if num > 1 then \'if lastOrderID = orderid then \'CancelCount = CancelCount + 1 \'else \'CancelCount = 0 \'lastOrderID = orderid \'end if \'if (CancelCount > 2) then \'call Document.DebugFile("D:\\OrderLog.Txt", "CancelOrder:%.2f",orderid ) \'call Order.CancelOrder(orderid) \'CancelCount = 0 \'end if \'end if if CountIndex > 5 then dim BuyHoding dim BuyTodayHoding dim SellHoding dim SellTodayHoding dim BuyCost dim SellCost dim PNL Dim UseMargin call Order.HoldingInfoByCode2(hangqing.label,hangqing.marketname,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin) if SellHoding > 0 then application.MsgOut hangqing.UpperLimitPrice application.MsgOut hangqing.NewPrice msg = "SellShort= " & hangqing.UpperLimitPrice msg = msg & " SellHoding=" & SellHoding msg = msg & " num= " & num call Document.DebugFile("D:\\OrderLog.Txt", msg,0) call Order.SellShort(0,SellHoding,hangqing.UpperLimitPrice,0,hangqing.label,hangqing.marketname,"",1) \'msgbox hangqing.UpperLimitPrice \'msgbox SellHoding CountIndex = 0 end if end if txt = " BuyShort= " & hangqing.NewPrice call Document.DebugFile("D:\\OrderLog.Txt", txt, 0) call Order.BuyShort(0,lots,hangqing.NewPrice,0,hangqing.label,hangqing.marketname,"",1) CountIndex = CountIndex + 1 elseif ctp=0 then msgbox "IB账户不支持交易" end if end if
|
-- 作者:王锋
-- 发布时间:2013/8/29 11:34:30
--
Buy 方法
开多操作
Buy(Type,Vol,Price,StoplmtPrice,Code,Market,AccountID,Valid)
Type 委托类型,分别可为 0限价 1市价 2停损 3限价停损
Vol 委托数量
Price 委托价格,当Type为2和3时为停损价格
StoplmtPrice 停损限价,当Type为3时必须指定停损限价
Code 品种代码,如 "600215"
Market 品种市场,如"SH"表示上海市场
AccountID 指定帐户,为空表示当前帐户
Valid 为1表示下单时弹出确认对话框,为0表示直接下单到服务器
|