示例#1
0
        /// <summary>
        /// Add new scheduled action
        /// </summary>
        /// <param name="date"></param>
        /// <param name="time"></param>
        /// <param name="action"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public ScheduledEventAction Event(DateComposite date, TimeComposite time, Action <string, DateTime> action, string name = "")
        {
            var toadd = new ScheduledAction(date, time, action, name);

            Add(toadd);
            return(toadd);
        }
示例#2
0
        /// <summary>
        /// Initialize new scheduled action instance
        /// </summary>
        /// <param name="date"></param>
        /// <param name="time"></param>
        /// <param name="action"></param>
        /// <param name="name"></param>
        public ScheduledAction(DateComposite date, TimeComposite time, Action <string, DateTime> action, string name = "")
        {
            //Check for name input (and make sure it is unique)
            if (string.IsNullOrWhiteSpace(name))
            {
                name = string.Join("-", date.Name, time.Name, Guid.NewGuid());
            }
            else
            {
                name += "-" + Guid.NewGuid();
            }

            //Add fund id, if applicable
            if (!string.IsNullOrWhiteSpace(FundId))
            {
                name = $"{FundId}-{name}";
            }

            //Set name and other variables
            Name    = name;
            _action = action;
            _date   = date;
            _time   = time;
        }
示例#3
0
 /// <summary>
 /// Add new scheduled action
 /// </summary>
 /// <param name="name"></param>
 /// <param name="date"></param>
 /// <param name="time"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public ScheduledEventAction Event(string name, DateComposite date, TimeComposite time, Action action) =>
 Event(date, time, (n, d) => action(), name);
示例#4
0
 /// <summary>
 /// Add new scheduled action
 /// </summary>
 /// <param name="date"></param>
 /// <param name="time"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public ScheduledEventAction Event(DateComposite date, TimeComposite time, Action action) =>
 Event(date, time, (n, d) => action());
示例#5
0
 /// <summary>
 /// Add new scheduled action
 /// </summary>
 /// <param name="date"></param>
 /// <param name="time"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public ScheduledEventAction Event(DateComposite date, TimeComposite time, Action <string, DateTime> action) =>
 Event(date, time, action);
示例#6
0
 /// <summary>
 /// Schedules the specified action.
 /// </summary>
 /// <param name="date">The date.</param>
 /// <param name="time">The time.</param>
 /// <param name="action">The action.</param>
 /// <returns></returns>
 public ScheduledEventAction Schedule(DateComposite date, TimeComposite time, Action <string, DateTime> action) =>
 QuantFund.Portfolio.ActionsScheduler.ScheduledActionsKeeper.Add(new ScheduledAction(QuantFund, date, time, action));
示例#7
0
 /// <summary>
 /// Schedules the specified action.
 /// </summary>
 /// <param name="date">The date.</param>
 /// <param name="time">The time.</param>
 /// <param name="action">The action.</param>
 /// <returns></returns>
 public ScheduledEventAction Schedule(DateComposite date, TimeComposite time, Action action) =>
 QuantFund.Portfolio.ActionsScheduler.ScheduledActionsKeeper.Add(new ScheduledAction(QuantFund, date, time,
                                                                                     (n, d) => action()));
示例#8
0
 /// <summary>
 /// Initialize new scheduled action instance
 /// </summary>
 /// <param name="quantfund"></param>
 /// <param name="date"></param>
 /// <param name="time"></param>
 /// <param name="action"></param>
 /// <param name="name"></param>
 public ScheduledAction(IQuantFund quantfund, DateComposite date, TimeComposite time, Action <string, DateTime> action, string name = "")
     : this(date, time, action, name) => FundId = quantfund.FundId;