//-- 2000
        public void BOARD_LOT_IN()
        {
            Console.WriteLine("BOARD_LOT_IN ******** count " + ++count1);

            C_LotIN obj = new C_LotIN()
            {
                TransectionCode = 2000,
                OrderNo = 0002,
                ClintId = Global.Instance.ClientId,//ORDERC001
                TokenNo = 42882,
                contract_obj = new C_Contract_Desc()
                {
                    InstrumentName = "FUTIDX",
                    Symbol = "NIFTY",
                    ExpiryDate = 1107009000,
                    StrikePrice = -1,
                    OptionType = "XX",
                    //		CALevel = 0,//
                },
                AccountNumber = "",
                Buy_SellIndicator = 1,
                DisclosedVolume = 100,
                Volume = 100,
                Price = 802000,
                TriggerPrice = 801000,
                Open_Close = Convert.ToByte('O'),
                //	Reasoncode=00,//
            };
            byte[] buffer = DataPacket.RawSerialize(obj);
            NNFHandler.Instance.Publisher(MessageType.ORDER, buffer);
        }
        // 20040
        //public void ORDER_MOD_IN_TR(double OrderNo,int price )// 20040
        public void ORDER_MOD_IN_TR(long _OrderNo, int volume, int price)
        {
            double OrderNo = Convert.ToDouble(_OrderNo);
            C_LotIN obj = new C_LotIN();
            if (Holder.holderOrder.ContainsKey(OrderNo))
            {
                obj.TransectionCode = 20040;
                obj.OrderNo = (long)OrderNo;
                obj.ClintId = Global.Instance.ClientId;
                obj.TokenNo = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.TokenNo);
                obj.contract_obj = new C_Contract_Desc()
                {
                    InstrumentName = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.InstrumentName),
                    Symbol = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.Symbol),
                    ExpiryDate = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.ExpiryDate),
                    StrikePrice = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.StrikePrice),
                    OptionType = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.OptionType),
                    //		CALevel = 0,//
                };
                obj.AccountNumber = "";
                obj.Buy_SellIndicator = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Buy_SellIndicator);
                obj.Price = price;
                obj.DisclosedVolume = obj.Volume=volume;

                obj.Open_Close = Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Open_Close;

                byte[] buffer = DataPacket.RawSerialize(obj);
                NNFHandler.Instance.Publisher(MessageType.ORDER, buffer);
            }
            else
                Console.WriteLine("Order no. does no exist ");
        }
        //-- 2040
        public void ORDER_MOD_IN(double OrderNo, int TriggerPrice)
        {
            C_LotIN obj = new C_LotIN()
            {
                TransectionCode = 2040,
                OrderNo = (long)OrderNo,
                ClintId = Global.Instance.ClientId,
                //Holder.holderOrder [OrderNo].TokenNo
                TokenNo = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_REQUEST.TokenNo),

                contract_obj = new C_Contract_Desc()
                {
                    InstrumentName = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_REQUEST.contract_obj.InstrumentName),
                    Symbol = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_REQUEST.contract_obj.Symbol),
                    ExpiryDate = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_REQUEST.contract_obj.ExpiryDate),
                    StrikePrice = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_REQUEST.contract_obj.StrikePrice),
                    OptionType = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_REQUEST.contract_obj.OptionType),
                    //		CALevel = 0,//
                },
                AccountNumber = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_REQUEST.AccountNumber),
                Buy_SellIndicator = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_REQUEST.Buy_SellIndicator),
                DisclosedVolume = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_REQUEST.DisclosedVolume),
                Volume = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_REQUEST.Volume),
                Price = 802000,
                TriggerPrice = TriggerPrice,
                Open_Close = Holder.holderOrder[OrderNo].mS_OE_REQUEST.Open_Close,

            };
            byte[] buffer = DataPacket.RawSerialize(obj);
            NNFHandler.Instance.Publisher(MessageType.ORDER, buffer);
        }
        //-- 20070
        public void ORDER_CANCEL_IN_TR(long _OrderNo)
        {
            // Console.WriteLine("Enter Order No ");
            double OrderNo = Convert.ToDouble(_OrderNo);

            if (Holder.holderOrder.ContainsKey(OrderNo))
            {

                C_LotIN obj = new C_LotIN()
                {
                    TransectionCode = 20070,
                    OrderNo = (long)OrderNo,
                    ClintId = Global.Instance.ClientId,
                    TokenNo = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.TokenNo),

                    contract_obj = new C_Contract_Desc()
                    {
                        InstrumentName = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.InstrumentName),
                        Symbol = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.Symbol),
                        ExpiryDate = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.ExpiryDate),
                        StrikePrice = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.StrikePrice),
                        OptionType = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.OptionType),
                        //		CALevel = 0,//
                    },
                    AccountNumber = System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.AccountNumber),
                    Buy_SellIndicator = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Buy_SellIndicator),
                    DisclosedVolume = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.DisclosedVolume),
                    Volume = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Volume),
                    Price = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Price),
                    //TriggerPrice = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR),
                    Open_Close = Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Open_Close,

                };

                byte[] buffer = DataPacket.RawSerialize(obj);
                NNFHandler.Instance.Publisher(MessageType.ORDER, buffer);
            }
            else
                Console.WriteLine("Order no. does no exist ");
        }
        //-- 20000
        public void BOARD_LOT_IN_TR(int tokenNo, string instrumentName, string symbol, int expiryDate, int strikePrice, string optionType, short buy_SellIndicator, int volume, int price)
        {
            C_LotIN obj = new C_LotIN()
            {
                TransectionCode = 20000,
                OrderNo = 0,
                ClintId = Global.Instance.ClientId,
                TokenNo = tokenNo,
                contract_obj = new C_Contract_Desc()
                {
                    InstrumentName = instrumentName,
                    Symbol = symbol,
                    ExpiryDate = expiryDate,
                    StrikePrice = instrumentName == "OPTIDX" || instrumentName == "OPTSTK" ? strikePrice * 100 : strikePrice,
                    OptionType = optionType,
                    //		CALevel = 0,//
                },

                AccountNumber = "",
                Buy_SellIndicator = buy_SellIndicator,
                DisclosedVolume = volume,
                Volume = volume,
                Price = price,
                //  TriggerPrice = 0,//
                Open_Close = Convert.ToByte('O'),
                //	Reasoncode=00,//

            };
            bool flag = true;

            /*	Console.WriteLine (" InstrumentName\n 1.FUTIDX  \n 2. FUTSTK ");
                Char ch = Console.ReadLine ().ToString ().ToUpper ().ToCharArray () [0];
                if (ch == '1')
                    obj.contract_obj.InstrumentName = "FUTIDX";
                if (ch == '2')
                    obj.contract_obj.InstrumentName = "FUTSTK";
                Console.WriteLine (" Symbol ");
                obj.contract_obj.Symbol = Console.ReadLine().ToUpper();
                Console.WriteLine ("Enter Buy_SellIndicator 1(buy)/2(sell) = ");
                flag= Int16.TryParse(Console.ReadLine(),out obj.Buy_SellIndicator);
                Console.WriteLine ("Enter Token No = ");
                flag= int.TryParse(Console.ReadLine(),out obj.TokenNo);
                Console.WriteLine ("Enter quantity = ");
                flag=int.TryParse(Console.ReadLine(),out obj.Volume);
                obj.DisclosedVolume = obj.Volume;
                Console.WriteLine ("Enter Price = ");
                flag=int.TryParse(Console.ReadLine(),out obj.Price);
            */
             /*   if (!flag || obj.Price == 0)
            {
                Console.WriteLine("Market Order Not allow  ");
                return;
            }
            */
            byte[] buffer = DataPacket.RawSerialize(obj);
            NNFHandler.Instance.Publisher(MessageType.ORDER, buffer);
        }
Exemplo n.º 6
0
        //-- 2062
        public void KILL_switch_in()
        {
            // Console.WriteLine("Enter Order No ");
            double OrderNo = Convert.ToDouble(0);

            //if (Holder.holderOrder.ContainsKey(OrderNo))
               // {

                C_LotIN obj = new C_LotIN()
                {
                    TransectionCode = 2062,
                    OrderNo = (long)OrderNo,
                    ClintId = Global.Instance.ClientId,
                    TokenNo = IPAddress.HostToNetworkOrder(0),

                    contract_obj = new C_Contract_Desc()
                    {
                        InstrumentName = "",
                        Symbol =" ",//System.Text.Encoding.UTF8.GetString(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR.Contr_dec_tr_Obj.Symbol),
                        ExpiryDate = IPAddress.HostToNetworkOrder(0),
                        StrikePrice = IPAddress.HostToNetworkOrder(0),
                        OptionType = "",
                        //		CALevel = 0,//
                    },
                    AccountNumber = "",
                    Buy_SellIndicator = IPAddress.HostToNetworkOrder((short)0),
                    DisclosedVolume = IPAddress.HostToNetworkOrder(0),
                    Volume = IPAddress.HostToNetworkOrder(0),
                    Price = IPAddress.HostToNetworkOrder(0),
                    //TriggerPrice = IPAddress.HostToNetworkOrder(Holder.holderOrder[OrderNo].mS_OE_RESPONSE_TR),
                    Open_Close =Convert.ToByte(' '),

                };

                byte[] buffer = DataPacket.RawSerialize(obj);
                NNFHandler.Instance.Publisher(MessageType.ORDER, buffer);
               // }
               // else
              //  Console.WriteLine("Order no. does no exist ");
        }