/// <summary> /// Applies the split to the specified order ticket /// </summary> /// <remarks> /// This default implementation will update the orders to maintain a similar market value /// </remarks> /// <param name="tickets">The open tickets matching the split event</param> /// <param name="split">The split event data</param> public virtual void ApplySplit(List<OrderTicket> tickets, Split split) { // by default we'll just update the orders to have the same notional value var splitFactor = split.SplitFactor; tickets.ForEach(ticket => ticket.Update(new UpdateOrderFields { Quantity = (int?) (ticket.Quantity/splitFactor), LimitPrice = ticket.OrderType.IsLimitOrder() ? ticket.Get(OrderField.LimitPrice)*splitFactor : (decimal?) null, StopPrice = ticket.OrderType.IsStopOrder() ? ticket.Get(OrderField.StopPrice)*splitFactor : (decimal?) null })); }
public IntraDayDividendSplit(Split split, Dividend dividend) { if (split == null) throw new ArgumentNullException("split"); if (dividend == null) throw new ArgumentNullException("dividend"); Split = split; Dividend = dividend; Time = Split.Time; }
/// <summary> /// Applies the split to the specified order ticket /// </summary> /// <param name="tickets">The open tickets matching the split event</param> /// <param name="split">The split event data</param> public override void ApplySplit(List<OrderTicket> tickets, Split split) { // tradier cancels reverse splits var splitFactor = split.SplitFactor; if (splitFactor > 1.0m) { tickets.ForEach(ticket => ticket.Cancel("Tradier Brokerage cancels open orders on reverse split symbols")); } else { base.ApplySplit(tickets, split); } }
private void OnLevel1FundamentalEvent(object sender, Level1FundamentalEventArgs e) { // handle split data, they're only valid today, they'll show up around 4:45am EST if (e.SplitDate1.Date == DateTime.Today && DateTime.Now.TimeOfDay.TotalHours <= 8) // they will always be sent premarket { // get the last price, if it doesn't exist then we'll just issue the split claiming the price was zero // this should (ideally) never happen, but sending this without the price is much better then not sending // it at all double referencePrice; _prices.TryGetValue(e.Symbol, out referencePrice); var sid = SecurityIdentifier.GenerateEquity(e.Symbol, Market.USA); var split = new Split(new Symbol(sid, e.Symbol), FeedTime, (decimal) referencePrice, (decimal) e.SplitFactor1); _dataQueue.Add(split); } }