[R-SIG-Finance] Questions regarding Cashflows in Blotter and hacking Quantstrat

Ueli Hofstetter uelihofstetter at gmail.com
Thu Apr 2 04:50:55 CEST 2015


Thanks for the reply. Regarding the reason for using quantstrat: No, there
is no particular reason but that it seems to provide quite a lot of
functionality out of the box .... but unfortunately, as you pointed out, it
is not the functionality I actually need ;-). In this case, I guess I will
use blotter and performanceanalytics directly.

thanks a lot for the advise.

2015-04-02 4:17 GMT+02:00 Ilya Kipnis <ilya.kipnis at gmail.com>:

> Well, I'm not sure quantstrat is the tool for that, then. Quantstrat is a
> signal-based backtesting system. If you want to rebalance a portfolio based
> on a signal, you may want to do that in PerformanceAnalytics with
> Return.Portfolio functionality. Is there a particular reason you want to
> use quantstrat?
>
> On Wed, Apr 1, 2015 at 10:04 PM, Ueli Hofstetter <uelihofstetter at gmail.com
> > wrote:
>
>> Hi Ilya, thanks for the reply.
>>
>> Yes I guess this would eliminate the need to add a dummy instrument for
>> the non-instrument based timeseries. But than the problem is that the
>> signal gets triggered for all securities in the universe, but actually I
>> need only one signal to trigger the rebalancing  (again, the signal could
>> be something like the current lunar phase, i.e. not related to any
>> securities in the portfolio/universe)..... or did I miss your argument?
>>
>> 2015-04-02 3:50 GMT+02:00 Ilya Kipnis <ilya.kipnis at gmail.com>:
>>
>>> Ueli,
>>>
>>> Why don't you just append the indicator to the instruments before you
>>> create the strategy? That is, you know how an instrument is usually defined
>>> by OHLCV? Why not add another column called MyIndicator to your instruments
>>> outside the strategy definition? The strategy will pick up the column in
>>> the signals phase.
>>>
>>> -Ilya
>>>
>>> On Wed, Apr 1, 2015 at 9:41 PM, Ueli Hofstetter <
>>> uelihofstetter at gmail.com> wrote:
>>>
>>>> I have posted two questions regarding Blotter and Quantstrat on
>>>> Stackoverflow and appreciate any hints and suggestions:
>>>>
>>>> Nr 1: ----------------------------------------------
>>>>
>>>> http://stackoverflow.com/questions/29403601/how-to-implement-rule-based-rebalancing-strategy-using-quantstrat-blotter
>>>>
>>>> How to implement rule based rebalancing strategy using
>>>> QUANTSTRAT/BLOTTER
>>>> <
>>>> http://stackoverflow.com/questions/29403601/how-to-implement-rule-based-rebalancing-strategy-using-quantstrat-blotter
>>>> >
>>>> :
>>>>
>>>> I am trying to implement a rulebased rebalancing strategy within the
>>>> QUANTSTRAT framework. Let's assume I want to base my rebalancing time
>>>> for a
>>>> portfolio of instruments on some indicator which is not calculated from
>>>> a
>>>> traded instrument but from some other time series (for instance GDP
>>>> figures) and whenever the signal based on that indicator is triggered
>>>> (let's say GDP drops by x% within some period z) I d'like rebalance my
>>>> portfolio according to some rebalancing algorithm (e.g. Markowitz).
>>>>
>>>> My idea was to
>>>>
>>>>    - create a dummy instrument for the non-instrument based timeseries
>>>> so
>>>>    that I can define and indicator and rule based on it and
>>>>    - to write my own 'ruleSignal' implementation in order to do the
>>>>    algorithm based rebalancing.
>>>>
>>>> So my question is: Is this a reasonable approach (is it even possible)?
>>>> Or
>>>> would it be better to use BLOTTER directly (and thus not to rely on the
>>>> QUANTSTRAT abstraction)?
>>>>
>>>>
>>>> Nr 2: ----------------------------------------------
>>>>
>>>> http://stackoverflow.com/questions/29403028/how-do-blotter-quantstrat-quantmod-performanceanalytics-handle-internal-cashflow
>>>> How do blotter/quantstrat/quantmod/performanceanalytics handle internal
>>>> cashflows
>>>> <
>>>> http://stackoverflow.com/questions/29403028/how-do-blotter-quantstrat-quantmod-performanceanalytics-handle-internal-cashflow
>>>> >
>>>> ?
>>>>
>>>> I don't understand how internal cashflows are handled in
>>>> blotter/quantstrat/quantmod/performanceanalytics. This mainly concerns
>>>> two
>>>> aspects: Regular cashflows like dividends, coupons etc. as well as
>>>> cashflows from expiring instruments (e.g. a cash settled in the money
>>>> option). For equities this seems not too much of an issue as one can
>>>> always
>>>> use dividend adjusted prices and it is relatively rare that stocks get
>>>> delisted. For coupon bonds or options however, I don't get how this is
>>>> handled.
>>>>
>>>> So my questions are:
>>>>
>>>>    - Is there a generic mechanism to handle internal cashflows
>>>> (dividends,
>>>>    coupons, repayments etc.) in these packages?
>>>>    - If so, is there some documentation for this and where can I find
>>>> the
>>>>    relevant implementation in the source code (i.e. pointers to
>>>> specific R
>>>>    files and/or functions would be great)?
>>>>
>>>> Cheers
>>>>
>>>> --
>>>> Ueli Hofstetter
>>>>
>>>>         [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> R-SIG-Finance at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>> -- Subscriber-posting only. If you want to post, subscribe first.
>>>> -- Also note that this is not the r-help list where general R questions
>>>> should go.
>>>>
>>>
>>>
>>
>>
>> --
>> Ueli Hofstetter
>>
>
>


-- 
Ueli Hofstetter

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list