fixmsg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fixmsg holds the FIX 4.4 tags and message types this lab uses, the price format, and small helpers for building and reading messages with QuickFIX/Go. Both the exchange and the client import it, so the two sides cannot disagree about a tag number.

Index

Constants

View Source
const (
	TagAvgPx            quickfix.Tag = 6
	TagClOrdID          quickfix.Tag = 11
	TagCumQty           quickfix.Tag = 14
	TagExecID           quickfix.Tag = 17
	TagLastPx           quickfix.Tag = 31
	TagLastQty          quickfix.Tag = 32
	TagMsgType          quickfix.Tag = 35
	TagOrderID          quickfix.Tag = 37
	TagOrderQty         quickfix.Tag = 38
	TagOrdStatus        quickfix.Tag = 39
	TagOrdType          quickfix.Tag = 40
	TagOrigClOrdID      quickfix.Tag = 41
	TagPrice            quickfix.Tag = 44
	TagSide             quickfix.Tag = 54
	TagSymbol           quickfix.Tag = 55
	TagText             quickfix.Tag = 58
	TagTransactTime     quickfix.Tag = 60
	TagCxlRejReason     quickfix.Tag = 102
	TagOrdRejReason     quickfix.Tag = 103
	TagExecType         quickfix.Tag = 150
	TagLeavesQty        quickfix.Tag = 151
	TagCxlRejResponseTo quickfix.Tag = 434
	TagSecondaryExecID  quickfix.Tag = 527
)

Tags, by their FIX 4.4 names.

View Source
const (
	MsgNewOrderSingle     = "D"
	MsgOrderCancelRequest = "F"
	MsgExecutionReport    = "8"
	MsgOrderCancelReject  = "9"
)

Message types.

View Source
const (
	ExecNew      = "0"
	ExecCanceled = "4"
	ExecRejected = "8"
	ExecTrade    = "F"

	StatusNew      = "0"
	StatusPartial  = "1"
	StatusFilled   = "2"
	StatusCanceled = "4"
	StatusRejected = "8"
)

ExecType / OrdStatus values used here.

View Source
const BeginString = "FIX.4.4"

BeginString is the protocol version on every message.

View Source
const OrdTypeLimit = "2"

OrdTypeLimit is the only order type the exchange takes.

View Source
const TicksPerUnit = 100

TicksPerUnit is the price grid: hundredths.

Variables

View Source
var ErrPrice = errors.New("price must be a positive number with at most two decimals")

ErrPrice is a price that is not a positive number with at most two decimals.

Functions

func FormatAvg

func FormatAvg(notional, qty int64) string

FormatAvg writes notional/qty (notional in ticks times quantity) to four decimals, truncated, which is enough to show an average across fills.

func FormatPrice

func FormatPrice(t int64) string

FormatPrice writes ticks as "101.25".

func Get

func Get(m *quickfix.Message, tag quickfix.Tag) string

Get reads a body field as a string; a missing field is "".

func MsgType

func MsgType(m *quickfix.Message) string

MsgType reads the header's MsgType.

func New

func New(msgType string) *quickfix.Message

New returns an empty message of type msgType.

func ParsePrice

func ParsePrice(s string) (int64, error)

ParsePrice reads "101.25" as 10125 ticks. It accepts no sign, no exponent and no more than two decimals, so a price either sits on the grid or is refused; nothing is rounded.

func Set

func Set(m *quickfix.Message, tag quickfix.Tag, v string)

Set sets a body string field.

Types

This section is empty.

Jump to

Keyboard shortcuts

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