Upgraded quantstrat 0.7.8 from 0.7.7 then old code does not work

 ̄綄美尐妖づ 提交于 2019-12-11 19:17:52

问题


I have upgraded quantstrat package from 0.7.7(installed on Jan 7th 2013) to 0.7.8, however old code does not work properly. looks like we can not put any entry orders niether buy or sell, and only exit orders are executed. Here is the detail. Someone knows major changes in add.rule or applyStrategy function or same issue has been reported?

We set up trading rule by add.rule()

    add.rule(f,'ruleSignal',arguments=list(sigcol="DoSell",sigval=TRUE,orderqty=(-1*tradeSize),osFUN='osSUS',ordertype='market',TxnFees="calcTxnFee",prefer='Open'),type='enter',label=gExitLabel)
    add.rule(f,'ruleSignal',arguments=list(sigcol="DoBuy", sigval=TRUE,orderqty=tradeSize,osFUN='osBuy',ordertype='market',TxnFees="calcTxnFee",prefer='Price'),type='enter',label=gEnterLabel)
    add.rule(f,'ruleSignal',arguments=list(sigcol="DoStop", sigval=TRUE,orderqty=-1*tradeSize,osFUN='osStop',ordertype='stoplimit',threshold='StopLevel',TxnFees="calcTxnFee"),type='risk',label='Stop')

The problem we had is we don't get entry signal when we run applyStrategy ...... It seems that getOrderbook has "Buy" and "Sell" .....

 applyStrategy(rs, rs)  only applied sell signal ........(not buy)

[1] "2010-11-18 09:00:00 ABC -65660 @ 4.6"
[1] "2010-12-07 09:00:00 ABC -37509 @ 5.17"

However getOrderBook() recorded "Buy", and "Sell" in order ..... at the same time order.prices were set "0", order.status "replaced" and Prefer "Price" by the system


回答1:


It is hard to understand what is your problem exactly: "no entry signal", "orderbook has Buy and Sell" (whatever that means), "order.prices were set to 0" ...

I see that you are using your own order sizing functions, could it have something to do with that? You may try dropping your order sizing functions for a test, just to check if your entry orders are being executed.

Otherwise I suggest that you provide a complete example so I can run it and check.

Please be aware that quantstrat is under heavy development and that the code is patched almost on a daily basis, although the version number may not always be bumped up. So make sure that you always download the latest code.

HTH,

Jan Humme.



来源:https://stackoverflow.com/questions/16706335/upgraded-quantstrat-0-7-8-from-0-7-7-then-old-code-does-not-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!