Пример #1
0
 protected override void HandleMarketCommand(MarketCommand marketCommand)
 {
     try
     {
         if (marketCommand is UpdateInstrumentTradingStatusMarketCommand)
         {
             var command = (UpdateInstrumentTradingStatusMarketCommand)marketCommand;
             Logger.InfoFormat("Update instrument status {0}", command);
             Engine.EngineService.Default.UpdateInstrumentStatus(command.InstrumentStatus);
         }
         else if (marketCommand is UpdateInstrumentDayOpenCloseTimeMarketCommand)
         {
             var command = (UpdateInstrumentDayOpenCloseTimeMarketCommand)marketCommand;
             if (command.Records == null || command.Records.Count == 0)
             {
                 Logger.Warn("update instrument day open close time  no records");
                 return;
             }
             foreach (var eachInstrumentInfo in command.Records)
             {
                 Logger.InfoFormat("update instrument day open close time , id={0}, dayopentime={1}, dayclosetime={2}", eachInstrumentInfo.Id, eachInstrumentInfo.DayOpenTime, eachInstrumentInfo.DayCloseTime);
             }
             ServerFacade.Default.Server.UpdateInstrumentDayOpenCloseTime(command);
         }
         else if (marketCommand is AccountResetMarketCommand)
         {
             var command = (AccountResetMarketCommand)marketCommand;
             if (!command.IsReseted)
             {
                 Logger.InfoFormat("received account reset command tradeDay = {0}", command.TradeDay);
                 InstrumentTradingStateManager.Default.UpdateLastResetDay(command.TradeDay);
                 AccountResetter.Default.Add(command.TradeDay);
             }
         }
         else if (marketCommand is UpdateTradeDayInfoMarketCommand)
         {
             var command = (UpdateTradeDayInfoMarketCommand)marketCommand;
             Logger.InfoFormat("update tradeDay info, tradeDay={0}, begintime={1}, endtime={2}, istrading={3}", command.TradeDay, command.BeginTime, command.EndTime, command.IsTrading);
             ServerFacade.Default.Server.UpdateTradeDayInfo(command);
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
Пример #2
0
 protected override void HandleMarketCommand(MarketCommand command)
 {
     try
     {
         if (command is AccountResetMarketCommand)
         {
             var resetCommand = (AccountResetMarketCommand)command;
             if (resetCommand.IsReseted)
             {
                 FaxEmailServices.FaxEmailEngine.Default.NotifyTradeDayReset(resetCommand.TradeDay);
             }
         }
         else if (command is UpdateInstrumentTradingStatusMarketCommand)
         {
             CommandManager.Default.ProcessMarketCommand(command);
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
Пример #3
0
 protected abstract void HandleMarketCommand(MarketCommand command);