//GetOrdType gets OrdType, Tag 40
func (m ExecutionReport) GetOrdType() (v enum.OrdType, err quickfix.MessageRejectError) {
	var f field.OrdTypeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}
//GetOrdType gets OrdType, Tag 40
func (m NewOrderSingle) GetOrdType() (v enum.OrdType, err quickfix.MessageRejectError) {
	var f field.OrdTypeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}
//GetOrdType gets OrdType, Tag 40
func (m OrderCancelReplaceRequest) GetOrdType() (v enum.OrdType, err quickfix.MessageRejectError) {
	var f field.OrdTypeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}
//GetOrdType gets OrdType, Tag 40
func (m NoQuoteEntries) GetOrdType() (v enum.OrdType, err quickfix.MessageRejectError) {
	var f field.OrdTypeField
	if err = m.Get(&f); err == nil {
		v = f.Value()
	}
	return
}
Example #5
0
func (e *executor) OnFIX41NewOrderSingle(msg fix41nos.NewOrderSingle, sessionID quickfix.SessionID) (err quickfix.MessageRejectError) {
	var ordType field.OrdTypeField
	if ordType, err = msg.GetOrdType(); err != nil {
		return err
	}
	if ordType.String() != enum.OrdType_LIMIT {
		return quickfix.ValueIsIncorrect(tag.OrdType)
	}

	var symbol field.SymbolField
	if symbol, err = msg.GetSymbol(); err != nil {
		return
	}

	var side field.SideField
	if side, err = msg.GetSide(); err != nil {
		return
	}

	var orderQty field.OrderQtyField
	if orderQty, err = msg.GetOrderQty(); err != nil {
		return
	}

	var price field.PriceField
	if price, err = msg.GetPrice(); 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),
		symbol,
		side,
		orderQty,
		field.NewLastShares(orderQty.Float64()),
		field.NewLastPx(price.Float64()),
		field.NewLeavesQty(0),
		field.NewCumQty(orderQty.Float64()),
		field.NewAvgPx(price.Float64()),
	)

	quickfix.SendToTarget(execReport, sessionID)

	return
}
Example #6
0
func queryNewOrderSingle40() fix40nos.NewOrderSingle {
	var ordType field.OrdTypeField
	order := fix40nos.New(queryClOrdID(), field.NewHandlInst("1"), querySymbol(), querySide(), queryOrderQty(), queryOrdType(&ordType))

	switch ordType.Value() {
	case enum.OrdType_LIMIT, enum.OrdType_STOP_LIMIT:
		order.Set(queryPrice())
	}

	switch ordType.Value() {
	case enum.OrdType_STOP, enum.OrdType_STOP_LIMIT:
		order.Set(queryStopPx())
	}

	order.Set(queryTimeInForce())
	queryHeader(order.Header.Header)

	return order
}
Example #7
0
func queryNewOrderSingle42() (msg quickfix.Message) {
	var ordType field.OrdTypeField
	order := fix42nos.New(queryClOrdID(), field.NewHandlInst("1"), querySymbol(), querySide(), field.NewTransactTime(time.Now()), queryOrdType(&ordType))
	order.Set(queryOrderQty())

	switch ordType.Value() {
	case enum.OrdType_LIMIT, enum.OrdType_STOP_LIMIT:
		order.Set(queryPrice())
	}

	switch ordType.Value() {
	case enum.OrdType_STOP, enum.OrdType_STOP_LIMIT:
		order.Set(queryStopPx())
	}

	order.Set(queryTimeInForce())
	msg = order.ToMessage()
	queryHeader(msg.Header)
	return
}
Example #8
0
func queryOrdType(f *field.OrdTypeField) field.OrdTypeField {
	choices := []string{
		"Market",
		"Limit",
		"Stop",
		"Stop Limit",
	}

	values := []string{
		string(enum.OrdType_MARKET),
		string(enum.OrdType_LIMIT),
		string(enum.OrdType_STOP),
		string(enum.OrdType_STOP_LIMIT),
	}

	f.FIXString = quickfix.FIXString(queryFieldChoices("OrdType", choices, values))
	return *f
}
Example #9
0
func (e *executor) OnFIX50NewOrderSingle(msg fix50nos.NewOrderSingle, sessionID quickfix.SessionID) (err quickfix.MessageRejectError) {
	var ordType field.OrdTypeField
	if ordType, err = msg.GetOrdType(); err != nil {
		return err
	}

	if ordType.String() != enum.OrdType_LIMIT {
		return quickfix.ValueIsIncorrect(tag.OrdType)
	}

	var symbol field.SymbolField
	if symbol, err = msg.GetSymbol(); err != nil {
		return
	}

	var side field.SideField
	if side, err = msg.GetSide(); err != nil {
		return
	}

	var orderQty field.OrderQtyField
	if orderQty, err = msg.GetOrderQty(); err != nil {
		return
	}

	var price field.PriceField
	if price, err = msg.GetPrice(); err != nil {
		return
	}

	var clOrdID field.ClOrdIDField
	if clOrdID, err = msg.GetClOrdID(); err != nil {
		return
	}

	execReport := fix50er.New(
		e.genOrderID(),
		e.genExecID(),
		field.NewExecType(enum.ExecType_FILL),
		field.NewOrdStatus(enum.OrdStatus_FILLED),
		side,
		field.NewLeavesQty(0),
		field.NewCumQty(orderQty.Float64()),
	)

	execReport.Set(clOrdID)
	execReport.Set(symbol)
	execReport.Set(orderQty)
	execReport.SetLastQty(orderQty.Float64())
	execReport.SetLastPx(price.Float64())
	execReport.SetAvgPx(price.Float64())

	if msg.HasAccount() {
		var acct field.AccountField
		if acct, err = msg.GetAccount(); err != nil {
			return err
		}
		execReport.Set(acct)
	}

	quickfix.SendToTarget(execReport, sessionID)

	return
}