/// <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); }
/// <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; }
/// <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);
/// <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());
/// <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);
/// <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));
/// <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()));
/// <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;