/// <summary> /// 分发商品期货成交回报方法 /// Create by 董鹏 2010-01-22 /// </summary> /// <param name="sender">事件对象</param> /// <param name="e">事件参数</param> private void DispatchCommoditiesProcess(object sender, QueueItemHandleEventArg <CommoditiesDealBackEntity> e) { //撮合中心委托回报为空判断 if (e.Item == null) { LogHelper.WriteDebug("委托回报不能为空"); } try { QueueBufferBase <CommoditiesDealBackEntity> bufferDeal = null; foreach (var queueBufferBase in CommoditiesDealList) { if (bufferDeal == null || queueBufferBase.BufferedItemCount < bufferDeal.BufferedItemCount) { bufferDeal = queueBufferBase; } } //撮合中心委托回报失败 if (bufferDeal == null) { LogHelper.WriteDebug("委托回报中心.DispatchStockProcess无法找到回报队列,委托回报失败."); return; } bufferDeal.InsertQueueItem(e.Item); } //撮合中心委托回报异常 catch (Exception ex) { LogHelper.WriteError(GenerateInfo.CH_E004, ex); return; } }
/// <summary> /// 分发港股成交回报方法 /// </summary> /// <param name="sender">对象</param> /// <param name="e">参数</param> private void DispatchHKStockProcess(object sender, QueueItemHandleEventArg <HKDealBackEntity> e) { #region 要求实现港股委托成交回报 if (e.Item == null) { LogHelper.WriteDebug("委托回报不能为空"); } try { QueueBufferBase <HKDealBackEntity> bufferDeal = null; foreach (var queueBufferBase in HKDealList) { if (bufferDeal == null || queueBufferBase.BufferedItemCount < bufferDeal.BufferedItemCount) { bufferDeal = queueBufferBase; } } //委托回报失败 if (bufferDeal == null) { LogHelper.WriteDebug("委托回报中心.DispatchStockProcess无法找到回报队列,委托回报失败."); return; } bufferDeal.InsertQueueItem(e.Item); } //委托回报分发异常 catch (Exception ex) { string strMessage = "CH-2000:[委托回报分发异常]" + ex.Message; LogHelper.WriteError(strMessage, ex); return; } #endregion }
/// <summary> /// 构造函数 初始化撮合中心撤单委托缓冲区 /// </summary> public CanceFailCommoditiesBack() { bufferCommoditiesCancel = new QueueBufferBase <CancelEntity>(); bufferCommoditiesCancel.QueueItemProcessEvent += ProcessCommoditiesCancel; }
/// <summary> /// 实例构造函数 /// </summary> public CanceFailStockBack() { bufferCancel = new QueueBufferBase <CancelEntity>(); bufferCancel.QueueItemProcessEvent += ProcessCancel; }
/// <summary> /// 构造函数 /// </summary> /// <param name="backCount"></param> public DobackService(int backCount) { //撮合中心缓冲区处理 BufferXHCancelEntityList = new QueueBufferBase <CancelOrderEntity>(); BufferXHCancelEntityList.QueueItemProcessEvent += ProcessXHCancel; BufferHKCancelEntityList = new QueueBufferBase <CancelOrderEntity>(); BufferHKCancelEntityList.QueueItemProcessEvent += ProcessHKCancel; #region add by 董鹏 2010-04-30 BufferSICancelEntityList = new QueueBufferBase <CancelOrderEntity>(); BufferSICancelEntityList.QueueItemProcessEvent += ProcessSICancel; BufferCFCancelEntityList = new QueueBufferBase <CancelOrderEntity>(); BufferCFCancelEntityList.QueueItemProcessEvent += ProcessCFCancel; #endregion BufferHKModifyEntityList = new QueueBufferBase <HKModifyBackEntity>(); BufferHKModifyEntityList.QueueItemProcessEvent += ProcessHKModify; stockDealOrderCacheList = new QueueBufferBase <StockDealEntity>(); stockDealOrderCacheList.QueueItemProcessEvent += DispatchStockProcess; futureDealOrderCacheList = new QueueBufferBase <FutureDealBackEntity>(); futureDealOrderCacheList.QueueItemProcessEvent += DispatchFutureProcess; hkstockDealOrderCatheList = new QueueBufferBase <HKDealBackEntity>(); hkstockDealOrderCatheList.QueueItemProcessEvent += DispatchHKStockProcess; #region commoditiesDealOrderCacheList add by 董鹏 2010-01-22 commoditiesDealOrderCacheList = new QueueBufferBase <CommoditiesDealBackEntity>(); commoditiesDealOrderCacheList.QueueItemProcessEvent += DispatchCommoditiesProcess; #endregion smartPool.Start(); StockDealList = new List <QueueBufferBase <StockDealEntity> >(); FutureDealList = new List <QueueBufferBase <FutureDealBackEntity> >(); HKDealList = new List <QueueBufferBase <HKDealBackEntity> >(); #region CommoditiesDealList add by 董鹏 2010-01-22 CommoditiesDealList = new List <QueueBufferBase <CommoditiesDealBackEntity> >(); #endregion for (int i = 0; i < backCount; i++) { QueueBufferBase <StockDealEntity> stockEntity = new QueueBufferBase <StockDealEntity>(); stockEntity.QueueItemProcessEvent += (sender, e) => smartPool.QueueWorkItem(ProcessBussiness, sender, e); StockDealList.Add(stockEntity); QueueBufferBase <FutureDealBackEntity> futureEntity = new QueueBufferBase <FutureDealBackEntity>(); futureEntity.QueueItemProcessEvent += (sender, e) => smartPool.QueueWorkItem(ProcessFutureBussiness, sender, e); FutureDealList.Add(futureEntity); QueueBufferBase <HKDealBackEntity> hkstockEntity = new QueueBufferBase <HKDealBackEntity>(); hkstockEntity.QueueItemProcessEvent += (sender, e) => smartPool.QueueWorkItem(ProcessHKBussiness, sender, e); HKDealList.Add(hkstockEntity); #region QueueBufferBase <CommoditiesDealBackEntity> commoditiesEntity = new QueueBufferBase <CommoditiesDealBackEntity>(); commoditiesEntity.QueueItemProcessEvent += (sender, e) => smartPool.QueueWorkItem(ProcessCommoditiesBussiness, sender, e); CommoditiesDealList.Add(commoditiesEntity); #endregion } }
/// <summary> /// 构造函数 /// </summary> public RealTimeDataCache() { realTimeCache = new List <FutureMarketEntity>(); bufferRealTime = new QueueBufferBase <FutureMarketEntity>(); }
/// <summary> /// 构造函数 初始化撮合中心撤单委托缓冲区 /// </summary> public CanceFailFutureBack() { bufferFutureCancel = new QueueBufferBase <CancelEntity>(); bufferFutureCancel.QueueItemProcessEvent += ProcessFutureCancel; }
/// <summary> /// 实例构造函数 /// </summary> private ModifyFailHKStockBack() { bufferModify = new QueueBufferBase <HKModifyEntity>(); bufferModify.QueueItemProcessEvent += ProcessModify; }