Product Field
Inheritance: IntField
Exemplo n.º 1
0
        /// <summary>
        /// Creates a FIX4.4 OrderCancelRequest message for Fxcm
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX44.OrderCancelRequest OrderCancelRequest(Order order)
        {
            char orderSide = default(char);

            if (order.OrderSide == Constants.OrderSide.BUY)
            {
                orderSide = Side.BUY;
            }
            else if (order.OrderSide == Constants.OrderSide.SELL)
            {
                orderSide = Side.SELL;
            }

            if (orderSide.Equals(default(char)))
            {
                _logger.Error("Invalid Order Side", _type.FullName, "OrderCancelRequest");
                return(null);
            }

            QuickFix.FIX44.OrderCancelRequest orderCancelRequest = new QuickFix.FIX44.OrderCancelRequest();

            QuickFix.Fields.OrderID orderId = new QuickFix.Fields.OrderID(order.BrokerOrderID);
            orderCancelRequest.SetField(orderId);

            QuickFix.Fields.OrigClOrdID origClOrdId = new QuickFix.Fields.OrigClOrdID(order.OrderID);
            orderCancelRequest.SetField(origClOrdId);

            QuickFix.Fields.ClOrdID clOrdId = new QuickFix.Fields.ClOrdID(DateTime.Now.ToString(("yyMMddHmsfff")));
            orderCancelRequest.SetField(clOrdId);

            var account = new QuickFix.Fields.Account(_account);

            orderCancelRequest.SetField(account);

            QuickFix.Fields.Symbol symbol = new QuickFix.Fields.Symbol(order.Security.Symbol);
            orderCancelRequest.SetField(symbol);


            QuickFix.Fields.Side side = new QuickFix.Fields.Side(orderSide);
            orderCancelRequest.SetField(side);

            QuickFix.Fields.TransactTime transactTime = new QuickFix.Fields.TransactTime(order.OrderDateTime);
            orderCancelRequest.SetField(transactTime);

            QuickFix.Fields.Product product = new QuickFix.Fields.Product(FixCommon.Constants.Product.Currency);
            orderCancelRequest.SetField(product);

            return(orderCancelRequest);
        }
        /// <summary>
        /// Creates a FIX4.3 OrderCancelRequest message for Integral
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX43.OrderCancelRequest OrderCancelRequest(Order order)
        {
            QuickFix.FIX43.OrderCancelRequest orderCancelRequest = new QuickFix.FIX43.OrderCancelRequest();

            QuickFix.Fields.OrigClOrdID origClOrdId = new QuickFix.Fields.OrigClOrdID(order.OrderID);
            orderCancelRequest.SetField(origClOrdId);

            QuickFix.Fields.ClOrdID clOrdId = new QuickFix.Fields.ClOrdID(DateTime.Now.ToString(("yyMMddHmsfff")));
            orderCancelRequest.SetField(clOrdId);

            QuickFix.Fields.Symbol symbol = new QuickFix.Fields.Symbol(order.Security.Symbol);
            orderCancelRequest.SetField(symbol);

            QuickFix.Fields.Side side = new QuickFix.Fields.Side(Convert.ToChar(order.OrderSide));
            orderCancelRequest.SetField(side);

            QuickFix.Fields.TransactTime transactTime = new QuickFix.Fields.TransactTime(order.OrderDateTime);
            orderCancelRequest.SetField(transactTime);

            QuickFix.Fields.Product product = new QuickFix.Fields.Product(FixCommon.Constants.Product.Currency);
            orderCancelRequest.SetField(product);

            return(orderCancelRequest);
        }
Exemplo n.º 3
0
 public void Set(QuickFix.Fields.Product val) 
 { 
     this.Product = val;
 }
Exemplo n.º 4
0
 public bool IsSet(QuickFix.Fields.Product val)
 {
     return(IsSetProduct());
 }
Exemplo n.º 5
0
 public QuickFix.Fields.Product Get(QuickFix.Fields.Product val)
 {
     GetField(val);
     return(val);
 }
Exemplo n.º 6
0
 public void Set(QuickFix.Fields.Product val)
 {
     this.Product = val;
 }
        /// <summary>
        /// Creates a FIX4.3 NewOrderSingle message for Integral
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX43.NewOrderSingle NewOrderSingle(Order order)
        {
            var newOrderSingle = new QuickFix.FIX43.NewOrderSingle();

            var clOrdId = new QuickFix.Fields.ClOrdID(order.OrderID);

            newOrderSingle.SetField(clOrdId);

            var securityType = new QuickFix.Fields.SecurityType(FixCommon.Constants.SecurityType.ForeignExchangeContract);

            newOrderSingle.SetField(securityType);

            var symbol = new QuickFix.Fields.Symbol(order.Security.Symbol);

            newOrderSingle.SetField(symbol);

            var product = new QuickFix.Fields.Product(FixCommon.Constants.Product.Currency);

            newOrderSingle.SetField(product);

            //set order side
            if (order.OrderSide == Constants.OrderSide.BUY)
            {
                newOrderSingle.Set(new Side(Side.BUY));
            }
            else if (order.OrderSide == Constants.OrderSide.SELL)
            {
                newOrderSingle.Set(new Side(Side.SELL));
            }

            var transactTime = new QuickFix.Fields.TransactTime(order.OrderDateTime);

            newOrderSingle.SetField(transactTime);

            var orderQty = new QuickFix.Fields.OrderQty(order.OrderSize);

            newOrderSingle.SetField(orderQty);

            var minQty = new QuickFix.Fields.MinQty(order.OrderSize);

            newOrderSingle.SetField(minQty);

            //only limit and market orders are supported.
            if (order.GetType() == typeof(LimitOrder))
            {
                newOrderSingle.Set(new OrdType(OrdType.LIMIT));
                newOrderSingle.Set(new Price(((LimitOrder)order).LimitPrice));
            }
            else if (order.GetType() == typeof(MarketOrder))
            {
                newOrderSingle.Set(new OrdType(OrdType.MARKET));
            }

            var maxShow = new QuickFix.Fields.MaxShow(order.OrderSize);

            newOrderSingle.SetField(maxShow);

            var tif = new QuickFix.Fields.TimeInForce(FixCommon.Converter.ConvertTif.GetFixValue(order.OrderTif));

            newOrderSingle.SetField(tif);

            var execInst = new QuickFix.Fields.ExecInst(ExecInst.BEST_EXECUTION);

            newOrderSingle.SetField(execInst);

            var currency = new QuickFix.Fields.Currency(order.OrderCurrency);

            newOrderSingle.SetField(currency);

            var handlInst = new QuickFix.Fields.HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE);

            newOrderSingle.SetField(handlInst);

            return(newOrderSingle);
        }