forked from quickfixgo/quickfix
/
BidResponse.go
51 lines (44 loc) · 1.73 KB
/
BidResponse.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
//Package bidresponse msg type = l.
package bidresponse
import (
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/enum"
"github.com/quickfixgo/quickfix/fix50/bidcomprspgrp"
"github.com/quickfixgo/quickfix/fixt11"
)
//Message is a BidResponse FIX Message
type Message struct {
FIXMsgType string `fix:"l"`
fixt11.Header
//BidID is a non-required field for BidResponse.
BidID *string `fix:"390"`
//ClientBidID is a non-required field for BidResponse.
ClientBidID *string `fix:"391"`
//BidCompRspGrp is a required component for BidResponse.
bidcomprspgrp.BidCompRspGrp
fixt11.Trailer
}
//Marshal converts Message to a quickfix.Message instance
func (m Message) Marshal() quickfix.Message { return quickfix.Marshal(m) }
//New returns an initialized BidResponse instance
func New(bidcomprspgrp bidcomprspgrp.BidCompRspGrp) *Message {
var m Message
m.SetBidCompRspGrp(bidcomprspgrp)
return &m
}
func (m *Message) SetBidID(v string) { m.BidID = &v }
func (m *Message) SetClientBidID(v string) { m.ClientBidID = &v }
func (m *Message) SetBidCompRspGrp(v bidcomprspgrp.BidCompRspGrp) { m.BidCompRspGrp = 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_FIX50, "l", r
}