QuoteRequest fix
This commit is contained in:
@ -6,6 +6,8 @@ import (
|
|||||||
|
|
||||||
"quantex.com/qfixdpl/quickfix"
|
"quantex.com/qfixdpl/quickfix"
|
||||||
"quantex.com/qfixdpl/quickfix/gen/fix50sp2/quote"
|
"quantex.com/qfixdpl/quickfix/gen/fix50sp2/quote"
|
||||||
|
"quantex.com/qfixdpl/quickfix/gen/fix50sp2/quoterequest"
|
||||||
|
"quantex.com/qfixdpl/quickfix/gen/tag"
|
||||||
"quantex.com/qfixdpl/src/domain"
|
"quantex.com/qfixdpl/src/domain"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,6 +26,7 @@ func newApplication(n domain.Notifier) *application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.router.AddRoute(quote.Route(app.handleQuote))
|
app.router.AddRoute(quote.Route(app.handleQuote))
|
||||||
|
app.router.AddRoute(quoterequest.Route(app.handleQuoteRequest))
|
||||||
|
|
||||||
return app
|
return app
|
||||||
}
|
}
|
||||||
@ -58,7 +61,45 @@ func (a *application) FromAdmin(_ *quickfix.Message, _ quickfix.SessionID) quick
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *application) FromApp(msg *quickfix.Message, sessionID quickfix.SessionID) quickfix.MessageRejectError {
|
func (a *application) FromApp(msg *quickfix.Message, sessionID quickfix.SessionID) quickfix.MessageRejectError {
|
||||||
return a.router.Route(msg, sessionID)
|
beginString, _ := msg.Header.GetBytes(tag.BeginString)
|
||||||
|
msgType, _ := msg.Header.GetBytes(tag.MsgType)
|
||||||
|
|
||||||
|
var applVerID quickfix.FIXString
|
||||||
|
msg.Header.GetField(tag.ApplVerID, &applVerID)
|
||||||
|
|
||||||
|
slog.Info("FIX FromApp received",
|
||||||
|
"beginString", string(beginString),
|
||||||
|
"msgType", string(msgType),
|
||||||
|
"applVerID", string(applVerID),
|
||||||
|
"session", sessionID.String(),
|
||||||
|
"rawMsg", msg.String(),
|
||||||
|
)
|
||||||
|
|
||||||
|
rejErr := a.router.Route(msg, sessionID)
|
||||||
|
if rejErr != nil {
|
||||||
|
slog.Error("FIX FromApp routing failed",
|
||||||
|
"msgType", string(msgType),
|
||||||
|
"error", rejErr.Error(),
|
||||||
|
"isBusinessReject", rejErr.IsBusinessReject(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rejErr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *application) handleQuoteRequest(msg quoterequest.QuoteRequest, sessionID quickfix.SessionID) quickfix.MessageRejectError {
|
||||||
|
quoteReqID, err := msg.GetQuoteReqID()
|
||||||
|
if err != nil {
|
||||||
|
slog.Error("QuoteRequest missing QuoteReqID", "error", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
slog.Info("QuoteRequest received",
|
||||||
|
"quoteReqID", quoteReqID,
|
||||||
|
"session", sessionID.String(),
|
||||||
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *application) handleQuote(msg quote.Quote, sessionID quickfix.SessionID) quickfix.MessageRejectError {
|
func (a *application) handleQuote(msg quote.Quote, sessionID quickfix.SessionID) quickfix.MessageRejectError {
|
||||||
|
|||||||
Reference in New Issue
Block a user