private void AddTimeEventTask(ETradingTimeEventType eventType, int startTimeDelaySec = 0) { var tradingTimeEvent = new TradingTimeEvent(eventType); switch (eventType) { case ETradingTimeEventType.StartTrading: tradingTimeEvent.EventTime = startTimeDelaySec == 0 ? StartTradingTimeLocal : DateTime.Now.AddSeconds(startTimeDelaySec); break; case ETradingTimeEventType.EndTradingIn60Seconds: tradingTimeEvent.EventTime = EndTradingTimeLocal.AddSeconds(-60); break; case ETradingTimeEventType.EndTradingIn30Seconds: tradingTimeEvent.EventTime = EndTradingTimeLocal.AddSeconds(-30); break; case ETradingTimeEventType.EndTrading: tradingTimeEvent.EventTime = EndTradingTimeLocal; break; default: return; } //Verify task time is logical if (DateTime.Now >= tradingTimeEvent.EventTime) { return; } AddTradingTimeEvent(tradingTimeEvent); Logger.InfoFormat("{0}: Event Registration: ***** {1} ", Symbol, tradingTimeEvent); }
public TradingTimeEvent(ETradingTimeEventType tradingTimeEventType) { TradingTimeEventType = tradingTimeEventType; }