当前位置: 首页>>代码示例>>Golang>>正文


Golang field.NewLastPx函数代码示例

本文整理汇总了Golang中github.com/quickfixgo/quickfix/field.NewLastPx函数的典型用法代码示例。如果您正苦于以下问题:Golang NewLastPx函数的具体用法?Golang NewLastPx怎么用?Golang NewLastPx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewLastPx函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OnFIX41NewOrderSingle

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
}
开发者ID:cbusbey,项目名称:examples,代码行数:49,代码来源:executor.go

示例3: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m NoExecs) SetLastPx(value decimal.Decimal, scale int32) {
	m.Set(field.NewLastPx(value, scale))
}
开发者ID:quickfixgo,项目名称:quickfix,代码行数:4,代码来源:Allocation.generated.go

示例4: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m DontKnowTrade) SetLastPx(value decimal.Decimal, scale int32) {
	m.Set(field.NewLastPx(value, scale))
}
开发者ID:quickfixgo,项目名称:quickfix,代码行数:4,代码来源:DontKnowTrade.generated.go

示例5: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m DontKnowTrade) SetLastPx(v float64) {
	m.Set(field.NewLastPx(v))
}
开发者ID:cbusbey,项目名称:quickfix,代码行数:4,代码来源:DontKnowTrade.generated.go

示例6: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m SecurityStatus) SetLastPx(v float64) {
	m.Set(field.NewLastPx(v))
}
开发者ID:cbusbey,项目名称:quickfix,代码行数:4,代码来源:SecurityStatus.generated.go

示例7: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m ExecutionReport) SetLastPx(value decimal.Decimal, scale int32) {
	m.Set(field.NewLastPx(value, scale))
}
开发者ID:quickfixgo,项目名称:examples,代码行数:4,代码来源:ExecutionReport.generated.go

示例8: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m SecurityStatus) SetLastPx(value decimal.Decimal, scale int32) {
	m.Set(field.NewLastPx(value, scale))
}
开发者ID:quickfixgo,项目名称:quickfix,代码行数:4,代码来源:SecurityStatus.generated.go

示例9: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m NoExecs) SetLastPx(v float64) {
	m.Set(field.NewLastPx(v))
}
开发者ID:cbusbey,项目名称:quickfix,代码行数:4,代码来源:Allocation.generated.go

示例10: SetLastPx

//SetLastPx sets LastPx, Tag 31
func (m ExecutionReport) SetLastPx(v float64) {
	m.Set(field.NewLastPx(v))
}
开发者ID:cbusbey,项目名称:quickfix,代码行数:4,代码来源:ExecutionReport.generated.go


注:本文中的github.com/quickfixgo/quickfix/field.NewLastPx函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。