private void OnInstrumentFill(Fill x) { // Update position. if (x.BuySell == "B") { m_Position += x.Qty; } else { m_Position -= x.Qty; } // Send the data to the TradeMacher. TradeMatching.Fill m_Fill = new TradeMatching.Fill(); if (x.BuySell == "B") { m_Fill.BS = TradeMatching.TradeType.BUY; } else { m_Fill.BS = TradeMatching.TradeType.SELL; } m_Fill.Price = Convert.ToDouble(x.Price); m_Fill.TradeID = x.TradeID; m_Fill.Qty = (int)x.Qty; m_Matcher.Fill_Received(m_Fill); m_NetPos = m_Matcher.NetPos; }
private void OnInstrumentFill(int qty, string BS, string px, string key) { // Update position. if (BS == "B") { m_Position += qty; } else { m_Position -= qty; } // Send the data to the TradeMacher. TradeMatching.Fill m_Fill = new TradeMatching.Fill(); if (BS == "B") { m_Fill.BS = TradeMatching.TradeType.BUY; } else { m_Fill.BS = TradeMatching.TradeType.SELL; } m_Fill.Price = Convert.ToDouble(px); m_Fill.TradeID = key; m_Fill.Qty = qty; m_Matcher.Fill_Received(m_Fill); m_NetPos = m_Matcher.NetPos; }
// build mass function 2 // place an initial position order based on mass 2 // keep building EMAs until we reach 500 events private void OnInstrumentFill(Fill pFill) { // Update position. if (pFill.BS == TradeType.BUY) { Position += pFill.Qty; } else { Position -= pFill.Qty; } // Send the data to the TradeMatcher. //Need to convert IBApi.Order to int to //IBApi.Order order = new Order(); //key = order.OrderId; //if (BS == "B") // m_Fill.BS = TradeType.BUY; //else // m_Fill.BS = TradeType.SELL; //m_Fill.Price = Convert.ToDouble(px); //m_Fill.TradeID = key.ToString(); //m_Fill.Qty = qty; m_Matcher.Fill_Received(pFill); NetPos = m_Matcher.NetPos; OnFillUpdate(pFill); }