コード例 #1
0
        public static OrderStatus Convert(OrdStatus ordStatus)
        {
            switch (ordStatus.Obj)
            {
            case ExecType.NEW:
                return(OrderStatus.New);

            case ExecType.PARTIAL_FILL:
                return(OrderStatus.Partial);

            case ExecType.FILL:
                return(OrderStatus.Filled);

            case ExecType.CANCELED:
                return(OrderStatus.Canceled);

            case ExecType.REPLACED:
                return(OrderStatus.Replaced);

            case ExecType.REJECTED:
                return(OrderStatus.Rejected);

            case ExecType.SUSPENDED:
                return(OrderStatus.Suspended);

            case ExecType.TRADE:
                return(OrderStatus.Traded);
            }
            return(OrderStatus.Unknown);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderExecutionReport" /> class.
 /// </summary>
 /// <param name="exchangeId">Exchange identifier used to identify the routing destination. (required).</param>
 /// <param name="clientOrderId">The unique identifier of the order assigned by the client. (required).</param>
 /// <param name="symbolIdExchange">Exchange symbol. One of the properties (&#x60;symbol_id_exchange&#x60;, &#x60;symbol_id_coinapi&#x60;) is required to identify the market for the new order..</param>
 /// <param name="symbolIdCoinapi">CoinAPI symbol. One of the properties (&#x60;symbol_id_exchange&#x60;, &#x60;symbol_id_coinapi&#x60;) is required to identify the market for the new order..</param>
 /// <param name="amountOrder">Order quantity. (required).</param>
 /// <param name="price">Order price. (required).</param>
 /// <param name="side">side (required).</param>
 /// <param name="orderType">orderType (required).</param>
 /// <param name="timeInForce">timeInForce (required).</param>
 /// <param name="expireTime">Expiration time. Conditionaly required for orders with time_in_force &#x3D; &#x60;GOOD_TILL_TIME_EXCHANGE&#x60; or &#x60;GOOD_TILL_TIME_OEML&#x60;..</param>
 /// <param name="execInst">Order execution instructions are documented in the separate section: &lt;a href&#x3D;\&quot;#oeml-order-params-exec\&quot;&gt;OEML / Starter Guide / Order parameters / Execution instructions&lt;/a&gt; .</param>
 /// <param name="clientOrderIdFormatExchange">The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it. (required).</param>
 /// <param name="exchangeOrderId">Unique identifier of the order assigned by the exchange or executing system..</param>
 /// <param name="amountOpen">Quantity open for further execution. &#x60;amount_open&#x60; &#x3D; &#x60;amount_order&#x60; - &#x60;amount_filled&#x60; (required).</param>
 /// <param name="amountFilled">Total quantity filled. (required).</param>
 /// <param name="status">status (required).</param>
 /// <param name="timeOrder">Timestamped history of order status changes. (required).</param>
 /// <param name="errorMessage">Error message.</param>
 public OrderExecutionReport(string exchangeId = default(string), string clientOrderId = default(string), string symbolIdExchange = default(string), string symbolIdCoinapi = default(string), decimal amountOrder = default(decimal), decimal price = default(decimal), OrdSide side = default(OrdSide), OrdType orderType = default(OrdType), TimeInForce timeInForce = default(TimeInForce), DateTime expireTime = default(DateTime), List <ExecInstEnum> execInst = default(List <ExecInstEnum>), string clientOrderIdFormatExchange = default(string), string exchangeOrderId = default(string), decimal amountOpen = default(decimal), decimal amountFilled = default(decimal), OrdStatus status = default(OrdStatus), List <List <string> > timeOrder = default(List <List <string> >), string errorMessage = default(string))
 {
     // to ensure "exchangeId" is required (not null)
     this.ExchangeId = exchangeId ?? throw new ArgumentNullException("exchangeId is a required property for OrderExecutionReport and cannot be null");
     // to ensure "clientOrderId" is required (not null)
     this.ClientOrderId = clientOrderId ?? throw new ArgumentNullException("clientOrderId is a required property for OrderExecutionReport and cannot be null");
     this.AmountOrder   = amountOrder;
     this.Price         = price;
     this.Side          = side;
     this.OrderType     = orderType;
     this.TimeInForce   = timeInForce;
     // to ensure "clientOrderIdFormatExchange" is required (not null)
     this.ClientOrderIdFormatExchange = clientOrderIdFormatExchange ?? throw new ArgumentNullException("clientOrderIdFormatExchange is a required property for OrderExecutionReport and cannot be null");
     this.AmountOpen   = amountOpen;
     this.AmountFilled = amountFilled;
     this.Status       = status;
     // to ensure "timeOrder" is required (not null)
     this.TimeOrder        = timeOrder ?? throw new ArgumentNullException("timeOrder is a required property for OrderExecutionReport and cannot be null");
     this.SymbolIdExchange = symbolIdExchange;
     this.SymbolIdCoinapi  = symbolIdCoinapi;
     this.ExpireTime       = expireTime;
     this.ExecInst         = execInst;
     this.ExchangeOrderId  = exchangeOrderId;
     this.ErrorMessage     = errorMessage;
 }
コード例 #3
0
        public OrderCancelRejectWrapper(string pOrderId, string pOrigClOrderId, string pClOrderId,
                                        OrdStatus pOrdStatus, Side pSide, decimal?pPrice, decimal pOrdQty,
                                        decimal pLeftQty,
                                        DateTime pTransactTime,
                                        CxlRejReason pCxlRejReason,
                                        string pText, string pSymbol)
        {
            OrderId = pOrderId;

            OrigClOrderId = pOrigClOrderId;

            ClOrderId = pClOrderId;

            OrdStatus = pOrdStatus;

            Side = pSide;

            Price = pPrice;

            OrdQty = pOrdQty;

            LeftQty = pLeftQty;

            TransactTime = pTransactTime;

            CxlRejReason = pCxlRejReason;

            Text = pText;

            Symbol = pSymbol;
        }
コード例 #4
0
ファイル: EnumConverter.cs プロジェクト: heber/FreeOQ
		internal static OrderStatus Convert(OrdStatus status)
		{
			switch (status)
			{
				case OrdStatus.New:
					return OrderStatus.New;
				case OrdStatus.PartiallyFilled:
					return OrderStatus.PartiallyFilled;
				case OrdStatus.Filled:
					return OrderStatus.Filled;
				case OrdStatus.Cancelled:
					return OrderStatus.Cancelled;
				case OrdStatus.Replaced:
					return OrderStatus.Replaced;
				case OrdStatus.PendingCancel:
					return OrderStatus.PendingCancel;
				case OrdStatus.Rejected:
					return OrderStatus.Rejected;
				case OrdStatus.PendingNew:
					return OrderStatus.PendingNew;
				case OrdStatus.Expired:
					return OrderStatus.Expired;
				case OrdStatus.PendingReplace:
					return OrderStatus.PendingReplace;
				default:
					throw new ArgumentException(string.Format("Unsupported OrdStatus - {0}", status));
			}
		}
コード例 #5
0
        private static ExecType GetExecType(OrdStatus status)
        {
            switch (status)
            {
            case OrdStatus.New:
                return(ExecType.New);

            case OrdStatus.PartiallyFilled:
                return(ExecType.PartialFill);

            case OrdStatus.Filled:
                return(ExecType.Fill);

            case OrdStatus.Cancelled:
                return(ExecType.Cancelled);

            case OrdStatus.Replaced:
                return(ExecType.Replace);

            case OrdStatus.PendingCancel:
                return(ExecType.PendingCancel);

            case OrdStatus.Rejected:
                return(ExecType.Rejected);

            case OrdStatus.PendingReplace:
                return(ExecType.PendingReplace);

            case OrdStatus.Expired:
                return(ExecType.Expired);
            }
            throw new ArgumentException(string.Format("Cannot find exec type for ord status - {0}", status));
        }
コード例 #6
0
		internal static OrderStatus Convert(OrdStatus status)
		{
			switch (status)
			{
			case OrdStatus.New:
				return OrderStatus.New;
			case OrdStatus.PartiallyFilled:
				return OrderStatus.PartiallyFilled;
			case OrdStatus.Filled:
				return OrderStatus.Filled;
			case OrdStatus.Cancelled:
				return OrderStatus.Cancelled;
			case OrdStatus.Replaced:
				return OrderStatus.Replaced;
			case OrdStatus.PendingCancel:
				return OrderStatus.PendingCancel;
			case OrdStatus.Rejected:
				return OrderStatus.Rejected;
			case OrdStatus.PendingNew:
				return OrderStatus.PendingNew;
			case OrdStatus.Expired:
				return OrderStatus.Expired;
			case OrdStatus.PendingReplace:
				return OrderStatus.PendingReplace;
			}
			throw new NotImplementedException("OrderStatus is not supported : " + status);
		}
コード例 #7
0
 public static char GetStatus(OrdStatus status)
 {
     if (status == OrdStatus.AcceptedForBidding || status == OrdStatus.Calculated || status == OrdStatus.New ||
         status == OrdStatus.PendingCancel || status == OrdStatus.PendingNew || status == OrdStatus.PendingReplace ||
         status == OrdStatus.Replaced)
     {
         return(_STATUS_OPEN);
     }
     else if (status == OrdStatus.Canceled)
     {
         return(_STATUS_CANCELED);
     }
     else if (status == OrdStatus.Rejected || status == OrdStatus.Suspended)
     {
         return(_STATUS_REJECTED);
     }
     else if (status == OrdStatus.Filled)
     {
         return(_STATUS_FILLED);
     }
     else if (status == OrdStatus.PartiallyFilled)
     {
         return /*_STATUS_PARTIALLY_FILLED*/ (_STATUS_OPEN);
     }
     else if (status == OrdStatus.Expired || status == OrdStatus.DoneForDay)
     {
         return(_STATUS_EXPIRED);
     }
     else
     {
         throw new Exception(string.Format("Unkwnown order status: {0}", status.ToString()));
     }
 }
コード例 #8
0
        internal void SetOrderDone(SingleOrder order)
        {
            OrdStatus ordStatus = order.OrdStatus;

            switch (ordStatus)
            {
            case OrdStatus.Filled:
                this.OnOrderFilled(order);
                break;

            case OrdStatus.DoneForDay:
                break;

            case OrdStatus.Cancelled:
                this.OnOrderCancelled(order);
                break;

            default:
                if (ordStatus == OrdStatus.Rejected)
                {
                    this.OnOrderRejected(order);
                }
                break;
            }
            this.OnOrderDone(order);
        }
コード例 #9
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (OrdID?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdOrderID_Remote?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdOrderExternalCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdOrderDescr?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdRegDateTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDateTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDeliveryDateTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDepositorCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDepositorFullName?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdCustomerCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdCustomerFullName?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdStatus?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdMemo?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdPurpose?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDeliveryValue?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDeliveryNotes?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdIsReturn?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdPrdTypeDescr?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdWrhRoutingCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDlsId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDlsDescr?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDlsAddress?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDlsZipCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDlsCity?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdDlsArea?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdRoutingStatus?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdWeight?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdVol?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdCtn?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdBar?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdPalEuro?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdPalInd?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdPalElsa?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdParOU?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLfdVar?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVoucherDateTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVoucherNumber?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVoucherSeries?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVoucherId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdAgencyCode?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdAgencyDescr?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdAgencyAddress?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdTelRouteId?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVchPlateNr?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVchRouteNr?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVhrDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdVhrID?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdLastUpdateDateTime?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrdReadyForLoading?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Warehouse?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (WarehouseAddress?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Polyline?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (OrderDTOKey?.GetHashCode() ?? 0);
            return(hashCode);
        }
コード例 #10
0
ファイル: FIXOrdStatus.cs プロジェクト: zhuzhenping/FreeOQ
        public static char ToFIX(OrdStatus ordStatus)
        {
            switch (ordStatus)
            {
            case OrdStatus.Undefined:
                return(char.MinValue);

            case OrdStatus.New:
                return('0');

            case OrdStatus.PartiallyFilled:
                return('1');

            case OrdStatus.Filled:
                return('2');

            case OrdStatus.DoneForDay:
                return('3');

            case OrdStatus.Cancelled:
                return('4');

            case OrdStatus.Replaced:
                return('5');

            case OrdStatus.PendingCancel:
                return('6');

            case OrdStatus.Stopped:
                return('7');

            case OrdStatus.Rejected:
                return('8');

            case OrdStatus.Suspended:
                return('9');

            case OrdStatus.PendingNew:
                return('A');

            case OrdStatus.Calculated:
                return('B');

            case OrdStatus.Expired:
                return('C');

            case OrdStatus.AcceptedForBidding:
                return('D');

            case OrdStatus.PendingReplace:
                return('E');

            default:
                throw new ArgumentException("unknown: " + ((object)ordStatus).ToString());
            }
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderExecutionReportAllOf" /> class.
        /// </summary>
        /// <param name="clientOrderIdFormatExchange">The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it. (required).</param>
        /// <param name="exchangeOrderId">Unique identifier of the order assigned by the exchange or executing system..</param>
        /// <param name="amountOpen">Quantity open for further execution. &#x60;amount_open&#x60; &#x3D; &#x60;amount_order&#x60; - &#x60;amount_filled&#x60; (required).</param>
        /// <param name="amountFilled">Total quantity filled. (required).</param>
        /// <param name="status">status (required).</param>
        /// <param name="timeOrder">Timestamped history of order status changes. (required).</param>
        /// <param name="errorMessage">Error message.</param>
        public OrderExecutionReportAllOf(string clientOrderIdFormatExchange = default(string), string exchangeOrderId = default(string), decimal amountOpen = default(decimal), decimal amountFilled = default(decimal), OrdStatus status = default(OrdStatus), List <List <string> > timeOrder = default(List <List <string> >), string errorMessage = default(string))
        {
            // to ensure "clientOrderIdFormatExchange" is required (not null)
            if (clientOrderIdFormatExchange == null)
            {
                throw new InvalidDataException("clientOrderIdFormatExchange is a required property for OrderExecutionReportAllOf and cannot be null");
            }
            else
            {
                this.ClientOrderIdFormatExchange = clientOrderIdFormatExchange;
            }

            // to ensure "amountOpen" is required (not null)
            if (amountOpen == null)
            {
                throw new InvalidDataException("amountOpen is a required property for OrderExecutionReportAllOf and cannot be null");
            }
            else
            {
                this.AmountOpen = amountOpen;
            }

            // to ensure "amountFilled" is required (not null)
            if (amountFilled == null)
            {
                throw new InvalidDataException("amountFilled is a required property for OrderExecutionReportAllOf and cannot be null");
            }
            else
            {
                this.AmountFilled = amountFilled;
            }

            // to ensure "status" is required (not null)
            if (status == null)
            {
                throw new InvalidDataException("status is a required property for OrderExecutionReportAllOf and cannot be null");
            }
            else
            {
                this.Status = status;
            }

            // to ensure "timeOrder" is required (not null)
            if (timeOrder == null)
            {
                throw new InvalidDataException("timeOrder is a required property for OrderExecutionReportAllOf and cannot be null");
            }
            else
            {
                this.TimeOrder = timeOrder;
            }

            this.ExchangeOrderId = exchangeOrderId;
            this.ErrorMessage    = errorMessage;
        }
コード例 #12
0
        public override string ToString()
        {
            OrdStatus ordStatus = GetOrdStatus(ExecutionReport.GetChar(QuickFix.Fields.Tags.OrdStatus));
            ExecType? execType  = GetExecType(ExecutionReport.GetChar(QuickFix.Fields.Tags.ExecType));
            string    symbol    = FixHelper.GetNullFieldIfSet(ExecutionReport, QuickFix.Fields.Tags.Symbol);
            string    exchange  = "";


            return(string.Format("Execution Report for symbol {2}: Order Status={0} - Exec Type={1}",
                                 ordStatus.ToString(), execType.ToString(), symbol));
        }
コード例 #13
0
 private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission)
 {
     SmartQuant.FIX.ExecutionReport executionReport = new SmartQuant.FIX.ExecutionReport();
     executionReport.TransactTime     = Clock.Now;
     executionReport.ClOrdID          = record.Order.ClOrdID;
     executionReport.OrigClOrdID      = record.Order.ClOrdID;
     executionReport.OrderID          = record.Order.OrderID;
     executionReport.Symbol           = record.Order.Symbol;
     executionReport.SecurityType     = record.Order.SecurityType;
     executionReport.SecurityExchange = record.Order.SecurityExchange;
     executionReport.Currency         = record.Order.Currency;
     executionReport.CommType         = commType;
     executionReport.Commission       = commission;
     executionReport.Side             = record.Order.Side;
     if (ordStatus == OrdStatus.Replaced)
     {
         executionReport.OrdType     = (record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : record.Order.OrdType);
         executionReport.TimeInForce = (record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : record.Order.TimeInForce);
         executionReport.OrderQty    = (record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : record.Order.OrderQty);
         executionReport.Price       = (record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : record.Order.Price);
         executionReport.StopPx      = (record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : record.Order.StopPx);
         record.LeavesQty            = (int)executionReport.OrderQty - record.CumQty;
     }
     else
     {
         executionReport.OrdType     = record.Order.OrdType;
         executionReport.TimeInForce = record.Order.TimeInForce;
         executionReport.OrderQty    = record.Order.OrderQty;
         executionReport.Price       = record.Order.Price;
         executionReport.StopPx      = record.Order.StopPx;
     }
     executionReport.LastPx  = lastPx;
     executionReport.LastQty = (double)lastQty;
     if (ordStatus == OrdStatus.Undefined)
     {
         record.AddFill(lastPx, lastQty);
         if (record.LeavesQty > 0)
         {
             ordStatus = OrdStatus.PartiallyFilled;
         }
         else
         {
             ordStatus = OrdStatus.Filled;
         }
     }
     executionReport.AvgPx     = record.AvgPx;
     executionReport.CumQty    = (double)record.CumQty;
     executionReport.LeavesQty = (double)record.LeavesQty;
     executionReport.ExecType  = this.GetExecType(ordStatus);
     executionReport.OrdStatus = ordStatus;
     executionReport.Text      = text;
     this.EmitExecutionReport(executionReport);
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderExecutionReportAllOf" /> class.
 /// </summary>
 /// <param name="clientOrderIdFormatExchange">The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it. (required).</param>
 /// <param name="exchangeOrderId">Unique identifier of the order assigned by the exchange or executing system..</param>
 /// <param name="amountOpen">Quantity open for further execution. &#x60;amount_open&#x60; &#x3D; &#x60;amount_order&#x60; - &#x60;amount_filled&#x60; (required).</param>
 /// <param name="amountFilled">Total quantity filled. (required).</param>
 /// <param name="status">status (required).</param>
 /// <param name="timeOrder">Timestamped history of order status changes. (required).</param>
 /// <param name="errorMessage">Error message.</param>
 public OrderExecutionReportAllOf(string clientOrderIdFormatExchange = default(string), string exchangeOrderId = default(string), decimal amountOpen = default(decimal), decimal amountFilled = default(decimal), OrdStatus status = default(OrdStatus), List <List <string> > timeOrder = default(List <List <string> >), string errorMessage = default(string))
 {
     // to ensure "clientOrderIdFormatExchange" is required (not null)
     this.ClientOrderIdFormatExchange = clientOrderIdFormatExchange ?? throw new ArgumentNullException("clientOrderIdFormatExchange is a required property for OrderExecutionReportAllOf and cannot be null");
     this.AmountOpen   = amountOpen;
     this.AmountFilled = amountFilled;
     this.Status       = status;
     // to ensure "timeOrder" is required (not null)
     this.TimeOrder       = timeOrder ?? throw new ArgumentNullException("timeOrder is a required property for OrderExecutionReportAllOf and cannot be null");
     this.ExchangeOrderId = exchangeOrderId;
     this.ErrorMessage    = errorMessage;
 }
コード例 #15
0
ファイル: OrderManager.cs プロジェクト: zhuzhenping/FreeOQ
        private static void OnOrderCancelReject(object sender, OrderCancelRejectEventArgs e)
        {
            OrderCancelReject orderCancelReject = e.OrderCancelReject;
            SingleOrder       order             = OrderManager.orders.All[orderCancelReject.OrigClOrdID] as SingleOrder;

            if (orderCancelReject.OrdStatus == OrdStatus.Undefined)
            {
                orderCancelReject.OrdStatus = OrdStatus.New;
                ArrayList arrayList = new ArrayList((ICollection)order.Reports);
                arrayList.Reverse();
                foreach (ExecutionReport executionReport in arrayList)
                {
                    switch (executionReport.OrdStatus)
                    {
                    case OrdStatus.PendingCancel:
                    case OrdStatus.PendingNew:
                    case OrdStatus.PendingReplace:
                        continue;

                    default:
                        orderCancelReject.OrdStatus = executionReport.OrdStatus;
                        goto label_10;
                    }
                }
            }
label_10:
            OrdStatus ordStatus = order.OrdStatus;

            order.EmitCancelReject(orderCancelReject);
            if (OrderManager.OrderCancelReject != null)
            {
                OrderManager.OrderCancelReject(sender, new OrderCancelRejectEventArgs(order, orderCancelReject));
            }
            if (order.IsDone)
            {
                if (!OrderManager.EnablePartialTransactions)
                {
                    OrderManager.nf3XP7Xf3(order, orderCancelReject.TransactTime, order.AvgPx, order.CumQty);
                }
                OrderManager.YUArMfFNj(order);
            }
            else
            {
                if (ordStatus == order.OrdStatus)
                {
                    return;
                }
                OrderManager.orders.Update(order);
                order.EmitStatusChanged();
                OrderManager.EmitOrderStatusChanged(order);
            }
        }
コード例 #16
0
        public OrderList GetOrderList(OrdStatus ordStatus)
        {
            OrderList orderList = new OrderList();

            foreach (SingleOrder singleOrder in this.allOrders)
            {
                if (singleOrder.OrdStatus == ordStatus)
                {
                    orderList.Add(singleOrder);
                }
            }
            return(orderList);
        }
コード例 #17
0
ファイル: FQProvider.cs プロジェクト: zhuzhenping/FreeOQ
        private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text)
        {
            OrderCancelReject reject = new OrderCancelReject();

            reject.TransactTime     = Clock.Now;
            reject.ClOrdID          = ((FIXNewOrderSingle)record.Order).ClOrdID;
            reject.OrigClOrdID      = ((FIXNewOrderSingle)record.Order).ClOrdID;
            reject.OrdStatus        = ordStatus;
            reject.CxlRejResponseTo = responseTo;
            reject.CxlRejReason     = CxlRejReason.BrokerOption;
            reject.Text             = text;
            this.EmitOrderCancelReject(reject);
        }
コード例 #18
0
 private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text)
 {
     this.EmitOrderCancelReject(new OrderCancelReject
     {
         TransactTime     = Clock.Now,
         ClOrdID          = record.Order.ClOrdID,
         OrigClOrdID      = record.Order.ClOrdID,
         OrdStatus        = ordStatus,
         CxlRejResponseTo = responseTo,
         CxlRejReason     = CxlRejReason.BrokerOption,
         Text             = text
     });
 }
コード例 #19
0
        public override void onMessage(QuickFix44.ExecutionReport message, SessionID session)
        {
            OrderID   orderID   = message.getOrderID();
            ClOrdID   clOrdID   = message.getClOrdID();
            OrdStatus ordStatus = message.getOrdStatus();
            Symbol    symbol    = message.getSymbol();

            // firing event

            Console.WriteLine("QuickFix44.ExecutionReport: {0}, {1}, {2}, {3}", orderID, clOrdID, ordStatus, symbol);

            this.fixServices.NotifyExecutionInfo(Counterpart.Dukascopy, DataAdaptors.AdaptExecutionReport(new DukascopyExecutionReportToAdapt(message)));
        }
コード例 #20
0
        protected void EmitCancelReject(SingleOrder order, OrdStatus status, string message)
        {
            OrderCancelReject reject = new OrderCancelReject
            {
                TransactTime = Clock.Now,
                ClOrdID      = order.ClOrdID,
                OrigClOrdID  = order.ClOrdID,
                OrderID      = order.OrderID,

                CxlRejReason     = CxlRejReason.BrokerOption,
                CxlRejResponseTo = CxlRejResponseTo.CancelRequest,
                OrdStatus        = status
            };

            EmitOrderCancelReject(reject);
        }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderExecutionReportAllOf" /> class.
 /// </summary>
 /// <param name="clientOrderIdFormatExchange">The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it. (required).</param>
 /// <param name="exchangeOrderId">Unique identifier of the order assigned by the exchange or executing system..</param>
 /// <param name="amountOpen">Quantity open for further execution. &#x60;amount_open&#x60; &#x3D; &#x60;amount_order&#x60; - &#x60;amount_filled&#x60; (required).</param>
 /// <param name="amountFilled">Total quantity filled. (required).</param>
 /// <param name="avgPx">Calculated average price of all fills on this order..</param>
 /// <param name="status">status (required).</param>
 /// <param name="statusHistory">Timestamped history of order status changes..</param>
 /// <param name="errorMessage">Error message..</param>
 /// <param name="fills">Relay fill information on working orders..</param>
 public OrderExecutionReportAllOf(string clientOrderIdFormatExchange = default(string), string exchangeOrderId = default(string), decimal amountOpen = default(decimal), decimal amountFilled = default(decimal), decimal avgPx = default(decimal), OrdStatus status = default(OrdStatus), List <List <string> > statusHistory = default(List <List <string> >), string errorMessage = default(string), List <Fills> fills = default(List <Fills>))
 {
     // to ensure "clientOrderIdFormatExchange" is required (not null)
     if (clientOrderIdFormatExchange == null)
     {
         throw new ArgumentNullException("clientOrderIdFormatExchange is a required property for OrderExecutionReportAllOf and cannot be null");
     }
     this.ClientOrderIdFormatExchange = clientOrderIdFormatExchange;
     this.AmountOpen      = amountOpen;
     this.AmountFilled    = amountFilled;
     this.Status          = status;
     this.ExchangeOrderId = exchangeOrderId;
     this.AvgPx           = avgPx;
     this.StatusHistory   = statusHistory;
     this.ErrorMessage    = errorMessage;
     this.Fills           = fills;
 }
コード例 #22
0
ファイル: OrderBook.cs プロジェクト: VirtuFinancial/FixClient
        void ProcessOrdStatusUpdate(Message message, Order order, OrdStatus status)
        {
            if (order.OrdStatus != OrdStatus.PendingReplace || (order.OrdStatus == OrdStatus.PendingReplace && status != OrdStatus.PendingCancel))
            {
                order.OrdStatus = status;
            }

            if (order.OrdStatus != Fix.OrdStatus.PendingCancel &&
                order.OrdStatus != Fix.OrdStatus.PendingReplace &&
                order.OrdStatus != Fix.OrdStatus.Replaced)
            {
                UpdateOrder(order, message);
            }
            else
            {
                Field ExecType = message.Fields.Find(Dictionary.Fields.ExecType);

                if (ExecType != null)
                {
                    //
                    // Use hardcoded values for ExecType because values were removed in later releases and we don't want the
                    // conversion to explode.
                    //
                    if (ExecType.Value == "1" /* Partial */ || ExecType.Value == "2" /* Fill */)
                    {
                        UpdateOrder(order, message);
                    }
                }
            }

            if (order.OrdStatus == Fix.OrdStatus.Replaced)
            {
                order.LeavesQty       = 0;
                order.PendingOrderQty = null;
                order.PendingPrice    = null;
            }

            order.Messages.Add(message);
            OnOrderUpdated(order);

            if (DeleteInactiveOrders && !order.Active)
            {
                DeleteOrder(order);
                OnOrderDeleted(order);
            }
        }
コード例 #23
0
ファイル: FQProvider.cs プロジェクト: zhuzhenping/FreeOQ
 private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission)
 {
     FreeQuant.FIX.ExecutionReport report = new FreeQuant.FIX.ExecutionReport();
     report.TransactTime     = Clock.Now;
     report.ClOrdID          = ((FIXNewOrderSingle)record.Order).ClOrdID;
     report.OrigClOrdID      = ((FIXNewOrderSingle)record.Order).ClOrdID;
     report.OrderID          = record.Order.OrderID;
     report.Symbol           = ((FIXNewOrderSingle)record.Order).Symbol;
     report.SecurityType     = ((FIXNewOrderSingle)record.Order).SecurityType;
     report.SecurityExchange = ((FIXNewOrderSingle)record.Order).SecurityExchange;
     report.Currency         = ((FIXNewOrderSingle)record.Order).Currency;
     report.CommType         = commType;
     report.Commission       = commission;
     report.Side             = ((NewOrderSingle)record.Order).Side;
     if (ordStatus == OrdStatus.Replaced)
     {
         report.OrdType     = record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : ((NewOrderSingle)record.Order).OrdType;
         report.TimeInForce = record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : ((NewOrderSingle)record.Order).TimeInForce;
         report.OrderQty    = record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : ((FIXNewOrderSingle)record.Order).OrderQty;
         report.Price       = record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : ((FIXNewOrderSingle)record.Order).Price;
         report.StopPx      = record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : ((FIXNewOrderSingle)record.Order).StopPx;
         record.LeavesQty   = (int)report.OrderQty - record.CumQty;
     }
     else
     {
         report.OrdType     = ((NewOrderSingle)record.Order).OrdType;
         report.TimeInForce = ((NewOrderSingle)record.Order).TimeInForce;
         report.OrderQty    = ((FIXNewOrderSingle)record.Order).OrderQty;
         report.Price       = ((FIXNewOrderSingle)record.Order).Price;
         report.StopPx      = ((FIXNewOrderSingle)record.Order).StopPx;
     }
     report.LastPx  = lastPx;
     report.LastQty = (double)lastQty;
     if (ordStatus == OrdStatus.Undefined)
     {
         record.AddFill(lastPx, lastQty);
         ordStatus = record.LeavesQty <= 0 ? OrdStatus.Filled : OrdStatus.PartiallyFilled;
     }
     report.AvgPx     = record.AvgPx;
     report.CumQty    = (double)record.CumQty;
     report.LeavesQty = (double)record.LeavesQty;
     report.ExecType  = this.GetExecType(ordStatus);
     report.OrdStatus = ordStatus;
     report.Text      = text;
     this.EmitExecutionReport(report);
 }
コード例 #24
0
        private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text)
        {
            ExecutionReport report = new ExecutionReport
            {
                TransactTime     = Clock.Now,
                ClOrdID          = record.Order.ClOrdID,
                OrigClOrdID      = record.Order.ClOrdID,
                OrderID          = record.Order.OrderID,
                Symbol           = record.Order.Symbol,
                SecurityType     = record.Order.SecurityType,
                SecurityExchange = record.Order.SecurityExchange,
                Currency         = record.Order.Currency,
                Side             = record.Order.Side,
                OrdType          = record.Order.OrdType,
                TimeInForce      = record.Order.TimeInForce,
                OrderQty         = record.Order.OrderQty,
                Price            = record.Order.Price,
                StopPx           = record.Order.StopPx,
                LastPx           = lastPx,
                LastQty          = lastQty
            };

            if (ordStatus == OrdStatus.Undefined)
            {
                record.AddFill(lastPx, lastQty);
                if (record.LeavesQty > 0)
                {
                    ordStatus = OrdStatus.PartiallyFilled;
                }
                else
                {
                    ordStatus = OrdStatus.Filled;
                }
            }
            report.AvgPx     = record.AvgPx;
            report.CumQty    = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.ExecType  = this.GetExecType(ordStatus);
            report.OrdStatus = ordStatus;
            report.Text      = text;

            EmitExecutionReport(report);
        }
コード例 #25
0
ファイル: Server.cs プロジェクト: jmptrader/QuickFix-5
        //35=8
        public override void onMessage(QuickFix42.ExecutionReport message, SessionID session)
        {
            ExecType et   = message.getExecType();
            char     type = et.getValue();

            switch (type)
            {
            case 'A':
                OrdStatus ordS   = message.getOrdStatus();
                char      status = ordS.getValue();
                //if status == 'A'
                //order acknowledgement
                break;

            case '0':
            case 'B':
            case 'F':
                break;
            }
        }
コード例 #26
0
ファイル: OrderBook.cs プロジェクト: VirtuFinancial/FixClient
        bool ProcessOrdStatusUpdate(Message message, string ClOrdID, OrdStatus status)
        {
            //
            // When we first store the order we set the comp id's relative to the order source so we
            // need to flip them when searching for orders to match messages coming from the destination.
            //
            Order order = FindOrder(message.Fields.Find(Dictionary.Fields.TargetCompID).Value,
                                    message.Fields.Find(Dictionary.Fields.SenderCompID).Value,
                                    ClOrdID);

            if (order == null)
            {
                message.Status        = MessageStatus.Error;
                message.StatusMessage = StatusMessageHeader + $" because a matching order with ClOrdID = {ClOrdID} could not be found";
                return(false);
            }

            ProcessOrdStatusUpdate(message, order, status);

            return(true);
        }
コード例 #27
0
ファイル: EnumConverter.cs プロジェクト: zhuzhenping/FreeOQ
        internal static OrderStatus Convert(OrdStatus status)
        {
            switch (status)
            {
            case OrdStatus.New:
                return(OrderStatus.New);

            case OrdStatus.PartiallyFilled:
                return(OrderStatus.PartiallyFilled);

            case OrdStatus.Filled:
                return(OrderStatus.Filled);

            case OrdStatus.Cancelled:
                return(OrderStatus.Cancelled);

            case OrdStatus.Replaced:
                return(OrderStatus.Replaced);

            case OrdStatus.PendingCancel:
                return(OrderStatus.PendingCancel);

            case OrdStatus.Rejected:
                return(OrderStatus.Rejected);

            case OrdStatus.PendingNew:
                return(OrderStatus.PendingNew);

            case OrdStatus.Expired:
                return(OrderStatus.Expired);

            case OrdStatus.PendingReplace:
                return(OrderStatus.PendingReplace);

            default:
                throw new ArgumentException(string.Format("Unsupported OrdStatus - {0}", status));
            }
        }
コード例 #28
0
ファイル: OrderResponse.cs プロジェクト: Paulito123/BitMEX
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new System.Text.StringBuilder();

            sb.Append("class OrderResponse {\n");
            sb.Append("  OrderID: ").Append(OrderId.ToString()).Append("\n");
            sb.Append("  ClOrdID: ").Append(ClOrdId.ToString()).Append("\n");
            sb.Append("  ClOrdLinkID: ").Append(ClOrdLinkId.ToString()).Append("\n");
            sb.Append("  Account: ").Append(Account.ToString()).Append("\n");
            sb.Append("  Symbol: ").Append(Symbol.ToString()).Append("\n");
            sb.Append("  Side: ").Append(Side.ToString()).Append("\n");
            sb.Append("  OrderQty: ").Append(OrderQty.ToString()).Append("\n");
            sb.Append("  Price: ").Append(Price.ToString()).Append("\n");
            sb.Append("  DisplayQty: ").Append((DisplayQty == null) ? "null" : DisplayQty.ToString()).Append("\n");
            sb.Append("  StopPx: ").Append((StopPx == null) ? "null" : StopPx.ToString()).Append("\n");
            sb.Append("  PegOffsetValue: ").Append((PegOffsetValue == null) ? "null" : PegOffsetValue.ToString()).Append("\n");
            sb.Append("  PegPriceType: ").Append((PegPriceType == null) ? "null" : PegPriceType.ToString()).Append("\n");
            sb.Append("  Currency: ").Append((Currency == null) ? "null" : Currency.ToString()).Append("\n");
            sb.Append("  SettlCurrency: ").Append((SettlCurrency == null) ? "null" : SettlCurrency.ToString()).Append("\n");
            sb.Append("  OrdType: ").Append((OrdType == null) ? "null" : OrdType.ToString()).Append("\n");
            sb.Append("  TimeInForce: ").Append((TimeInForce == null) ? "null" : TimeInForce.ToString()).Append("\n");
            sb.Append("  ExecInst: ").Append((ExecInst == null) ? "null" : ExecInst.ToString()).Append("\n");
            sb.Append("  ContingencyType: ").Append((ContingencyType == null) ? "null" : ContingencyType.ToString()).Append("\n");
            sb.Append("  ExDestination: ").Append((ExDestination == null) ? "null" : ExDestination.ToString()).Append("\n");
            sb.Append("  OrdStatus: ").Append((OrdStatus == null) ? "null" : OrdStatus.ToString()).Append("\n");
            sb.Append("  Triggered: ").Append((Triggered == null) ? "null" : Triggered.ToString()).Append("\n");
            sb.Append("  WorkingIndicator: ").Append((WorkingIndicator == null) ? "null" : WorkingIndicator.ToString()).Append("\n");
            sb.Append("  OrdRejReason: ").Append((OrdRejReason == null) ? "null" : OrdRejReason.ToString()).Append("\n");
            sb.Append("  LeavesQty: ").Append((LeavesQty == null) ? "null" : LeavesQty.ToString()).Append("\n");
            sb.Append("  CumQty: ").Append((CumQty == null) ? "null" : CumQty.ToString()).Append("\n");
            sb.Append("  AvgPx: ").Append((AvgPx == null) ? "null" : AvgPx.ToString()).Append("\n");
            sb.Append("  MultiLegReportingType: ").Append((MultiLegReportingType == null) ? "null" : MultiLegReportingType.ToString()).Append("\n");
            sb.Append("  Text: ").Append((Text == null) ? "null" : Text.ToString()).Append("\n");
            sb.Append("  TransactTime: ").Append(TransactTime.ToString()).Append("\n");
            sb.Append("  Timestamp: ").Append(Timestamp.ToString()).Append("\n");
            sb.Append("}\n");
            return(sb.ToString());
        }
コード例 #29
0
        private static OrderExecutionStatus ConvertStatus(OrdStatus status)
        {
            switch (status.Obj)
            {
            case OrdStatus.PARTIALLY_FILLED:
                return(OrderExecutionStatus.PartialFill);

            case OrdStatus.FILLED:
                return(OrderExecutionStatus.Fill);

            case OrdStatus.NEW:
                return(OrderExecutionStatus.New);

            case OrdStatus.CANCELED:
                return(OrderExecutionStatus.Cancelled);

            case OrdStatus.REJECTED:
                return(OrderExecutionStatus.Rejected);

            default:
                return(OrderExecutionStatus.Unknown);
            }
        }
コード例 #30
0
        internal static OrderStatus Convert(OrdStatus status)
        {
            switch (status)
            {
            case OrdStatus.New:
                return(OrderStatus.New);

            case OrdStatus.PartiallyFilled:
                return(OrderStatus.PartiallyFilled);

            case OrdStatus.Filled:
                return(OrderStatus.Filled);

            case OrdStatus.Cancelled:
                return(OrderStatus.Cancelled);

            case OrdStatus.Replaced:
                return(OrderStatus.Replaced);

            case OrdStatus.PendingCancel:
                return(OrderStatus.PendingCancel);

            case OrdStatus.Rejected:
                return(OrderStatus.Rejected);

            case OrdStatus.PendingNew:
                return(OrderStatus.PendingNew);

            case OrdStatus.Expired:
                return(OrderStatus.Expired);

            case OrdStatus.PendingReplace:
                return(OrderStatus.PendingReplace);
            }
            throw new NotImplementedException("OrderStatus is not supported : " + status);
        }
コード例 #31
0
        protected void EmitCancelReject(SingleOrder order, OrdStatus status, string message)
        {
            OrderCancelReject reject = new OrderCancelReject
            {
                TransactTime = Clock.Now,
                ClOrdID = order.ClOrdID,
                OrigClOrdID = order.ClOrdID,
                OrderID = order.OrderID,

                CxlRejReason = CxlRejReason.BrokerOption,
                CxlRejResponseTo = CxlRejResponseTo.CancelRequest,
                OrdStatus = status
            };

            EmitOrderCancelReject(reject);
        }
コード例 #32
0
        private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission)
        {
            ExecutionReport report = new ExecutionReport
            {
                TransactTime = Clock.Now,
                ClOrdID = record.Order.ClOrdID,
                OrigClOrdID = record.Order.ClOrdID,
                OrderID = record.Order.OrderID,
                Symbol = record.Order.Symbol,
                SecurityType = record.Order.SecurityType,
                SecurityExchange = record.Order.SecurityExchange,
                Currency = record.Order.Currency,
                CommType = commType,
                Commission = commission,
                Side = record.Order.Side,

                OrdType = record.Order.OrdType,
                TimeInForce = record.Order.TimeInForce,
                OrderQty = record.Order.OrderQty,
                Price = record.Order.Price,
                StopPx = record.Order.StopPx,
                LastPx = lastPx,
                LastQty = lastQty
            };

            if (ordStatus == OrdStatus.Replaced)
            {
                report.OrdType = record.Order.ReplaceOrder.ContainsField(EFIXField.OrdType) ? record.Order.ReplaceOrder.OrdType : record.Order.OrdType;
                report.TimeInForce = record.Order.ReplaceOrder.ContainsField(EFIXField.TimeInForce) ? record.Order.ReplaceOrder.TimeInForce : record.Order.TimeInForce;
                report.OrderQty = record.Order.ReplaceOrder.ContainsField(EFIXField.OrderQty) ? record.Order.ReplaceOrder.OrderQty : record.Order.OrderQty;
                report.Price = record.Order.ReplaceOrder.ContainsField(EFIXField.Price) ? record.Order.ReplaceOrder.Price : record.Order.Price;
                report.StopPx = record.Order.ReplaceOrder.ContainsField(EFIXField.StopPx) ? record.Order.ReplaceOrder.StopPx : record.Order.StopPx;
                record.LeavesQty = ((int)report.OrderQty) - record.CumQty;
            }
            else
            {
                report.OrdType = record.Order.OrdType;
                report.TimeInForce = record.Order.TimeInForce;
                report.OrderQty = record.Order.OrderQty;
                report.Price = record.Order.Price;
                report.StopPx = record.Order.StopPx;
            }


            if (ordStatus == OrdStatus.Undefined)
            {
                record.AddFill(lastPx, lastQty);
                if (record.LeavesQty > 0)
                {
                    ordStatus = OrdStatus.PartiallyFilled;
                }
                else
                {
                    ordStatus = OrdStatus.Filled;
                }
            }
            report.AvgPx = record.AvgPx;
            report.CumQty = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.ExecType = CTPZQProvider.GetExecType(ordStatus);
            report.OrdStatus = ordStatus;
            report.Text = text;

            EmitExecutionReport(report);
        }
コード例 #33
0
 public void EmitExecutionReport(SingleOrder order, OrdStatus status, string text)
 {
     OrderRecord record = orderRecords[order];
     EmitExecutionReport(record, status, 0.0, 0, text, CommType.Absolute, 0);
 }
コード例 #34
0
		private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text)
		{
			this.EmitOrderCancelReject(new OrderCancelReject
			{
				TransactTime = Clock.Now,
				ClOrdID = record.Order.ClOrdID,
				OrigClOrdID = record.Order.ClOrdID,
				OrdStatus = ordStatus,
				CxlRejResponseTo = responseTo,
				CxlRejReason = CxlRejReason.BrokerOption,
				Text = text
			});
		}
コード例 #35
0
ファイル: FQProvider.cs プロジェクト: heber/FreeOQ
 public void EmitExecutionReport(Order order, OrdStatus status, string text)
 {
   this.EmitExecutionReport(this.orderRecords[order], status, 0.0, 0, text);
 }
コード例 #36
0
 private ExecType GetExecType(OrdStatus status)
 {
     switch (status)
     {
         case OrdStatus.New:
             return ExecType.New;
         case OrdStatus.PartiallyFilled:
             return ExecType.PartialFill;
         case OrdStatus.Filled:
             return ExecType.Fill;
         case OrdStatus.Cancelled:
             return ExecType.Cancelled;
         case OrdStatus.Replaced:
             return ExecType.Replace;
         case OrdStatus.PendingCancel:
             return ExecType.PendingCancel;
         case OrdStatus.Rejected:
             return ExecType.Rejected;
         case OrdStatus.PendingReplace:
             return ExecType.PendingReplace;
     }
     throw new ArgumentException(string.Format("Cannot find exec type for ord status - {0}", status));
 }
コード例 #37
0
		public void EmitCancelReplaceReject(Order order, OrdStatus status, string message)
		{
			OrderRecord record = this.orderRecords[order];
			this.EmitOrderCancelReject(record, status, CxlRejResponseTo.CancelReplaceRequest, message);
		}
コード例 #38
0
		private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission)
		{
			SmartQuant.FIX.ExecutionReport executionReport = new SmartQuant.FIX.ExecutionReport();
			executionReport.TransactTime = Clock.Now;
			executionReport.ClOrdID = record.Order.ClOrdID;
			executionReport.OrigClOrdID = record.Order.ClOrdID;
			executionReport.OrderID = record.Order.OrderID;
			executionReport.Symbol = record.Order.Symbol;
			executionReport.SecurityType = record.Order.SecurityType;
			executionReport.SecurityExchange = record.Order.SecurityExchange;
			executionReport.Currency = record.Order.Currency;
			executionReport.CommType = commType;
			executionReport.Commission = commission;
			executionReport.Side = record.Order.Side;
			if (ordStatus == OrdStatus.Replaced)
			{
				executionReport.OrdType = (record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : record.Order.OrdType);
				executionReport.TimeInForce = (record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : record.Order.TimeInForce);
				executionReport.OrderQty = (record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : record.Order.OrderQty);
				executionReport.Price = (record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : record.Order.Price);
				executionReport.StopPx = (record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : record.Order.StopPx);
				record.LeavesQty = (int)executionReport.OrderQty - record.CumQty;
			}
			else
			{
				executionReport.OrdType = record.Order.OrdType;
				executionReport.TimeInForce = record.Order.TimeInForce;
				executionReport.OrderQty = record.Order.OrderQty;
				executionReport.Price = record.Order.Price;
				executionReport.StopPx = record.Order.StopPx;
			}
			executionReport.LastPx = lastPx;
			executionReport.LastQty = (double)lastQty;
			if (ordStatus == OrdStatus.Undefined)
			{
				record.AddFill(lastPx, lastQty);
				if (record.LeavesQty > 0)
				{
					ordStatus = OrdStatus.PartiallyFilled;
				}
				else
				{
					ordStatus = OrdStatus.Filled;
				}
			}
			executionReport.AvgPx = record.AvgPx;
			executionReport.CumQty = (double)record.CumQty;
			executionReport.LeavesQty = (double)record.LeavesQty;
			executionReport.ExecType = this.GetExecType(ordStatus);
			executionReport.OrdStatus = ordStatus;
			executionReport.Text = text;
			this.EmitExecutionReport(executionReport);
		}
コード例 #39
0
 public void EmitExecutionReport(SingleOrder order, OrdStatus status, string text)
 {
     OrderRecord record = this.orderRecords[order];
     EmitExecutionReport(record, status, 0.0, 0, text);
 }
コード例 #40
0
		public void EmitExecutionReport(Order order, OrdStatus status)
		{
			this.EmitExecutionReport(order, status, "");
		}
コード例 #41
0
ファイル: OrderMap.cs プロジェクト: Jicheng-Yan/OpenQuant-CTP
 // 返回状态
 public bool TryGetValue(SingleOrder key, out OrdStatus value)
 {
     return Order_OrdStatus.TryGetValue(key, out value);
 }
コード例 #42
0
 public void set(OrdStatus field)
 { // 39
     SetField(field);
 }
コード例 #43
0
ファイル: FQProvider.cs プロジェクト: heber/FreeOQ
 public void EmitCancelReject(Order order, OrdStatus status, string message)
 {
   this.EmitOrderCancelReject(this.orderRecords[order], status, CxlRejResponseTo.CancelRequest, message);
 }
コード例 #44
0
        private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text)
        {
            ExecutionReport report = new ExecutionReport
            {
                TransactTime = Clock.Now,
                ClOrdID = record.Order.ClOrdID,
                OrigClOrdID = record.Order.ClOrdID,
                OrderID = record.Order.OrderID,
                Symbol = record.Order.Symbol,
                SecurityType = record.Order.SecurityType,
                SecurityExchange = record.Order.SecurityExchange,
                Currency = record.Order.Currency,
                Side = record.Order.Side,
                OrdType = record.Order.OrdType,
                TimeInForce = record.Order.TimeInForce,
                OrderQty = record.Order.OrderQty,
                Price = record.Order.Price,
                StopPx = record.Order.StopPx,
                LastPx = lastPx,
                LastQty = lastQty
            };
            if (ordStatus == OrdStatus.Undefined)
            {
                record.AddFill(lastPx, lastQty);
                if (record.LeavesQty > 0)
                {
                    ordStatus = OrdStatus.PartiallyFilled;
                }
                else
                {
                    ordStatus = OrdStatus.Filled;
                }
            }
            report.AvgPx = record.AvgPx;
            report.CumQty = record.CumQty;
            report.LeavesQty = record.LeavesQty;
            report.ExecType = this.GetExecType(ordStatus);
            report.OrdStatus = ordStatus;
            report.Text = text;

            EmitExecutionReport(report);
        }
コード例 #45
0
		private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text)
		{
			this.EmitExecutionReport(record, ordStatus, lastPx, lastQty, text, CommType.Absolute, 0.0);
		}
コード例 #46
0
 public void EmitExecutionReport(SingleOrder order, OrdStatus status)
 {
     EmitExecutionReport(order, status, "");
 }
コード例 #47
0
		public OrderList GetOrderList(OrdStatus ordStatus)
		{
			OrderList orderList = new OrderList();
			foreach (SingleOrder singleOrder in this.allOrders)
			{
				if (singleOrder.OrdStatus == ordStatus)
					orderList.Add(singleOrder);
			}
			return orderList;
		}
コード例 #48
0
ファイル: FQProvider.cs プロジェクト: heber/FreeOQ
    private void EmitExecutionReport(OrderRecord record, OrdStatus ordStatus, double lastPx, int lastQty, string text, CommType commType, double commission)
    {
      FreeQuant.FIX.ExecutionReport report = new FreeQuant.FIX.ExecutionReport();
      report.TransactTime = Clock.Now;
      report.ClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID;
      report.OrigClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID;
      report.OrderID = record.Order.OrderID;
      report.Symbol = ((FIXNewOrderSingle) record.Order).Symbol;
      report.SecurityType = ((FIXNewOrderSingle) record.Order).SecurityType;
      report.SecurityExchange = ((FIXNewOrderSingle) record.Order).SecurityExchange;
      report.Currency = ((FIXNewOrderSingle) record.Order).Currency;
      report.CommType = commType;
      report.Commission = commission;
      report.Side = ((NewOrderSingle) record.Order).Side;
      if (ordStatus == OrdStatus.Replaced)
      {
				report.OrdType = record.Order.ReplaceOrder.ContainsField(40) ? record.Order.ReplaceOrder.OrdType : ((NewOrderSingle) record.Order).OrdType;
				report.TimeInForce = record.Order.ReplaceOrder.ContainsField(59) ? record.Order.ReplaceOrder.TimeInForce : ((NewOrderSingle) record.Order).TimeInForce;
				report.OrderQty = record.Order.ReplaceOrder.ContainsField(38) ? record.Order.ReplaceOrder.OrderQty : ((FIXNewOrderSingle) record.Order).OrderQty;
				report.Price = record.Order.ReplaceOrder.ContainsField(44) ? record.Order.ReplaceOrder.Price : ((FIXNewOrderSingle) record.Order).Price;
				report.StopPx = record.Order.ReplaceOrder.ContainsField(99) ? record.Order.ReplaceOrder.StopPx : ((FIXNewOrderSingle) record.Order).StopPx;
        record.LeavesQty = (int) report.OrderQty - record.CumQty;
      }
      else
      {
        report.OrdType = ((NewOrderSingle) record.Order).OrdType;
        report.TimeInForce = ((NewOrderSingle) record.Order).TimeInForce;
        report.OrderQty = ((FIXNewOrderSingle) record.Order).OrderQty;
        report.Price = ((FIXNewOrderSingle) record.Order).Price;
        report.StopPx = ((FIXNewOrderSingle) record.Order).StopPx;
      }
      report.LastPx = lastPx;
      report.LastQty = (double) lastQty;
      if (ordStatus == OrdStatus.Undefined)
      {
        record.AddFill(lastPx, lastQty);
        ordStatus = record.LeavesQty <= 0 ? OrdStatus.Filled : OrdStatus.PartiallyFilled;
      }
      report.AvgPx = record.AvgPx;
      report.CumQty = (double) record.CumQty;
      report.LeavesQty = (double) record.LeavesQty;
      report.ExecType = this.GetExecType(ordStatus);
      report.OrdStatus = ordStatus;
      report.Text = text;
      this.EmitExecutionReport(report);
    }
コード例 #49
0
ファイル: FIXOrdStatus.cs プロジェクト: heber/FreeOQ
		public static char ToFIX(OrdStatus ordStatus)
		{
			switch (ordStatus)
			{
				case OrdStatus.Undefined:
					return char.MinValue;
				case OrdStatus.New:
					return '0';
				case OrdStatus.PartiallyFilled:
					return '1';
				case OrdStatus.Filled:
					return '2';
				case OrdStatus.DoneForDay:
					return '3';
				case OrdStatus.Cancelled:
					return '4';
				case OrdStatus.Replaced:
					return '5';
				case OrdStatus.PendingCancel:
					return '6';
				case OrdStatus.Stopped:
					return '7';
				case OrdStatus.Rejected:
					return '8';
				case OrdStatus.Suspended:
					return '9';
				case OrdStatus.PendingNew:
					return 'A';
				case OrdStatus.Calculated:
					return 'B';
				case OrdStatus.Expired:
					return 'C';
				case OrdStatus.AcceptedForBidding:
					return 'D';
				case OrdStatus.PendingReplace:
					return 'E';
				default:
					throw new ArgumentException("unknown: " + ((object)ordStatus).ToString());
			}
		}
コード例 #50
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OrderExecutionReport" /> class.
        /// </summary>
        /// <param name="exchangeId">Exchange identifier used to identify the routing destination. (required).</param>
        /// <param name="clientOrderId">The unique identifier of the order assigned by the client. (required).</param>
        /// <param name="symbolIdExchange">Exchange symbol. One of the properties (&#x60;symbol_id_exchange&#x60;, &#x60;symbol_id_coinapi&#x60;) is required to identify the market for the new order..</param>
        /// <param name="symbolIdCoinapi">CoinAPI symbol. One of the properties (&#x60;symbol_id_exchange&#x60;, &#x60;symbol_id_coinapi&#x60;) is required to identify the market for the new order..</param>
        /// <param name="amountOrder">Order quantity. (required).</param>
        /// <param name="price">Order price. (required).</param>
        /// <param name="side">side (required).</param>
        /// <param name="orderType">orderType (required).</param>
        /// <param name="timeInForce">timeInForce (required).</param>
        /// <param name="expireTime">Expiration time. Conditionaly required for orders with time_in_force &#x3D; &#x60;GOOD_TILL_TIME_EXCHANGE&#x60; or &#x60;GOOD_TILL_TIME_OEML&#x60;..</param>
        /// <param name="execInst">Order execution instructions are documented in the separate section: &lt;a href&#x3D;\&quot;#oeml-order-params-exec\&quot;&gt;OEML / Starter Guide / Order parameters / Execution instructions&lt;/a&gt; .</param>
        /// <param name="clientOrderIdFormatExchange">The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it. (required).</param>
        /// <param name="exchangeOrderId">Unique identifier of the order assigned by the exchange or executing system..</param>
        /// <param name="amountOpen">Quantity open for further execution. &#x60;amount_open&#x60; &#x3D; &#x60;amount_order&#x60; - &#x60;amount_filled&#x60; (required).</param>
        /// <param name="amountFilled">Total quantity filled. (required).</param>
        /// <param name="avgPx">Calculated average price of all fills on this order..</param>
        /// <param name="status">status (required).</param>
        /// <param name="statusHistory">Timestamped history of order status changes..</param>
        /// <param name="errorMessage">Error message..</param>
        /// <param name="fills">Relay fill information on working orders..</param>
        public OrderExecutionReport(string exchangeId = default(string), string clientOrderId = default(string), string symbolIdExchange = default(string), string symbolIdCoinapi = default(string), decimal amountOrder = default(decimal), decimal price = default(decimal), OrdSide side = default(OrdSide), OrdType orderType = default(OrdType), TimeInForce timeInForce = default(TimeInForce), DateTime expireTime = default(DateTime), List <ExecInstEnum> execInst = default(List <ExecInstEnum>), string clientOrderIdFormatExchange = default(string), string exchangeOrderId = default(string), decimal amountOpen = default(decimal), decimal amountFilled = default(decimal), decimal avgPx = default(decimal), OrdStatus status = default(OrdStatus), List <List <string> > statusHistory = default(List <List <string> >), string errorMessage = default(string), List <Fills> fills = default(List <Fills>))
        {
            // to ensure "exchangeId" is required (not null)
            if (exchangeId == null)
            {
                throw new InvalidDataException("exchangeId is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.ExchangeId = exchangeId;
            }

            // to ensure "clientOrderId" is required (not null)
            if (clientOrderId == null)
            {
                throw new InvalidDataException("clientOrderId is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.ClientOrderId = clientOrderId;
            }

            // to ensure "amountOrder" is required (not null)
            if (amountOrder == null)
            {
                throw new InvalidDataException("amountOrder is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.AmountOrder = amountOrder;
            }

            // to ensure "price" is required (not null)
            if (price == null)
            {
                throw new InvalidDataException("price is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.Price = price;
            }

            // to ensure "side" is required (not null)
            if (side == null)
            {
                throw new InvalidDataException("side is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.Side = side;
            }

            // to ensure "orderType" is required (not null)
            if (orderType == null)
            {
                throw new InvalidDataException("orderType is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.OrderType = orderType;
            }

            // to ensure "timeInForce" is required (not null)
            if (timeInForce == null)
            {
                throw new InvalidDataException("timeInForce is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.TimeInForce = timeInForce;
            }

            // to ensure "clientOrderIdFormatExchange" is required (not null)
            if (clientOrderIdFormatExchange == null)
            {
                throw new InvalidDataException("clientOrderIdFormatExchange is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.ClientOrderIdFormatExchange = clientOrderIdFormatExchange;
            }

            // to ensure "amountOpen" is required (not null)
            if (amountOpen == null)
            {
                throw new InvalidDataException("amountOpen is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.AmountOpen = amountOpen;
            }

            // to ensure "amountFilled" is required (not null)
            if (amountFilled == null)
            {
                throw new InvalidDataException("amountFilled is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.AmountFilled = amountFilled;
            }

            // to ensure "status" is required (not null)
            if (status == null)
            {
                throw new InvalidDataException("status is a required property for OrderExecutionReport and cannot be null");
            }
            else
            {
                this.Status = status;
            }

            this.SymbolIdExchange = symbolIdExchange;
            this.SymbolIdCoinapi  = symbolIdCoinapi;
            this.ExpireTime       = expireTime;
            this.ExecInst         = execInst;
            this.ExchangeOrderId  = exchangeOrderId;
            this.AvgPx            = avgPx;
            this.StatusHistory    = statusHistory;
            this.ErrorMessage     = errorMessage;
            this.Fills            = fills;
        }
コード例 #51
0
ファイル: FQProvider.cs プロジェクト: heber/FreeOQ
 private void EmitOrderCancelReject(OrderRecord record, OrdStatus ordStatus, CxlRejResponseTo responseTo, string text)
 {
   OrderCancelReject reject = new OrderCancelReject();
   reject.TransactTime = Clock.Now;
   reject.ClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID;
   reject.OrigClOrdID = ((FIXNewOrderSingle) record.Order).ClOrdID;
   reject.OrdStatus = ordStatus;
   reject.CxlRejResponseTo = responseTo;
   reject.CxlRejReason = CxlRejReason.BrokerOption;
   reject.Text = text;
   this.EmitOrderCancelReject(reject);
 }