public OrderTrailingStop PlaceOrderTrailingStop(Symbol symbol, OrderSide side, decimal quantity, int lagTicks, Action <OrderBase> orderStatusHandler = null, Action <OrderBase, ErrorCodes> errorHandler = null) { OrderTrailingStop order = new OrderTrailingStop(side, quantity, _orderBooks[symbol].AdjustedSpotPrice, lagTicks, symbol, this); return(_sender.PlaceOrderTrailingStop(order, orderStatusHandler, errorHandler)); }
internal OrderTrailingStop PlaceOrderTrailingStop(OrderTrailingStop order, Action <OrderBase> orderStatusHandler = null, Action <OrderBase, ErrorCodes> errorHandler = null) { if (!_connection.IsControlConnected()) { return(null); } order.OrderStatusChanged += orderStatusHandler; order.ErrorEvent += errorHandler; _trailingsLock.EnterWriteLock(); try { _trailingOrders.Add(order); } finally { _trailingsLock.ExitWriteLock(); } return(order); }