コード例 #1
0
        internal static Protocal.UpdateInstrumentDayOpenCloseTimeMarketCommand CreateUpdateInstrumentDayOpenCloseTimeCommand(List <InstrumentDayOpenCloseParams> instrumentParams)
        {
            if (instrumentParams == null || instrumentParams.Count == 0)
            {
                return(null);
            }

            var result = new Protocal.UpdateInstrumentDayOpenCloseTimeMarketCommand
            {
                Records = new List <InstrumentDayOpenCloseTimeRecord>()
            };

            foreach (var eachInstrumentParam in instrumentParams)
            {
                result.Records.Add(new Protocal.InstrumentDayOpenCloseTimeRecord
                {
                    Id              = eachInstrumentParam.Id,
                    TradeDay        = eachInstrumentParam.TradeDay,
                    DayOpenTime     = eachInstrumentParam.DayOpenTime,
                    DayCloseTime    = eachInstrumentParam.DayCloseTime,
                    NextDayOpenTime = eachInstrumentParam.NextDayOpenTime,
                    ValueDate       = eachInstrumentParam.ValueDate,
                    RealValueDate   = eachInstrumentParam.RealValueDate
                });
            }
            return(result);
        }
コード例 #2
0
 public void UpdateInstrumentDayOpenCloseTime(Protocal.UpdateInstrumentDayOpenCloseTimeMarketCommand command)
 {
     this.CallByWrite(() =>
     {
         foreach (var eachDayCloseInfo in command.Records)
         {
             var instrument = TradingSetting.Default.GetInstrument(eachDayCloseInfo.Id);
             Logger.InfoFormat("UpdateInstrumentDayOpenCloseTime id={0} tradeDay= {1},dayOpenTime = {2}, dayCloseTime= {3}, valueDate = {4}, nextDayOpenTime = {5}, realValueDate = {6}",
                               eachDayCloseInfo.Id, eachDayCloseInfo.TradeDay, eachDayCloseInfo.DayOpenTime, eachDayCloseInfo.DayCloseTime, eachDayCloseInfo.ValueDate, eachDayCloseInfo.NextDayOpenTime, eachDayCloseInfo.RealValueDate);
             instrument.UpdateTradingTime(eachDayCloseInfo.DayOpenTime, eachDayCloseInfo.DayCloseTime, eachDayCloseInfo.ValueDate, eachDayCloseInfo.NextDayOpenTime);
             ResetManager.Default.Add(eachDayCloseInfo.Id, eachDayCloseInfo.TradeDay, eachDayCloseInfo.DayOpenTime, eachDayCloseInfo.DayCloseTime, eachDayCloseInfo.ValueDate, eachDayCloseInfo.RealValueDate);
         }
     });
 }