forked from quickfixgo/quickfix
/
ListStatus.go
528 lines (432 loc) · 14.7 KB
/
ListStatus.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
package liststatus
import (
"time"
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/field"
"github.com/quickfixgo/quickfix/fixt11"
"github.com/quickfixgo/quickfix/tag"
)
//ListStatus is the fix50sp1 ListStatus type, MsgType = N
type ListStatus struct {
fixt11.Header
quickfix.Body
fixt11.Trailer
//ReceiveTime is the time that this message was read from the socket connection
ReceiveTime time.Time
}
//FromMessage creates a ListStatus from a quickfix.Message instance
func FromMessage(m quickfix.Message) ListStatus {
return ListStatus{
Header: fixt11.Header{Header: m.Header},
Body: m.Body,
Trailer: fixt11.Trailer{Trailer: m.Trailer},
ReceiveTime: m.ReceiveTime,
}
}
//ToMessage returns a quickfix.Message instance
func (m ListStatus) ToMessage() quickfix.Message {
return quickfix.Message{
Header: m.Header.Header,
Body: m.Body,
Trailer: m.Trailer.Trailer,
ReceiveTime: m.ReceiveTime,
}
}
//New returns a ListStatus initialized with the required fields for ListStatus
func New(listid field.ListIDField, liststatustype field.ListStatusTypeField, norpts field.NoRptsField, listorderstatus field.ListOrderStatusField, rptseq field.RptSeqField, totnoorders field.TotNoOrdersField) (m ListStatus) {
m.Header = fixt11.NewHeader()
m.Init()
m.Trailer.Init()
m.Header.Set(field.NewMsgType("N"))
m.Set(listid)
m.Set(liststatustype)
m.Set(norpts)
m.Set(listorderstatus)
m.Set(rptseq)
m.Set(totnoorders)
return
}
//A RouteOut is the callback type that should be implemented for routing Message
type RouteOut func(msg ListStatus, sessionID quickfix.SessionID) quickfix.MessageRejectError
//Route returns the beginstring, message type, and MessageRoute for this Message type
func Route(router RouteOut) (string, string, quickfix.MessageRoute) {
r := func(msg quickfix.Message, sessionID quickfix.SessionID) quickfix.MessageRejectError {
return router(FromMessage(msg), sessionID)
}
return "8", "N", r
}
//SetTransactTime sets TransactTime, Tag 60
func (m ListStatus) SetTransactTime(v time.Time) {
m.Set(field.NewTransactTime(v))
}
//SetListID sets ListID, Tag 66
func (m ListStatus) SetListID(v string) {
m.Set(field.NewListID(v))
}
//SetTotNoOrders sets TotNoOrders, Tag 68
func (m ListStatus) SetTotNoOrders(v int) {
m.Set(field.NewTotNoOrders(v))
}
//SetNoOrders sets NoOrders, Tag 73
func (m ListStatus) SetNoOrders(f NoOrdersRepeatingGroup) {
m.SetGroup(f)
}
//SetNoRpts sets NoRpts, Tag 82
func (m ListStatus) SetNoRpts(v int) {
m.Set(field.NewNoRpts(v))
}
//SetRptSeq sets RptSeq, Tag 83
func (m ListStatus) SetRptSeq(v int) {
m.Set(field.NewRptSeq(v))
}
//SetListStatusType sets ListStatusType, Tag 429
func (m ListStatus) SetListStatusType(v int) {
m.Set(field.NewListStatusType(v))
}
//SetListOrderStatus sets ListOrderStatus, Tag 431
func (m ListStatus) SetListOrderStatus(v int) {
m.Set(field.NewListOrderStatus(v))
}
//SetListStatusText sets ListStatusText, Tag 444
func (m ListStatus) SetListStatusText(v string) {
m.Set(field.NewListStatusText(v))
}
//SetEncodedListStatusTextLen sets EncodedListStatusTextLen, Tag 445
func (m ListStatus) SetEncodedListStatusTextLen(v int) {
m.Set(field.NewEncodedListStatusTextLen(v))
}
//SetEncodedListStatusText sets EncodedListStatusText, Tag 446
func (m ListStatus) SetEncodedListStatusText(v string) {
m.Set(field.NewEncodedListStatusText(v))
}
//SetLastFragment sets LastFragment, Tag 893
func (m ListStatus) SetLastFragment(v bool) {
m.Set(field.NewLastFragment(v))
}
//SetContingencyType sets ContingencyType, Tag 1385
func (m ListStatus) SetContingencyType(v int) {
m.Set(field.NewContingencyType(v))
}
//SetListRejectReason sets ListRejectReason, Tag 1386
func (m ListStatus) SetListRejectReason(v int) {
m.Set(field.NewListRejectReason(v))
}
//GetTransactTime gets TransactTime, Tag 60
func (m ListStatus) GetTransactTime() (f field.TransactTimeField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetListID gets ListID, Tag 66
func (m ListStatus) GetListID() (f field.ListIDField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetTotNoOrders gets TotNoOrders, Tag 68
func (m ListStatus) GetTotNoOrders() (f field.TotNoOrdersField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetNoOrders gets NoOrders, Tag 73
func (m ListStatus) GetNoOrders() (NoOrdersRepeatingGroup, quickfix.MessageRejectError) {
f := NewNoOrdersRepeatingGroup()
err := m.GetGroup(f)
return f, err
}
//GetNoRpts gets NoRpts, Tag 82
func (m ListStatus) GetNoRpts() (f field.NoRptsField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetRptSeq gets RptSeq, Tag 83
func (m ListStatus) GetRptSeq() (f field.RptSeqField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetListStatusType gets ListStatusType, Tag 429
func (m ListStatus) GetListStatusType() (f field.ListStatusTypeField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetListOrderStatus gets ListOrderStatus, Tag 431
func (m ListStatus) GetListOrderStatus() (f field.ListOrderStatusField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetListStatusText gets ListStatusText, Tag 444
func (m ListStatus) GetListStatusText() (f field.ListStatusTextField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetEncodedListStatusTextLen gets EncodedListStatusTextLen, Tag 445
func (m ListStatus) GetEncodedListStatusTextLen() (f field.EncodedListStatusTextLenField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetEncodedListStatusText gets EncodedListStatusText, Tag 446
func (m ListStatus) GetEncodedListStatusText() (f field.EncodedListStatusTextField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetLastFragment gets LastFragment, Tag 893
func (m ListStatus) GetLastFragment() (f field.LastFragmentField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetContingencyType gets ContingencyType, Tag 1385
func (m ListStatus) GetContingencyType() (f field.ContingencyTypeField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetListRejectReason gets ListRejectReason, Tag 1386
func (m ListStatus) GetListRejectReason() (f field.ListRejectReasonField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//HasTransactTime returns true if TransactTime is present, Tag 60
func (m ListStatus) HasTransactTime() bool {
return m.Has(tag.TransactTime)
}
//HasListID returns true if ListID is present, Tag 66
func (m ListStatus) HasListID() bool {
return m.Has(tag.ListID)
}
//HasTotNoOrders returns true if TotNoOrders is present, Tag 68
func (m ListStatus) HasTotNoOrders() bool {
return m.Has(tag.TotNoOrders)
}
//HasNoOrders returns true if NoOrders is present, Tag 73
func (m ListStatus) HasNoOrders() bool {
return m.Has(tag.NoOrders)
}
//HasNoRpts returns true if NoRpts is present, Tag 82
func (m ListStatus) HasNoRpts() bool {
return m.Has(tag.NoRpts)
}
//HasRptSeq returns true if RptSeq is present, Tag 83
func (m ListStatus) HasRptSeq() bool {
return m.Has(tag.RptSeq)
}
//HasListStatusType returns true if ListStatusType is present, Tag 429
func (m ListStatus) HasListStatusType() bool {
return m.Has(tag.ListStatusType)
}
//HasListOrderStatus returns true if ListOrderStatus is present, Tag 431
func (m ListStatus) HasListOrderStatus() bool {
return m.Has(tag.ListOrderStatus)
}
//HasListStatusText returns true if ListStatusText is present, Tag 444
func (m ListStatus) HasListStatusText() bool {
return m.Has(tag.ListStatusText)
}
//HasEncodedListStatusTextLen returns true if EncodedListStatusTextLen is present, Tag 445
func (m ListStatus) HasEncodedListStatusTextLen() bool {
return m.Has(tag.EncodedListStatusTextLen)
}
//HasEncodedListStatusText returns true if EncodedListStatusText is present, Tag 446
func (m ListStatus) HasEncodedListStatusText() bool {
return m.Has(tag.EncodedListStatusText)
}
//HasLastFragment returns true if LastFragment is present, Tag 893
func (m ListStatus) HasLastFragment() bool {
return m.Has(tag.LastFragment)
}
//HasContingencyType returns true if ContingencyType is present, Tag 1385
func (m ListStatus) HasContingencyType() bool {
return m.Has(tag.ContingencyType)
}
//HasListRejectReason returns true if ListRejectReason is present, Tag 1386
func (m ListStatus) HasListRejectReason() bool {
return m.Has(tag.ListRejectReason)
}
//NoOrders is a repeating group element, Tag 73
type NoOrders struct {
quickfix.Group
}
//SetClOrdID sets ClOrdID, Tag 11
func (m NoOrders) SetClOrdID(v string) {
m.Set(field.NewClOrdID(v))
}
//SetSecondaryClOrdID sets SecondaryClOrdID, Tag 526
func (m NoOrders) SetSecondaryClOrdID(v string) {
m.Set(field.NewSecondaryClOrdID(v))
}
//SetCumQty sets CumQty, Tag 14
func (m NoOrders) SetCumQty(v float64) {
m.Set(field.NewCumQty(v))
}
//SetOrdStatus sets OrdStatus, Tag 39
func (m NoOrders) SetOrdStatus(v string) {
m.Set(field.NewOrdStatus(v))
}
//SetWorkingIndicator sets WorkingIndicator, Tag 636
func (m NoOrders) SetWorkingIndicator(v bool) {
m.Set(field.NewWorkingIndicator(v))
}
//SetLeavesQty sets LeavesQty, Tag 151
func (m NoOrders) SetLeavesQty(v float64) {
m.Set(field.NewLeavesQty(v))
}
//SetCxlQty sets CxlQty, Tag 84
func (m NoOrders) SetCxlQty(v float64) {
m.Set(field.NewCxlQty(v))
}
//SetAvgPx sets AvgPx, Tag 6
func (m NoOrders) SetAvgPx(v float64) {
m.Set(field.NewAvgPx(v))
}
//SetOrdRejReason sets OrdRejReason, Tag 103
func (m NoOrders) SetOrdRejReason(v int) {
m.Set(field.NewOrdRejReason(v))
}
//SetText sets Text, Tag 58
func (m NoOrders) SetText(v string) {
m.Set(field.NewText(v))
}
//SetEncodedTextLen sets EncodedTextLen, Tag 354
func (m NoOrders) SetEncodedTextLen(v int) {
m.Set(field.NewEncodedTextLen(v))
}
//SetEncodedText sets EncodedText, Tag 355
func (m NoOrders) SetEncodedText(v string) {
m.Set(field.NewEncodedText(v))
}
//SetOrderID sets OrderID, Tag 37
func (m NoOrders) SetOrderID(v string) {
m.Set(field.NewOrderID(v))
}
//GetClOrdID gets ClOrdID, Tag 11
func (m NoOrders) GetClOrdID() (f field.ClOrdIDField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetSecondaryClOrdID gets SecondaryClOrdID, Tag 526
func (m NoOrders) GetSecondaryClOrdID() (f field.SecondaryClOrdIDField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetCumQty gets CumQty, Tag 14
func (m NoOrders) GetCumQty() (f field.CumQtyField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetOrdStatus gets OrdStatus, Tag 39
func (m NoOrders) GetOrdStatus() (f field.OrdStatusField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetWorkingIndicator gets WorkingIndicator, Tag 636
func (m NoOrders) GetWorkingIndicator() (f field.WorkingIndicatorField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetLeavesQty gets LeavesQty, Tag 151
func (m NoOrders) GetLeavesQty() (f field.LeavesQtyField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetCxlQty gets CxlQty, Tag 84
func (m NoOrders) GetCxlQty() (f field.CxlQtyField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetAvgPx gets AvgPx, Tag 6
func (m NoOrders) GetAvgPx() (f field.AvgPxField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetOrdRejReason gets OrdRejReason, Tag 103
func (m NoOrders) GetOrdRejReason() (f field.OrdRejReasonField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetText gets Text, Tag 58
func (m NoOrders) GetText() (f field.TextField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetEncodedTextLen gets EncodedTextLen, Tag 354
func (m NoOrders) GetEncodedTextLen() (f field.EncodedTextLenField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetEncodedText gets EncodedText, Tag 355
func (m NoOrders) GetEncodedText() (f field.EncodedTextField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//GetOrderID gets OrderID, Tag 37
func (m NoOrders) GetOrderID() (f field.OrderIDField, err quickfix.MessageRejectError) {
err = m.Get(&f)
return
}
//HasClOrdID returns true if ClOrdID is present, Tag 11
func (m NoOrders) HasClOrdID() bool {
return m.Has(tag.ClOrdID)
}
//HasSecondaryClOrdID returns true if SecondaryClOrdID is present, Tag 526
func (m NoOrders) HasSecondaryClOrdID() bool {
return m.Has(tag.SecondaryClOrdID)
}
//HasCumQty returns true if CumQty is present, Tag 14
func (m NoOrders) HasCumQty() bool {
return m.Has(tag.CumQty)
}
//HasOrdStatus returns true if OrdStatus is present, Tag 39
func (m NoOrders) HasOrdStatus() bool {
return m.Has(tag.OrdStatus)
}
//HasWorkingIndicator returns true if WorkingIndicator is present, Tag 636
func (m NoOrders) HasWorkingIndicator() bool {
return m.Has(tag.WorkingIndicator)
}
//HasLeavesQty returns true if LeavesQty is present, Tag 151
func (m NoOrders) HasLeavesQty() bool {
return m.Has(tag.LeavesQty)
}
//HasCxlQty returns true if CxlQty is present, Tag 84
func (m NoOrders) HasCxlQty() bool {
return m.Has(tag.CxlQty)
}
//HasAvgPx returns true if AvgPx is present, Tag 6
func (m NoOrders) HasAvgPx() bool {
return m.Has(tag.AvgPx)
}
//HasOrdRejReason returns true if OrdRejReason is present, Tag 103
func (m NoOrders) HasOrdRejReason() bool {
return m.Has(tag.OrdRejReason)
}
//HasText returns true if Text is present, Tag 58
func (m NoOrders) HasText() bool {
return m.Has(tag.Text)
}
//HasEncodedTextLen returns true if EncodedTextLen is present, Tag 354
func (m NoOrders) HasEncodedTextLen() bool {
return m.Has(tag.EncodedTextLen)
}
//HasEncodedText returns true if EncodedText is present, Tag 355
func (m NoOrders) HasEncodedText() bool {
return m.Has(tag.EncodedText)
}
//HasOrderID returns true if OrderID is present, Tag 37
func (m NoOrders) HasOrderID() bool {
return m.Has(tag.OrderID)
}
//NoOrdersRepeatingGroup is a repeating group, Tag 73
type NoOrdersRepeatingGroup struct {
*quickfix.RepeatingGroup
}
//NewNoOrdersRepeatingGroup returns an initialized, NoOrdersRepeatingGroup
func NewNoOrdersRepeatingGroup() NoOrdersRepeatingGroup {
return NoOrdersRepeatingGroup{
quickfix.NewRepeatingGroup(tag.NoOrders,
quickfix.GroupTemplate{quickfix.GroupElement(tag.ClOrdID), quickfix.GroupElement(tag.SecondaryClOrdID), quickfix.GroupElement(tag.CumQty), quickfix.GroupElement(tag.OrdStatus), quickfix.GroupElement(tag.WorkingIndicator), quickfix.GroupElement(tag.LeavesQty), quickfix.GroupElement(tag.CxlQty), quickfix.GroupElement(tag.AvgPx), quickfix.GroupElement(tag.OrdRejReason), quickfix.GroupElement(tag.Text), quickfix.GroupElement(tag.EncodedTextLen), quickfix.GroupElement(tag.EncodedText), quickfix.GroupElement(tag.OrderID)})}
}
//Add create and append a new NoOrders to this group
func (m NoOrdersRepeatingGroup) Add() NoOrders {
g := m.RepeatingGroup.Add()
return NoOrders{g}
}
//Get returns the ith NoOrders in the NoOrdersRepeatinGroup
func (m NoOrdersRepeatingGroup) Get(i int) NoOrders {
return NoOrders{m.RepeatingGroup.Get(i)}
}