public ExecutionMessage(int reqId, Contract contract, Execution execution)
 {
     Type = MessageType.ExecutionData;
     ReqId = reqId;
     Contract = contract;
     Execution = execution;
 }
Beispiel #2
0
 public virtual void execDetails(int reqId, Contract contract, Execution execution)
 {
     //Console.WriteLine("ExecutionDetails. " + reqId + " - " + contract.Symbol + ", " + contract.SecType + ", " + contract.Currency + " - " + execution.ExecId + ", " + execution.OrderId + ", " + execution.Shares);
     Utils.Logger.Info("ExecutionDetails. ReqId:" + reqId + " - " + contract.Symbol + ", " + contract.SecType + ", " + contract.Currency + " ,executionId: " + execution.ExecId + ", orderID:" + execution.OrderId + ", nShares:" + execution.Shares);
 }
Beispiel #3
0
        public virtual void execDetails(int reqId, Contract contract, Execution execution)
        {
            Console.WriteLine("ExecDetails. " + reqId + " - " 
                               + contract.Symbol + ", " + contract.SecType + ", " + contract.Currency + " - " 
                               + execution.ExecId + ", " + execution.OrderId + ", " + execution.Shares + "\n");
            MyLogger.Instance.CreateEntry("ExecDetails. " + reqId + " - "
                               + contract.Symbol + ", " + contract.SecType + ", " + contract.Currency + " - "
                               + execution.ExecId + ", " + execution.OrderId + ", " + execution.Shares + "\n");

            foreach (var tmpPosPair in PairPosDict.Values)
            {
                // save price and share to PosPair obj
                tmpPosPair.saveExecID(execution.OrderId, execution.ExecId);
            }
        }
 public virtual void execDetails(int reqId, Contract contract, Execution execution)
 {
     Console.WriteLine("ExecDetails. "+reqId+" - "+contract.Symbol+", "+contract.SecType+", "+contract.Currency+" - "+execution.ExecId+", "+execution.OrderId+", "+execution.Shares+"\n");
 }
 public void execDetails(int reqId, Contract contract, Execution execution)
 {
     var message = new ExecutionMessage(reqId, contract, execution);
     MessageHandler.messageBox.Enqueue(message);
     
 }
Beispiel #6
0
 public virtual void execDetails(int reqId, Contract contract, Execution execution)
 {
     parentUI.HandleMessage(new ExecutionMessage(reqId, contract, execution));
 }
Beispiel #7
0
        private void ExecutionDataEvent()
        {
            int msgVersion = ReadInt();
            int requestId = -1;
            if (msgVersion >= 7)
                requestId = ReadInt();
            int orderId = ReadInt();
            Contract contract = new Contract();
            if (msgVersion >= 5)
            {
                contract.ConId = ReadInt();
            }
            contract.Symbol = ReadString();
            contract.SecType = ReadString();
            contract.Expiry = ReadString();
            contract.Strike = ReadDouble();
            contract.Right = ReadString();
            if (msgVersion >= 9)
            {
                contract.Multiplier = ReadString();
            }
            contract.Exchange = ReadString();
            contract.Currency = ReadString();
            contract.LocalSymbol = ReadString();
            if (msgVersion >= 10)
            {
                contract.TradingClass = ReadString();
            }

            Execution exec = new Execution();
            exec.OrderId = orderId;
            exec.ExecId = ReadString();
            exec.Time = ReadString();
            exec.AcctNumber = ReadString();
            exec.Exchange = ReadString();
            exec.Side = ReadString();
            exec.Shares = ReadInt();
            exec.Price = ReadDouble();
            if (msgVersion >= 2)
            {
                exec.PermId = ReadInt();
            }
            if (msgVersion >= 3)
            {
                exec.ClientId = ReadInt();
            }
            if (msgVersion >= 4)
            {
                exec.Liquidation = ReadInt();
            }
            if (msgVersion >= 6)
            {
                exec.CumQty = ReadInt();
                exec.AvgPrice = ReadDouble();
            }
            if (msgVersion >= 8)
            {
                exec.OrderRef = ReadString();
            }
            if (msgVersion >= 9)
            {
                exec.EvRule = ReadString();
                exec.EvMultiplier = ReadDouble();
            }
            //Console.WriteLine(ReadString());
            parent.Wrapper.execDetails(requestId, contract, exec);
        }
Beispiel #8
0
 public void execDetails(int reqId, Contract contract, Execution execution)
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
        private void ExecutionDataEvent()
        {
            int msgVersion = ReadInt();
            int requestId = -1;
            if (msgVersion >= 7)
                requestId = ReadInt();
            int orderId = ReadInt();
            Contract contract = new Contract();
            if (msgVersion >= 5)
            {
                contract.ConId = ReadInt();
            }
            contract.Symbol = ReadString();
            contract.SecType = ReadString();
            contract.LastTradeDateOrContractMonth = ReadString();
            contract.Strike = ReadDouble();
            contract.Right = ReadString();
            if (msgVersion >= 9)
            {
                contract.Multiplier = ReadString();
            }
            contract.Exchange = ReadString();
            contract.Currency = ReadString();
            contract.LocalSymbol = ReadString();
            if (msgVersion >= 10)
            {
                contract.TradingClass = ReadString();
            }

            Execution exec = new Execution();
            exec.OrderId = orderId;
            exec.ExecId = ReadString();
            exec.Time = ReadString();
            exec.AcctNumber = ReadString();
            exec.Exchange = ReadString();
            exec.Side = ReadString();
            exec.Shares = serverVersion >= MinServerVer.FRACTIONAL_POSITIONS ? ReadDouble() : (double)ReadInt();
            exec.Price = ReadDouble();
            if (msgVersion >= 2)
            {
                exec.PermId = ReadInt();
            }
            if (msgVersion >= 3)
            {
                exec.ClientId = ReadInt();
            }
            if (msgVersion >= 4)
            {
                exec.Liquidation = ReadInt();
            }
            if (msgVersion >= 6)
            {
                exec.CumQty = ReadInt();
                exec.AvgPrice = ReadDouble();
            }
            if (msgVersion >= 8)
            {
                exec.OrderRef = ReadString();
            }
            if (msgVersion >= 9)
            {
                exec.EvRule = ReadString();
                exec.EvMultiplier = ReadDouble();
            }
            eWrapper.execDetails(requestId, contract, exec);
        }
Beispiel #10
0
        // Provides the executions which happened in the last 24 hours.
        // This event is fired when the reqExecutions() functions is invoked, or when an order is filled.
        public virtual void execDetails(int reqId, Contract contract, Execution execution)
        {
            Trade trade = new Trade();
            //trade.Currency = contract.Currency;
            trade.Account = Account;
            trade.Id = 0;

            trade.TradePrice = (decimal)execution.Price;
            trade.TradeSize = (execution.Side == "BOT"?1:-1)*execution.Shares;
            
            // FullSymbol includes SecurityType, Exchange and Multiplier
            // trade.Security = (SecurityType)EnumDescConverter.GetEnumValue(typeof(SecurityType), contract.SecType);
            trade.FullSymbol = ContractToSecurityFullName(contract);

            // convert date and time
            DateTime dt = DateTime.ParseExact(execution.Time, "yyyyMMdd  HH:mm:ss", CultureInfo.InvariantCulture);       // Two blanks
            trade.TradeDate = dt.Year * 10000 + dt.Month * 100 + dt.Day;
            trade.TradeTime = dt.Hour * 10000 + dt.Minute * 100 + dt.Second;

            if (contract.SecType != "BAG")
            {
                if (_iborderIdToOrderInfo.ContainsKey(execution.OrderId))
                {
                    trade.Id = _iborderIdToOrderInfo[execution.OrderId].StrategyOrderId;
                    if (_iborderIdToOrderInfo[execution.OrderId].IsAcknowledged)
                    {
                        OnGotFill(trade);
                        return;
                    }
                }
                // order not found or not acknowledged yet - defer fill notification
                _duplicateIBIdToDeferredTrade.Add(new KeyValuePair<int, Trade>(execution.OrderId, trade));
            }
        }
        // This event is fired when the reqExecutions() functions is invoked, or when an order is filled.
        public virtual void execDetails(int reqId, Contract contract, Execution execution)
        {
            String str;
            str = "Execution Details @ " + DateTime.Now.ToShortTimeString()
                + " req id = " + reqId.ToString()
                + " order id = " + execution.OrderId.ToString()
                + " contract = " + contract.Symbol
                + " execution client id = " + execution.ClientId.ToString()
                + " exeuction id = " + execution.ExecId.ToString()
                + " exeuction shares = " + execution.Shares.ToString();

            AddTextToResponseListWindow(str);
        }
Beispiel #12
0
 public virtual void execDetails(int reqId, Contract contract, Execution execution)
 {
 }
 /// <summary>
 /// Returns executions from the last 24 hours as a response to reqExecutions(), or when an order is filled.
 /// </summary>
 /// <param name="reqId">The request's identifier.</param>
 /// <param name="contract">This structure contains a full description of the contract that was executed.</param>
 /// <param name="execution">This structure contains addition order execution details.</param>
 public void execDetails(int reqId, Contract contract, Execution execution)
 {
     OnExecutionDetails(new ExecutionDetailsEventArgs(reqId, contract, execution));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ExecutionDetailsEventArgs"/> class
 /// </summary>
 public ExecutionDetailsEventArgs(int requestId, Contract contract, Execution execution)
 {
     RequestId = requestId;
     Contract = contract;
     Execution = execution;
 }