Ejemplo n.º 1
0
            protected override void SendOrder(IEnumerable <string> receivers, ExecutionMessage order)
            {
                if (order.OrderType == OrderTypes.Conditional)
                {
                    var fixMsg = order.ToExecutionReport <StopOrderExecutionReport>(order.TransactionId == 0 ? (long?)null : GetRequestId(order.TransactionId), GetRequestId(order.OriginalTransactionId));

                    var condition = (QuikOrderCondition)order.Condition;

                    if (condition.Type != null)
                    {
                        fixMsg.Type = new StopOrderExecutionReport.TypeField((int)condition.Type);
                    }

                    if (condition.StopPriceCondition != null)
                    {
                        fixMsg.StopPriceCondition = new StopOrderExecutionReport.StopPriceConditionField((int)condition.StopPriceCondition);
                    }

                    if (condition.ConditionOrderSide != null)
                    {
                        fixMsg.ConditionOrderSide = new StopOrderExecutionReport.ConditionOrderSideField((int)condition.ConditionOrderSide);
                    }

                    if (condition.LinkedOrderCancel != null)
                    {
                        fixMsg.LinkedOrderCancel = new StopOrderExecutionReport.LinkedOrderCancelField(condition.LinkedOrderCancel.Value);
                    }

                    if (condition.Result != null)
                    {
                        fixMsg.Result = new StopOrderExecutionReport.ResultField((int)condition.Result);
                    }

                    if (condition.OtherSecurityId != null)
                    {
                        fixMsg.OtherSecurityCode = new StopOrderExecutionReport.OtherSecurityCodeField(condition.OtherSecurityId.Value.SecurityCode);
                    }

                    if (condition.StopPrice != null)
                    {
                        fixMsg.StopPx = new StopPx(condition.StopPrice.Value);
                    }

                    if (condition.StopLimitPrice != null)
                    {
                        fixMsg.StopLimitPrice = new StopOrderExecutionReport.StopLimitPriceField(condition.StopLimitPrice.Value);
                    }

                    if (condition.IsMarketStopLimit != null)
                    {
                        fixMsg.IsMarketStopLimit = new StopOrderExecutionReport.IsMarketStopLimitField(condition.IsMarketStopLimit.Value);
                    }

                    if (condition.ActiveTime != null)
                    {
                        fixMsg.ActiveTimeFrom = new StopOrderExecutionReport.ActiveTimeFromField(condition.ActiveTime.Min.UtcDateTime);
                        fixMsg.ActiveTimeTo   = new StopOrderExecutionReport.ActiveTimeToField(condition.ActiveTime.Min.UtcDateTime);
                    }

                    if (condition.ConditionOrderId != null)
                    {
                        fixMsg.ConditionOrderId = new StopOrderExecutionReport.ConditionOrderIdField((int)condition.ConditionOrderId);
                    }

                    if (condition.ConditionOrderPartiallyMatched != null)
                    {
                        fixMsg.ConditionOrderPartiallyMatched = new StopOrderExecutionReport.ConditionOrderPartiallyMatchedField(condition.ConditionOrderPartiallyMatched.Value);
                    }

                    if (condition.ConditionOrderUseMatchedBalance != null)
                    {
                        fixMsg.ConditionOrderUseMatchedBalance = new StopOrderExecutionReport.ConditionOrderUseMatchedBalanceField(condition.ConditionOrderUseMatchedBalance.Value);
                    }

                    if (condition.LinkedOrderPrice != null)
                    {
                        fixMsg.LinkedOrderPrice = new StopOrderExecutionReport.LinkedOrderPriceField(condition.LinkedOrderPrice.Value);
                    }

                    if (condition.Offset != null)
                    {
                        fixMsg.Offset = new StopOrderExecutionReport.OffsetField(condition.Offset.ToString());
                    }

                    if (condition.Spread != null)
                    {
                        fixMsg.StopSpread = new StopOrderExecutionReport.SpreadField(condition.Spread.ToString());
                    }

                    if (condition.IsMarketTakeProfit != null)
                    {
                        fixMsg.IsMarketTakeProfit = new StopOrderExecutionReport.IsMarketTakeProfitField(condition.IsMarketTakeProfit.Value);
                    }

                    SendMessage(receivers, false, fixMsg);
                }
                else
                {
                    base.SendOrder(receivers, order);
                }
            }