[R-SIG-Finance] basket of trading systems (blotter, quantstrat)
Brian G. Peterson
brian at braverock.com
Tue Mar 15 12:49:02 CET 2011
On 03/15/2011 05:23 AM, Immanuel wrote:
> Hello all,
>
> I'm wondering what the best portfolio / account structure would be if
> one works with a basket of trading
> systems. I'm not sure the term "trading system" is clearly defined, so
> for me the
> following are different trading systems (TS):
>
> * strategy_A + Financialnstrument_A + frequency_A
> * strategy_B + Financialnstrument_A + frequency_A
> * strategy_A + Financialnstrument_B + frequency_A
> * strategy_A + Financialnstrument_A + frequency_B
>
> I want to access endEq, trades P/L individually for each TS. I need
> access to this information during the execution of the
> TS to adjust orderqty etc.
> What is the best way to do this in blotter / quantstrat?
> Should I construct a portfolio object for each TS or are there other
> options? (I'm not asking for code, just the big picture on how to
> approach this)
Looks like I missed this one a week or so ago.
You are correct that the term 'trading system' is not well defined, in R
or anywhere else...
If you intend to share account equity across your various 'systems',
then put them all in the same account. This mirrors the way your broker
will calculate account margin.
I can imply from your example that your systems need a combination of
strategy, instrument, and frequency to make a unique set. It seems like
you're over-complicating things here. 'frequency' suggests itself as
something that should be a parameter for your strategy, but you don't
provide enough details for me to be sure.
quantstrat will loop over all instruments in a single portfolio by
default when you call applyStrategy. If you truly have different sets
of strategy rules (and not just different parameters to the same
strategy), then you'll apply these strategies to different portfolios by
strategy.
At the lowest level, you can put each instrument in its own portfolio.
We often do this when we are looking for instrument and parameter
combinations that will work well with a given strategy.
When I see people adjusting order sizing based on account equity, I'm
always concerned that they don't really understand the risk profile of
the strategy involved, and are 'betting' capital rather than 'applying'
capital to a strategy with a known risk profile. I feel it is better to
trade a system at the maximum size you can without market impact,
possibly reduced by periodic *portfolio* rebalancing based on the risks
of the strategy on each instrument. As such, I tend to discount
'systems' that need to do account equity based rebalancing frequently.
If you need to do this, then wrap your calls to applyStrategy inside a
time loop, calling applyStrategy repeatedly (like every day or every
week or every month) based on your periodic rebalancing frequency.
We will add this type of periodic rebalancing to quantstrat eventually,
but it's not super high on my priority list.
Regards,
- Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list