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
  •  
  •  
  •  
37 changes: 28 additions & 9 deletions _gen/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,35 @@ import ({{ range .}}
)
{{ end}}

{{/* template writes out a constructor for message/component/group */}}
{{define "new"}}
func New(
{{- range $index, $field := .RequiredParts -}}
{{if $index}},{{end}}{{toLower $field.Name}} {{partAsGoType $field}}
{{- end }}) *{{.Name}} {

{{/* template writes out a constructor for message and component type */}}
{{define "new"}}
//New returns an initialized {{.Name}} instance
func New({{ template "parts_args" .RequiredParts}}) *{{.Name}} {
var m {{.Name}}
{{- range .RequiredFields}}
{{- range .RequiredParts}}
m.Set{{.Name}}({{toLower .Name}})
{{- end}}
return &m
}
{{end}}
{{end}}

{{/* template writes out a constructor for group */}}
{{define "newgroup"}}
//New{{.Name}} returns an initialized {{.Name}} instance
func New{{.Name}}({{ template "parts_args" .RequiredParts}}) *{{.Name}} {
var m {{.Name}}
{{- range .RequiredParts}}
m.Set{{.Name}}({{toLower .Name}})
{{- end}}
return &m
}
{{end}}

{{/* template writes out a comma delimited list of parts to be used as an argument list*/}}
{{define "parts_args"}}
{{- range $index, $field := . }}{{if $index}},{{end}}{{toLower $field.Name}} {{partAsGoType $field}}{{ end }}
{{- end }}

{{define "fieldSetter"}}
func (m *{{.Receiver}}) Set{{.Name}}(v {{ if .IsGroup}}[]{{.Name}}{{else}}{{fixFieldTypeToGoType .Type}}{{end}}) {
Expand Down Expand Up @@ -168,10 +184,13 @@ func WriteGroupDeclaration(fixSpecMajor, fixSpecMinor int, field *datadictionary
fileOut += fmt.Sprintf("//%v is a repeating group in %v\n", field.Name(), parent)
fileOut += fmt.Sprintf("type %v struct {\n", field.Name())
fileOut += WriteFieldDeclarations(fixSpecMajor, fixSpecMinor, field.Parts, field.Name())

fileOut += "}\n"

writer := new(bytes.Buffer)
if err := genTemplate.ExecuteTemplate(writer, "newgroup", *field); err != nil {
panic(err)
}

if err := WriteFieldSetters(writer, field.Name(), field.Parts); err != nil {
panic(err)
}
Expand Down
27 changes: 27 additions & 0 deletions fix40/allocation/Allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ type NoOrders struct {
WaveNo *string `fix:"105"`
}

//NewNoOrders returns an initialized NoOrders instance
func NewNoOrders(clordid string) *NoOrders {
var m NoOrders
m.SetClOrdID(clordid)
return &m
}

func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = v }
func (m *NoOrders) SetOrderID(v string) { m.OrderID = &v }
func (m *NoOrders) SetListID(v string) { m.ListID = &v }
Expand All @@ -37,6 +44,12 @@ type NoExecs struct {
LastMkt *string `fix:"30"`
}

//NewNoExecs returns an initialized NoExecs instance
func NewNoExecs() *NoExecs {
var m NoExecs
return &m
}

func (m *NoExecs) SetExecID(v int) { m.ExecID = &v }
func (m *NoExecs) SetLastShares(v int) { m.LastShares = &v }
func (m *NoExecs) SetLastPx(v float64) { m.LastPx = &v }
Expand All @@ -52,6 +65,12 @@ type NoMiscFees struct {
MiscFeeType *string `fix:"139"`
}

//NewNoMiscFees returns an initialized NoMiscFees instance
func NewNoMiscFees() *NoMiscFees {
var m NoMiscFees
return &m
}

func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }
Expand Down Expand Up @@ -80,6 +99,14 @@ type NoAllocs struct {
DlvyInst *string `fix:"86"`
}

//NewNoAllocs returns an initialized NoAllocs instance
func NewNoAllocs(allocaccount string, allocshares int) *NoAllocs {
var m NoAllocs
m.SetAllocAccount(allocaccount)
m.SetAllocShares(allocshares)
return &m
}

func (m *NoAllocs) SetAllocAccount(v string) { m.AllocAccount = v }
func (m *NoAllocs) SetAllocShares(v int) { m.AllocShares = v }
func (m *NoAllocs) SetProcessCode(v string) { m.ProcessCode = &v }
Expand Down
6 changes: 6 additions & 0 deletions fix40/executionreport/ExecutionReport.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ type NoMiscFees struct {
MiscFeeType *string `fix:"139"`
}

//NewNoMiscFees returns an initialized NoMiscFees instance
func NewNoMiscFees() *NoMiscFees {
var m NoMiscFees
return &m
}

func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }
Expand Down
10 changes: 10 additions & 0 deletions fix40/liststatus/ListStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ type NoOrders struct {
AvgPx float64 `fix:"6"`
}

//NewNoOrders returns an initialized NoOrders instance
func NewNoOrders(clordid string, cumqty int, cxlqty int, avgpx float64) *NoOrders {
var m NoOrders
m.SetClOrdID(clordid)
m.SetCumQty(cumqty)
m.SetCxlQty(cxlqty)
m.SetAvgPx(avgpx)
return &m
}

func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = v }
func (m *NoOrders) SetCumQty(v int) { m.CumQty = v }
func (m *NoOrders) SetCxlQty(v int) { m.CxlQty = v }
Expand Down
25 changes: 25 additions & 0 deletions fix41/allocation/Allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ type NoOrders struct {
WaveNo *string `fix:"105"`
}

//NewNoOrders returns an initialized NoOrders instance
func NewNoOrders() *NoOrders {
var m NoOrders
return &m
}

func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = &v }
func (m *NoOrders) SetOrderID(v string) { m.OrderID = &v }
func (m *NoOrders) SetSecondaryOrderID(v string) { m.SecondaryOrderID = &v }
Expand All @@ -40,6 +46,12 @@ type NoExecs struct {
LastCapacity *string `fix:"29"`
}

//NewNoExecs returns an initialized NoExecs instance
func NewNoExecs() *NoExecs {
var m NoExecs
return &m
}

func (m *NoExecs) SetLastShares(v int) { m.LastShares = &v }
func (m *NoExecs) SetExecID(v string) { m.ExecID = &v }
func (m *NoExecs) SetLastPx(v float64) { m.LastPx = &v }
Expand Down Expand Up @@ -89,6 +101,13 @@ type NoAllocs struct {
NoMiscFees []NoMiscFees `fix:"136,omitempty"`
}

//NewNoAllocs returns an initialized NoAllocs instance
func NewNoAllocs(allocshares int) *NoAllocs {
var m NoAllocs
m.SetAllocShares(allocshares)
return &m
}

func (m *NoAllocs) SetAllocAccount(v string) { m.AllocAccount = &v }
func (m *NoAllocs) SetAllocShares(v int) { m.AllocShares = v }
func (m *NoAllocs) SetProcessCode(v string) { m.ProcessCode = &v }
Expand Down Expand Up @@ -120,6 +139,12 @@ type NoMiscFees struct {
MiscFeeType *string `fix:"139"`
}

//NewNoMiscFees returns an initialized NoMiscFees instance
func NewNoMiscFees() *NoMiscFees {
var m NoMiscFees
return &m
}

func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }
Expand Down
13 changes: 13 additions & 0 deletions fix41/email/Email.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ type NoRelatedSym struct {
SecurityDesc *string `fix:"107"`
}

//NewNoRelatedSym returns an initialized NoRelatedSym instance
func NewNoRelatedSym() *NoRelatedSym {
var m NoRelatedSym
return &m
}

func (m *NoRelatedSym) SetRelatdSym(v string) { m.RelatdSym = &v }
func (m *NoRelatedSym) SetSymbolSfx(v string) { m.SymbolSfx = &v }
func (m *NoRelatedSym) SetSecurityID(v string) { m.SecurityID = &v }
Expand All @@ -58,6 +64,13 @@ type LinesOfText struct {
Text string `fix:"58"`
}

//NewLinesOfText returns an initialized LinesOfText instance
func NewLinesOfText(text string) *LinesOfText {
var m LinesOfText
m.SetText(text)
return &m
}

func (m *LinesOfText) SetText(v string) { m.Text = v }

//Message is a Email FIX Message
Expand Down
6 changes: 6 additions & 0 deletions fix41/indicationofinterest/IndicationofInterest.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ type NoIOIQualifiers struct {
IOIQualifier *string `fix:"104"`
}

//NewNoIOIQualifiers returns an initialized NoIOIQualifiers instance
func NewNoIOIQualifiers() *NoIOIQualifiers {
var m NoIOIQualifiers
return &m
}

func (m *NoIOIQualifiers) SetIOIQualifier(v string) { m.IOIQualifier = &v }

//Message is a IndicationofInterest FIX Message
Expand Down
11 changes: 11 additions & 0 deletions fix41/liststatus/ListStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ type NoOrders struct {
AvgPx float64 `fix:"6"`
}

//NewNoOrders returns an initialized NoOrders instance
func NewNoOrders(clordid string, cumqty int, leavesqty int, cxlqty int, avgpx float64) *NoOrders {
var m NoOrders
m.SetClOrdID(clordid)
m.SetCumQty(cumqty)
m.SetLeavesQty(leavesqty)
m.SetCxlQty(cxlqty)
m.SetAvgPx(avgpx)
return &m
}

func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = v }
func (m *NoOrders) SetCumQty(v int) { m.CumQty = v }
func (m *NoOrders) SetLeavesQty(v int) { m.LeavesQty = v }
Expand Down
13 changes: 13 additions & 0 deletions fix41/news/News.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ type NoRelatedSym struct {
SecurityDesc *string `fix:"107"`
}

//NewNoRelatedSym returns an initialized NoRelatedSym instance
func NewNoRelatedSym() *NoRelatedSym {
var m NoRelatedSym
return &m
}

func (m *NoRelatedSym) SetRelatdSym(v string) { m.RelatdSym = &v }
func (m *NoRelatedSym) SetSymbolSfx(v string) { m.SymbolSfx = &v }
func (m *NoRelatedSym) SetSecurityID(v string) { m.SecurityID = &v }
Expand All @@ -58,6 +64,13 @@ type LinesOfText struct {
Text string `fix:"58"`
}

//NewLinesOfText returns an initialized LinesOfText instance
func NewLinesOfText(text string) *LinesOfText {
var m LinesOfText
m.SetText(text)
return &m
}

func (m *LinesOfText) SetText(v string) { m.Text = v }

//Message is a News FIX Message
Expand Down
25 changes: 25 additions & 0 deletions fix42/allocation/Allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ type NoOrders struct {
WaveNo *string `fix:"105"`
}

//NewNoOrders returns an initialized NoOrders instance
func NewNoOrders() *NoOrders {
var m NoOrders
return &m
}

func (m *NoOrders) SetClOrdID(v string) { m.ClOrdID = &v }
func (m *NoOrders) SetOrderID(v string) { m.OrderID = &v }
func (m *NoOrders) SetSecondaryOrderID(v string) { m.SecondaryOrderID = &v }
Expand All @@ -40,6 +46,12 @@ type NoExecs struct {
LastCapacity *string `fix:"29"`
}

//NewNoExecs returns an initialized NoExecs instance
func NewNoExecs() *NoExecs {
var m NoExecs
return &m
}

func (m *NoExecs) SetLastShares(v float64) { m.LastShares = &v }
func (m *NoExecs) SetExecID(v string) { m.ExecID = &v }
func (m *NoExecs) SetLastPx(v float64) { m.LastPx = &v }
Expand Down Expand Up @@ -95,6 +107,13 @@ type NoAllocs struct {
NoMiscFees []NoMiscFees `fix:"136,omitempty"`
}

//NewNoAllocs returns an initialized NoAllocs instance
func NewNoAllocs(allocshares float64) *NoAllocs {
var m NoAllocs
m.SetAllocShares(allocshares)
return &m
}

func (m *NoAllocs) SetAllocAccount(v string) { m.AllocAccount = &v }
func (m *NoAllocs) SetAllocPrice(v float64) { m.AllocPrice = &v }
func (m *NoAllocs) SetAllocShares(v float64) { m.AllocShares = v }
Expand Down Expand Up @@ -129,6 +148,12 @@ type NoMiscFees struct {
MiscFeeType *string `fix:"139"`
}

//NewNoMiscFees returns an initialized NoMiscFees instance
func NewNoMiscFees() *NoMiscFees {
var m NoMiscFees
return &m
}

func (m *NoMiscFees) SetMiscFeeAmt(v float64) { m.MiscFeeAmt = &v }
func (m *NoMiscFees) SetMiscFeeCurr(v string) { m.MiscFeeCurr = &v }
func (m *NoMiscFees) SetMiscFeeType(v string) { m.MiscFeeType = &v }
Expand Down
12 changes: 12 additions & 0 deletions fix42/bidrequest/BidRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ type NoBidDescriptors struct {
ValueOfFutures *float64 `fix:"408"`
}

//NewNoBidDescriptors returns an initialized NoBidDescriptors instance
func NewNoBidDescriptors() *NoBidDescriptors {
var m NoBidDescriptors
return &m
}

func (m *NoBidDescriptors) SetBidDescriptorType(v int) { m.BidDescriptorType = &v }
func (m *NoBidDescriptors) SetBidDescriptor(v string) { m.BidDescriptor = &v }
func (m *NoBidDescriptors) SetSideValueInd(v int) { m.SideValueInd = &v }
Expand Down Expand Up @@ -64,6 +70,12 @@ type NoBidComponents struct {
Account *string `fix:"1"`
}

//NewNoBidComponents returns an initialized NoBidComponents instance
func NewNoBidComponents() *NoBidComponents {
var m NoBidComponents
return &m
}

func (m *NoBidComponents) SetListID(v string) { m.ListID = &v }
func (m *NoBidComponents) SetSide(v string) { m.Side = &v }
func (m *NoBidComponents) SetTradingSessionID(v string) { m.TradingSessionID = &v }
Expand Down
8 changes: 8 additions & 0 deletions fix42/bidresponse/BidResponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ type NoBidComponents struct {
EncodedText *string `fix:"355"`
}

//NewNoBidComponents returns an initialized NoBidComponents instance
func NewNoBidComponents(commission float64, commtype string) *NoBidComponents {
var m NoBidComponents
m.SetCommission(commission)
m.SetCommType(commtype)
return &m
}

func (m *NoBidComponents) SetCommission(v float64) { m.Commission = v }
func (m *NoBidComponents) SetCommType(v string) { m.CommType = v }
func (m *NoBidComponents) SetListID(v string) { m.ListID = &v }
Expand Down
Loading