-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathPositionGreek.h
96 lines (65 loc) · 2.75 KB
/
PositionGreek.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/************************************************************************
* Copyright(c) 2018, One Unified. All rights reserved. *
* *
* 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. *
************************************************************************/
/*
* File: PositionGreek.h
* Author: [email protected]
*
* Created on July 31, 2018, 9:21 AM
*/
#ifndef POSITIONGREEK_H
#define POSITIONGREEK_H
#include <boost/serialization/version.hpp>
#include <boost/serialization/split_member.hpp>
#include <TFOptions/Option.h>
#include "Watch.h"
#include "Position.h"
namespace ou { // One Unified
namespace tf { // TradeFrame
class PositionGreek: public Position {
friend class boost::serialization::access;
public:
friend std::ostream& operator<<( std::ostream& os, const PositionGreek& );
using pPositionGreek_t = std::shared_ptr<PositionGreek>;
using pUnderlying_t = ou::tf::Watch::pWatch_t;
using pOption_t = ou::tf::option::Option::pOption_t;
typedef ProviderInterfaceBase::pProvider_t pProvider_t;
PositionGreek( pOption_t&, pUnderlying_t& );
virtual ~PositionGreek( );
pOption_t GetOption() { return m_pOption; }
pUnderlying_t GetUnderlying() { return m_pUnderlying; }
ou::Delegate<const ou::tf::Greek&> OnGreek; // need to fire this on option updates
void PositionPendingDelta( int n ); // -1 or +1
protected:
using greek_t = SymbolBase::greek_t;
private:
pOption_t m_pOption;
pUnderlying_t m_pUnderlying;
int m_nQuantity; // number of contracts
void Construction();
void HandleGreek( greek_t );
template<typename Archive>
void save( Archive& ar, const unsigned int version ) const {
ar & boost::serialization::base_object<const Position>(*this);
}
template<typename Archive>
void load( Archive& ar, const unsigned int version ) {
ar & boost::serialization::base_object<Position>(*this);
OnPositionChanged( *this ); // may need this in position.h as well.
}
BOOST_SERIALIZATION_SPLIT_MEMBER()
};
std::ostream& operator<<( std::ostream& os, const PositionGreek& );
} // namespace tf
} // namespace ou
BOOST_CLASS_VERSION(ou::tf::PositionGreek, 1)
#endif /* POSITIONGREEK_H */