Beispiel #1
0
        private void BroadcastInstrumentTradingStatus(Dictionary <InstrumentStatus, List <Guid> > status)
        {
            var command = MarketCommandFactory.CreateUpdateInstrumentTradingStatusCommand(status);

            Logger.InfoFormat("BroadcastInstrumentTradingStatus  {0}", command);
            Broadcaster.Default.AddCommand(command);
        }
Beispiel #2
0
        private void BroadcastResetCommand(DateTime tradeDay)
        {
            var command = MarketCommandFactory.CreateAccountResetCommand(tradeDay);

            Broadcaster.Default.AddCommand(command);
            var updateTradeDayInfoCommand = MarketCommandFactory.CreateUpdateTradeDayInfoCommand();

            Broadcaster.Default.AddCommand(updateTradeDayInfoCommand);
        }
Beispiel #3
0
 public UpdateTradeDayInfoMarketCommand GetTradeDayInfoCommand()
 {
     try
     {
         return(MarketCommandFactory.CreateUpdateTradeDayInfoCommand());
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(null);
     }
 }
Beispiel #4
0
        internal void CreateAndBroadcastInstrumentDayOpenCloseTimeCommand(List <Guid> instrumentIds)
        {
            Logger.InfoFormat("Begin CreateAndBroadcastInstrumentDayOpenCloseTimeCommand {0}", instrumentIds.Aggregate(string.Empty, (seed, item) => seed + ", " + item));
            List <InstrumentDayOpenCloseParams> instrumentParams = this.LoadInstrumentTradingParamAndAddCheckPoint(instrumentIds);

            if (instrumentParams != null)
            {
                var instrumentDayCloseCommand = MarketCommandFactory.CreateUpdateInstrumentDayOpenCloseTimeCommand(instrumentParams);
                if (instrumentDayCloseCommand != null)
                {
                    Broadcaster.Default.AddCommand(instrumentDayCloseCommand);
                    InstrumentDayOpenCloseTimeKeeper.Default.AddInstrumentDayOpenCloseTimeRecords(instrumentDayCloseCommand.Records);
                    Logger.InfoFormat("BroadcastInstrumentDayOpenCloseTimeCommand recordsCount = {1}, {0}", instrumentDayCloseCommand, instrumentDayCloseCommand.Records.Count);
                }
            }
        }
 internal void ClientConnectedHanlde(ClientBase client)
 {
     _readWriteLock.EnterReadLock();
     try
     {
         Logger.InfoFormat("client connect, send back instrument trading status command client url = {0}, appType = {1}", client.ServiceUrl, client.AppType);
         if (!_builder.ExistsStatus())
         {
             return;
         }
         client.Send(MarketCommandFactory.CreateUpdateInstrumentTradingStatusCommand(_builder.StatusDict));
     }
     finally
     {
         _readWriteLock.ExitReadLock();
     }
 }