gpt4 book ai didi

c# - 如何使用 QuickFIX 引擎发送简单的 QuoteRequest 消息?

转载 作者:行者123 更新时间:2023-11-30 20:48:00 24 4
gpt4 key购买 nike

我正在尝试发送一个 QuoteRequest(标记 35=R),QuickFIX 引擎必填字段为:

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);

最佳答案

这是我用来让它工作的代码:

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");
}
}

关于c# - 如何使用 QuickFIX 引擎发送简单的 QuoteRequest 消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25236554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com