以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- [求助]金字塔上面显示的时间是本地时间么 (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=4699) |
-- 作者:wangwatercup -- 发布时间:2011/1/4 9:59:00 -- [求助]金字塔上面显示的时间是本地时间么 设计了一个程序,从9:14:30开始,每50毫秒下一次单,结果在9:15:06之前的单子都没有下去,说是“已撤单报单被拒绝当前状态禁止此交易”,但是在9:15:07全部成交 于是想问一下: (1)是因为金字塔显示的是本地的本机时间,所以才会有这6秒的延迟么? (2)理论上每50毫秒下一次单,每秒应该有20次下单,但是实际上只有5次左右的下单,那么这时候说明金字塔是否是处理完本次任务之后才处理下一个任务,而且“过期不候”? vbs代码如下: dim dmHY,dmJYS,signal,buy_amount,IDaccount,RangeTick,RangeStoploss,Stoploss,NumberStoploss,Slide dim orderid dim ConSign dim Filled dim Remaining dim Action dim OrderType dim LmtPrice dim Account dim Kaiping dim BuyHoding dim BuyCost dim BuyTodayHoding dim SellHoding dim SellCost dim SellTodayHoding dim PNL dim UseMargin dim FirstTrade,StatusFirstTrade sub b0() \'设置参数 \'一定要在开盘之前运行本程序, signal=1 \'1 买 2 卖空 buy_amount=6 \'开仓数量 IDaccount="40009975" \'帐号 dmHY="if01" \'合约 dmJYS="zj" \'交易所 RangeTick=.005 \'报价与开盘价之间价差变动范围百分比 RangeStoploss=.02 \'止损百分比 NumberStoploss=0 Slide=.2 end sub Sub APPLICATION_VBAStart() FirstTrade=1 \'一定要在未建仓之前运行本程序; \'如果想在开盘时最先成交,一定在9点14分之前启动本程序 call b0 call Application.SetTimer(1,1000) \'1S触发一次 call application.SetTimer (2,50) call marketdata.RegReportNotify(dmHY,dmJYS) msgbox "启动" End Sub Sub APPLICATION_Close() call Application.KillTimer(1) call Application.KillTimer(2) call marketdata.UnRegReportNotify(dmHY,dmJYS) End Sub Sub APPLICATION_Timer(ID) select case ID case 1 call b3 case 2 call b1 end select End Sub Sub ORDER_OrderStatusEx(oOrderID,oStatus,oFilled,oRemaining,oPrice,oCode,oMarket,oOrderType,oAspect,oKaiping) StatusFirstTrade = oStatus End Sub Sub MARKETDATA_ReportNotify(ReportData) \'争取在启动的时候下单 timePart=time if timePart<=timevalue("09:14:30") or (timePart>timevalue("11:30:10") and timePart<=timevalue("12:59:50")) then exit sub end if if FirstTrade=1 and (isempty(StatusFirstTrade) or StatusFirstTrade="Cancelled" or StatusFirstTrade="Inactive") then Set rpt = marketdata.GetReportData(dmHY,dmJYS)\'得到这个品种的行情报价 PriceOpen=rpt.Open select case signal case 1 Ssx_Price_Buy=rpt.SellPrice1+Slide if abs((Ssx_Price_Buy-PriceOpen)/PriceOpen)<=RangeTick then call Order.Buy(0,buy_amount,Ssx_Price_Buy,0,dmHY,dmJYS,"",0) end if case 2 Ssx_Price_Sell=rpt.BuyPrice1-Slide if abs((Ssx_Price_Sell-PriceOpen)/PriceOpen)<=RangeTick then call Order.BuyShort(0,buy_amount,Ssx_Price_Sell,0,dmHY,dmJYS,"",0) end if end select if StatusFirstTrade ="Filled" or StatusFirstTrade ="Tradeing" or StatusFirstTrade ="Submitted" or StatusFirstTrade ="PreSubmitted" then FirstTrade = 0 \'不会存在下了指令却无法成为委托的情况,因为如果能获得注册的品种发出的价格,则一定是在交易时间 call document.WritePrivateProfileFloat("operation", "timePartReportNotify", timePart, "C:\\out.ini") end if end if end sub sub b1() \'争取在开盘的时候下第一单 timePart=time if timePart<=timevalue("09:14:40") or timePart>=timevalue("9:15:10") then exit sub end if if FirstTrade=1 and (isempty(StatusFirstTrade) or StatusFirstTrade="Cancelled" or StatusFirstTrade="Inactive") then Set rpt = marketdata.GetReportData(dmHY,dmJYS)\'得到这个品种的行情报价 PriceOpen=rpt.open select case signal case 1 Ssx_Price_Buy=rpt.SellPrice1+Slide if abs((Ssx_Price_Buy-PriceOpen)/PriceOpen)<=RangeTick then call Order.Buy(0,buy_amount,Ssx_Price_Buy,0,dmHY,dmJYS,"",0) end if case 2 Ssx_Price_Sell=rpt.BuyPrice1-Slide if abs((Ssx_Price_Sell-PriceOpen)/PriceOpen)<=RangeTick then call Order.BuyShort(0,buy_amount,Ssx_Price_Sell,0,dmHY,dmJYS,"",0) end if end select if StatusFirstTrade ="Filled" or StatusFirstTrade ="Tradeing" or StatusFirstTrade ="Submitted" or StatusFirstTrade ="PreSubmitted" then FirstTrade = 0 \'不会存在下了指令却无法成为委托的情况,因为如果能获得注册的品种发出的价格,则一定是在交易时间 call document.WritePrivateProfileFloat("operation", "timePart", timePart, "C:\\out.ini") end if end if end sub |
-- 作者:王锋 -- 发布时间:2011/1/5 9:44:09 -- 是本地时间。 实际上只有5次左右的下单,你看看是否跟行情有关,因为只有0.5秒一笔 |
-- 作者:wangwatercup -- 发布时间:2011/1/5 12:59:30 -- 多谢!! |