Beispiel #1
0
        /// <summary>
        /// Register the defined event with the callback
        /// </summary>
        ScheduledEvent IFluentSchedulingRunnable.Run(Action <string, DateTime> callback)
        {
            var name = _name ?? _dateRule.Name + ": " + _timeRule.Name;
            // back the date up to ensure we get all events, the event scheduler will skip past events that whose time has passed
            var dates      = ScheduleManager.GetDatesDeferred(_dateRule, _securities);
            var eventTimes = _timeRule.CreateUtcEventTimes(dates);

            if (_predicate != null)
            {
                eventTimes = eventTimes.Where(_predicate);
            }
            var scheduledEvent = new ScheduledEvent(name, eventTimes, callback);

            _schedule.Add(scheduledEvent);
            return(scheduledEvent);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FluentScheduledEventBuilder"/> class
 /// </summary>
 /// <param name="schedule">The schedule to send created events to</param>
 /// <param name="securities">The algorithm's security manager</param>
 /// <param name="name">A specific name for this event</param>
 public FluentScheduledEventBuilder(ScheduleManager schedule, SecurityManager securities, string name = null)
 {
     _name = name;
     _schedule = schedule;
     _securities = securities;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FluentScheduledEventBuilder"/> class
 /// </summary>
 /// <param name="schedule">The schedule to send created events to</param>
 /// <param name="securities">The algorithm's security manager</param>
 /// <param name="name">A specific name for this event</param>
 public FluentScheduledEventBuilder(ScheduleManager schedule, SecurityManager securities, string name = null)
 {
     _name       = name;
     _schedule   = schedule;
     _securities = securities;
 }