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
- Variables
- func FormatAvg(notional, qty int64) string
- func FormatPrice(t int64) string
- func Get(m *quickfix.Message, tag quickfix.Tag) string
- func MsgType(m *quickfix.Message) string
- func New(msgType string) *quickfix.Message
- func ParsePrice(s string) (int64, error)
- func Set(m *quickfix.Message, tag quickfix.Tag, v string)
Constants ¶
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.
const ( MsgNewOrderSingle = "D" MsgOrderCancelRequest = "F" MsgExecutionReport = "8" MsgOrderCancelReject = "9" )
Message types.
const ( ExecNew = "0" ExecCanceled = "4" ExecRejected = "8" ExecTrade = "F" StatusNew = "0" StatusPartial = "1" StatusFilled = "2" StatusCanceled = "4" StatusRejected = "8" )
ExecType / OrdStatus values used here.
const BeginString = "FIX.4.4"
BeginString is the protocol version on every message.
const OrdTypeLimit = "2"
OrdTypeLimit is the only order type the exchange takes.
const TicksPerUnit = 100
TicksPerUnit is the price grid: hundredths.
Variables ¶
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 ¶
FormatAvg writes notional/qty (notional in ticks times quantity) to four decimals, truncated, which is enough to show an average across fills.
func ParsePrice ¶
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.
Types ¶
This section is empty.