以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- [求助]请问下VBA的order对象需要专业版才能使用,那意思是免费版无法通过VBA来做程序化交易? (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=144934) |
-- 作者:michaelyjy -- 发布时间:2016/12/19 14:58:27 -- [求助]请问下VBA的order对象需要专业版才能使用,那意思是免费版无法通过VBA来做程序化交易? 如题 |
-- 作者:王锋 -- 发布时间:2016/12/19 15:17:40 -- 无法用VBA实现直接下单操作,可以间接做一些辅助的二次开发工作 |
-- 作者:michaelyjy -- 发布时间:2016/12/19 15:18:19 -- 即便模拟账号也无法交易? |
-- 作者:王锋 -- 发布时间:2016/12/19 15:26:59 -- 模拟可以的 |
-- 作者:michaelyjy -- 发布时间:2016/12/19 15:33:03 -- 但我用模拟账号,调用order对象,什么反应都没有,请问是什么原因? |
-- 作者:yukizzc -- 发布时间:2016/12/19 16:47:07 -- 具体看下你怎么使用的,代码贴下呢 |
-- 作者:michaelyjy -- 发布时间:2016/12/19 16:53:18 -- 下面这代码,开仓条件应该是恒成立的,但运行后什么反应都没 Sub TLStart()
call marketdata.RegReportNotify("IC00","ZJ")
call marketdata.RegReportNotify("IF00","ZJ") End Sub Sub MARKETDATA_ReportNotify()
Set Report1 = marketdata.GetReportData("IC00","ZJ")
Set Report2 = marketdata.GetReportData("IF00","ZJ")
msgbox Report1.SellPrice1
msgbox Report2.BuyPrice1
dim BuyHoding1
dim BuyHlding2
dim BuyTodayHoding1
dim BuyTodayHoding2
dim SellHoding1
dim SellHoding2
dim SellTodayHoding1
dim SellTodayHoding2
dim BuyCost
dim SellCost
dim PNL
Dim UseMargin
call Order.HoldingInfoByCode2("IC00","ZJ",BuyHoding1,BuyCost,BuyTodayHoding1,SellHoding1,SellCost,SellTodayHoding1,PNL,UseMargin)
call Order.HoldingInfoByCode2("IF00","ZJ",BuyHoding2,BuyCost,BuyTodayHoding2,SellHoding2,SellCost,SellTodayHoding2,PNL,UseMargin)
Diff = Report1.SellPrice1 - Report2.BuyPrice1 \'分别取卖价和买价计算差价
if Diff > 2800 and BuyHoding1 = 0 then
call Order.Buy(0,1,Report1.SellPrice1,0,"IC00","ZJ","",0)
call Order.BuyShort(0,1,Report2.BuyPrice1,0,"IF00","ZJ","",0)
end if
Diff = Report1.BuyPrice1 - Report2.SellPrice1
if diff < 2800 and BuyHoding1 > 0 then
call Order.Sell(0,1,Report1.BuyPrice1,0,"IC00","ZJ","",0)
call Order.Sellshort(0,1,Report2.SellPrice1,0,"IF00","ZJ","",0)
end if End Sub
|
-- 作者:yukizzc -- 发布时间:2016/12/19 17:01:16 -- Diff = Report1.BuyPrice1 - Report2.SellPrice1 application.msgout diff
if diff < 2800 and BuyHoding1 > 0 then
call Order.Sell(0,1,Report1.BuyPrice1,0,"IC00","ZJ","",0)
call Order.Sellshort(0,1,Report2.SellPrice1,0,"IF00","ZJ","",0)
end if
另一个贴中回复您了,类似这样自己做下调试输出,看下是不是条件不满足
|
-- 作者:michaelyjy -- 发布时间:2016/12/20 9:37:00 -- 按您说的application.msgout diff,我执行TLStart后什么东西都没出来。 |
-- 作者:michaelyjy -- 发布时间:2016/12/20 9:40:47 -- 原因好像是TLStart并没有触发MARKETDATA_ReportNotify |