本文整理汇总了C#中StockSharp.Messages.ExecutionMessage.AddValue方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutionMessage.AddValue方法的具体用法?C# ExecutionMessage.AddValue怎么用?C# ExecutionMessage.AddValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSharp.Messages.ExecutionMessage
的用法示例。
在下文中一共展示了ExecutionMessage.AddValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSendInMessage
//.........这里部分代码省略.........
if (mdMsg.Count != null)
url.QueryString.Append("maxrecords", mdMsg.Count.Value);
if (mdMsg.From != null)
url.QueryString.Append("start", mdMsg.From.Value.FromDateTimeOffset(_defaultTimeFormatRequest));
if (mdMsg.To != null)
url.QueryString.Append("end", mdMsg.To.Value.FromDateTimeOffset(_defaultTimeFormatRequest));
using (var client = new WebClient())
{
var lines = client.DownloadString(url)
.Split("\n")
.Where(l => l != "\r")
.ToArray();
var i = 0;
foreach (var line in lines)
{
var columns = line.Split(',');
try
{
var msg = new ExecutionMessage
{
SecurityId = mdMsg.SecurityId,
OriginalTransactionId = mdMsg.TransactionId,
ExecutionType = ExecutionTypes.Tick,
ServerTime = columns[0].ToDateTime("yyyy-MM-dd HH:mm:ss.fff"),
TradePrice = columns[3].To<decimal>(),
Volume = columns[4].To<decimal>(),
};
msg.AddValue("IsFinished", ++i == lines.Length);
SendOutMessage(msg);
}
catch (Exception ex)
{
throw new InvalidOperationException(LocalizedStrings.Str2141Params.Put(line), ex);
}
}
}
}
break;
}
case MarketDataTypes.News:
break;
case MarketDataTypes.CandleTimeFrame:
{
var tf = (TimeSpan)mdMsg.Arg;
string serviceName;
string timeFormatRequest = _defaultTimeFormatRequest;
string timeFormatResponse = "yyyy-MM-dd";
if (tf == TimeSpan.FromMinutes(1))
{
serviceName = "queryminutes";
timeFormatResponse = "yyyy-MM-dd HH:mm";
}
else if (tf == TimeSpan.FromDays(1))
{
serviceName = "queryeod";
timeFormatRequest = "yyyyMMdd";