[R-SIG-Finance] quantstrat- adding transaction fee to rule
Brian G. Peterson
brian at braverock.com
Sun Sep 12 00:28:15 CEST 2010
On Sat, 11 Sep 2010 23:44:09 +0200, Andre Barroso
<andre.barroso at gmail.com>
wrote:
> Dear all,
>
> I tried to change the Faber demo from quantstrat to include transaction
> fees but without success. The original rule is:
>
> stratFaber <- add.rule(stratFaber, name='ruleSignal',arguments =
> list(sigcol="Cl.gt.SMA", sigval=TRUE, orderqty=1000,ordertype='market',
> orderside='long', pricemethod='market'), type='enter',path.dep=TRUE)
>
> my idea was just to include TxnFees as an argument, but this was
> ineffective:
>
> stratFaber <- add.rule(stratFaber, name='ruleSignal',arguments =
> list(sigcol="Cl.gt.SMA", sigval=TRUE, orderqty=1000,ordertype='market',
> orderside='long', pricemethod='market'),TxnFees=-5,
> type='enter',path.dep=TRUE)
>
> Any ideas of how this work?
I'm not at a machine that has quantstrat installed right this moment to
test it, but I believe that you should be able to put TxnFees into the
arguments=list(...) for ruleSignal. if that doesn't work, try adding it as
parameters=list(TxnFees=-5)
The relevant code files, I think, are traderules.R and orders.R The
function ruleOrderProc (and its documentation) might say more about the
precise method of calling addTxn.
I suppose it's possible we're not passing dots correctly somewhere, but I
hope one of my suggestions works. Let us know if/which one works.
Otherwise, I'll test tomorrow or Monday.
Regards,
- Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973cat ruleSi
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list