本文整理匯總了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;
}