[R-sig-hpc] Problems in applying parallel and GPU(cuda) computing for time efficient backtesting

潘毅 ypan at precise-investing.com
Sat Jul 11 10:07:23 CEST 2015

Hi, I just started to learn how to program in Cuda C/C++ and did go through several sample programs (like the vector add, stencil_1d, matrix multiplication and some others) to get the ideas of the basic concept of Cuda (like block, threads, index etc).
We would like to figure out how fast it would be to apply the cuda in stock stategy backtesting and do some simple tasks like generate (exponential) moving average series, breakout strategy from a long stock price time series. And I figured out that the most efficient way to do this performance task is to get a large number of stocks (say 20,000) and assign the tasks on each stock to each block/thread. 
Here is a simple Breakout strategy: 
 inputs: x(20),y(10) ;
Vars: V20(10),V10(10),N2(10),N1(10),N(10);
V20=Volatility(x)of data2;
V10=Volatility(y)of data2;
if V10<>0 and N2<>0 then beginN1=(N*V20)/V10;
value1=Average(high of data2,N2)of data2;
value2=Average(low of data2,N2)of data2;
if close crosses above value1  then beginbuy next bar at market;end;
if close crosses below value2  then beginsellshort next bar at market;end;

I was looking for similar examples for quite a while, but found nothing. Please let me know if you know how to apply parallel computation with respect to each stock to run the above pseudo code / should we simply apply parallel computation on each time series if it is possible.  Or have you seen any existing example?? Please give me the code if you have.
	[[alternative HTML version deleted]]

More information about the R-sig-hpc mailing list