protected void OnExecutionDetails(int orderId, IBContract contract, IBExecutionDetails execution) { if (ExecutionDetails != null) ExecutionDetails(this, new TWSExecutionDetailsEventArgs(this) { OrderId = orderId, Contract = contract, Execution = execution }); if (OrderChanged != null) { OrderRecord or; if (_orderRecords.TryGetValue(orderId, out or)) { OrderChanged(this, new TWSOrderChangedEventArgs(this, or) { ChangeType = IBOrderChangeType.ExecutionDetails, ReportedContract = contract, ExecutionDetails = execution, }); } } }
private void ProcessExecutionData() { var version = _enc.DecodeInt(); var reqId = -1; if (version >= 7) reqId = _enc.DecodeInt(); var orderId = _enc.DecodeInt(); var contract = new IBContract { ContractId = version >= 5 ? _enc.DecodeInt() : 0, Symbol = _enc.DecodeString(), SecurityType = _enc.DecodeEnum<IBSecurityType>(), Expiry = DecodeIBExpiry(_enc), Strike = _enc.DecodeDouble(), Right = _enc.DecodeString() }; if (version >= 9) contract.Multiplier = _enc.DecodeString(); contract.Exchange = _enc.DecodeString(); contract.Currency = _enc.DecodeString(); contract.LocalSymbol = _enc.DecodeString(); var execution = new IBExecutionDetails { OrderId = orderId, ExecId = _enc.DecodeString(), Time = _enc.DecodeString(), AcctNumber = _enc.DecodeString(), Exchange = _enc.DecodeString(), Side = _enc.DecodeEnum<IBExecutionSide>(), Shares = _enc.DecodeInt(), Price = _enc.DecodeDouble(), PermId = version >= 2 ? _enc.DecodeInt() : 0, ClientId = version >= 3 ? _enc.DecodeInt() : 0, Liquidation = version >= 4 ? _enc.DecodeInt() : 0, CumQty = version >= 6 ? _enc.DecodeInt() : 0, AveragePrice = version >= 6 ? _enc.DecodeDouble() : 0, OrderRef = version >= 8 ? _enc.DecodeString() : null, EvRule = version >= 9 ? _enc.DecodeString() : null, EvMultiplier = version >= 9 ? _enc.DecodeDouble() : 0 }; OnExecutionDetails(reqId, contract, execution); }