func TestUnmarshal_RepeatingGroups(t *testing.T) { type Group1 struct { StringField1 string `fix:"8"` StringField2 *string `fix:"9"` } type Group2 struct { IntField1 int `fix:"1"` IntField2 int `fix:"2"` } type Message struct { FIXMsgType string `fix:"0"` GroupField1 []Group1 `fix:"100"` StringField string `fix:"112"` GroupField2 []Group2 `fix:"101"` } fixMsg := quickfix.NewMessage() fixMsg.Body.SetField(quickfix.Tag(112), quickfix.FIXString("world")) group1Template := quickfix.GroupTemplate{ quickfix.GroupElement(quickfix.Tag(8)), quickfix.GroupElement(quickfix.Tag(9)), } group1 := quickfix.RepeatingGroup{Tag: quickfix.Tag(100), GroupTemplate: group1Template} group1.Add().SetField(quickfix.Tag(8), quickfix.FIXString("hello")).SetField(quickfix.Tag(9), quickfix.FIXString("world")) group1.Add().SetField(quickfix.Tag(8), quickfix.FIXString("goodbye")) group1.Add().SetField(quickfix.Tag(8), quickfix.FIXString("OHHAI")).SetField(quickfix.Tag(9), quickfix.FIXString("world")) fixMsg.Body.SetGroup(group1) var msgOut Message quickfix.Unmarshal(fixMsg, &msgOut) if msgOut.StringField != "world" { t.Errorf("Expected '%v' got '%v'", "world", msgOut.StringField) } if len(msgOut.GroupField1) != 3 { t.Errorf("Expected group size '%v' got '%v'", 3, len(msgOut.GroupField1)) } if msgOut.GroupField1[0].StringField1 != "hello" { t.Errorf("Expected %v got %v", "hello", msgOut.GroupField1[0].StringField1) } if *(msgOut.GroupField1[0].StringField2) != "world" { t.Errorf("Expected %v got %v", "world", *(msgOut.GroupField1[0].StringField2)) } if msgOut.GroupField1[1].StringField1 != "goodbye" { t.Errorf("Expected %v got %v", "goodbye", msgOut.GroupField1[1].StringField1) } if msgOut.GroupField1[1].StringField2 != nil { t.Errorf("Expected stringfield 2 to be nil, got %v", *(msgOut.GroupField1[1].StringField2)) } }
//NewNoEventsRepeatingGroup returns an initialized, NoEventsRepeatingGroup func NewNoEventsRepeatingGroup() NoEventsRepeatingGroup { return NoEventsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoEvents, quickfix.GroupTemplate{quickfix.GroupElement(tag.EventType), quickfix.GroupElement(tag.EventDate), quickfix.GroupElement(tag.EventPx), quickfix.GroupElement(tag.EventText)})} }
//NewNoNestedPartyIDsRepeatingGroup returns an initialized, NoNestedPartyIDsRepeatingGroup func NewNoNestedPartyIDsRepeatingGroup() NoNestedPartyIDsRepeatingGroup { return NoNestedPartyIDsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoNestedPartyIDs, quickfix.GroupTemplate{quickfix.GroupElement(tag.NestedPartyID), quickfix.GroupElement(tag.NestedPartyIDSource), quickfix.GroupElement(tag.NestedPartyRole), NewNoNestedPartySubIDsRepeatingGroup()})} }
//NewNoTradingSessionsRepeatingGroup returns an initialized, NoTradingSessionsRepeatingGroup func NewNoTradingSessionsRepeatingGroup() NoTradingSessionsRepeatingGroup { return NoTradingSessionsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoTradingSessions, quickfix.GroupTemplate{quickfix.GroupElement(tag.TradingSessionID)})} }
//NewNoMDEntryTypesRepeatingGroup returns an initialized, NoMDEntryTypesRepeatingGroup func NewNoMDEntryTypesRepeatingGroup() NoMDEntryTypesRepeatingGroup { return NoMDEntryTypesRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoMDEntryTypes, quickfix.GroupTemplate{quickfix.GroupElement(tag.MDEntryType)})} }
//NewNoRelatedSymRepeatingGroup returns an initialized, NoRelatedSymRepeatingGroup func NewNoRelatedSymRepeatingGroup() NoRelatedSymRepeatingGroup { return NoRelatedSymRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoRelatedSym, quickfix.GroupTemplate{quickfix.GroupElement(tag.Symbol), quickfix.GroupElement(tag.SymbolSfx), quickfix.GroupElement(tag.SecurityID), quickfix.GroupElement(tag.SecurityIDSource), NewNoSecurityAltIDRepeatingGroup(), quickfix.GroupElement(tag.Product), quickfix.GroupElement(tag.CFICode), quickfix.GroupElement(tag.SecurityType), quickfix.GroupElement(tag.MaturityMonthYear), quickfix.GroupElement(tag.MaturityDate), quickfix.GroupElement(tag.CouponPaymentDate), quickfix.GroupElement(tag.IssueDate), quickfix.GroupElement(tag.RepoCollateralSecurityType), quickfix.GroupElement(tag.RepurchaseTerm), quickfix.GroupElement(tag.RepurchaseRate), quickfix.GroupElement(tag.Factor), quickfix.GroupElement(tag.CreditRating), quickfix.GroupElement(tag.InstrRegistry), quickfix.GroupElement(tag.CountryOfIssue), quickfix.GroupElement(tag.StateOrProvinceOfIssue), quickfix.GroupElement(tag.LocaleOfIssue), quickfix.GroupElement(tag.RedemptionDate), quickfix.GroupElement(tag.StrikePrice), quickfix.GroupElement(tag.OptAttribute), quickfix.GroupElement(tag.ContractMultiplier), quickfix.GroupElement(tag.CouponRate), quickfix.GroupElement(tag.SecurityExchange), quickfix.GroupElement(tag.Issuer), quickfix.GroupElement(tag.EncodedIssuerLen), quickfix.GroupElement(tag.EncodedIssuer), quickfix.GroupElement(tag.SecurityDesc), quickfix.GroupElement(tag.EncodedSecurityDescLen), quickfix.GroupElement(tag.EncodedSecurityDesc), quickfix.GroupElement(tag.PrevClosePx), quickfix.GroupElement(tag.QuoteRequestType), quickfix.GroupElement(tag.QuoteType), quickfix.GroupElement(tag.TradingSessionID), quickfix.GroupElement(tag.TradingSessionSubID), quickfix.GroupElement(tag.TradeOriginationDate), NewNoStipulationsRepeatingGroup(), quickfix.GroupElement(tag.Side), quickfix.GroupElement(tag.QuantityType), quickfix.GroupElement(tag.OrderQty), quickfix.GroupElement(tag.CashOrderQty), quickfix.GroupElement(tag.SettlmntTyp), quickfix.GroupElement(tag.FutSettDate), quickfix.GroupElement(tag.OrdType), quickfix.GroupElement(tag.FutSettDate2), quickfix.GroupElement(tag.OrderQty2), quickfix.GroupElement(tag.ExpireTime), quickfix.GroupElement(tag.TransactTime), quickfix.GroupElement(tag.Currency), quickfix.GroupElement(tag.Spread), quickfix.GroupElement(tag.BenchmarkCurveCurrency), quickfix.GroupElement(tag.BenchmarkCurveName), quickfix.GroupElement(tag.BenchmarkCurvePoint), quickfix.GroupElement(tag.PriceType), quickfix.GroupElement(tag.Price), quickfix.GroupElement(tag.Price2), quickfix.GroupElement(tag.YieldType), quickfix.GroupElement(tag.Yield)})} }
//NewNoSecurityAltIDRepeatingGroup returns an initialized, NoSecurityAltIDRepeatingGroup func NewNoSecurityAltIDRepeatingGroup() NoSecurityAltIDRepeatingGroup { return NoSecurityAltIDRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoSecurityAltID, quickfix.GroupTemplate{quickfix.GroupElement(tag.SecurityAltID), quickfix.GroupElement(tag.SecurityAltIDSource)})} }
//NewNoHopsRepeatingGroup returns an initialized, NoHopsRepeatingGroup func NewNoHopsRepeatingGroup() NoHopsRepeatingGroup { return NoHopsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoHops, quickfix.GroupTemplate{quickfix.GroupElement(tag.HopCompID), quickfix.GroupElement(tag.HopSendingTime), quickfix.GroupElement(tag.HopRefID)})} }
//NewNoBidComponentsRepeatingGroup returns an initialized, NoBidComponentsRepeatingGroup func NewNoBidComponentsRepeatingGroup() NoBidComponentsRepeatingGroup { return NoBidComponentsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoBidComponents, quickfix.GroupTemplate{quickfix.GroupElement(tag.Commission), quickfix.GroupElement(tag.CommType), quickfix.GroupElement(tag.ListID), quickfix.GroupElement(tag.Country), quickfix.GroupElement(tag.Side), quickfix.GroupElement(tag.Price), quickfix.GroupElement(tag.PriceType), quickfix.GroupElement(tag.FairValue), quickfix.GroupElement(tag.NetGrossInd), quickfix.GroupElement(tag.SettlmntTyp), quickfix.GroupElement(tag.FutSettDate), quickfix.GroupElement(tag.TradingSessionID), quickfix.GroupElement(tag.Text), quickfix.GroupElement(tag.EncodedTextLen), quickfix.GroupElement(tag.EncodedText)})} }
//NewNoRoutingIDsRepeatingGroup returns an initialized, NoRoutingIDsRepeatingGroup func NewNoRoutingIDsRepeatingGroup() NoRoutingIDsRepeatingGroup { return NoRoutingIDsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoRoutingIDs, quickfix.GroupTemplate{quickfix.GroupElement(tag.RoutingType), quickfix.GroupElement(tag.RoutingID)})} }
//NewLinesOfTextRepeatingGroup returns an initialized, LinesOfTextRepeatingGroup func NewLinesOfTextRepeatingGroup() LinesOfTextRepeatingGroup { return LinesOfTextRepeatingGroup{ quickfix.NewRepeatingGroup(tag.LinesOfText, quickfix.GroupTemplate{quickfix.GroupElement(tag.Text), quickfix.GroupElement(tag.EncodedTextLen), quickfix.GroupElement(tag.EncodedText)})} }
//NewNoAllocsRepeatingGroup returns an initialized, NoAllocsRepeatingGroup func NewNoAllocsRepeatingGroup() NoAllocsRepeatingGroup { return NoAllocsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoAllocs, quickfix.GroupTemplate{quickfix.GroupElement(tag.AllocAccount), quickfix.GroupElement(tag.AllocAcctIDSource), quickfix.GroupElement(tag.AllocPrice), quickfix.GroupElement(tag.IndividualAllocID), quickfix.GroupElement(tag.IndividualAllocRejCode), quickfix.GroupElement(tag.AllocText), quickfix.GroupElement(tag.EncodedAllocTextLen), quickfix.GroupElement(tag.EncodedAllocText), quickfix.GroupElement(tag.SecondaryIndividualAllocID), quickfix.GroupElement(tag.AllocCustomerCapacity), quickfix.GroupElement(tag.IndividualAllocType), quickfix.GroupElement(tag.AllocQty), NewNoNestedPartyIDsRepeatingGroup(), quickfix.GroupElement(tag.AllocPositionEffect)})} }
//NewNoBidComponentsRepeatingGroup returns an initialized, NoBidComponentsRepeatingGroup func NewNoBidComponentsRepeatingGroup() NoBidComponentsRepeatingGroup { return NoBidComponentsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoBidComponents, quickfix.GroupTemplate{quickfix.GroupElement(tag.ListID), quickfix.GroupElement(tag.Side), quickfix.GroupElement(tag.TradingSessionID), quickfix.GroupElement(tag.NetGrossInd), quickfix.GroupElement(tag.SettlmntTyp), quickfix.GroupElement(tag.FutSettDate), quickfix.GroupElement(tag.Account)})} }
//NewNoRelatedSymRepeatingGroup returns an initialized, NoRelatedSymRepeatingGroup func NewNoRelatedSymRepeatingGroup() NoRelatedSymRepeatingGroup { return NoRelatedSymRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoRelatedSym, quickfix.GroupTemplate{quickfix.GroupElement(tag.RelatdSym), quickfix.GroupElement(tag.SymbolSfx), quickfix.GroupElement(tag.SecurityID), quickfix.GroupElement(tag.IDSource), quickfix.GroupElement(tag.SecurityType), quickfix.GroupElement(tag.MaturityMonthYear), quickfix.GroupElement(tag.MaturityDay), quickfix.GroupElement(tag.PutOrCall), quickfix.GroupElement(tag.StrikePrice), quickfix.GroupElement(tag.OptAttribute), quickfix.GroupElement(tag.SecurityExchange), quickfix.GroupElement(tag.Issuer), quickfix.GroupElement(tag.SecurityDesc)})} }
//NewNoIOIQualifiersRepeatingGroup returns an initialized, NoIOIQualifiersRepeatingGroup func NewNoIOIQualifiersRepeatingGroup() NoIOIQualifiersRepeatingGroup { return NoIOIQualifiersRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoIOIQualifiers, quickfix.GroupTemplate{quickfix.GroupElement(tag.IOIQualifier)})} }
//NewNoAllocsRepeatingGroup returns an initialized, NoAllocsRepeatingGroup func NewNoAllocsRepeatingGroup() NoAllocsRepeatingGroup { return NoAllocsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoAllocs, quickfix.GroupTemplate{quickfix.GroupElement(tag.AllocAccount), quickfix.GroupElement(tag.AllocAcctIDSource), quickfix.GroupElement(tag.AllocPrice), quickfix.GroupElement(tag.IndividualAllocID), quickfix.GroupElement(tag.IndividualAllocRejCode), quickfix.GroupElement(tag.AllocText), quickfix.GroupElement(tag.EncodedAllocTextLen), quickfix.GroupElement(tag.EncodedAllocText)})} }
//NewNoOrdersRepeatingGroup returns an initialized, NoOrdersRepeatingGroup func NewNoOrdersRepeatingGroup() NoOrdersRepeatingGroup { return NoOrdersRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoOrders, quickfix.GroupTemplate{quickfix.GroupElement(tag.ClOrdID), quickfix.GroupElement(tag.CumQty), quickfix.GroupElement(tag.LeavesQty), quickfix.GroupElement(tag.CxlQty), quickfix.GroupElement(tag.AvgPx)})} }
//NewNoBidDescriptorsRepeatingGroup returns an initialized, NoBidDescriptorsRepeatingGroup func NewNoBidDescriptorsRepeatingGroup() NoBidDescriptorsRepeatingGroup { return NoBidDescriptorsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoBidDescriptors, quickfix.GroupTemplate{quickfix.GroupElement(tag.BidDescriptorType), quickfix.GroupElement(tag.BidDescriptor), quickfix.GroupElement(tag.SideValueInd), quickfix.GroupElement(tag.LiquidityValue), quickfix.GroupElement(tag.LiquidityNumSecurities), quickfix.GroupElement(tag.LiquidityPctLow), quickfix.GroupElement(tag.LiquidityPctHigh), quickfix.GroupElement(tag.EFPTrackingError), quickfix.GroupElement(tag.FairValue), quickfix.GroupElement(tag.OutsideIndexPct), quickfix.GroupElement(tag.ValueOfFutures)})} }
//NewNoCompIDsRepeatingGroup returns an initialized, NoCompIDsRepeatingGroup func NewNoCompIDsRepeatingGroup() NoCompIDsRepeatingGroup { return NoCompIDsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoCompIDs, quickfix.GroupTemplate{quickfix.GroupElement(tag.RefCompID), quickfix.GroupElement(tag.RefSubID), quickfix.GroupElement(tag.LocationID), quickfix.GroupElement(tag.DeskID)})} }
//NewNoBidComponentsRepeatingGroup returns an initialized, NoBidComponentsRepeatingGroup func NewNoBidComponentsRepeatingGroup() NoBidComponentsRepeatingGroup { return NoBidComponentsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoBidComponents, quickfix.GroupTemplate{quickfix.GroupElement(tag.ListID), quickfix.GroupElement(tag.Side), quickfix.GroupElement(tag.TradingSessionID), quickfix.GroupElement(tag.TradingSessionSubID), quickfix.GroupElement(tag.NetGrossInd), quickfix.GroupElement(tag.SettlType), quickfix.GroupElement(tag.SettlDate), quickfix.GroupElement(tag.Account), quickfix.GroupElement(tag.AcctIDSource)})} }
//NewNoStipulationsRepeatingGroup returns an initialized, NoStipulationsRepeatingGroup func NewNoStipulationsRepeatingGroup() NoStipulationsRepeatingGroup { return NoStipulationsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoStipulations, quickfix.GroupTemplate{quickfix.GroupElement(tag.StipulationType), quickfix.GroupElement(tag.StipulationValue)})} }
//NewNoOrdersRepeatingGroup returns an initialized, NoOrdersRepeatingGroup func NewNoOrdersRepeatingGroup() NoOrdersRepeatingGroup { return NoOrdersRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoOrders, quickfix.GroupTemplate{quickfix.GroupElement(tag.ClOrdID), quickfix.GroupElement(tag.OrderID), quickfix.GroupElement(tag.SecondaryOrderID), quickfix.GroupElement(tag.ListID), quickfix.GroupElement(tag.WaveNo)})} }
//NewNoRelatedSymRepeatingGroup returns an initialized, NoRelatedSymRepeatingGroup func NewNoRelatedSymRepeatingGroup() NoRelatedSymRepeatingGroup { return NoRelatedSymRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoRelatedSym, quickfix.GroupTemplate{quickfix.GroupElement(tag.Symbol), quickfix.GroupElement(tag.SymbolSfx), quickfix.GroupElement(tag.SecurityID), quickfix.GroupElement(tag.IDSource), quickfix.GroupElement(tag.SecurityType), quickfix.GroupElement(tag.MaturityMonthYear), quickfix.GroupElement(tag.MaturityDay), quickfix.GroupElement(tag.PutOrCall), quickfix.GroupElement(tag.StrikePrice), quickfix.GroupElement(tag.OptAttribute), quickfix.GroupElement(tag.ContractMultiplier), quickfix.GroupElement(tag.CouponRate), quickfix.GroupElement(tag.SecurityExchange), quickfix.GroupElement(tag.Issuer), quickfix.GroupElement(tag.EncodedIssuerLen), quickfix.GroupElement(tag.EncodedIssuer), quickfix.GroupElement(tag.SecurityDesc), quickfix.GroupElement(tag.EncodedSecurityDescLen), quickfix.GroupElement(tag.EncodedSecurityDesc), quickfix.GroupElement(tag.TradingSessionID)})} }
//NewNoMiscFeesRepeatingGroup returns an initialized, NoMiscFeesRepeatingGroup func NewNoMiscFeesRepeatingGroup() NoMiscFeesRepeatingGroup { return NoMiscFeesRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoMiscFees, quickfix.GroupTemplate{quickfix.GroupElement(tag.MiscFeeAmt), quickfix.GroupElement(tag.MiscFeeCurr), quickfix.GroupElement(tag.MiscFeeType)})} }
//NewNoAllocsRepeatingGroup returns an initialized, NoAllocsRepeatingGroup func NewNoAllocsRepeatingGroup() NoAllocsRepeatingGroup { return NoAllocsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoAllocs, quickfix.GroupTemplate{quickfix.GroupElement(tag.AllocAccount), quickfix.GroupElement(tag.AllocShares)})} }
//NewNoAllocsRepeatingGroup returns an initialized, NoAllocsRepeatingGroup func NewNoAllocsRepeatingGroup() NoAllocsRepeatingGroup { return NoAllocsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoAllocs, quickfix.GroupTemplate{quickfix.GroupElement(tag.AllocAccount), quickfix.GroupElement(tag.AllocPrice), quickfix.GroupElement(tag.AllocShares), quickfix.GroupElement(tag.ProcessCode), quickfix.GroupElement(tag.BrokerOfCredit), quickfix.GroupElement(tag.NotifyBrokerOfCredit), quickfix.GroupElement(tag.AllocHandlInst), quickfix.GroupElement(tag.AllocText), quickfix.GroupElement(tag.EncodedAllocTextLen), quickfix.GroupElement(tag.EncodedAllocText), quickfix.GroupElement(tag.ExecBroker), quickfix.GroupElement(tag.ClientID), quickfix.GroupElement(tag.Commission), quickfix.GroupElement(tag.CommType), quickfix.GroupElement(tag.AllocAvgPx), quickfix.GroupElement(tag.AllocNetMoney), quickfix.GroupElement(tag.SettlCurrAmt), quickfix.GroupElement(tag.SettlCurrency), quickfix.GroupElement(tag.SettlCurrFxRate), quickfix.GroupElement(tag.SettlCurrFxRateCalc), quickfix.GroupElement(tag.AccruedInterestAmt), quickfix.GroupElement(tag.SettlInstMode), NewNoMiscFeesRepeatingGroup()})} }
//NewNoPartySubIDsRepeatingGroup returns an initialized, NoPartySubIDsRepeatingGroup func NewNoPartySubIDsRepeatingGroup() NoPartySubIDsRepeatingGroup { return NoPartySubIDsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoPartySubIDs, quickfix.GroupTemplate{quickfix.GroupElement(tag.PartySubID), quickfix.GroupElement(tag.PartySubIDType)})} }
//NewNoExecsRepeatingGroup returns an initialized, NoExecsRepeatingGroup func NewNoExecsRepeatingGroup() NoExecsRepeatingGroup { return NoExecsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoExecs, quickfix.GroupTemplate{quickfix.GroupElement(tag.LastShares), quickfix.GroupElement(tag.ExecID), quickfix.GroupElement(tag.LastPx), quickfix.GroupElement(tag.LastCapacity)})} }
//NewNoApplIDsRepeatingGroup returns an initialized, NoApplIDsRepeatingGroup func NewNoApplIDsRepeatingGroup() NoApplIDsRepeatingGroup { return NoApplIDsRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoApplIDs, quickfix.GroupTemplate{quickfix.GroupElement(tag.RefApplID), quickfix.GroupElement(tag.ApplBegSeqNum), quickfix.GroupElement(tag.ApplEndSeqNum), NewNoNestedPartyIDsRepeatingGroup(), quickfix.GroupElement(tag.RefApplReqID)})} }
//NewNoOrdersRepeatingGroup returns an initialized, NoOrdersRepeatingGroup func NewNoOrdersRepeatingGroup() NoOrdersRepeatingGroup { return NoOrdersRepeatingGroup{ quickfix.NewRepeatingGroup(tag.NoOrders, quickfix.GroupTemplate{quickfix.GroupElement(tag.ClOrdID), quickfix.GroupElement(tag.OrderID), quickfix.GroupElement(tag.SecondaryOrderID), quickfix.GroupElement(tag.SecondaryClOrdID), quickfix.GroupElement(tag.ListID), NewNoNested2PartyIDsRepeatingGroup(), quickfix.GroupElement(tag.OrderQty), quickfix.GroupElement(tag.OrderAvgPx), quickfix.GroupElement(tag.OrderBookingQty)})} }