-
Notifications
You must be signed in to change notification settings - Fork 122
/
order.go
169 lines (163 loc) · 5.57 KB
/
order.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package ib
import (
"math"
)
// This file ports IB API Order.java. Please preserve declaration order.
// Order .
type Order struct {
OrderID int64
ClientID int64
PermID int64
Action string
TotalQty int64
OrderType string
LimitPrice float64
AuxPrice float64
TIF string
ActiveStartTime string
ActiveStopTime string
OCAGroup string
OCAType int64
OrderRef string
Transmit bool
ParentID int64
BlockOrder bool
SweepToFill bool
DisplaySize int64
TriggerMethod int64
OutsideRTH bool
Hidden bool
GoodAfterTime string
GoodTillDate string
OverridePercentageConstraints bool
Rule80A string
AllOrNone bool
MinQty int64
PercentOffset float64
TrailStopPrice float64
TrailingPercent float64
FAGroup string
FAProfile string
FAMethod string
FAPercentage string
OpenClose string
Origin int64
ShortSaleSlot int64
DesignatedLocation string
ExemptCode int64
DiscretionaryAmount float64
ETradeOnly int64
FirmQuoteOnly bool
NBBOPriceCap float64
OptOutSmartRouting bool
AuctionStrategy int64
StartingPrice float64
StockRefPrice float64
Delta float64
StockRangeLower float64
StockRangeUpper float64
Volatility float64
VolatilityType int64
ContinuousUpdate int64
ReferencePriceType int64
DeltaNeutralOrderType string
DeltaNeutralAuxPrice float64
DeltaNeutral DeltaNeutralData `when:"DeltaNeutralOrderType" cond:"is" value:""`
BasisPoints float64
BasisPointsType int64
ScaleInitLevelSize int64 // max
ScaleSubsLevelSize int64 // max
ScalePriceIncrement float64 // max
ScalePriceAdjustValue float64
ScalePriceAdjustInterval int64
ScaleProfitOffset float64
ScaleAutoReset bool
ScaleInitPosition int64
ScaleInitFillQty int64
ScaleRandomPercent bool
ScaleTable string
HedgeType string
HedgeParam string
Account string
SettlingFirm string
ClearingAccount string
ClearingIntent string
AlgoStrategy string
AlgoParams AlgoParams `when:"AlgoStrategy" cond:"is" value:""`
WhatIf bool
NotHeld bool
SmartComboRoutingParams []TagValue
OrderComboLegs []OrderComboLeg
OrderMiscOptions []TagValue
}
// DeltaNeutralData .
type DeltaNeutralData struct {
ContractID int64
SettlingFirm string
ClearingAccount string
ClearingIntent string
OpenClose string
ShortSale bool
ShortSaleSlot int64
DesignatedLocation string
}
// AlgoParams .
type AlgoParams struct {
Params []*TagValue
}
// NewOrder .
func NewOrder() (Order, error) {
return Order{
LimitPrice: math.MaxFloat64,
AuxPrice: math.MaxFloat64,
ActiveStartTime: "",
ActiveStopTime: "",
OutsideRTH: false,
OpenClose: "O",
Origin: 0, // customer
Transmit: true,
DesignatedLocation: "",
ExemptCode: -1,
MinQty: math.MaxInt64,
PercentOffset: math.MaxFloat64,
NBBOPriceCap: math.MaxFloat64,
OptOutSmartRouting: false,
StartingPrice: math.MaxFloat64,
StockRefPrice: math.MaxFloat64,
Delta: math.MaxFloat64,
StockRangeLower: math.MaxFloat64,
StockRangeUpper: math.MaxFloat64,
Volatility: math.MaxFloat64,
VolatilityType: math.MaxInt64,
DeltaNeutralOrderType: "",
DeltaNeutralAuxPrice: math.MaxFloat64,
DeltaNeutral: DeltaNeutralData{
ContractID: 0,
SettlingFirm: "",
ClearingAccount: "",
ClearingIntent: "",
OpenClose: "",
ShortSale: false,
ShortSaleSlot: 0,
DesignatedLocation: "",
},
ReferencePriceType: math.MaxInt64,
TrailStopPrice: math.MaxFloat64,
TrailingPercent: math.MaxFloat64,
BasisPoints: math.MaxFloat64,
BasisPointsType: math.MaxInt64,
ScaleInitLevelSize: math.MaxInt64,
ScaleSubsLevelSize: math.MaxInt64,
ScalePriceIncrement: math.MaxFloat64,
ScalePriceAdjustValue: math.MaxFloat64,
ScalePriceAdjustInterval: math.MaxInt64,
ScaleProfitOffset: math.MaxFloat64,
ScaleAutoReset: false,
ScaleInitPosition: math.MaxInt64,
ScaleInitFillQty: math.MaxInt64,
ScaleRandomPercent: false,
ScaleTable: "",
WhatIf: false,
NotHeld: false,
}, nil
}