-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathStrike.h
74 lines (53 loc) · 2.82 KB
/
Strike.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
69
70
71
72
73
74
/************************************************************************
* Copyright(c) 2011, 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 "Option.h"
namespace ou { // One Unified
namespace tf { // TradeFrame
namespace option { // options
class Strike {
public:
typedef ou::tf::ProviderInterfaceBase::pProvider_t pProvider_t;
Strike(); // for construction in std::Map
Strike( double dblStrike );
Strike( const Strike& rhs );
~Strike();
Strike& operator=( const Strike& rhs );
bool operator< ( const Strike& rhs ) const { return m_dblStrike < rhs.m_dblStrike; };
bool operator<=( const Strike& rhs ) const { return m_dblStrike <= rhs.m_dblStrike; };
double GetStrike() const { return m_dblStrike; };
void AssignCall( Instrument::pInstrument_t pInstrument, pProvider_t pDataProvider, pProvider_t pGreekProvider );
void AssignPut( Instrument::pInstrument_t pInstrument, pProvider_t pDataProvider, pProvider_t pGreekProvider );
void AssignCall( Instrument::pInstrument_t pInstrument, pProvider_t pDataProvider );
void AssignPut( Instrument::pInstrument_t pInstrument, pProvider_t pDataProvider );
ou::tf::option::Call* Call() { return m_call.get(); };
ou::tf::option::Put* Put() { return m_put.get(); };
void SetWatchableOn(); // watchable defaults to off at time of construction
void SetWatchableOff();
void WatchStart(); // not started if watchable is off
void WatchStop();
bool IsWatching( void ) const { return 0 != m_nWatching; };
void SaveSeries( const std::string& sPrefix );
void EmitValues( double dblPriceUnderlying );
protected:
boost::shared_ptr<ou::tf::option::Call> m_call;
boost::shared_ptr<ou::tf::option::Put> m_put;
private:
bool m_bWatchable; // for when large number of strikes, but only a few to watch and collect
unsigned int m_nWatching; // 0 = no watch, > 0 watching, < 0 illegal
double m_dblStrike;
};
} // namespace option
} // namespace tf
} // namespace ou