forked from quickfixgo/quickfix
/
News.go
112 lines (105 loc) · 5.07 KB
/
News.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
//Package news msg type = B.
package news
import (
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/enum"
"github.com/quickfixgo/quickfix/fix50sp2/applicationsequencecontrol"
"github.com/quickfixgo/quickfix/fix50sp2/instrmtgrp"
"github.com/quickfixgo/quickfix/fix50sp2/instrmtleggrp"
"github.com/quickfixgo/quickfix/fix50sp2/linesoftextgrp"
"github.com/quickfixgo/quickfix/fix50sp2/newsrefgrp"
"github.com/quickfixgo/quickfix/fix50sp2/routinggrp"
"github.com/quickfixgo/quickfix/fix50sp2/undinstrmtgrp"
"github.com/quickfixgo/quickfix/fixt11"
"time"
)
//Message is a News FIX Message
type Message struct {
FIXMsgType string `fix:"B"`
fixt11.Header
//OrigTime is a non-required field for News.
OrigTime *time.Time `fix:"42"`
//Urgency is a non-required field for News.
Urgency *string `fix:"61"`
//Headline is a required field for News.
Headline string `fix:"148"`
//EncodedHeadlineLen is a non-required field for News.
EncodedHeadlineLen *int `fix:"358"`
//EncodedHeadline is a non-required field for News.
EncodedHeadline *string `fix:"359"`
//RoutingGrp is a non-required component for News.
RoutingGrp *routinggrp.RoutingGrp
//InstrmtGrp is a non-required component for News.
InstrmtGrp *instrmtgrp.InstrmtGrp
//InstrmtLegGrp is a non-required component for News.
InstrmtLegGrp *instrmtleggrp.InstrmtLegGrp
//UndInstrmtGrp is a non-required component for News.
UndInstrmtGrp *undinstrmtgrp.UndInstrmtGrp
//LinesOfTextGrp is a required component for News.
linesoftextgrp.LinesOfTextGrp
//URLLink is a non-required field for News.
URLLink *string `fix:"149"`
//RawDataLength is a non-required field for News.
RawDataLength *int `fix:"95"`
//RawData is a non-required field for News.
RawData *string `fix:"96"`
//ApplicationSequenceControl is a non-required component for News.
ApplicationSequenceControl *applicationsequencecontrol.ApplicationSequenceControl
//NewsID is a non-required field for News.
NewsID *string `fix:"1472"`
//NewsRefGrp is a non-required component for News.
NewsRefGrp *newsrefgrp.NewsRefGrp
//NewsCategory is a non-required field for News.
NewsCategory *int `fix:"1473"`
//LanguageCode is a non-required field for News.
LanguageCode *string `fix:"1474"`
//MarketID is a non-required field for News.
MarketID *string `fix:"1301"`
//MarketSegmentID is a non-required field for News.
MarketSegmentID *string `fix:"1300"`
fixt11.Trailer
}
//Marshal converts Message to a quickfix.Message instance
func (m Message) Marshal() quickfix.Message { return quickfix.Marshal(m) }
//New returns an initialized News instance
func New(headline string, linesoftextgrp linesoftextgrp.LinesOfTextGrp) *Message {
var m Message
m.SetHeadline(headline)
m.SetLinesOfTextGrp(linesoftextgrp)
return &m
}
func (m *Message) SetOrigTime(v time.Time) { m.OrigTime = &v }
func (m *Message) SetUrgency(v string) { m.Urgency = &v }
func (m *Message) SetHeadline(v string) { m.Headline = v }
func (m *Message) SetEncodedHeadlineLen(v int) { m.EncodedHeadlineLen = &v }
func (m *Message) SetEncodedHeadline(v string) { m.EncodedHeadline = &v }
func (m *Message) SetRoutingGrp(v routinggrp.RoutingGrp) { m.RoutingGrp = &v }
func (m *Message) SetInstrmtGrp(v instrmtgrp.InstrmtGrp) { m.InstrmtGrp = &v }
func (m *Message) SetInstrmtLegGrp(v instrmtleggrp.InstrmtLegGrp) { m.InstrmtLegGrp = &v }
func (m *Message) SetUndInstrmtGrp(v undinstrmtgrp.UndInstrmtGrp) { m.UndInstrmtGrp = &v }
func (m *Message) SetLinesOfTextGrp(v linesoftextgrp.LinesOfTextGrp) { m.LinesOfTextGrp = v }
func (m *Message) SetURLLink(v string) { m.URLLink = &v }
func (m *Message) SetRawDataLength(v int) { m.RawDataLength = &v }
func (m *Message) SetRawData(v string) { m.RawData = &v }
func (m *Message) SetApplicationSequenceControl(v applicationsequencecontrol.ApplicationSequenceControl) {
m.ApplicationSequenceControl = &v
}
func (m *Message) SetNewsID(v string) { m.NewsID = &v }
func (m *Message) SetNewsRefGrp(v newsrefgrp.NewsRefGrp) { m.NewsRefGrp = &v }
func (m *Message) SetNewsCategory(v int) { m.NewsCategory = &v }
func (m *Message) SetLanguageCode(v string) { m.LanguageCode = &v }
func (m *Message) SetMarketID(v string) { m.MarketID = &v }
func (m *Message) SetMarketSegmentID(v string) { m.MarketSegmentID = &v }
//A RouteOut is the callback type that should be implemented for routing Message
type RouteOut func(msg Message, 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 {
m := new(Message)
if err := quickfix.Unmarshal(msg, m); err != nil {
return err
}
return router(*m, sessionID)
}
return enum.ApplVerID_FIX50SP2, "B", r
}