本文整理汇总了C#中IAlgorithm.Error方法的典型用法代码示例。如果您正苦于以下问题:C# IAlgorithm.Error方法的具体用法?C# IAlgorithm.Error怎么用?C# IAlgorithm.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAlgorithm
的用法示例。
在下文中一共展示了IAlgorithm.Error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
/// <summary>
/// Runs this command against the specified algorithm instance
/// </summary>
/// <param name="algorithm">The algorithm to run this command against</param>
public CommandResultPacket Run(IAlgorithm algorithm)
{
var request = new SubmitOrderRequest(OrderType, SecurityType, Symbol, Quantity, StopPrice, LimitPrice, DateTime.UtcNow, Tag);
var ticket = algorithm.Transactions.ProcessRequest(request);
var response = ticket.GetMostRecentOrderResponse();
var message = string.Format("{0} for {1} units of {2}: {3}", OrderType, Quantity, Symbol, response);
if (response.IsSuccess)
{
algorithm.Debug(message);
}
else
{
algorithm.Error(message);
}
return new CommandResultPacket(this, response.IsSuccess);
}
示例2: Run
/// <summary>
/// Runs this command against the specified algorithm instance
/// </summary>
/// <param name="algorithm">The algorithm to run this command against</param>
public CommandResultPacket Run(IAlgorithm algorithm)
{
try
{
var security = algorithm.AddSecurity(SecurityType, Symbol, Resolution, Market, FillDataForward, Leverage, ExtendedMarketHours);
return new Result(this, true, security.Symbol);
}
catch (Exception err)
{
Log.Error(err);
algorithm.Error("AddSecuityCommand Error: " + err.Message);
return new Result(this, false, QuantConnect.Symbol.Empty);
}
}