本文整理汇总了Golang中github.com/quickfixgo/quickfix.NewMessage函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMessage函数的具体用法?Golang NewMessage怎么用?Golang NewMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestUnmarshal_Components
func TestUnmarshal_Components(t *testing.T) {
type Component1 struct {
StringField string `fix:"8"`
}
type Component2 struct {
IntField int `fix:"1"`
}
type Message struct {
FIXMsgType string `fix:"0"`
Component1
StringField string `fix:"112"`
*Component2
}
fixMsg := quickfix.NewMessage()
fixMsg.Body.SetField(quickfix.Tag(8), quickfix.FIXString("hello"))
fixMsg.Body.SetField(quickfix.Tag(112), quickfix.FIXString("world"))
var msgOut Message
quickfix.Unmarshal(fixMsg, &msgOut)
if msgOut.Component1.StringField != "hello" {
t.Errorf("Expected '%v' got '%v'", "hello", msgOut.Component1.StringField)
}
if msgOut.StringField != "world" {
t.Errorf("Expected '%v' got '%v'", "world", msgOut.StringField)
}
}
开发者ID:dbudworth,项目名称:quickfix,代码行数:30,代码来源:unmarshal_test.go
示例2: New
//New returns an initialized Message with specified required fields for SecurityStatus.
func New() Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIXT11))
builder.Header.Set(field.NewDefaultApplVerID(enum.ApplVerID_FIX50SP1))
builder.Header.Set(field.NewMsgType("f"))
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:8,代码来源:SecurityStatus.go
示例3: New
//New returns an initialized Message with specified required fields for AssignmentReport.
func New(
asgnrptid *field.AsgnRptIDField,
accounttype *field.AccountTypeField,
settlprice *field.SettlPriceField,
settlpricetype *field.SettlPriceTypeField,
underlyingsettlprice *field.UnderlyingSettlPriceField,
assignmentmethod *field.AssignmentMethodField,
openinterest *field.OpenInterestField,
exercisemethod *field.ExerciseMethodField,
settlsessid *field.SettlSessIDField,
settlsesssubid *field.SettlSessSubIDField,
clearingbusinessdate *field.ClearingBusinessDateField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX44))
builder.Header.Set(field.NewMsgType("AW"))
builder.Body.Set(asgnrptid)
builder.Body.Set(accounttype)
builder.Body.Set(settlprice)
builder.Body.Set(settlpricetype)
builder.Body.Set(underlyingsettlprice)
builder.Body.Set(assignmentmethod)
builder.Body.Set(openinterest)
builder.Body.Set(exercisemethod)
builder.Body.Set(settlsessid)
builder.Body.Set(settlsesssubid)
builder.Body.Set(clearingbusinessdate)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:29,代码来源:AssignmentReport.go
示例4: TestUnmarshal_HeaderTrailer
func TestUnmarshal_HeaderTrailer(t *testing.T) {
type Header struct {
StringField string `fix:"49"`
}
type Trailer struct {
IntField int `fix:"89"`
}
type Message struct {
FIXMsgType string `fix:"0"`
StringField string `fix:"112"`
Header
Trailer
}
fixMsg := quickfix.NewMessage()
fixMsg.Header.SetField(quickfix.Tag(35), quickfix.FIXString("0"))
fixMsg.Header.SetField(quickfix.Tag(49), quickfix.FIXString("hello"))
fixMsg.Body.SetField(quickfix.Tag(112), quickfix.FIXString("world"))
fixMsg.Trailer.SetField(quickfix.Tag(89), quickfix.FIXInt(3))
var msgOut Message
quickfix.Unmarshal(fixMsg, &msgOut)
if msgOut.Header.StringField != "hello" {
t.Errorf("Expected '%v' got '%v'", "hello", msgOut.Header.StringField)
}
if msgOut.Trailer.IntField != 3 {
t.Errorf("Expected '%v' got '%v'", 3, msgOut.Trailer.IntField)
}
}
开发者ID:dbudworth,项目名称:quickfix,代码行数:32,代码来源:unmarshal_test.go
示例5: New
//New returns an initialized Message with specified required fields for ExecutionReport.
func New(
orderid *field.OrderIDField,
execid *field.ExecIDField,
exectranstype *field.ExecTransTypeField,
exectype *field.ExecTypeField,
ordstatus *field.OrdStatusField,
symbol *field.SymbolField,
side *field.SideField,
leavesqty *field.LeavesQtyField,
cumqty *field.CumQtyField,
avgpx *field.AvgPxField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX42))
builder.Header.Set(field.NewMsgType("8"))
builder.Body.Set(orderid)
builder.Body.Set(execid)
builder.Body.Set(exectranstype)
builder.Body.Set(exectype)
builder.Body.Set(ordstatus)
builder.Body.Set(symbol)
builder.Body.Set(side)
builder.Body.Set(leavesqty)
builder.Body.Set(cumqty)
builder.Body.Set(avgpx)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:27,代码来源:ExecutionReport.go
示例6: TestUnmarshal_RepeatingGroups
func TestUnmarshal_RepeatingGroups(t *testing.T) {
type Group1 struct {
StringField1 string `fix:"8"`
StringField2 *string `fix:"9"`
}
type Group2 struct {
IntField1 int `fix:"1"`
IntField2 int `fix:"2"`
}
type Message struct {
FIXMsgType string `fix:"0"`
GroupField1 []Group1 `fix:"100"`
StringField string `fix:"112"`
GroupField2 []Group2 `fix:"101"`
}
fixMsg := quickfix.NewMessage()
fixMsg.Body.SetField(quickfix.Tag(112), quickfix.FIXString("world"))
group1Template := quickfix.GroupTemplate{
quickfix.GroupElement(quickfix.Tag(8)),
quickfix.GroupElement(quickfix.Tag(9)),
}
group1 := quickfix.RepeatingGroup{Tag: quickfix.Tag(100), GroupTemplate: group1Template}
group1.Add().SetField(quickfix.Tag(8), quickfix.FIXString("hello")).SetField(quickfix.Tag(9), quickfix.FIXString("world"))
group1.Add().SetField(quickfix.Tag(8), quickfix.FIXString("goodbye"))
group1.Add().SetField(quickfix.Tag(8), quickfix.FIXString("OHHAI")).SetField(quickfix.Tag(9), quickfix.FIXString("world"))
fixMsg.Body.SetGroup(group1)
var msgOut Message
quickfix.Unmarshal(fixMsg, &msgOut)
if msgOut.StringField != "world" {
t.Errorf("Expected '%v' got '%v'", "world", msgOut.StringField)
}
if len(msgOut.GroupField1) != 3 {
t.Errorf("Expected group size '%v' got '%v'", 3, len(msgOut.GroupField1))
}
if msgOut.GroupField1[0].StringField1 != "hello" {
t.Errorf("Expected %v got %v", "hello", msgOut.GroupField1[0].StringField1)
}
if *(msgOut.GroupField1[0].StringField2) != "world" {
t.Errorf("Expected %v got %v", "world", *(msgOut.GroupField1[0].StringField2))
}
if msgOut.GroupField1[1].StringField1 != "goodbye" {
t.Errorf("Expected %v got %v", "goodbye", msgOut.GroupField1[1].StringField1)
}
if msgOut.GroupField1[1].StringField2 != nil {
t.Errorf("Expected stringfield 2 to be nil, got %v", *(msgOut.GroupField1[1].StringField2))
}
}
开发者ID:dbudworth,项目名称:quickfix,代码行数:59,代码来源:unmarshal_test.go
示例7: New
//New returns an initialized Message with specified required fields for SecurityTypeRequest.
func New(
securityreqid *field.SecurityReqIDField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX44))
builder.Header.Set(field.NewMsgType("v"))
builder.Body.Set(securityreqid)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:SecurityTypeRequest.go
示例8: New
//New returns an initialized Message with specified required fields for MarketDataRequestReject.
func New(
mdreqid *field.MDReqIDField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX43))
builder.Header.Set(field.NewMsgType("Y"))
builder.Body.Set(mdreqid)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:MarketDataRequestReject.go
示例9: New
//New returns an initialized Message with specified required fields for BidResponse.
func New(
nobidcomponents *field.NoBidComponentsField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX42))
builder.Header.Set(field.NewMsgType("l"))
builder.Body.Set(nobidcomponents)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:BidResponse.go
示例10: New
//New returns an initialized Message with specified required fields for SecurityStatus.
func New(
symbol *field.SymbolField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX42))
builder.Header.Set(field.NewMsgType("f"))
builder.Body.Set(symbol)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:SecurityStatus.go
示例11: New
//New returns an initialized Message with specified required fields for SequenceReset.
func New(
newseqno *field.NewSeqNoField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX43))
builder.Header.Set(field.NewMsgType("4"))
builder.Body.Set(newseqno)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:SequenceReset.go
示例12: New
//New returns an initialized Message with specified required fields for MarketDataSnapshotFullRefresh.
func New(
nomdentries *field.NoMDEntriesField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX43))
builder.Header.Set(field.NewMsgType("W"))
builder.Body.Set(nomdentries)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:MarketDataSnapshotFullRefresh.go
示例13: New
//New returns an initialized Message with specified required fields for ListStatusRequest.
func New(
listid *field.ListIDField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX40))
builder.Header.Set(field.NewMsgType("M"))
builder.Body.Set(listid)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:ListStatusRequest.go
示例14: New
//New returns an initialized Message with specified required fields for QuoteAcknowledgement.
func New(
quoteackstatus *field.QuoteAckStatusField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX42))
builder.Header.Set(field.NewMsgType("b"))
builder.Body.Set(quoteackstatus)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:QuoteAcknowledgement.go
示例15: New
//New returns an initialized Message with specified required fields for Reject.
func New(
refseqnum *field.RefSeqNumField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX40))
builder.Header.Set(field.NewMsgType("3"))
builder.Body.Set(refseqnum)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:Reject.go
示例16: New
//New returns an initialized Message with specified required fields for TestRequest.
func New(
testreqid *field.TestReqIDField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX42))
builder.Header.Set(field.NewMsgType("1"))
builder.Body.Set(testreqid)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:TestRequest.go
示例17: New
//New returns an initialized Message with specified required fields for Quote.
func New(
quoteid *field.QuoteIDField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIX44))
builder.Header.Set(field.NewMsgType("S"))
builder.Body.Set(quoteid)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:9,代码来源:Quote.go
示例18: New
//New returns an initialized Message with specified required fields for QuoteCancel.
func New(
quotecanceltype *field.QuoteCancelTypeField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIXT11))
builder.Header.Set(field.NewDefaultApplVerID(enum.ApplVerID_FIX50SP2))
builder.Header.Set(field.NewMsgType("Z"))
builder.Body.Set(quotecanceltype)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:10,代码来源:QuoteCancel.go
示例19: New
//New returns an initialized Message with specified required fields for StreamAssignmentReport.
func New(
streamasgnrptid *field.StreamAsgnRptIDField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIXT11))
builder.Header.Set(field.NewDefaultApplVerID(enum.ApplVerID_FIX50SP2))
builder.Header.Set(field.NewMsgType("CD"))
builder.Body.Set(streamasgnrptid)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:10,代码来源:StreamAssignmentReport.go
示例20: New
//New returns an initialized Message with specified required fields for MassQuoteAcknowledgement.
func New(
quotestatus *field.QuoteStatusField) Message {
builder := Message{Message: quickfix.NewMessage()}
builder.Header.Set(field.NewBeginString(enum.BeginStringFIXT11))
builder.Header.Set(field.NewDefaultApplVerID(enum.ApplVerID_FIX50))
builder.Header.Set(field.NewMsgType("b"))
builder.Body.Set(quotestatus)
return builder
}
开发者ID:jfyuen,项目名称:quickfix,代码行数:10,代码来源:MassQuoteAcknowledgement.go
注:本文中的github.com/quickfixgo/quickfix.NewMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论