generator

package
v1.14.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupItem     = "group"
	FieldItem     = "field"
	ComponentItem = "component"
)

Variables

View Source
var DefaultFlowFields = map[string][]string{
	"Logon":              {"HeartBtInt", "EncryptMethod", "Password", "Username", "ResetSeqNumFlag"},
	"Logout":             nil,
	"Heartbeat":          {"TestReqID"},
	"TestRequest":        {"TestReqID"},
	"ResendRequest":      {"BeginSeqNo", "EndSeqNo"},
	"SequenceReset":      {"NewSeqNo", "GapFillFlag"},
	"Reject":             {"SessionRejectReason", "RefSeqNum", "RefTagID"},
	"ExecutionReport":    nil,
	"NewOrderSingle":     nil,
	"MarketDataRequest":  nil,
	"OrderCancelRequest": nil,
}

DefaultFlowFields indicates the required tags for each message type that must be contained in the trailer. A FIX session pipeline will not operate properly if any of these tags are missing for the specified messages.

View Source
var ExcludedFields = map[string]bool{
	"BeginString": true,
	"BodyLength":  true,
	"MsgType":     true,
	"CheckSum":    true,
}

ExcludedFields specifies the tags that will be omitted in generated messages because they are already included into the base message structure.

View Source
var RequiredHeaderFields = map[string]bool{

	"BeginString": true,

	"BodyLength": true,

	"MsgType": true,

	"SenderCompID": true,

	"TargetCompID": true,

	"MsgSeqNum": true,

	"SendingTime": true,
}

RequiredHeaderFields indicates the required fields that must be contained in the header. A FIX message is not considered properly structured unless it contains these fields in its header.

View Source
var RequiredTrailerFields = map[string]bool{

	"CheckSum": true,
}

RequiredTrailerFields indicates the required field(s) that must be contained in the trailer. A FIX message is not considered properly structured unless it contains these fields in its trailer.

Functions

This section is empty.

Types

type Component

type Component struct {
	Name    string `xml:"name,attr"`
	MsgCat  string `xml:"msgcat,attr"`
	MsgType string `xml:"msgtype,attr"`

	Members []*ComponentMember `xml:",any"`
}

Component is a structure identifying the set of basic elements required for FIX messages, such as key-value groups or basic components.

type ComponentMember

type ComponentMember struct {
	XMLName  xml.Name
	Name     string `xml:"name,attr"`
	Required string `xml:"required,attr"`

	Members []*ComponentMember `xml:",any"`
}

type Config

type Config struct {
	Types []*Type `xml:"types>type"`
}

type Doc

type Doc struct {
	Type        string `xml:"type,attr"`
	Major       string `xml:"major,attr"`
	Minor       string `xml:"minor,attr"`
	ServicePack int    `xml:"servicepack,attr"`

	Header     *Component   `xml:"header"`
	Trailer    *Component   `xml:"trailer"`
	Messages   []*Component `xml:"messages>message"`
	Components []*Component `xml:"components>component"`
	Fields     []*Field     `xml:"fields>field"`
}

Doc is a structure identifying the components and fields required for a custom FIX protocol implementation.

type Field

type Field struct {
	Number string   `xml:"number,attr"`
	Name   string   `xml:"name,attr"`
	Type   string   `xml:"type,attr"`
	Values []*Value `xml:"value"`
}

Field is a structure used to implement key-value groups.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator reads a specified file (Doc) to create structures and methods required for constructing FIX messages.

func NewGenerator

func NewGenerator(doc *Doc, config *Config, libPkg string) *Generator

NewGenerator creates a new Generator instance.

func (*Generator) Execute

func (g *Generator) Execute(outputDirPath string) (err error)

Execute creates a separate file for each message.

type Type

type Type struct {
	XMLName xml.Name

	Name     string `xml:"name,attr"`
	CastType string `xml:"cast,attr"`
}

type Value

type Value struct {
	Enum        string `xml:"enum,attr"`
	Description string `xml:"description,attr"`
}

Value is a structure used to support enumeration-like FIX values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL