-
Notifications
You must be signed in to change notification settings - Fork 160
/
Leg.h
94 lines (67 loc) · 2.76 KB
/
Leg.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
/************************************************************************
* Copyright(c) 2019, One Unified. All rights reserved. *
* email: info@oneunified.net *
* *
* 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: Leg.h
* Author: raymond@burkholder.net
* Project: TFOptionCombos
* Created on May 25, 2019, 4:46 PM
*/
#ifndef OU_TF_LEG_H
#define OU_TF_LEG_H
#include <OUCharting/ChartDataView.h>
#include <OUCharting/ChartEntryIndicator.h>
#include <TFTrading/Position.h>
// TODO: may need option version inheritance
#include <TFOptions/Option.h>
#include "LegNote.h"
namespace ou {
namespace tf {
class Leg {
public:
using pPosition_t = Position::pPosition_t;
using pOption_t = ou::tf::option::Option::pOption_t;
using pChartDataView_t = ou::ChartDataView::pChartDataView_t;
Leg();
Leg( Leg&& rhs );
Leg( const Leg& rhs ) = delete;
Leg( pPosition_t pPosition );
Leg& operator=( Leg&& rhs );
virtual ~Leg();
const option::LegNote::values_t& SetPosition( pPosition_t pPosition );
pPosition_t GetPosition() const;
void Tick( ptime dt, double price );
bool IsActive() const;
void SaveSeries( const std::string& sPrefix );
void SetChartData( pChartDataView_t pChartData, ou::Colour::EColour );
void DelChartData();
double GetNet( double price ) const;
double ConstructedValue() const;
void NetGreeks( double& delta, double& gamma ) const;
void NetGreeks( double& pl, double& IV, double& delta, double& gamma, double& theta, double& vega, double& rho );
const option::LegNote& GetLegNote() const { return m_legNote; }
private:
bool m_bOption; // only set upon assignment of appropriate position
pPosition_t m_pPosition;
option::LegNote m_legNote;
pChartDataView_t m_pChartDataView;
ou::ChartEntryIndicator m_ceProfitLoss;
ou::ChartEntryIndicator m_ceImpliedVolatility;
ou::ChartEntryIndicator m_ceDelta;
ou::ChartEntryIndicator m_ceGamma;
ou::ChartEntryIndicator m_ceVega;
ou::ChartEntryIndicator m_ceTheta;
};
} // namespace ou
} // namespace tf
#endif /* OU_TF_LEG_H */