-
Notifications
You must be signed in to change notification settings - Fork 1
/
types_mktdata.go
155 lines (133 loc) · 2.74 KB
/
types_mktdata.go
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package ibapi
// Inbound Messages
type MsgInTickPrice struct {
TickerId int64
Type int64
Price float64
Size int64 `minVer:"2"`
CanAutoExecute bool `minVer:"3"`
}
type MsgInTickSize struct {
TickerId int64
Type int64
Size int64
}
type MsgInTickOptionComputation struct {
TickerId int64
Type int64
ImpliedVol float64 // > 0
Delta float64 // 0 <= delta <= 1
OptionPrice float64
PvDividend float64
Gamma float64
Vega float64
Theta float64
SpotPrice float64
}
type MsgInTickGeneric struct {
TickerId int64
Type int64
Value float64
}
type MsgInTickString struct {
TickerId int64
Type int64
Value string
}
type MsgInTickEFP struct {
TickerId int64
Type int64
BasisPoints float64
FormattedBasisPoints string
ImpliedFuturesPrice float64
HoldDays int64
FuturesExpiry string
DividendImpact float64
DividendsToExpiry float64
}
type MsgInTickSnapshotEnd struct {
TickerId int64
}
type MsgInMarketDataType struct {
TickerId int64
Type int64
}
// Outbound Messages
type MsgOutReqMktData struct {
TickerId int64
ContractId int64 `minVer:"37"`
Symbol string
SecurityType string
Expiry string
Strike float64
Right string
Multiplier string
Exchange string
PrimaryExchange string
Currency string
LocalSymbol string
ComboLegs []ComboLeg
Comp *UnderComp
GenericTickList string
Snapshot bool
}
func (m *MsgOutReqMktData) RequestEncode(b *requestBytes) {
b.writeInt(m.TickerId)
if b.verServer >= 47 {
b.writeInt(m.ContractId)
}
b.writeString(m.Symbol)
b.writeString(m.SecurityType)
b.writeString(m.Expiry)
b.writeFloat(m.Strike)
b.writeString(m.Right)
if b.verServer >= 15 {
b.writeString(m.Multiplier)
}
b.writeString(m.Exchange)
if b.verServer >= 14 {
b.writeString(m.PrimaryExchange)
}
b.writeString(m.Currency)
if b.verServer >= 2 {
b.writeString(m.LocalSymbol)
}
if b.verServer >= 8 && m.SecurityType == SecTypeBag {
if m.ComboLegs != nil {
b.writeInt(int64(len(m.ComboLegs)))
for _, e := range m.ComboLegs {
b.writeStruct(e)
}
} else {
b.writeInt(0)
}
}
if b.verServer >= 40 {
if m.Comp != nil {
b.writeBool(true)
b.writeStruct(m.Comp)
} else {
b.writeBool(false)
}
}
if b.verServer >= 31 {
b.writeString(m.GenericTickList)
}
if b.verServer >= 35 {
b.writeBool(m.Snapshot)
}
}
type MsgOutCxlMktData struct {
TickerId int64
}
type MsgOutCalcImpVol struct {
}
type MsgOutCxlCalcImpVol struct {
}
type MsgOutCalcOptPx struct {
}
type MsgOutCxlCalcOptPx struct {
}
type MsgOutReqMktDataType struct {
Type int64
}