當前位置: 首頁>>代碼示例>>Golang>>正文


Golang field.NewOrderQty函數代碼示例

本文整理匯總了Golang中github.com/quickfixgo/quickfix/field.NewOrderQty函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewOrderQty函數的具體用法?Golang NewOrderQty怎麽用?Golang NewOrderQty使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewOrderQty函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: OnFIX41NewOrderSingle

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
}
開發者ID:quickfixgo,項目名稱:examples,代碼行數:55,代碼來源:executor.go

示例2: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m NewOrderSingle) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:NewOrderSingle.generated.go

示例3: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m OrderCancelRequest) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:OrderCancelRequest.generated.go

示例4: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m DontKnowTrade) SetOrderQty(value decimal.Decimal, scale int32) {
	m.Set(field.NewOrderQty(value, scale))
}
開發者ID:quickfixgo,項目名稱:quickfix,代碼行數:4,代碼來源:DontKnowTrade.generated.go

示例5: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m DontKnowTrade) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:DontKnowTrade.generated.go

示例6: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m NoOrders) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:ConfirmationRequest.generated.go

示例7: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m NoRelatedSym) SetOrderQty(value decimal.Decimal, scale int32) {
	m.Set(field.NewOrderQty(value, scale))
}
開發者ID:quickfixgo,項目名稱:quickfix,代碼行數:4,代碼來源:QuoteRequest.generated.go

示例8: main

func main() {
	fmt.Println("hello world")

	msg := quickfix.NewMessage()

	group := NewNoOrdersRepeatingGroup()
	order1 := group.Add()
	order1.SetClOrdID(field.ClOrdIDField{FIXString: "1"})

	order2 := group.Add()
	order2.SetClOrdID(field.ClOrdIDField{FIXString: "2"})

	msg.Header.Set(field.NewBeginString(enum.BeginStringFIX42))
	msg.Header.Set(field.NewMsgType(enum.MsgType_NEW_ORDER_CROSS))
	msg.Body.SetGroup(group)

	b, _ := msg.Build()
	fmt.Println(string(b))

	m, err := quickfix.ParseMessage(b)
	if err != nil {
		panic(err)
	}

	g := NewNoOrdersRepeatingGroup()
	m.Body.GetGroup(g)

	fmt.Println(g.Len())

	clordid1, _ := g.Get(0).GetClOrdID()
	clordid2, _ := g.Get(1).GetClOrdID()

	fmt.Println(clordid1)
	fmt.Println(clordid2)

	m, err = quickfix.ParseMessage([]byte("8=FIX.4.29=10835=D34=249=TW52=20160421-14:43:5056=ISLD11=ID21=440=154=138=002000.0055=INTC60=20160421-14:43:5010=004"))
	//	m, err = quickfix.ParseMessage([]byte("8=FIX.4.29=10835=D34=249=TW52=20160421-14:43:5056=ISLD11=ID21=438=002000.0040=154=255=INTC60=20160421-14:43:5010=005"))
	//	m, err = quickfix.ParseMessage([]byte("8=FIX.4.29=11835=D34=249=TW52=20160421-14:43:5056=ISLD11=ID21=438=002000.0040=154=255=INTC58=oh hai60=20160421-14:43:5010=218"))

	if err != nil {
		panic(err)
	}

	nos := newordersingle.FromMessage(m)
	if side, err := nos.GetSide(); err != nil {
		panic(err)
	} else {
		fmt.Printf("Side is %v\n", side)
	}
	nos.SetSide(enum.Side_SELL)
	nos.Set(field.NewText("oh hai"))

	m = nos.ToMessage()
	b, err = m.Build()
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))

	newNos := newordersingle.New(
		field.NewClOrdID("1234"),
		field.NewHandlInst("1"),
		field.NewSymbol("TSLA"),
		field.NewSide(enum.Side_BUY),
		field.NewOrderQty(100.0),
		field.NewOrdType(enum.OrdType_MARKET),
	)

	//newNos.Set(field.NewTransactTime(time.Now()))
	newNos.Set(field.NewTransactTimeNoMillis(time.Now()))

	m = newNos.ToMessage()
	b, err = m.Build()
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:78,代碼來源:main.go

示例9: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m OrderCancelRequest) SetOrderQty(value decimal.Decimal, scale int32) {
	m.Set(field.NewOrderQty(value, scale))
}
開發者ID:quickfixgo,項目名稱:quickfix,代碼行數:4,代碼來源:OrderCancelRequest.generated.go

示例10: queryOrderQty

func queryOrderQty() field.OrderQtyField {
	return field.NewOrderQty(queryDecimal("OrderQty"), 2)
}
開發者ID:quickfixgo,項目名稱:examples,代碼行數:3,代碼來源:console.go

示例11: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m NewOrderList) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:NewOrderList.generated.go

示例12: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m ExecutionReport) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:ExecutionReport.generated.go

示例13: queryOrderQty

func queryOrderQty() field.OrderQtyField {
	return field.NewOrderQty(queryFloat("OrderQty"))
}
開發者ID:cbusbey,項目名稱:examples,代碼行數:3,代碼來源:console.go

示例14: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m NoRelatedSym) SetOrderQty(v float64) {
	m.Set(field.NewOrderQty(v))
}
開發者ID:cbusbey,項目名稱:quickfix,代碼行數:4,代碼來源:QuoteRequest.generated.go

示例15: SetOrderQty

//SetOrderQty sets OrderQty, Tag 38
func (m ExecutionReport) SetOrderQty(value decimal.Decimal, scale int32) {
	m.Set(field.NewOrderQty(value, scale))
}
開發者ID:quickfixgo,項目名稱:examples,代碼行數:4,代碼來源:ExecutionReport.generated.go


注:本文中的github.com/quickfixgo/quickfix/field.NewOrderQty函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。