Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions cmd/generate-fix/generate-fix.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func genHeader(pkg string, spec *datadictionary.DataDictionary) {
Package: pkg,
Name: "Header",
MessageDef: spec.Header,
FIXSpec: spec,
}
if err := internal.HeaderTemplate.Execute(writer, c); err != nil {
errors <- err
Expand Down
8 changes: 8 additions & 0 deletions cmd/generate-fix/internal/template_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ func requiredFields(m *datadictionary.MessageDef) (required []*datadictionary.Fi
return
}

func beginString(spec *datadictionary.DataDictionary) string {
if spec.FIXType == "FIXT" || spec.Major == 5 {
return "FIXT.1.1"
}

return fmt.Sprintf("FIX.%v.%v", spec.Major, spec.Minor)
}

func routerBeginString(spec *datadictionary.DataDictionary) (routerBeginString string) {
switch {
case spec.FIXType == "FIXT":
Expand Down
10 changes: 9 additions & 1 deletion cmd/generate-fix/internal/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func init() {
tmplFuncs := template.FuncMap{
"toLower": strings.ToLower,
"requiredFields": requiredFields,
"beginString": beginString,
"routerBeginString": routerBeginString,
"importRootPath": getImportPathRoot,
"quickfixType": quickfixType,
Expand Down Expand Up @@ -146,6 +147,13 @@ type Header struct {
quickfix.Header
}

//NewHeader returns a new, initialized Header instance
func NewHeader() (h Header) {
h.Init()
h.SetBeginString("{{ beginString .FIXSpec }}")
return
}

{{ template "setters" .}}
{{ template "getters" . }}
{{ template "hasers" . }}
Expand Down Expand Up @@ -222,7 +230,7 @@ func (m {{ .Name }}) ToMessage() quickfix.Message {
{{ $required_fields := requiredFields .MessageDef -}}
//New returns a {{ .Name }} initialized with the required fields for {{ .Name }}
func New({{template "field_args" $required_fields }}) (m {{ .Name }}) {
m.Header.Init()
m.Header = {{ .TransportPackage }}.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/advertisement/Advertisement.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Advertisement) ToMessage() quickfix.Message {

//New returns a Advertisement initialized with the required fields for Advertisement
func New(advid field.AdvIdField, advtranstype field.AdvTransTypeField, symbol field.SymbolField, advside field.AdvSideField, shares field.SharesField) (m Advertisement) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/allocation/Allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Allocation) ToMessage() quickfix.Message {

//New returns a Allocation initialized with the required fields for Allocation
func New(allocid field.AllocIDField, alloctranstype field.AllocTransTypeField, side field.SideField, symbol field.SymbolField, shares field.SharesField, avgpx field.AvgPxField, tradedate field.TradeDateField) (m Allocation) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/allocationack/AllocationACK.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m AllocationACK) ToMessage() quickfix.Message {

//New returns a AllocationACK initialized with the required fields for AllocationACK
func New(allocid field.AllocIDField, tradedate field.TradeDateField, allocstatus field.AllocStatusField) (m AllocationACK) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/dontknowtrade/DontKnowTrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m DontKnowTrade) ToMessage() quickfix.Message {

//New returns a DontKnowTrade initialized with the required fields for DontKnowTrade
func New(dkreason field.DKReasonField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField, lastshares field.LastSharesField, lastpx field.LastPxField) (m DontKnowTrade) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/email/Email.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Email) ToMessage() quickfix.Message {

//New returns a Email initialized with the required fields for Email
func New(emailtype field.EmailTypeField, linesoftext field.LinesOfTextField, text field.TextField) (m Email) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/executionreport/ExecutionReport.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ExecutionReport) ToMessage() quickfix.Message {

//New returns a ExecutionReport initialized with the required fields for ExecutionReport
func New(orderid field.OrderIDField, execid field.ExecIDField, exectranstype field.ExecTransTypeField, ordstatus field.OrdStatusField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField, lastshares field.LastSharesField, lastpx field.LastPxField, cumqty field.CumQtyField, avgpx field.AvgPxField) (m ExecutionReport) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
7 changes: 7 additions & 0 deletions fix40/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ type Header struct {
quickfix.Header
}

//NewHeader returns a new, initialized Header instance
func NewHeader() (h Header) {
h.Init()
h.SetBeginString("FIX.4.0")
return
}

//SetBeginString sets BeginString, Tag 8
func (h Header) SetBeginString(v string) {
h.Set(field.NewBeginString(v))
Expand Down
2 changes: 1 addition & 1 deletion fix40/heartbeat/Heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Heartbeat) ToMessage() quickfix.Message {

//New returns a Heartbeat initialized with the required fields for Heartbeat
func New() (m Heartbeat) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/indicationofinterest/IndicationofInterest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m IndicationofInterest) ToMessage() quickfix.Message {

//New returns a IndicationofInterest initialized with the required fields for IndicationofInterest
func New(ioiid field.IOIidField, ioitranstype field.IOITransTypeField, symbol field.SymbolField, side field.SideField, ioishares field.IOISharesField) (m IndicationofInterest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/listcancelrequest/ListCancelRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ListCancelRequest) ToMessage() quickfix.Message {

//New returns a ListCancelRequest initialized with the required fields for ListCancelRequest
func New(listid field.ListIDField) (m ListCancelRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/listexecute/ListExecute.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ListExecute) ToMessage() quickfix.Message {

//New returns a ListExecute initialized with the required fields for ListExecute
func New(listid field.ListIDField) (m ListExecute) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/liststatus/ListStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ListStatus) ToMessage() quickfix.Message {

//New returns a ListStatus initialized with the required fields for ListStatus
func New(listid field.ListIDField, norpts field.NoRptsField, rptseq field.RptSeqField) (m ListStatus) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/liststatusrequest/ListStatusRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ListStatusRequest) ToMessage() quickfix.Message {

//New returns a ListStatusRequest initialized with the required fields for ListStatusRequest
func New(listid field.ListIDField) (m ListStatusRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/logon/Logon.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Logon) ToMessage() quickfix.Message {

//New returns a Logon initialized with the required fields for Logon
func New(encryptmethod field.EncryptMethodField, heartbtint field.HeartBtIntField) (m Logon) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/logout/Logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Logout) ToMessage() quickfix.Message {

//New returns a Logout initialized with the required fields for Logout
func New() (m Logout) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/neworderlist/NewOrderList.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m NewOrderList) ToMessage() quickfix.Message {

//New returns a NewOrderList initialized with the required fields for NewOrderList
func New(listid field.ListIDField, listseqno field.ListSeqNoField, listnoords field.ListNoOrdsField, clordid field.ClOrdIDField, handlinst field.HandlInstField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField, ordtype field.OrdTypeField) (m NewOrderList) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/newordersingle/NewOrderSingle.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m NewOrderSingle) ToMessage() quickfix.Message {

//New returns a NewOrderSingle initialized with the required fields for NewOrderSingle
func New(clordid field.ClOrdIDField, handlinst field.HandlInstField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField, ordtype field.OrdTypeField) (m NewOrderSingle) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/news/News.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m News) ToMessage() quickfix.Message {

//New returns a News initialized with the required fields for News
func New(linesoftext field.LinesOfTextField, text field.TextField) (m News) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/ordercancelreject/OrderCancelReject.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m OrderCancelReject) ToMessage() quickfix.Message {

//New returns a OrderCancelReject initialized with the required fields for OrderCancelReject
func New(orderid field.OrderIDField, clordid field.ClOrdIDField) (m OrderCancelReject) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m OrderCancelReplaceRequest) ToMessage() quickfix.Message {

//New returns a OrderCancelReplaceRequest initialized with the required fields for OrderCancelReplaceRequest
func New(origclordid field.OrigClOrdIDField, clordid field.ClOrdIDField, handlinst field.HandlInstField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField, ordtype field.OrdTypeField) (m OrderCancelReplaceRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/ordercancelrequest/OrderCancelRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m OrderCancelRequest) ToMessage() quickfix.Message {

//New returns a OrderCancelRequest initialized with the required fields for OrderCancelRequest
func New(origclordid field.OrigClOrdIDField, clordid field.ClOrdIDField, cxltype field.CxlTypeField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField) (m OrderCancelRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/orderstatusrequest/OrderStatusRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m OrderStatusRequest) ToMessage() quickfix.Message {

//New returns a OrderStatusRequest initialized with the required fields for OrderStatusRequest
func New(clordid field.ClOrdIDField, symbol field.SymbolField, side field.SideField) (m OrderStatusRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/quote/Quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Quote) ToMessage() quickfix.Message {

//New returns a Quote initialized with the required fields for Quote
func New(quoteid field.QuoteIDField, symbol field.SymbolField, bidpx field.BidPxField) (m Quote) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/quoterequest/QuoteRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m QuoteRequest) ToMessage() quickfix.Message {

//New returns a QuoteRequest initialized with the required fields for QuoteRequest
func New(quotereqid field.QuoteReqIDField, symbol field.SymbolField) (m QuoteRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/reject/Reject.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Reject) ToMessage() quickfix.Message {

//New returns a Reject initialized with the required fields for Reject
func New(refseqnum field.RefSeqNumField) (m Reject) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/resendrequest/ResendRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ResendRequest) ToMessage() quickfix.Message {

//New returns a ResendRequest initialized with the required fields for ResendRequest
func New(beginseqno field.BeginSeqNoField, endseqno field.EndSeqNoField) (m ResendRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/sequencereset/SequenceReset.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m SequenceReset) ToMessage() quickfix.Message {

//New returns a SequenceReset initialized with the required fields for SequenceReset
func New(newseqno field.NewSeqNoField) (m SequenceReset) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix40/testrequest/TestRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m TestRequest) ToMessage() quickfix.Message {

//New returns a TestRequest initialized with the required fields for TestRequest
func New(testreqid field.TestReqIDField) (m TestRequest) {
m.Header.Init()
m.Header = fix40.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/advertisement/Advertisement.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Advertisement) ToMessage() quickfix.Message {

//New returns a Advertisement initialized with the required fields for Advertisement
func New(advid field.AdvIdField, advtranstype field.AdvTransTypeField, symbol field.SymbolField, advside field.AdvSideField, shares field.SharesField) (m Advertisement) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/allocation/Allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Allocation) ToMessage() quickfix.Message {

//New returns a Allocation initialized with the required fields for Allocation
func New(allocid field.AllocIDField, alloctranstype field.AllocTransTypeField, side field.SideField, symbol field.SymbolField, shares field.SharesField, avgpx field.AvgPxField, tradedate field.TradeDateField) (m Allocation) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/allocationack/AllocationACK.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m AllocationACK) ToMessage() quickfix.Message {

//New returns a AllocationACK initialized with the required fields for AllocationACK
func New(allocid field.AllocIDField, tradedate field.TradeDateField, allocstatus field.AllocStatusField) (m AllocationACK) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/dontknowtrade/DontKnowTrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m DontKnowTrade) ToMessage() quickfix.Message {

//New returns a DontKnowTrade initialized with the required fields for DontKnowTrade
func New(dkreason field.DKReasonField, symbol field.SymbolField, side field.SideField) (m DontKnowTrade) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/email/Email.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Email) ToMessage() quickfix.Message {

//New returns a Email initialized with the required fields for Email
func New(emailthreadid field.EmailThreadIDField, emailtype field.EmailTypeField, subject field.SubjectField) (m Email) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/executionreport/ExecutionReport.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m ExecutionReport) ToMessage() quickfix.Message {

//New returns a ExecutionReport initialized with the required fields for ExecutionReport
func New(orderid field.OrderIDField, execid field.ExecIDField, exectranstype field.ExecTransTypeField, exectype field.ExecTypeField, ordstatus field.OrdStatusField, symbol field.SymbolField, side field.SideField, orderqty field.OrderQtyField, lastshares field.LastSharesField, lastpx field.LastPxField, leavesqty field.LeavesQtyField, cumqty field.CumQtyField, avgpx field.AvgPxField) (m ExecutionReport) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
7 changes: 7 additions & 0 deletions fix41/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ type Header struct {
quickfix.Header
}

//NewHeader returns a new, initialized Header instance
func NewHeader() (h Header) {
h.Init()
h.SetBeginString("FIX.4.1")
return
}

//SetBeginString sets BeginString, Tag 8
func (h Header) SetBeginString(v string) {
h.Set(field.NewBeginString(v))
Expand Down
2 changes: 1 addition & 1 deletion fix41/heartbeat/Heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m Heartbeat) ToMessage() quickfix.Message {

//New returns a Heartbeat initialized with the required fields for Heartbeat
func New() (m Heartbeat) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
2 changes: 1 addition & 1 deletion fix41/indicationofinterest/IndicationofInterest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (m IndicationofInterest) ToMessage() quickfix.Message {

//New returns a IndicationofInterest initialized with the required fields for IndicationofInterest
func New(ioiid field.IOIidField, ioitranstype field.IOITransTypeField, symbol field.SymbolField, side field.SideField, ioishares field.IOISharesField) (m IndicationofInterest) {
m.Header.Init()
m.Header = fix41.NewHeader()
m.Init()
m.Trailer.Init()

Expand Down
Loading