/// <summary> /// Adds new LimitOrder to list /// If validation of order is successful it sends NewArrived Message. /// In case of failure it sends sends rejection. /// </summary> public void NewLimitOrderArrived(LimitOrder limitOrder) { try { if (ValidateMarketOrder(limitOrder)) { var order = new Order(limitOrder.OrderID, limitOrder.OrderSide, limitOrder.OrderSize, limitOrder.OrderTif, limitOrder.OrderCurrency, limitOrder.Security, limitOrder.OrderExecutionProvider); if (Logger.IsInfoEnabled) { Logger.Info("New Arrived :" + order, _type.FullName, "NewLimitOrderArrived"); } if (NewArrived != null) { NewArrived.Invoke(order); } // Execute Limit Order ExecuteLimitOrder(limitOrder); //// Add to List //_limitOrders.Add(limitOrder); } else { Rejection rejection = new Rejection(limitOrder.Security, OrderExecutionProvider.SimulatedExchange) { OrderId = limitOrder.OrderID, DateTime = DateTime.Now, RejectioReason = "Invaild Price Or Size" }; if (Logger.IsInfoEnabled) { Logger.Info("Rejection :" + rejection, _type.FullName, "NewLimitOrderArrived"); } if (LimitOrderRejection != null) { LimitOrderRejection.Invoke(rejection); } } } catch (Exception exception) { Logger.Error(exception, _type.FullName, "NewLimitOrderArrived"); } }
/// <summary> /// New Arrived /// </summary> /// <param name="obj"></param> private void NewOrderArrived(Order obj) { try { if (Logger.IsInfoEnabled) { Logger.Info(obj.ToString(), _type.FullName, "NewOrderArrived"); } if (NewArrived != null) { NewArrived.Invoke(obj); } } catch (Exception exception) { Logger.Error(exception, _type.FullName, "NewOrderArrived"); } }