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

hurst_test_base Class Reference

My software to estimate the Hurst exponent was originally developed to estimate the Hurst exponent of stock market time series (e.g., n-day returns etc...). More...

#include <hurst_test_base.h>

Inheritance diagram for hurst_test_base::

hurst_stocks wave_hurst List of all members.

Public Methods

 hurst_test_base (const char *path)
 ~hurst_test_base ()
virtual void test ()=0

Protected Methods

size_t blockedPercentReturn (const double *v, double *ret, const size_t N, const size_t block_size)
 Calculate the n-day percentage return:. More...

size_t blockedLogReturn (const double *v, double *ret, const size_t N, const size_t block_size)
 Calculate the n-day log return:. More...

equityEntryfindTableEntry (const char *ticker)
 Given a market "ticker" (equity symbol), return an equityEntry object containing the company name, the ticker and the file name. More...


Protected Attributes

yahooTS ts
 The yahooTS object ts supports reading and simple parsing of the finance.yahoo.com time series file. More...


Static Protected Attributes

equityEntry equityTable_ []
 A table of stocks that are going to be processed. More...

const size_t tableSize_
 The size of the table. More...


Private Methods

 hurst_test_base (const hurst_test_base &hurst_test_base)
 Disallow the copy constructor. More...


Detailed Description

My software to estimate the Hurst exponent was originally developed to estimate the Hurst exponent of stock market time series (e.g., n-day returns etc...).

The hurst_test_base supports reading finance.yahoo.com time series files (in spread sheet data format). Subclasses can then be derived from this class to calculate the Hurst exponent (via the reseacled range or via wavelets) or other statistics (autocorrelation) on the time series.

Definition at line 19 of file hurst_test_base.h.


Constructor & Destructor Documentation

hurst_test_base::hurst_test_base ( const hurst_test_base & hurst_test_base ) [private]
 

Disallow the copy constructor.

hurst_test_base::hurst_test_base ( const char * path ) [inline]
 

Definition at line 80 of file hurst_test_base.h.

00080 : ts( path ) {}

hurst_test_base::~hurst_test_base ( ) [inline]
 

Definition at line 81 of file hurst_test_base.h.

00081 {}


Member Function Documentation

size_t hurst_test_base::blockedLogReturn ( const double * v,
double * ret,
const size_t N,
const size_t block_size ) [protected]
 

Calculate the n-day log return:.

     Ri = log( Pt ) - log( Pt-n )
   

where log() is the natural log.

In the finance literature, log return is the most common method used to calculate the return. By taking the log of the return the effect of overall market movement is minimized.

Definition at line 58 of file hurst_test_base.cpp.

Referenced by wave_hurst::test(), and hurst_stocks::test().

00062 {
00063   size_t ix = 0;
00064   for (size_t i = block_size; i < N; i = i + block_size) {
00065     ret[ix] = log(v[i]) - log(v[i-block_size]);
00066     // printf("%4d %9.6f\n", ix, ret[ix] );
00067     ix++;
00068   }  
00069   // printf("\n\n");
00070   return ix;
00071 }

size_t hurst_test_base::blockedPercentReturn ( const double * v,
double * ret,
const size_t N,
const size_t block_size ) [protected]
 

Calculate the n-day percentage return:.

   Rt = (Pt - Pt-n)/Pt-n
   

The percentage return is also used by some people building financial models. I have not found that it makes much difference in my results when the percentage or log returns is used. For compatibility with the finance literature, I usually use log return.

Definition at line 87 of file hurst_test_base.cpp.

00091 {
00092   size_t ix = 0;
00093   for (size_t i = block_size; i < N; i = i + block_size) {
00094     ret[ix] = (v[i] - v[i-block_size]) / v[i-block_size];
00095     ix++;
00096   }  
00097   return ix;
00098 }

equityEntry & hurst_test_base::findTableEntry ( const char * ticker ) [protected]
 

Given a market "ticker" (equity symbol), return an equityEntry object containing the company name, the ticker and the file name.

Definition at line 35 of file hurst_test_base.cpp.

00036 {
00037   for (size_t i = 0; equityTable_[i].ticker() != 0; i++) {
00038     if (strcmp(equityTable_[i].ticker(), ticker) == 0)
00039       break;
00040   } // for
00041   return equityTable_[i];
00042 } // findTableEntry

void hurst_test_base::test ( ) [pure virtual]
 

Reimplemented in hurst_stocks, and wave_hurst.


Member Data Documentation

equityEntry hurst_test_base::equityTable_ [static, protected]
 

Initial value:

 
{ hurst_test_base::equityEntry( "Alcoa",        "aa",   "aa.csv" ),
  hurst_test_base::equityEntry( "Applied Mat.", "amat", "amat.csv"),
  hurst_test_base::equityEntry( "Boeing",       "ba",   "ba.csv" ),
  hurst_test_base::equityEntry( "Capital One",  "cof",  "cof.csv" ),
  hurst_test_base::equityEntry( "GE",           "ge",   "ge.csv" ),
  hurst_test_base::equityEntry( "General Mills","gis",  "gis.csv"),
  hurst_test_base::equityEntry( "IBM Corp.",    "ibm",  "ibm.csv" ),
  hurst_test_base::equityEntry( "Intel",        "intc", "intc.csv" ),
  hurst_test_base::equityEntry( "3M Corp.",     "mmm",  "mmm.csv" ),
  hurst_test_base::equityEntry( "Merck",        "mrk",  "mrk.csv"),
  hurst_test_base::equityEntry( "Wal-Mart",     "wmt",  "wmt.csv"),
}
A table of stocks that are going to be processed.

Definition at line 62 of file hurst_test_base.h.

const size_t hurst_test_base::tableSize_ [static, protected]
 

Initial value:

 
                sizeof( hurst_test_base::equityTable_ ) / sizeof( hurst_test_base::equityEntry )
The size of the table.

Definition at line 64 of file hurst_test_base.h.

yahooTS hurst_test_base::ts [protected]
 

The yahooTS object ts supports reading and simple parsing of the finance.yahoo.com time series file.

Definition at line 29 of file hurst_test_base.h.


The documentation for this class was generated from the following files:
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