-
Notifications
You must be signed in to change notification settings - Fork 317
Closed
Description
Steps to reproduce:
- Create a NOS message with a party ID repeating group.
- Convert it into bytes by calling
msgBytes := nos.ToMessage().Bytes()
. - Parse the bytes back into a quickfix message using
qfMsg := quickfix.ParseMessage(msgBytes)
. - Print the bytes from the parsed quickfix message using
qfMsg.Bytes()
. This should be equal tomsgBytes
which it is becauseqfMsg.Bytes()
simply returns therawMessage
field. - Now call
qfMsg.Build()
- I've made the build() method public to show the bug that happens when I actually try to sendqfMsg
to the counterparty. - You will see that the order of tags in the party ID repeating group as a result of calling
qfMsg.Build()
is wrong.
Here is the code to reproduce the above issue (assuming you point to a quickfix code which has the build() method made public).
package main
import (
"bytes"
"fmt"
"log"
"time"
"github.com/quickfixgo/enum"
"github.com/quickfixgo/field"
fix44nos "github.com/quickfixgo/fix44/newordersingle"
"github.com/quickfixgo/quickfix"
_ "github.com/quickfixgo/quickfix"
)
func main() {
nos := fix44nos.New(
field.NewClOrdID("1234"),
field.NewSide(enum.Side_BUY),
field.NewTransactTime(time.Now()),
field.NewOrdType(enum.OrdType_LIMIT),
)
partyIDsgrp := fix44nos.NewNoPartyIDsRepeatingGroup()
partyIDs := partyIDsgrp.Add()
partyIDs.SetPartyID("party-in-da-house")
partyIDs.SetPartyRole(enum.PartyRole_CLIENT_ID)
nos.SetNoPartyIDs(partyIDsgrp)
qfMsg := quickfix.NewMessage()
if err := quickfix.ParseMessage(qfMsg, bytes.NewBuffer(nos.ToMessage().Bytes())); err != nil {
log.Fatal(err)
}
// These two should be equal, but they're not. I've made qfMsg.Build() public for this example,
// to show what message is being sent to the counterparty. The second print shows messed up
// order of the party ID repeating group.
fmt.Println(string(qfMsg.Bytes()))
fmt.Println(string(qfMsg.Build()))
}
Here is the output of running the above code.
8=FIX.4.49=8235=D11=123440=254=160=20230622-08:23:27.847453=1448=party-in-da-house452=310=075
8=FIX.4.49=8235=D11=123440=254=160=20230622-08:23:27.847448=party-in-da-house452=3453=110=075
You will see that in the second print statement the party ID repeating group tags are (448, 452, 453), but it should have been (453, 458, 452).
Metadata
Metadata
Assignees
Labels
No labels