-
Notifications
You must be signed in to change notification settings - Fork 156
/
TSDifferential.h
68 lines (57 loc) · 2.46 KB
/
TSDifferential.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/************************************************************************
* Copyright(c) 2012, One Unified. All rights reserved. *
* email: [email protected] *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
#pragma once
#include <boost/date_time/time_duration.hpp>
#include "TSEMA.h"
namespace ou { // One Unified
namespace tf { // TradeFrame
namespace hf { // high frequency
// gamma is 0.0: differential, used for generating return value of the time duration
// gamma is 0.5: stochastic diffusion process
// gamma is 1.0: the usual derivative
class TSDifferential: public Prices { // page 65 Intro to HF Finance
public:
TSDifferential( Prices& series, time_duration dt );
TSDifferential( Prices& series, time_duration dt, double dblGammaDerivative, time_duration dtNormalization = hours( 365 * 24 ) );
TSDifferential( const TSDifferential& rhs );
~TSDifferential(void);
protected:
private:
static const double m_gamma;
static const double m_beta;
static const double m_alpha;
boost::posix_time::time_duration m_dtTimeRange;
boost::posix_time::time_duration m_dtAlphaTau;
boost::posix_time::time_duration m_dtAlphaBetaTau;
double m_dblTerm1;
double m_dblTerm2;
bool m_bDerivative;
time_duration m_dtNormalization;
double m_dblNormalization;
double m_dblGammaDerivative;
Prices& m_seriesSource;
TSEMA<Price>* m_pema1;
TSEMA<Price>* m_pema2;
TSEMA<Price>* m_pema3;
TSEMA<Price>* m_pema4;
TSEMA<Price>* m_pema5;
TSEMA<Price>* m_pema6;
void HandleTerm1Update( const Price& );
void HandleTerm2Update( const Price& );
void HandleTerm3Update( const Price& );
void Init( void );
};
} // namespace hf
} // namespace tf
} // namespace ou