private QuickFix.FIX42.NewOrderSingle createHeldOptionOrder(Model.OrderModel orderModel)
        {
            var order = new QuickFix.FIX42.NewOrderSingle(
                new ClOrdID(orderModel.messageId),
                new HandlInst('1'),
                new Symbol(orderModel.underlyingExchangeSymbol),
                StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.side),
                new TransactTime(DateTime.Now),
                new OrdType(OrdType.LIMIT));

            order.SecurityType = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.securityType);

            order.SecurityExchange = new SecurityExchange(orderModel.underlyingExchange);

            order.SetField(new StringField(18203, orderModel.underlyingGateway));

            order.PutOrCall = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.optionType);

            order.StrikePrice = new StrikePrice(orderModel.optionStrikePrice);  //new StrikePrice(new decimal(207000));

            order.MaturityMonthYear = new MaturityMonthYear(orderModel.maturityMonthYear);

            order.OrderQty = new OrderQty(orderModel.orderQty);


            order.SetField(new CharField(11028, 'Y'));

            //order.SetField(new StringField(50, "TML1"));

            //order.SetField(new StringField(16142, "TML NORTH VANCOUVER"));

            order.SetField(new StringField(18220, orderModel.broker_18220));

            //order.SetField(new StringField(16106, orderModel.stagedOrderMessage));

            order.SetField(new CharField(16111, 'I'));

            order.Account = new Account(orderModel.acct);

            order.Price = new Price(orderModel.orderPrice);

            order.ExecInst = new ExecInst("5");


            fillOrderInfoForICE(order, orderModel);


            //OrderRecord r = new OrderRecord(order);
            //lock (_orderViewModel.ordersLock)
            //{
            //    _orderViewModel.Orders.Add(r);
            //}

            //if (_fixConnectionSystem.InitiatorRunning && _connectionViewModel.IsOrderConnected)
            //{
            //    QuickFix.Session.SendToTarget(order, _fixConnectionSystem.orderSession.SessionID);
            //}

            return(order);
        }
        private QuickFix.FIX42.NewOrderSingle createStagedFutureOrder(Model.OrderModel orderModel)
        {
            var order = new QuickFix.FIX42.NewOrderSingle(
                new ClOrdID(orderModel.messageId),
                new HandlInst('3'),
                new Symbol(orderModel.underlyingExchangeSymbol),
                StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.side),
                new TransactTime(DateTime.Now),
                new OrdType(OrdType.LIMIT));

            //if(order.Side.Obj == Side.BUY)

            //switch (order.Side.Obj)
            //{
            //    case QuickFix.Fields.Side.BUY:
            //        Console.Write("t");
            //        break;
            //    case QuickFix.Fields.Side.SELL:
            //        Console.Write("t");
            //        break;
            //}



            order.SecurityType = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.securityType);

            order.SecurityExchange = new SecurityExchange(orderModel.underlyingExchange);

            order.SetField(new StringField(18203, orderModel.underlyingGateway));

            order.MaturityMonthYear = new MaturityMonthYear(orderModel.maturityMonthYear);

            order.OrderQty = new OrderQty(orderModel.orderQty);

            //order.Price = new Price(new decimal(207175));

            order.SetField(new CharField(11028, 'Y'));

            //order.SetField(new StringField(50, "TML1"));

            //order.SetField(new StringField(16142, "TML NORTH VANCOUVER"));

            order.SetField(new StringField(18220, orderModel.broker_18220));

            order.SetField(new StringField(16106, orderModel.stagedOrderMessage));

            order.SetField(new CharField(16111, 'I'));

            order.Account = new Account(orderModel.acct);

            order.Price = new Price(0);


            fillOrderInfoForICE(order, orderModel);


            return(order);
        }
        private void sendFuturesMarketDataRequest(Model.OrderModel orderModel)
        {
            var mdrq = new QuickFix.FIX42.MarketDataRequest(
                new MDReqID(orderModel.messageId),  //DateTime.Now.ToOADate().ToString()),
                new SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT),
                new MarketDepth(1)
                );

            mdrq.AggregatedBook =
                new AggregatedBook(AggregatedBook.ONE_BOOK_ENTRY_PER_SIDE_PER_PRICE);

            QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup entryTypeGroups =
                new QuickFix.FIX42.MarketDataRequest.NoMDEntryTypesGroup();

            entryTypeGroups.MDEntryType = new MDEntryType(MDEntryType.BID);

            mdrq.AddGroup(entryTypeGroups);

            entryTypeGroups.MDEntryType = new MDEntryType(MDEntryType.OFFER);

            mdrq.AddGroup(entryTypeGroups);


            QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup symGroup = new QuickFix.FIX42.MarketDataRequest.NoRelatedSymGroup();
            //symGroup.Symbol = new Symbol("FOO1");
            //symGroup.SecurityID = new SecurityID("secid1");

            symGroup.Symbol = new Symbol(orderModel.underlyingExchangeSymbol);

            symGroup.SecurityType = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.securityType);

            symGroup.SecurityExchange = new SecurityExchange(orderModel.underlyingExchange);

            symGroup.MaturityMonthYear = new MaturityMonthYear(orderModel.maturityMonthYear);



            mdrq.AddGroup(symGroup);



            //mdrq.MDUpdateType = new MDUpdateType(MDEntryType.BID);
            //mdrq.MDUpdateType = new MDUpdateType(MDEntryType.OFFER);

            //mdrq.NoRelatedSym = new NoRelatedSym(1);


            if (_fixConnectionSystem.InitiatorRunning && _connectionViewModel.IsPriceConnected)
            {
                Thread sendToTargetThreading = new Thread(new ParameterizedThreadStart(sendToMarketDataRequestToTarget));
                sendToTargetThreading.IsBackground = true;
                sendToTargetThreading.Start(mdrq);

                //QuickFix.Session.SendToTarget(mdrq, _fixConnectionSystem.priceSession.SessionID);
            }
        }
        private void createSecDefRequest(Model.OrderModel orderModel)
        {
            QuickFix.FIX42.SecurityDefinitionRequest order = new QuickFix.FIX42.SecurityDefinitionRequest();
            //new ClOrdID(DateTime.Now.ToOADate().ToString()),
            //new HandlInst('3'),
            //new Symbol("ES"),
            //new Side(Side.BUY),
            //new TransactTime(DateTime.Now),
            //new OrdType(OrdType.LIMIT));

            order.Symbol = new Symbol(orderModel.underlyingExchangeSymbol);

            order.SecurityExchange = new SecurityExchange(orderModel.underlyingExchange);

            order.SecurityType = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.securityType);

            if (orderModel.securityType == Enums.SECURITY_TYPE.OPTION)
            {
                order.PutOrCall = StageOrdersToTTWPFLibrary.FixEnumTranslator.ToField(orderModel.optionType);
            }

            order.StrikePrice = new StrikePrice(orderModel.optionStrikePrice); //new decimal(207000));

            order.MaturityMonthYear = new MaturityMonthYear(orderModel.maturityMonthYear);

            //order.OrderQty = new OrderQty(2);

            //order.Price = new Price(new decimal(1300));

            //new HandlInst()
            //new ClOrdID("1234"),
            //new Symbol("AAPL"),
            //new Side(Side.BUY),
            //new TransactTime(DateTime.Now),
            //new OrdType(OrdType.LIMIT));

            //order.SetField(new StringField(16106, "StagedOrderMsg"));

            //order.SetField(new CharField(16111, 'I'));

            //order.Account = new Account("tmqrexodts");



            //QuickFix.Session.SendToTarget(order, _session.SessionID);

            //QuickFix.FIX42.NewOrderSingle order = (QuickFix.FIX42.NewOrderSingle)orderObject;

            QuickFix.Session.SendToTarget(order, _fixConnectionSystem.orderSession.SessionID);
        }