Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

acorrtst.cpp File Reference

#include <assert.h>
#include <math.h>
#include <stdio.h>
#include "yahooTS.h"
#include "autocorr.h"

Go to the source code of this file.

Functions

int main ()

Variables

const size_t days = 10
const size_t N = 1024 + days
double v [N]
double returns [N-days]


Detailed Description

Test for the autocorelation function

Definition in file acorrtst.cpp.


Function Documentation

main ( )
 

Definition at line 36 of file acorrtst.cpp.

00037 {
00038   autocorr acor(0.01, 256);
00039   autocorr::acorrInfo info;
00040   size_t i;
00050 
00051   yahooTS ts( "..\\data\\equities\\" );
00052   
00053   size_t n = N;
00054   if (ts.getTS( "aa.csv", v, n, yahooTS::Close )) {
00055     assert( n == N );
00056 
00057     for (i = days; i < N; i++) {
00058       // returns[i-1] = (v[i] - v[i-1])/v[i-1];
00059       returns[i-days] = log(v[i]) - log(v[i-days]);
00060       // printf("%9.6f\n", returns[i-days] );
00061     }
00062 
00063     acor.ACF( returns, N, info );
00064 
00065     const size_t len = info.points().size();
00066     for (i = 0; i < len; i++) {
00067       printf("%7.4f\n", (info.points())[i] );
00068     }
00069 
00070     // printf("slope = %7.4f, slopeErr = %7.4f\n", info.slope(), info.slopeErr());
00071   }
00072   else {
00073     fprintf(stderr, "main: getTS failed\n");
00074   }
00075 
00076   return 0;
00077 }


Variable Documentation

const size_t N = 1024 + days
 

Definition at line 1049 of file hursttst.cpp.

const size_t days = 10
 

Definition at line 16 of file acorrtst.cpp.

double returns [static]
 

Definition at line 24 of file acorrtst.cpp.

double v [static]
 

Definition at line 23 of file acorrtst.cpp.


Generated at Thu May 22 21:12:35 2003 for Hurst Exponent Calculation and Supporting Statistics by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001