void m_Session_OnCancelMessage(object sender, CBWMsgCancel cancelMsg) { CANCELUPDATE(cancelMsg); }
private void CANCELUPDATE(CBWMsgCancel cancelMsg) { if (!_cancelMsgID.ContainsKey(cancelMsg.CancelID)) { _cancelMsgID.Add(cancelMsg.CancelID.Value, cancelMsg.SmartID.Value); double _price = Math.Round(cancelMsg.Price, 2); v(String.Format("ServerID: {0}, CancelID: {1}, CancelTime: {2}, CIOrdID: {3}, FeedID: {4}, OrderSize: {5}, OrderType: {6}, Price: {7}, OrderTime: {8}", cancelMsg.ServerID.ToString(), cancelMsg.CancelID.ToString(), cancelMsg.CancelTime.ToString(), cancelMsg.ClOrdID.ToString(), cancelMsg.FeedID.ToString(), cancelMsg.OrderSize.ToString(), cancelMsg.OrderType.ToString(), _price.ToString(), cancelMsg.OrderTime.ToString())); int _smartID = cancelMsg.SmartID; long _tlid = 0; if (_intlong.ContainsKey(_smartID)) { if (_intlong.TryGetValue(_smartID, out _tlid)) { if (!tl_canceledids.ContainsKey(_tlid)) { tl_canceledids.Add(_tlid, false); //validate TL bool _isTLsent = false; if (tl_canceledids.TryGetValue(_tlid, out _isTLsent)) { if (_isTLsent) { v(String.Format("CANCELUPDATE. TL already sent cancel to BW KEY:[{0}]", _smartID)); } else { v(String.Format("CANCELUPDATE. TL ++ADDING++ to TL_CANCELIDs BW KEY:[{0}]", _smartID)); tl.newCancel(_tlid); tl_canceledids[_tlid] = true; debug(String.Format("...found TL[{0}] and canceled BW[{1}]", _tlid, _smartID)); if (!bw_cancelids.ContainsKey(_smartID)) bw_cancelids.Add(_smartID, false); } } else { v(String.Format("CANCELUPDATE.tl_canceledids could not find TL KEY:[{0}]", _tlid)); } } else { //validate TL bool _isTLsent = false; if (tl_canceledids.TryGetValue(_tlid, out _isTLsent)) { if (_isTLsent) { v(String.Format("CANCELUPDATE. TL already sent cancel to BW KEY:[{0}]", _smartID)); } else { v(String.Format("CANCELUPDATE. TL ++ADDING++ to TL_CANCELIDs BW KEY:[{0}]", _smartID)); tl.newCancel(_tlid); tl_canceledids[_tlid] = true; debug(String.Format("...found TL[{0}] and canceled BW[{1}]", _tlid, _smartID)); if (!bw_cancelids.ContainsKey(_smartID)) bw_cancelids.Add(_smartID, false); } } else { v(String.Format("CANCELUPDATE.tl_canceledids could not find TL KEY:[{0}]", _tlid)); } } } else { v(String.Format("Error in getting value for _intlong with SmartID[{0}]", _smartID)); } } else { //v("appears to have already sent cancel for [" + _smartID + "]"); } } }