Skip to content
Prev 7202 / 15274 Next

Blotter example by kafka from R-bloggers

On 12/28/2010 01:28 PM, Stephen Choularton wrote:
>
The reason this script runs slowly is that it is calling updatePortf, 
updateAcct, and updateEndEq after each and every observation to do order 
sizing.

As a matter of practice, if you can 'cheat' and say 'I've got $1000000 
to invest, and I don't mind being a little leveraged', you don't need to 
do that, and things are *much* faster.  For example, we can typically 
run a strategy backtest on *tick* data (millions of observations) in 
less than a minute per day.

The reason for this divergent length of time is that the blotter update* 
functions do a *lot* of calculations, and all of those take time, even 
though they are vectorized where possible.

Perhaps a middle ground would be to call the update* functions monthly, 
or something similar.

I found his example script to be slower than I am used to, but not 
unbearable, and believe that it finished in a couple minutes, though its 
been a while since I ran it...
Good.
<...>
It's likely not a typo, but rather an incompatible index between one 
time series and another.  You'd need to check the indices of each of the 
input series, or of the custom order sizing function from the script to 
see what's going on.  If the output from your run and the blog post 
agree, I wouldn't bother.