我正在尝试使用QuickFIX引擎发送QuoteRequest(标记35 = R):
QuoteReqID (Tag: 131)
NoRelatedSym (Tag: 146)
Symbol (Tag: 55)
OrderQty (Tag: 38) *This tag MUST be part of the repeating group (broker said)
Account (Tag: 1)
我在这里做了什么但我仍然坚持如何实际设置应该在群组中的帐户字段,因为他们说但不确定如何在这种情况下使用群组:
string qrid = new Random().Next(111111111, 999999999).ToString();
QuickFix.Fields.QuoteReqID QuoteReqID = new QuickFix.Fields.QuoteReqID(qrid);
QuickFix.FIX44.QuoteRequest message = new QuickFix.FIX44.QuoteRequest(QuoteReqID);
message.NoRelatedSym = new QuickFix.Fields.NoRelatedSym(1);
message.SetField(new QuickFix.Fields.Symbol("EURUSD"));
message.SetField(new QuickFix.Fields.OrderQty(1000)); // not sure which amount to set
// QuickFix.Session.SendToTarget(message, application.QuoteSessionID);
答案 0 :(得分:3)
以下是我用来使其发挥作用的代码:
if ( is_logged_on ) { // previously run initiator.start() and listen for initiator.IsLoggedOn to be true
Console.WriteLine("We're logged on!");
Console.WriteLine("Sending QuoteRequest...");
// we're using two sessions: 1 for quotes and another for trades
// QuoteSessionID holds sessionID for quote operations
if ( application != null ) {
// generate a unique request ID
string qrid = new Random().Next(111111111, 999999999).ToString();
QuickFix.Fields.QuoteReqID QuoteReqID = new QuickFix.Fields.QuoteReqID(qrid);
// create QuoteRequest instance
QuickFix.FIX44.QuoteRequest message = new QuickFix.FIX44.QuoteRequest(QuoteReqID);
// Symbol, OrderQty and Account are in a repeating groups
QuickFix.Group group = new QuickFix.Group(QuickFix.Fields.Tags.NoRelatedSym, QuickFix.Fields.Tags.Symbol);
group.SetField(new QuickFix.Fields.Symbol("EURUSD"));
group.SetField(new QuickFix.Fields.OrderQty(500));
group.SetField(new QuickFix.Fields.Account(Account));
// add this group to message
message.AddGroup(group);
// send message to FIX server with QuoteSessionID
QuickFix.Session.SendToTarget(message, application.QuoteSessionID);
}
else
{
Console.WriteLine("QuoteSessionID is null");
}
}