Exemplo n.º 1
0
        public PriceQtyPopup(OrderRecord or)
        {
            DataContext = this;

            IsCancelled = true;

            QtyString = or.OriginalNOS.OrderQty.Obj.ToString();

            InitializeComponent();

            if (or.OriginalNOS.OrdType.Obj == QuickFix.Fields.OrdType.MARKET)
            {
                lblPrice.Visibility = Visibility.Collapsed;
                txtPrice.Visibility = Visibility.Collapsed;
                PriceString = "0";
            }
            else
                PriceString = or.Price.ToString();
        }
Exemplo n.º 2
0
        public void CancelOrder(OrderRecord or)
        {
            try
            {
                QuickFix.FIX42.OrderCancelRequest ocq = new QuickFix.FIX42.OrderCancelRequest(
                    new QuickFix.Fields.OrigClOrdID(or.ClOrdID),
                    MessageCreator42.GenerateClOrdID(),
                    new QuickFix.Fields.Symbol(or.Symbol),
                    or.OriginalNOS.Side,
                    new QuickFix.Fields.TransactTime(DateTime.Now));

                ocq.OrderID = new QuickFix.Fields.OrderID(or.OrderID);

                _strategy.ProcessOrderCancelRequest(or.OriginalNOS, ocq);

                _qfapp.Send(ocq);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="or"></param>
        /// <param name="newQty"></param>
        /// <param name="newPrice">ignored if not applicable for order type</param>
        /// <param name="customFields">other custom fields to be added</param>
        public void CancelReplaceOrder(OrderRecord or, int newQty, decimal newPrice, Dictionary<int, string> customFields)
        {
            try
            {
                QuickFix.FIX42.OrderCancelReplaceRequest ocrq = MessageCreator42.OrderCancelReplaceRequest(
                    customFields, or.OriginalNOS, newQty, newPrice);

                ocrq.OrderID = new QuickFix.Fields.OrderID(or.OrderID);

                _strategy.ProcessOrderCancelReplaceRequest(or.OriginalNOS, ocrq);

                _qfapp.Send(ocrq);
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.ToString());
            }
        }
Exemplo n.º 4
0
        private void SendOrder(Side side)
        {
            try
            {
                Trace.WriteLine(String.Format("Send New Order: Type={0} Side={1} Symbol=[{2}] Qty=[{3}] LimitPrice=[{4}] TIF={5}",
                    this.OrderType.ToString(), side.ToString(), this.Symbol,
                    this.OrderQtyString, this.LimitPriceString, this.TimeInForce.ToString()));

                Dictionary<int, string> customFieldsDict = new Dictionary<int, string>();
                foreach (CustomFieldRecord cfr in this.CustomFields)
                    customFieldsDict[cfr.Tag] = cfr.Value;

                int orderQty = int.Parse(this.OrderQtyString);
                decimal limitPrice = decimal.Parse(this.LimitPriceString);

                QuickFix.FIX42.NewOrderSingle nos = MessageCreator42.NewOrderSingle(
                    customFieldsDict,
                    this.OrderType, side, this.Symbol, orderQty, this.TimeInForce, limitPrice);

                OrderRecord r = new OrderRecord(nos);
                lock (_ordersLock)
                {
                    Orders.Add(r);
                }

                _qfapp.Send(nos);

            }
            catch (Exception e)
            {
                Trace.WriteLine("Failed to send order\n" + e.ToString());
            }
        }