Exemple #1
0
func (a *Application) updateOrder(order internal.Order, status enum.OrdStatus) {
	execReport := executionreport.New(
		field.NewOrderID(order.ClOrdID),
		field.NewExecID(a.genExecID()),
		field.NewExecTransType(enum.ExecTransType_NEW),
		field.NewExecType(enum.ExecType(status)),
		field.NewOrdStatus(status),
		field.NewSymbol(order.Symbol),
		field.NewSide(order.Side),
		field.NewLeavesQty(order.OpenQuantity(), 2),
		field.NewCumQty(order.ExecutedQuantity, 2),
		field.NewAvgPx(order.AvgPx, 2),
	)
	execReport.SetOrderQty(order.Quantity, 2)
	execReport.SetClOrdID(order.ClOrdID)

	switch status {
	case enum.OrdStatus_FILLED, enum.OrdStatus_PARTIALLY_FILLED:
		execReport.SetLastShares(order.LastExecutedQuantity, 2)
		execReport.SetLastPx(order.LastExecutedPrice, 2)
	}

	execReport.Header.SetTargetCompID(order.SenderCompID)
	execReport.Header.SetSenderCompID(order.TargetCompID)

	quickfix.Send(execReport)
}
Exemple #2
0
func (e *executor) OnFIX41NewOrderSingle(msg fix41nos.NewOrderSingle, sessionID quickfix.SessionID) (err quickfix.MessageRejectError) {
	ordType, err := msg.GetOrdType()
	if err != nil {
		return
	}
	if ordType != enum.OrdType_LIMIT {
		return quickfix.ValueIsIncorrect(tag.OrdType)
	}

	symbol, err := msg.GetSymbol()
	if err != nil {
		return
	}

	side, err := msg.GetSide()
	if err != nil {
		return
	}

	orderQty, err := msg.GetOrderQty()
	if err != nil {
		return
	}

	price, err := msg.GetPrice()
	if err != nil {
		return
	}

	execReport := fix41er.New(
		e.genOrderID(),
		e.genExecID(),
		field.NewExecTransType(enum.ExecTransType_NEW),
		field.NewExecType(enum.ExecType_FILL),
		field.NewOrdStatus(enum.OrdStatus_FILLED),
		field.NewSymbol(symbol),
		field.NewSide(side),
		field.NewOrderQty(orderQty, 2),
		field.NewLastShares(orderQty, 2),
		field.NewLastPx(price, 2),
		field.NewLeavesQty(decimal.Zero, 2),
		field.NewCumQty(orderQty, 2),
		field.NewAvgPx(price, 2),
	)

	clOrdID, err := msg.GetClOrdID()
	if err != nil {
		return
	}
	execReport.SetClOrdID(clOrdID)

	quickfix.SendToTarget(execReport, sessionID)

	return
}
Exemple #3
0
func (a *Application) updateOrder(order Order, status string) {
	execReport := executionreport.New(
		field.NewOrderID(order.ClOrdID),
		field.NewExecID(a.genExecID()),
		field.NewExecTransType(enum.ExecTransType_NEW),
		field.NewExecType(status),
		field.NewOrdStatus(status),
		field.NewSymbol(order.Symbol),
		field.NewSide(order.Side),
		field.NewLeavesQty(order.OpenQuantity()),
		field.NewCumQty(order.ExecutedQuantity),
		field.NewAvgPx(order.AvgPx),
	)

	execReport.SetOrderQty(order.Quantity)
	execReport.SetClOrdID(order.ClOrdID)
	execReport.Header.SetTargetCompID(order.SenderCompID)
	execReport.Header.SetSenderCompID(order.TargetCompID)

	quickfix.Send(execReport)
}
Exemple #4
0
func querySide() field.SideField {
	choices := []string{
		"Buy",
		"Sell",
		"Sell Short",
		"Sell Short Exempt",
		"Cross",
		"Cross Short",
		"Cross Short Exempt",
	}

	values := []string{
		string(enum.Side_BUY),
		string(enum.Side_SELL),
		string(enum.Side_SELL_SHORT),
		string(enum.Side_SELL_SHORT_EXEMPT),
		string(enum.Side_CROSS),
		string(enum.Side_CROSS_SHORT),
		"A",
	}

	return field.NewSide(enum.Side(queryFieldChoices("Side", choices, values)))
}
//SetSide sets Side, Tag 54
func (m NoRelatedSym) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m OrderMassCancelRequest) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NoBidComponents) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m DontKnowTrade) SetSide(v string) {
	m.Set(field.NewSide(v))
}
Exemple #9
0
//SetSide sets Side, Tag 54
func (m IOI) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NoRelatedSym) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m IndicationofInterest) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m OrderCancelRequest) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NoStrikes) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m Allocation) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NewOrderList) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m QuoteStatusRequest) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m OrderStatusRequest) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m ExecutionReport) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m OrderCancelReplaceRequest) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m SettlementInstructions) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NoBidComponents) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NoSides) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m DontKnowTrade) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m OrderStatusRequest) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m Allocation) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m TradeCaptureReportRequest) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NewOrderSingle) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m SettlementInstructionRequest) SetSide(v string) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m NewOrderSingle) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}
//SetSide sets Side, Tag 54
func (m IndicationofInterest) SetSide(v enum.Side) {
	m.Set(field.NewSide(v))
}