本文整理汇总了C#中StockSharp.Messages.ExecutionMessage.GetTradeId方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutionMessage.GetTradeId方法的具体用法?C# ExecutionMessage.GetTradeId怎么用?C# ExecutionMessage.GetTradeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StockSharp.Messages.ExecutionMessage
的用法示例。
在下文中一共展示了ExecutionMessage.GetTradeId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessMyTrade
/// <summary>
/// To calculate trade profitability. If the trade was already processed earlier, previous information returns.
/// </summary>
/// <param name="trade">Trade.</param>
/// <param name="info">Information on new trade.</param>
/// <returns><see langword="true" />, if new trade received, otherwise, <see langword="false" />.</returns>
public bool ProcessMyTrade(ExecutionMessage trade, out PnLInfo info)
{
if (trade == null)
throw new ArgumentNullException(nameof(trade));
var tradeId = trade.GetTradeId();
if (_tradeInfos.TryGetValue(tradeId, out info))
return false;
var queue = _securityPnLs.SafeAdd(trade.SecurityId, security => new PnLQueue(security));
info = queue.Process(trade);
_tradeInfos.Add(tradeId, info);
_realizedPnL += info.PnL;
return true;
}