#include <hurst_test_base.h>
Inheritance diagram for hurst_test_base::
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... | |
equityEntry& | findTableEntry (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... |
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.
|
Disallow the copy constructor.
|
|
Definition at line 80 of file hurst_test_base.h. 00080 : ts( path ) {} |
|
Definition at line 81 of file hurst_test_base.h. 00081 {} |
|
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 } |
|
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 } |
|
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 |
|
Reimplemented in hurst_stocks, and wave_hurst. |
|
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"), }
Definition at line 62 of file hurst_test_base.h. |
|
Initial value: sizeof( hurst_test_base::equityTable_ ) / sizeof( hurst_test_base::equityEntry )
Definition at line 64 of file hurst_test_base.h. |
|
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. |