datadictionary

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2016 License: Apache-1.1 Imports: 3 Imported by: 0

Documentation

Overview

Package datadictionary provides support for parsing and organizing FIX Data Dictionaries

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	*ComponentType
	// contains filtered or unexported fields
}

Component is a Component as it appears in a given MessageDef

func (Component) Required added in v0.2.0

func (c Component) Required() bool

Required returns true if this component is required for the containing MessageDef

type ComponentType added in v0.2.0

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

ComponentType is a grouping of fields.

func NewComponentType added in v0.2.0

func NewComponentType(name string, parts []MessagePart) *ComponentType

NewComponentType returns an initialized component type

func (ComponentType) Fields added in v0.2.0

func (c ComponentType) Fields() []*FieldDef

Fields returns all fields contained in this component. Includes fields encapsulated in components of this component

func (ComponentType) Name added in v0.2.0

func (c ComponentType) Name() string

Name returns the name of this component type

func (ComponentType) Parts added in v0.2.0

func (c ComponentType) Parts() []MessagePart

Parts returns all parts in declaration order contained in this component

func (ComponentType) RequiredFields added in v0.2.0

func (c ComponentType) RequiredFields() []*FieldDef

RequiredFields returns those fields that are required for this component

func (ComponentType) RequiredParts added in v0.2.0

func (c ComponentType) RequiredParts() []MessagePart

RequiredParts returns those parts that are required for this component

type DataDictionary

type DataDictionary struct {
	FIXType         string
	Major           int
	Minor           int
	ServicePack     int
	FieldTypeByTag  map[int]*FieldType
	FieldTypeByName map[string]*FieldType
	Messages        map[string]*MessageDef
	ComponentTypes  map[string]*ComponentType
	Header          *MessageDef
	Trailer         *MessageDef
}

DataDictionary models FIX messages, components, and fields.

func Parse

func Parse(path string) (*DataDictionary, error)

Parse loads and and build a datadictionary instance from an xml file.

type Enum

type Enum struct {
	Value       string
	Description string
}

Enum is a container for value and description.

type FieldDef

type FieldDef struct {
	*FieldType

	Parts       []MessagePart
	ChildFields []*FieldDef
	// contains filtered or unexported fields
}

FieldDef models a field or component belonging to a message.

func NewFieldDef added in v0.2.0

func NewFieldDef(fieldType *FieldType, required bool) *FieldDef

NewFieldDef returns an initialized FieldDef

func NewGroupFieldDef added in v0.2.0

func NewGroupFieldDef(fieldType *FieldType, required bool, parts []MessagePart) *FieldDef

NewGroupFieldDef returns an initialized FieldDef for a repeating group

func (FieldDef) IsGroup

func (f FieldDef) IsGroup() bool

IsGroup is true if the field is a repeating group.

func (FieldDef) Required

func (f FieldDef) Required() bool

Required returns true if this FieldDef is required for the containing MessageDef

func (FieldDef) RequiredFields added in v0.2.0

func (f FieldDef) RequiredFields() []*FieldDef

RequiredFields returns those fields that are required for this FieldDef. IsGroup must return true

func (FieldDef) RequiredParts added in v0.2.0

func (f FieldDef) RequiredParts() []MessagePart

RequiredParts returns those parts that are required for this FieldDef. IsGroup must return true

type FieldType

type FieldType struct {
	Tag   int
	Type  string
	Enums map[string]Enum
	// contains filtered or unexported fields
}

FieldType holds information relating to a field. Includes Tag, type, and enums, if defined.

func NewFieldType added in v0.2.0

func NewFieldType(name string, tag int, fixType string) *FieldType

NewFieldType returns a pointer to an initialized FieldType

func (FieldType) Name

func (f FieldType) Name() string

Name returns the name for this FieldType

type MessageDef

type MessageDef struct {
	Name    string
	MsgType string
	Fields  map[int]*FieldDef
	//Parts are the MessageParts of contained in this MessageDef in declaration
	//order
	Parts []MessagePart

	RequiredTags TagSet
	Tags         TagSet
	// contains filtered or unexported fields
}

MessageDef can apply to header, trailer, or body of a FIX Message.

func NewMessageDef added in v0.2.0

func NewMessageDef(name, msgType string, parts []MessagePart) *MessageDef

NewMessageDef returns a pointer to an initialized MessageDef

func (MessageDef) RequiredParts added in v0.2.0

func (m MessageDef) RequiredParts() []MessagePart

RequiredParts returns those parts that are required for this Message

type MessagePart added in v0.2.0

type MessagePart interface {
	Name() string
	Required() bool
}

MessagePart can represent a Field, Repeating Group, or Component

type TagSet

type TagSet map[int]struct{}

TagSet is set for tags.

func (TagSet) Add

func (t TagSet) Add(tag int)

Add adds a tag to the tagset.

type XMLComponent

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

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

XMLComponent can represent header, trailer, messages/message, or components/component xml elements.

type XMLComponentMember

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

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

XMLComponentMember represents child elements of header, trailer, messages/message, and components/component elements

type XMLDoc

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

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

XMLDoc is the unmarshalled root of a FIX Dictionary.

type XMLField

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

XMLField represents the fields/field xml element.

type XMLValue

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

XMLValue represents the fields/field/value xml element.

Jump to

Keyboard shortcuts

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