예제 #1
0
        private void client_ExecDetails(object sender, ExecDetailsEventArgs e)
        {
            log.InfoFormat("Execution: {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}",
                           e.Contract.Symbol, e.Execution.AccountNumber, e.Execution.ClientId, e.Execution.Exchange, e.Execution.ExecutionId,
                           e.Execution.Liquidation, e.Execution.OrderId, e.Execution.PermId, e.Execution.Price, e.Execution.Shares, e.Execution.Side, e.Execution.Time);

            SymbolInfo    symbol         = Factory.Symbol.LookupSymbol(e.Contract.Symbol);
            SymbolHandler symbolHandler  = symbolHandlers[symbol.BinaryIdentifier];
            TimeStamp     executionTime  = new TimeStamp(e.Execution.Time);
            int           logicalOrderId = GetLogicalOrderId(e.Execution.OrderId);
            double        change         = e.Execution.Side == ExecutionSide.Bought ? e.Execution.Shares : -e.Execution.Shares;
            double        positionBefore = symbolHandler.Position;

            symbolHandler.AddPosition(change);
            if (trace)
            {
                log.Trace("Changed symbol position: " + positionBefore + " + " + change + " = " + symbolHandler.Position);
            }
            LogicalFillBinary binary = new LogicalFillBinary(symbolHandler.Position, e.Execution.Price, executionTime, logicalOrderId);

            if (debug)
            {
                log.Debug("Sending logical fill: " + binary);
            }
            receiver.OnEvent(symbol, (int)EventType.LogicalFill, binary);
        }
예제 #2
0
파일: Instrument.cs 프로젝트: ajmal017/HAC
 private void S_OnFill(Object sender, ExecDetailsEventArgs e)
 {
     foreach (KeyValuePair <int, Instrument> x in contracts)
     {
         if (e.Contract.Symbol == x.Value.Symbol)
         {
             x.Value.I_OnFill(sender, e);
             break;
         }
     }
 }
예제 #3
0
파일: Instrument.cs 프로젝트: ajmal017/HAC
///////////////////////////////////////////////////


        private void Client_Fill(Object sender, ExecDetailsEventArgs e)
        {
            Fill m_Fill = new Fill();

            m_Fill.TradeID = e.Execution.OrderId.ToString();
            m_Fill.BuySell = e.Execution.Side.ToString().Substring(0, 1);
            m_Fill.Price   = e.Execution.Price;
            m_Fill.Qty     = e.Execution.Shares;
            m_Fill.Time    = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            m_Fill.Symbol  = e.Contract.Symbol;

            FillUpdate(m_Fill);
        }
예제 #4
0
 static void client_ExecDetails(object sender, ExecDetailsEventArgs e)
 {
     Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}",
                       e.Contract.Symbol, e.Execution.AccountNumber, e.Execution.ClientId, e.Execution.Exchange, e.Execution.ExecutionId,
                       e.Execution.Liquidation, e.Execution.OrderId, e.Execution.PermId, e.Execution.Price, e.Execution.Shares, e.Execution.Side, e.Execution.Time);
 }
예제 #5
0
파일: Instrument.cs 프로젝트: ajmal017/HAC
 private void I_OnFill(Object sender, ExecDetailsEventArgs e)
 {
     this.BeginInvoke(OnFillUpdateDelegate, sender, e);
 }
예제 #6
0
        void ibclient_ExecDetails(object sender, ExecDetailsEventArgs e)
        {
            lock (executionList)
            {
                DateTime exTime = DateTime.ParseExact(e.Execution.Time, "yyyyMMdd  HH:mm:ss",
                    CultureInfo.InvariantCulture);

                if (exTime > latestExecution)
                {
                    latestExecution = exTime;
                    latestExecutionID = e.Execution.ExecutionId;
                }
                if (!executionList.ContainsKey(e.Execution.ExecutionId))
                {
                    ExecutionInfo ei = new ExecutionInfo();

                    ei.contract = e.Contract;
                    ei.execution = e.Execution;
                    ei.OrderId = e.OrderId;
                    ei.symbol = e.Contract.Symbol;
                    executionList.Add(
                        e.Execution.ExecutionId,
                        ei);
                    numNewExecutions++;
                }
            }
        }