Symbol Field
Inheritance: StringField
Esempio n. 1
0
        public Message CreateFillReport(OrderMatch match, string execID)
        {
            var symbol = new Symbol(match.Contract.Symbol);
            var exReport = new ExecutionReport(
                new OrderID(match.OrderID.ToString(CultureInfo.InvariantCulture)),
                new ExecID(execID),
                new ExecType(match.MatchType == MatchType.Full
                                 ? ExecType.FILL
                                 : ExecType.PARTIAL_FILL),
                new OrdStatus(match.MatchType == MatchType.Full
                                  ? OrdStatus.FILLED
                                  : OrdStatus.PARTIALLY_FILLED),
                symbol,
                TranslateFixFields.Translate(match.MarketSide),
                new LeavesQty(match.RemainingQuantity),
                new CumQty(match.OriginalOrderQuantity - match.RemainingQuantity),
                new AvgPx(match.Price))
            {
                ClOrdID = new ClOrdID(match.ClOrdID),
                Symbol = symbol,
                OrderQty = new OrderQty(match.OriginalOrderQuantity),
                LastQty = new LastQty(match.MatchedQuantity),
                LastPx = new LastPx(match.Price)
            };

            if (TradingAccount.IsSet(match.Account))
                exReport.SetField(new Account(match.Account.Name));

            return exReport;
        }
Esempio n. 2
0
        public Message CreateNewOrderExecutionReport(IOrder o, string execID)
        {
            var symbol = new Symbol(o.Contract.Symbol);
            var exReport = new ExecutionReport(
                new OrderID(o.ID.ToString(CultureInfo.InvariantCulture)),
                new ExecID(execID),
                new ExecType(ExecType.NEW),
                new OrdStatus(OrdStatus.NEW),
                symbol,
                TranslateFixFields.Translate(o.MarketSide),
                new LeavesQty(o.Quantity),
                new CumQty(0m),
                new AvgPx(o.Price))
                {
                    ClOrdID = new ClOrdID(o.ClOrdID),
                    Symbol = symbol,
                    OrderQty = new OrderQty(o.Quantity),
                    LastQty = new LastQty(0m)
                };

            //exReport.Set(new LastPx(o.Price));

            if (TradingAccount.IsSet(o.Account))
                exReport.SetField(new Account(o.Account.Name));

            return exReport;
        }
Esempio n. 3
0
 public ExecutionReport(
     QuickFix.Fields.OrderID aOrderID,
     QuickFix.Fields.ExecID aExecID,
     QuickFix.Fields.ExecTransType aExecTransType,
     QuickFix.Fields.OrdStatus aOrdStatus,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.OrderQty aOrderQty,
     QuickFix.Fields.LastShares aLastShares,
     QuickFix.Fields.LastPx aLastPx,
     QuickFix.Fields.CumQty aCumQty,
     QuickFix.Fields.AvgPx aAvgPx
     ) : this()
 {
     this.OrderID       = aOrderID;
     this.ExecID        = aExecID;
     this.ExecTransType = aExecTransType;
     this.OrdStatus     = aOrdStatus;
     this.Symbol        = aSymbol;
     this.Side          = aSide;
     this.OrderQty      = aOrderQty;
     this.LastShares    = aLastShares;
     this.LastPx        = aLastPx;
     this.CumQty        = aCumQty;
     this.AvgPx         = aAvgPx;
 }
        /// <summary>
        /// Creates a FIX4.4 OrderCancelRequest message for Forexware
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX44.OrderCancelRequest OrderCancelRequest(Order order)
        {
            QuickFix.FIX44.OrderCancelRequest orderCancelRequest = new QuickFix.FIX44.OrderCancelRequest();

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

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

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

            orderCancelRequest.SetField(account);

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

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

            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);
        }
Esempio n. 5
0
 public Quote(
     QuickFix.Fields.QuoteID aQuoteID,
     QuickFix.Fields.Symbol aSymbol
     ) : this()
 {
     this.QuoteID = aQuoteID;
     this.Symbol  = aSymbol;
 }
Esempio n. 6
0
 public SecurityListRequest(
     QuickFix.Fields.SecurityReqID aSecurityReqID,
     QuickFix.Fields.SecurityListRequestType aSecurityListRequestType,
     QuickFix.Fields.Symbol aSymbol
     ) : this()
 {
     this.SecurityReqID           = aSecurityReqID;
     this.SecurityListRequestType = aSecurityListRequestType;
     this.Symbol = aSymbol;
 }
Esempio n. 7
0
 public Quote(
     QuickFix.Fields.QuoteID aQuoteID,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.BidPx aBidPx
     ) : this()
 {
     this.QuoteID = aQuoteID;
     this.Symbol  = aSymbol;
     this.BidPx   = aBidPx;
 }
Esempio n. 8
0
 public DontKnowTrade(
     QuickFix.Fields.DKReason aDKReason,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide
     ) : this()
 {
     this.DKReason = aDKReason;
     this.Symbol   = aSymbol;
     this.Side     = aSide;
 }
Esempio n. 9
0
 public OrderStatusRequest(
     QuickFix.Fields.ClOrdID aClOrdID,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide
     ) : this()
 {
     this.ClOrdID = aClOrdID;
     this.Symbol  = aSymbol;
     this.Side    = aSide;
 }
 public SecurityStatusRequest(
     QuickFix.Fields.SecurityStatusReqID aSecurityStatusReqID,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.SubscriptionRequestType aSubscriptionRequestType
     ) : this()
 {
     this.SecurityStatusReqID = aSecurityStatusReqID;
     this.Symbol = aSymbol;
     this.SubscriptionRequestType = aSubscriptionRequestType;
 }
        /// <summary>
        /// Creates a FIX4.3 NewOrderSingle message for GTX
        /// </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 symbol = new QuickFix.Fields.Symbol(order.Security.Symbol);

            newOrderSingle.SetField(symbol);

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

            newOrderSingle.SetField(side);

            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 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);

            return(newOrderSingle);
        }
Esempio n. 12
0
 public OrderCancelRequest(
     QuickFix.Fields.OrigClOrdID aOrigClOrdID,
     QuickFix.Fields.ClOrdID aClOrdID,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide
     ) : this()
 {
     this.OrigClOrdID = aOrigClOrdID;
     this.ClOrdID     = aClOrdID;
     this.Symbol      = aSymbol;
     this.Side        = aSide;
 }
Esempio n. 13
0
 public DontKnowTrade(
     QuickFix.Fields.OrderID aOrderID,
     QuickFix.Fields.ExecID aExecID,
     QuickFix.Fields.DKReason aDKReason,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide
     ) : this()
 {
     this.OrderID  = aOrderID;
     this.ExecID   = aExecID;
     this.DKReason = aDKReason;
     this.Symbol   = aSymbol;
     this.Side     = aSide;
 }
Esempio n. 14
0
 public NewOrderSingle(
     QuickFix.Fields.ClOrdID aClOrdID,
     QuickFix.Fields.HandlInst aHandlInst,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.OrdType aOrdType
     ) : this()
 {
     this.ClOrdID   = aClOrdID;
     this.HandlInst = aHandlInst;
     this.Symbol    = aSymbol;
     this.Side      = aSide;
     this.OrdType   = aOrdType;
 }
Esempio n. 15
0
 public Advertisement(
     QuickFix.Fields.AdvId aAdvId,
     QuickFix.Fields.AdvTransType aAdvTransType,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.AdvSide aAdvSide,
     QuickFix.Fields.Shares aShares
     ) : this()
 {
     this.AdvId        = aAdvId;
     this.AdvTransType = aAdvTransType;
     this.Symbol       = aSymbol;
     this.AdvSide      = aAdvSide;
     this.Shares       = aShares;
 }
Esempio n. 16
0
 public IndicationofInterest(
     QuickFix.Fields.IOIid aIOIid,
     QuickFix.Fields.IOITransType aIOITransType,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.IOIShares aIOIShares
     ) : this()
 {
     this.IOIid        = aIOIid;
     this.IOITransType = aIOITransType;
     this.Symbol       = aSymbol;
     this.Side         = aSide;
     this.IOIShares    = aIOIShares;
 }
Esempio n. 17
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);
        }
Esempio n. 18
0
 public DontKnowTrade(
     QuickFix.Fields.DKReason aDKReason,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.OrderQty aOrderQty,
     QuickFix.Fields.LastShares aLastShares,
     QuickFix.Fields.LastPx aLastPx
     ) : this()
 {
     this.DKReason   = aDKReason;
     this.Symbol     = aSymbol;
     this.Side       = aSide;
     this.OrderQty   = aOrderQty;
     this.LastShares = aLastShares;
     this.LastPx     = aLastPx;
 }
 public OrderCancelReplaceRequest(
     QuickFix.Fields.OrigClOrdID aOrigClOrdID,
     QuickFix.Fields.ClOrdID aClOrdID,
     QuickFix.Fields.HandlInst aHandlInst,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.OrdType aOrdType
     ) : this()
 {
     this.OrigClOrdID = aOrigClOrdID;
     this.ClOrdID     = aClOrdID;
     this.HandlInst   = aHandlInst;
     this.Symbol      = aSymbol;
     this.Side        = aSide;
     this.OrdType     = aOrdType;
 }
Esempio n. 20
0
 public OrderCancelRequest(
     QuickFix.Fields.OrigClOrdID aOrigClOrdID,
     QuickFix.Fields.ClOrdID aClOrdID,
     QuickFix.Fields.CxlType aCxlType,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.OrderQty aOrderQty
     ) : this()
 {
     this.OrigClOrdID = aOrigClOrdID;
     this.ClOrdID     = aClOrdID;
     this.CxlType     = aCxlType;
     this.Symbol      = aSymbol;
     this.Side        = aSide;
     this.OrderQty    = aOrderQty;
 }
Esempio n. 21
0
 public Allocation(
     QuickFix.Fields.AllocID aAllocID,
     QuickFix.Fields.AllocTransType aAllocTransType,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Shares aShares,
     QuickFix.Fields.AvgPx aAvgPx,
     QuickFix.Fields.TradeDate aTradeDate
     ) : this()
 {
     this.AllocID        = aAllocID;
     this.AllocTransType = aAllocTransType;
     this.Side           = aSide;
     this.Symbol         = aSymbol;
     this.Shares         = aShares;
     this.AvgPx          = aAvgPx;
     this.TradeDate      = aTradeDate;
 }
Esempio n. 22
0
 public NewOrderList(
     QuickFix.Fields.ListID aListID,
     QuickFix.Fields.ListSeqNo aListSeqNo,
     QuickFix.Fields.ListNoOrds aListNoOrds,
     QuickFix.Fields.ClOrdID aClOrdID,
     QuickFix.Fields.HandlInst aHandlInst,
     QuickFix.Fields.Symbol aSymbol,
     QuickFix.Fields.Side aSide,
     QuickFix.Fields.OrderQty aOrderQty,
     QuickFix.Fields.OrdType aOrdType
     ) : this()
 {
     this.ListID     = aListID;
     this.ListSeqNo  = aListSeqNo;
     this.ListNoOrds = aListNoOrds;
     this.ClOrdID    = aClOrdID;
     this.HandlInst  = aHandlInst;
     this.Symbol     = aSymbol;
     this.Side       = aSide;
     this.OrderQty   = aOrderQty;
     this.OrdType    = aOrdType;
 }
Esempio n. 23
0
        private static OrderData TranslateOrderImpl(Symbol symbol,
                                                    Side side,
                                                    OrdType ordType,
                                                    OrderQty orderQty,
                                                    Price price,
                                                    ClOrdID clOrdID,
                                                    Account account)
        {
            switch (ordType.getValue())
            {
                case OrdType.LIMIT:
                    if (price.Obj == 0)
                        throw new IncorrectTagValue(price.Tag);

                    break;

                    //case OrdType.MARKET: break;

                default:
                    throw new IncorrectTagValue(ordType.Tag);
            }

            return new OrderData
                {
                    MarketSide = TranslateFixFields.Translate(side),
                    Symbol = symbol.getValue(),
                    OrderType = TranslateFixFields.Translate(ordType),
                    Quantity = orderQty.getValue(),
                    Price = price.getValue(),
                    ClOrdID = clOrdID.getValue(),
                    Account =
                        account == null
                            ? TradingAccount.None
                            : new TradingAccount(account.getValue())
                };
        }
        /// <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);
        }
Esempio n. 25
0
        /// <summary>
        /// Creates a FIX4.2 OrderCancelRequest message for Currenex
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX42.OrderCancelRequest OrderCancelRequest(Order order)
        {
            QuickFix.FIX42.OrderCancelRequest orderCancelRequest = new QuickFix.FIX42.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.OrdType ordType = new QuickFix.Fields.OrdType('F');
            orderCancelRequest.SetField(ordType);

            return(orderCancelRequest);
        }
Esempio n. 26
0
 public void Set(QuickFix.Fields.Symbol val)
 {
     this.Symbol = 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);
        }
Esempio n. 28
0
 public SecurityStatus(
     QuickFix.Fields.Symbol aSymbol
     ) : this()
 {
     this.Symbol = aSymbol;
 }
Esempio n. 29
0
 public QuoteStatusRequest(
     QuickFix.Fields.Symbol aSymbol
     ) : this()
 {
     this.Symbol = aSymbol;
 }
        /// <summary>
        /// Creates a FIX4.4 NewOrderSingle message for Forexware
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX44.NewOrderSingle NewOrderSingle(Order order)
        {
            var newOrderSingle = new QuickFix.FIX44.NewOrderSingle();

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

            newOrderSingle.SetField(clOrdId);

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

            newOrderSingle.SetField(handlInst);

            //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 symbol = new QuickFix.Fields.Symbol(order.Security.Symbol);

            newOrderSingle.SetField(symbol);

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

            newOrderSingle.SetField(transactTime);

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

            newOrderSingle.SetField(orderQty);

            //limit, market and stop 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));
            }
            else if (order.GetType() == typeof(StopOrder))
            {
                newOrderSingle.Set(new OrdType(OrdType.STOP));

                // set StopPX field
                // TODO: add StopPx field
            }

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

            newOrderSingle.SetField(account);

            if (order.GetType() == typeof(LimitOrder) || order.GetType() == typeof(StopOrder))
            {
                var tif = new QuickFix.Fields.TimeInForce(FixCommon.Converter.ConvertTif.GetFixValue(order.OrderTif));
                newOrderSingle.SetField(tif);
            }

            return(newOrderSingle);
        }
Esempio n. 31
0
 public QuickFix.Fields.Symbol Get(QuickFix.Fields.Symbol val)
 {
     GetField(val);
     return(val);
 }
Esempio n. 32
0
 private Queue<QuickFix.FIX42.NewOrderSingle> CreateOrders(int n)
 {
     Queue<QuickFix.FIX42.NewOrderSingle> orders = new Queue<QuickFix.FIX42.NewOrderSingle>(n);
     for (int i = 0; i < n; i++) {
         ClOrdID cloudOrderId = new ClOrdID(Guid.NewGuid().ToString());
         HandlInst handlInst = new HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE_NO_BROKER_INTERVENTION);
         Symbol symbol = new Symbol("MSFT");
         Side side = new Side(Side.BUY);
         TransactTime time = new TransactTime();
         OrdType orderType = new OrdType(OrdType.LIMIT);
         QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle(cloudOrderId, handlInst, symbol, side, time, orderType);
         order.Account = new Account("Account");
         order.OrderQty = new OrderQty(100);
         order.ExDestination = new ExDestination("*");
         order.TimeInForce = new TimeInForce(TimeInForce.DAY);
         order.Price = new Price(50m);
         order.SecurityType = new SecurityType(SecurityType.COMMON_STOCK);
         orders.Enqueue(order);
     }
     return orders;
 }
Esempio n. 33
0
        public Message CreateNewOrderSingleMessage(string symbol,
                                                   MarketSide marketSide,
                                                   string clOrdID,
                                                   TradingAccount account,
                                                   decimal price,
                                                   decimal quantity,
                                                   OrderType orderType,
                                                   string execID)
        {
            var fOrdType = TranslateFixFields.Translate(orderType);
            var fSide = TranslateFixFields.Translate(marketSide);
            var fSymbol = new Symbol(symbol);
            var fTransactTime = new TransactTime(DateTime.Now);
            var fClOrdID = new ClOrdID(clOrdID);

            var nos = new NewOrderSingle(fClOrdID,
                                         fSymbol,
                                         fSide,
                                         fTransactTime,
                                         fOrdType)
            {
                OrderQty = new OrderQty(quantity),
                TimeInForce = new TimeInForce(TimeInForce.GOOD_TILL_CANCEL)
            };

            if (orderType == OrderType.Limit)
                nos.Price = new Price(price);

            return nos;
        }
Esempio n. 34
0
 public bool IsSet(QuickFix.Fields.Symbol val)
 {
     return(IsSetSymbol());
 }
Esempio n. 35
0
 public void set(Symbol field)
 {
     // 55
     SetField(field);
 }
Esempio n. 36
0
 public void Set(QuickFix.Fields.Symbol val) 
 { 
     this.Symbol = val;
 }
Esempio n. 37
0
        /// <summary>
        /// Creates a FIX4.2 NewOrderSingle message for Redi
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public QuickFix.FIX42.NewOrderSingle NewOrderSingle(Order order)
        {
            var newOrderSingle = new QuickFix.FIX42.NewOrderSingle();

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

            newOrderSingle.SetField(clOrdId);

            if (!string.IsNullOrEmpty(_account))
            {
                var account = new QuickFix.Fields.Account(_account);
                newOrderSingle.SetField(account);
            }

            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);

            //only limit and market orders are supported.
            if (order.GetType() == typeof(LimitOrder))
            {
                var execInst = new QuickFix.Fields.ExecInst("h");
                newOrderSingle.SetField(execInst);

                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 orderQty = new QuickFix.Fields.OrderQty(order.OrderSize);

            newOrderSingle.SetField(orderQty);

            var exDestination = new QuickFix.Fields.ExDestination(";");

            newOrderSingle.SetField(exDestination);

            var country = new QuickFix.Fields.DeliverToLocationID("1");

            newOrderSingle.SetField(country);

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

            newOrderSingle.SetField(side);

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

            newOrderSingle.SetField(symbol);

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

            newOrderSingle.SetField(tif);

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

            newOrderSingle.SetField(transactTime);

            return(newOrderSingle);
        }