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

Dirk Eddelbuettel edd at debian.org
Sat Jul 11 14:43:52 CEST 2015

On 11 July 2015 at 16:07, 潘毅 wrote:
| 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. 

You won't get all that data onto the card.

So you will have to do it in parts, and you are likely the hit the "wrong
side" of the communication versus computation tradeoff as the computation is
pretty simple.


| 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;
| N2=IntPortion(N1);
| 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]]
| _______________________________________________
| R-sig-hpc mailing list
| R-sig-hpc at r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-hpc

http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the R-sig-hpc mailing list