[R-SIG-Finance] quantstrat - model transactions on specific dates

Joshua Ulrich josh.m.ulrich at gmail.com
Thu Oct 9 22:35:16 CEST 2014


On Thu, Oct 9, 2014 at 3:31 PM, Brian G. Peterson <brian at braverock.com> wrote:
> On 10/09/2014 03:05 PM, Mark Knecht wrote:
>>
>>     I would like to do something in quantstrat like set up an initial
>> buy for all symbols in a portfolio on a certain date. To that end I
>> want a signal column that says the date is matching my buy date and
>> then I'l execute a specific rule. However signals need to match
>> columns which led me to wanting the index in a column as a value. To
>> that end the code below basically does this but returns  a numerical
>> value which (I think) is referenced to 1970-01-01.
>
> It seems to me that the simplest thing would be to just establish your
> initial portfolio.
>
> Initialize the portfolio, then construct a data.frame for the txnData
> argument of addTxns.
>
> Call addTxns before calling applyStrategy.
>
> Alternately, you could modify sigFlatten to essentially do the opposite, and
> initiate on a certain time.
>
You're thinking of sigTimestamp (which was based on sigFlatten, but
I'm not sure was ever made public).  Mark, I think sigTimestamp is
what you're looking for.

> Regards,
>
> Brian
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
>

--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list