本文整理匯總了C#中QuickFix.Message.setField方法的典型用法代碼示例。如果您正苦於以下問題:C# Message.setField方法的具體用法?C# Message.setField怎麽用?C# Message.setField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QuickFix.Message
的用法示例。
在下文中一共展示了Message.setField方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MakeMessage
public void MakeMessage(Message m, string fix)
{
idx = 0; prevIdx = 0;
// Handle first field differently, no SOH at start.
StringField sf = new StringField(0);
idx = fix.IndexOf('\x01');
if (idx != -1)
{
field = fix.Substring(prevIdx, (idx - prevIdx));
tagIndex = field.IndexOf('=');
sf.Tag = IntParse(field.Substring(0, tagIndex));
sf.Obj = field.Substring(tagIndex + 1);
m.setField(sf);
}
else return;
while (idx != -1)
{
prevIdx = idx;
idx = fix.IndexOf('\x01', prevIdx + 1);
if (idx == -1) break;
StringField sf2 = new StringField(0);
field = fix.Substring(prevIdx + 1, (idx - prevIdx) - 1);
tagIndex = field.IndexOf('=');
sf2.Tag = IntParse(field.Substring(0, tagIndex));
sf2.Obj = field.Substring(tagIndex + 1);
m.setField(sf2);
}
}
示例2: ServerQuickFix_newSendOrderRequest
long ServerQuickFix_newSendOrderRequest(Order o)
{
QuickFix.Message message = new QuickFix.Message();
QuickFix.Message.Header header = message.getHeader();
header.setField(new BeginString(FIXID));
header.setField(new SenderCompID(SenderCompId));
header.setField(new TargetCompID(TargetCompId));
header.setField(new MsgType(CANCEL));
message.setField(new OrigClOrdID(o.id.ToString()));
message.setField(new ClOrdID(o.id.ToString()));
message.setField(new Symbol(o.symbol));
message.setField(new Side(o.side ? Side.BUY : Side.SELL));
//message.setField(new Text("Cancel My Order!"));
Session.sendToTarget(message);
return 0;
}
示例3: AddBidAskQueryClause
private static bool AddBidAskQueryClause(Message msg, string ticker)
{
var simGroup = new QuickFix44.MarketDataRequest.NoRelatedSym(); // 146=1
// подписаться на символ по его коду?
if (subscribeBySecurityId)
{
int tickerCode;
if (!TickerCodeDictionary.Instance.tickerCode.TryGetValue(ticker, out tickerCode))
{
Logger.ErrorFormat("Запрос котировки {0} - нет кода", ticker);
return false;
}
simGroup.setField(new SecurityID(tickerCode.ToString())); // 48=4006 symbol
simGroup.setField(new SecurityIDSource("8")); // 22=8 symbol
}
else
// подписаться по названию
{
simGroup.setField(new Symbol(TickerCodeDictionary.Instance.GetTickerNameFormatted(ticker)));
}
// два отдельных запроса на bid-ask?
if (distinctQueriesForBidAsk)
{
var group = new QuickFix44.MarketDataRequest.NoMDEntryTypes(); // 267=2
group.setField(new MDEntryType('0')); // 269=0 (bid)
simGroup.addGroup(group);
group = new QuickFix44.MarketDataRequest.NoMDEntryTypes();
group.setField(new MDEntryType('1')); // 269=1 (offer)
simGroup.addGroup(group);
}
else
// один запрос
{
var group = new QuickFix44.MarketDataRequest.NoMDEntryTypes(); // 267=2
group.setField(new MDEntryType('2')); // 269=0 (bid + offer)
simGroup.addGroup(group);
}
msg.addGroup(simGroup);
msg.setField(new NoRelatedSym(1)); // 1 subscription
msg.setField(new Symbol(ticker));
return true;
}
示例4: SetUserDefinedFields
protected void SetUserDefinedFields(FIXMessage Message, Message message)
{
foreach (FIXField fixField in Message.Fields)
{
if (fixField.Tag >= 500)
{
switch (fixField.FIXType)
{
case FIXType.Bool:
message.setField(new BooleanField(fixField.Tag, ((FIXBoolField)fixField).Value));
continue;
case FIXType.Int:
message.setField(new IntField(fixField.Tag, ((FIXIntField)fixField).Value));
continue;
case FIXType.Double:
message.setField(new DoubleField(fixField.Tag, ((FIXDoubleField)fixField).Value));
continue;
case FIXType.Char:
message.setField(new CharField(fixField.Tag, ((FIXCharField)fixField).Value));
continue;
case FIXType.String:
message.setField(new StringField(fixField.Tag, ((FIXStringField)fixField).Value));
continue;
case FIXType.DateTime:
message.setField((UtcDateOnlyField)new UtcDateField(fixField.Tag, ((FIXDateTimeField)fixField).Value));
continue;
default:
continue;
}
}
}
}