forked from iblockin/quickfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserResponse.go
54 lines (47 loc) · 1.81 KB
/
UserResponse.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
//Package userresponse msg type = BF.
package userresponse
import (
"github.com/quickfixgo/quickfix"
"github.com/quickfixgo/quickfix/enum"
"github.com/quickfixgo/quickfix/fix44"
)
//Message is a UserResponse FIX Message
type Message struct {
FIXMsgType string `fix:"BF"`
fix44.Header
//UserRequestID is a required field for UserResponse.
UserRequestID string `fix:"923"`
//Username is a required field for UserResponse.
Username string `fix:"553"`
//UserStatus is a non-required field for UserResponse.
UserStatus *int `fix:"926"`
//UserStatusText is a non-required field for UserResponse.
UserStatusText *string `fix:"927"`
fix44.Trailer
}
//Marshal converts Message to a quickfix.Message instance
func (m Message) Marshal() quickfix.Message { return quickfix.Marshal(m) }
//New returns an initialized UserResponse instance
func New(userrequestid string, username string) *Message {
var m Message
m.SetUserRequestID(userrequestid)
m.SetUsername(username)
return &m
}
func (m *Message) SetUserRequestID(v string) { m.UserRequestID = v }
func (m *Message) SetUsername(v string) { m.Username = v }
func (m *Message) SetUserStatus(v int) { m.UserStatus = &v }
func (m *Message) SetUserStatusText(v string) { m.UserStatusText = &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.BeginStringFIX44, "BF", r
}