fix

package
v1.14.5 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CountOfSOHSymbols
	// Deprecated: should not be used, count SOH symbols by yourself
	CountOfSOHSymbols = 3
	// CountOfSOHSymbolsWithoutBody
	// Deprecated: should not be used, count SOH symbols by yourself
	CountOfSOHSymbolsWithoutBody = 2
)
View Source
const (
	True  = "Y"
	False = "N"
)
View Source
const TimeLayout = "20060102-15:04:05.000"

Variables

View Source
var Delimiter = []byte{1}

Functions

func CalcCheckSum

func CalcCheckSum(body []byte) []byte

func ValueByTag

func ValueByTag(msg []byte, tag string) ([]byte, error)

ValueByTag locates a value by its tag in a FIX message stored as a byte array.

Types

type Bool

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

Bool is a structure used for converting Boolean values.

func (*Bool) FromBytes

func (v *Bool) FromBytes(d []byte) error

func (*Bool) IsNull

func (v *Bool) IsNull() bool

func (*Bool) Set

func (v *Bool) Set(d interface{}) error

Set parses and assigns the field value stored in the Boolean format.

func (*Bool) String

func (v *Bool) String() string

func (*Bool) ToBytes

func (v *Bool) ToBytes() []byte

func (*Bool) Value

func (v *Bool) Value() interface{}

type Component

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

Component is an array of various FIX entities. It may contain a KeyValue, a Group and another Component.

func NewComponent

func NewComponent(items ...Item) *Component

NewComponent is used to create a new Component instance.

func (*Component) AsComponent

func (c *Component) AsComponent() *Component

AsComponent returns a specified component. This is required for structures that integrate this component.

func (*Component) AsTemplate

func (c *Component) AsTemplate() Items

AsTemplate returns a new structure with the same set of items as in a specified component (these items are assigned empty values).

func (*Component) Get

func (c *Component) Get(id int) Item

Get returns a specific component item identified by its sequence number. Such item may be a *KeyValue, *Component or *Group.

func (*Component) Items

func (c *Component) Items() Items

Items returns Component items.

func (*Component) Set

func (c *Component) Set(id int, v Item)

Set replaces a component item identified by its sequence number.

func (*Component) SetComponent

func (c *Component) SetComponent(id int, v *Component)

SetComponent is used to define an internal component for an item.

func (*Component) SetField

func (c *Component) SetField(id int, v Item)

SetField is used to define an internal field for any item.

func (*Component) SetGroup

func (c *Component) SetGroup(id int, v *Group)

SetGroup is used to define an internal group for an item.

func (*Component) String

func (c *Component) String() string

String returns a string representation of a component.

func (*Component) ToBytes

func (c *Component) ToBytes() []byte

ToBytes returns a representation of a message which is native to FIX.

type Float

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

Float is a structure used for converting values to the float64 type.

func NewFloat

func NewFloat(value float64) *Float

func (*Float) FromBytes

func (v *Float) FromBytes(d []byte) (err error)

func (*Float) IsNull

func (v *Float) IsNull() bool

func (*Float) Set

func (v *Float) Set(d interface{}) error

Set parses and assigns the field value stored as a float64 number.

func (*Float) String

func (v *Float) String() string

func (*Float) ToBytes

func (v *Float) ToBytes() []byte

func (*Float) Value

func (v *Float) Value() interface{}

type Group

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

Group is a structure used to implement FIX group types.

func NewGroup

func NewGroup(noTags string, tags ...Item) *Group

NewGroup is used to create a new group based on: - the tag value specifying the number of elements, and - the list of tags

func (*Group) AddEntry

func (g *Group) AddEntry(v Items) *Group

AddEntry adds a new entry with the same list of tags as in a specified group. To generate all tags for a newly created entry, use the AsTemplate method.

func (*Group) AsTemplate

func (g *Group) AsTemplate() Items

AsTemplate returns a list of group tags as an Items object.

func (*Group) Entries

func (g *Group) Entries() []Items

Entries returns all entries belonging to a group as an array of Items objects.

func (*Group) Entry

func (g *Group) Entry(id int) Item

Entry returns a group entry by its sequence number.

func (*Group) NoTag

func (g *Group) NoTag() string

NoTag returns a tag value indicating the number of elements in a group.

func (*Group) String

func (g *Group) String() string

String returns a string representation of a Group.

func (*Group) ToBytes

func (g *Group) ToBytes() []byte

ToBytes returns a byte representation of a Group.

type Int

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

Int is a structure used for converting integer values.

func NewInt

func NewInt(value int) *Int

func (*Int) FromBytes

func (v *Int) FromBytes(d []byte) (err error)

func (*Int) IsNull

func (v *Int) IsNull() bool

func (*Int) Set

func (v *Int) Set(d interface{}) error

Set parses and assigns the field value stored as an integer number.

func (*Int) String

func (v *Int) String() string

func (*Int) ToBytes

func (v *Int) ToBytes() []byte

func (*Int) Value

func (v *Int) Value() interface{}

type Item

type Item interface {
	ToBytes() []byte
	String() string
}

Item is an interface providing a method required to implement basic FIX item functionality.

type Items

type Items []Item

Items is an array of Item elements.

func (Items) String

func (v Items) String() string

String returns a string representation of an Items array.

func (Items) ToBytes

func (v Items) ToBytes() []byte

ToBytes returns a byte representation of an Items array.

type KeyValue

type KeyValue struct {
	Key   string
	Value Value
}

KeyValue is a basic structure used for FIX message implementation. It is used to specify the tag and value for each field.

func NewKeyValue

func NewKeyValue(key string, value Value) *KeyValue

NewKeyValue returns a new KeyValue object.

func (*KeyValue) AsTemplate

func (kv *KeyValue) AsTemplate() *KeyValue

AsTemplate returns a copy of a KeyValue object with an empty value assigned to it.

func (*KeyValue) FromBytes

func (kv *KeyValue) FromBytes(d []byte) error

FromBytes replaces a KeyValue object specified in the form of a byte array.

func (*KeyValue) Load

func (kv *KeyValue) Load() Value

Load returns a specified value.

func (*KeyValue) Set

func (kv *KeyValue) Set(value Value)

Set replaces a specified value.

func (*KeyValue) String

func (kv *KeyValue) String() string

String returns a string representation of a KeyValue object.

func (*KeyValue) ToBytes

func (kv *KeyValue) ToBytes() []byte

ToBytes returns a byte representation of a KeyValue.

type KeyValues

type KeyValues []*KeyValue

KeyValues is an array of KeyValue objects.

func (KeyValues) ToBytes

func (kvs KeyValues) ToBytes() []byte

ToBytes returns a byte representation of a KeyValues array.

type Message

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

Message is a structure providing functionality to FIX messages.

func NewMessage

func NewMessage(beginStringTag, bodyLengthTag, checkSumTag, msgTypeTag, beginString, msgType string) *Message

NewMessage is called to create a new message.

func (*Message) BeginString

func (msg *Message) BeginString() *KeyValue

BeginString returns the beginString field value.

func (*Message) BeginStringTag added in v1.13.0

func (msg *Message) BeginStringTag() string

func (*Message) Body

func (msg *Message) Body() (kvs Items)

Body returns the body of a FIX message as an Items object.

func (*Message) BodyLength

func (msg *Message) BodyLength() int

BodyLength returns the BodyLength field value.

func (*Message) BodyLengthTag added in v1.13.0

func (msg *Message) BodyLengthTag() string

func (*Message) BytesWithoutChecksum

func (msg *Message) BytesWithoutChecksum() []byte

func (*Message) CalcBodyLength

func (msg *Message) CalcBodyLength() int

func (*Message) CheckSum

func (msg *Message) CheckSum() string

CheckSum returns the CheckSum field value.

func (*Message) CheckSumTag added in v1.13.0

func (msg *Message) CheckSumTag() string

func (*Message) Get

func (msg *Message) Get(id int) Item

Get returns an Item corresponding to the message body (identified by the item sequence number).

func (*Message) Header

func (msg *Message) Header() *Component

Header returns the header of a FIX message as a Component object.

func (*Message) Items

func (msg *Message) Items() Items

Items returns all fields as Items slice

func (*Message) MsgType

func (msg *Message) MsgType() string

MsgType returns the MsgType field value.

func (*Message) Prepare

func (msg *Message) Prepare() error

Prepare prepares message by calculating body length and check sum

func (*Message) Set

func (msg *Message) Set(id int, item Item) *Message

Set replaces an Item corresponding to the message body (identified by the item sequence number).

func (*Message) SetBody

func (msg *Message) SetBody(body ...Item) *Message

SetBody specifies the message body.

func (*Message) SetHeader

func (msg *Message) SetHeader(header *Component) *Message

SetHeader specifies the message header.

func (*Message) SetTrailer

func (msg *Message) SetTrailer(trailer *Component) *Message

SetTrailer specifies the message trailer fields (except for checkSum).

func (*Message) String

func (msg *Message) String() string

String returns a string representation of a specified message.

func (*Message) ToBytes

func (msg *Message) ToBytes() ([]byte, error)

Prepared returns a byte representation of a specified message.

func (*Message) Trailer

func (msg *Message) Trailer() *Component

Trailer returns the trailer of a FIX message as a Component object.

type Raw

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

Raw is a structure that is used to convert the message data to a byte array.

func NewRaw

func NewRaw(v []byte) *Raw

NewRaw creates a new instance of a Raw object.

func (*Raw) FromBytes

func (v *Raw) FromBytes(d []byte) (err error)

func (*Raw) IsNull

func (v *Raw) IsNull() bool

func (*Raw) Set

func (v *Raw) Set(d interface{}) error

Set parses and assigns the field value stored as a byte array.

func (*Raw) String

func (v *Raw) String() string

func (*Raw) ToBytes

func (v *Raw) ToBytes() []byte

func (*Raw) Value

func (v *Raw) Value() interface{}

type StorageID added in v1.13.0

type StorageID struct {
	Sender string
	Target string
	Side   StorageSide
}

type StorageSide added in v1.14.0

type StorageSide string
const (
	Incoming StorageSide = "incoming"
	Outgoing StorageSide = "outgoing"
)

type String

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

String is a structure used for converting string values.

func NewString

func NewString(v string) *String

func (*String) FromBytes

func (v *String) FromBytes(d []byte) (err error)

func (*String) IsNull

func (v *String) IsNull() bool

func (*String) Set

func (v *String) Set(d interface{}) error

Set parses and assigns the field value stored as a string.

func (*String) String

func (v *String) String() string

func (*String) ToBytes

func (v *String) ToBytes() []byte

func (*String) Value

func (v *String) Value() interface{}

type Time

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

Time is a structure used for converting date-time values.

func NewTime

func NewTime(value time.Time) *Time

func (*Time) FromBytes

func (v *Time) FromBytes(d []byte) (err error)

func (*Time) IsNull

func (v *Time) IsNull() bool

func (*Time) Set

func (v *Time) Set(d interface{}) error

Set parses and assigns the field value stored in the date-time format.

func (*Time) String

func (v *Time) String() string

func (*Time) ToBytes

func (v *Time) ToBytes() []byte

func (*Time) Value

func (v *Time) Value() interface{}

type Uint

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

Uint is a structure used for converting values to the uint64 type.

func NewUint

func NewUint(value uint64) *Uint

func (*Uint) FromBytes

func (v *Uint) FromBytes(d []byte) (err error)

func (*Uint) IsNull

func (v *Uint) IsNull() bool

func (*Uint) Set

func (v *Uint) Set(d interface{}) error

Set parses and assigns the field value stored as a uint64 number.

func (*Uint) String

func (v *Uint) String() string

func (*Uint) ToBytes

func (v *Uint) ToBytes() []byte

func (*Uint) Value

func (v *Uint) Value() interface{}

type Value

type Value interface {
	// ToBytes returns a byte representation of a field value.
	ToBytes() []byte

	// FromBytes parses values stored in a byte array.
	FromBytes([]byte) error

	// Value returns a field value.
	Value() interface{}

	// String returns a string representation of a value.
	String() string

	// IsNull is used to check whether a field value is empty.
	IsNull() bool

	// Set replaces a specified field value with a value of a corresponding type.
	Set(d interface{}) error
}

Value is an interface implementing all basic methods required to process field values of FIX messages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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