void modified()
        {
            string pf = Convert.ToString(DGV1.SelectedRows[0].Cells["PF"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["PF"].Value);

            string Order_Type = Convert.ToString(DGV1.SelectedRows[0].Cells["Order_Type"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Order_Type"].Value);

            string Strategy_Type = Convert.ToString(DGV1.SelectedRows[0].Cells["Strategy_Type"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Strategy_Type"].Value);
            string Calc_type = Convert.ToString(DGV1.SelectedRows[0].Cells["Calc_type"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Calc_type"].Value);

            string InstType = Convert.ToString(DGV1.SelectedRows[0].Cells["tok1inst"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["tok1inst"].Value);

            string InstType2 = Convert.ToString(DGV1.SelectedRows[0].Cells["tok2inst"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["tok2inst"].Value);
            string Symbol1 = Convert.ToString(DGV1.SelectedRows[0].Cells["Symbol1"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Symbol1"].Value);
            string Symbol2 = Convert.ToString(DGV1.SelectedRows[0].Cells["Symbol2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Symbol2"].Value);
            string Expiry = Convert.ToString(DGV1.SelectedRows[0].Cells["Expiry"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Expiry"].Value);
            string Expiry2 = Convert.ToString(DGV1.SelectedRows[0].Cells["Expiry2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Expiry2"].Value);
            string OptionType = Convert.ToString(DGV1.SelectedRows[0].Cells["OptionType"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OptionType"].Value);
            string OptionType2 = Convert.ToString(DGV1.SelectedRows[0].Cells["OptionType2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OptionType2"].Value);
            string StrikePrice = Convert.ToString(DGV1.SelectedRows[0].Cells["StrikePrice"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["StrikePrice"].Value);
            string StrikePrice2 = Convert.ToString(DGV1.SelectedRows[0].Cells["StrikePrice2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["StrikePrice2"].Value);
            string ReqConnt1 = Convert.ToString(DGV1.SelectedRows[0].Cells["ReqConnt"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ReqConnt"].Value);
            string ratio1 = Convert.ToString(DGV1.SelectedRows[0].Cells["ratio1"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ratio1"].Value);
            string ratio2 = Convert.ToString(DGV1.SelectedRows[0].Cells["ratio2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ratio2"].Value);
            string buy_sel = Convert.ToString(DGV1.SelectedRows[0].Cells["Tok1B_S"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Tok1B_S"].Value);
            string buy_sel2 = Convert.ToString(DGV1.SelectedRows[0].Cells["Tok2B_S"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Tok2B_S"].Value);

            string First_LEG = Convert.ToString(DGV1.SelectedRows[0].Cells["First_LEG"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["First_LEG"].Value);
            string OPT_TICK = Convert.ToString(DGV1.SelectedRows[0].Cells["OPT_TICK"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OPT_TICK"].Value);
            string ORDER_DEPTH = Convert.ToString(DGV1.SelectedRows[0].Cells["ORDER_DEPTH"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ORDER_DEPTH"].Value);
            string Second_Leg = Convert.ToString(DGV1.SelectedRows[0].Cells["Second_Leg"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Second_Leg"].Value);
            string we = Convert.ToString(DGV1.SelectedRows[0].Cells["THRESHOLD"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["THRESHOLD"].Value);
            string THRESHOLD = we.Remove(we.Length - 1);
            string BIDDING_RANGE = Convert.ToString(DGV1.SelectedRows[0].Cells["BIDDING_RANGE"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["BIDDING_RANGE"].Value);
            string Token1 = Convert.ToString(DGV1.SelectedRows[0].Cells["Token1"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Token1"].Value);
            string Token2 = Convert.ToString(DGV1.SelectedRows[0].Cells["Token2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Token2"].Value);
            string Token3 = Convert.ToString(DGV1.SelectedRows[0].Cells["Token3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Token3"].Value);

            string NEAR = Convert.ToString(DGV1.SelectedRows[0].Cells["NEAR"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["NEAR"].Value);
            string FAR = Convert.ToString(DGV1.SelectedRows[0].Cells["FAR"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["FAR"].Value);

            string reqCON = Convert.ToString(DGV1.SelectedRows[0].Cells["ReqConnt"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ReqConnt"].Value);

            string Symbol3 = Convert.ToString(DGV1.SelectedRows[0].Cells["Symbol3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Symbol3"].Value);
            string Expiry3 = Convert.ToString(DGV1.SelectedRows[0].Cells["Expiry3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Expiry3"].Value);
            string OptionType3 = Convert.ToString(DGV1.SelectedRows[0].Cells["OptionType3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OptionType3"].Value);
            string StrikePrice3 = Convert.ToString(DGV1.SelectedRows[0].Cells["StrikePrice3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["StrikePrice3"].Value);
            string InstType3 = Convert.ToString(DGV1.SelectedRows[0].Cells["tok3inst"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["tok3inst"].Value);
            string ratio3 = Convert.ToString(DGV1.SelectedRows[0].Cells["ratio3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ratio3"].Value);
            string buy_sel3 = Convert.ToString(DGV1.SelectedRows[0].Cells["Tok3B_S"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["Tok3B_S"].Value);
            string tok3 = Convert.ToString(DGV1.SelectedRows[0].Cells["tok3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["tok3"].Value);

            string OppsitToken1 = Convert.ToString(DGV1.SelectedRows[0].Cells["OppsitToken1"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OppsitToken1"].Value);
            string OppsitToken2 = Convert.ToString(DGV1.SelectedRows[0].Cells["OppsitToken2"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OppsitToken2"].Value);
            string OppsitToken3 = Convert.ToString(DGV1.SelectedRows[0].Cells["OppsitToken3"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["OppsitToken3"].Value);
            //====================

            string BUYPRICE = Convert.ToString(DGV1.SelectedRows[0].Cells["BUYPRICE"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["BUYPRICE"].Value);
            string SELLPRICE = Convert.ToString(DGV1.SelectedRows[0].Cells["SELLPRICE"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["SELLPRICE"].Value);
            string ORDQTY_b = Convert.ToString(DGV1.SelectedRows[0].Cells["ORDQTY(B)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ORDQTY(B)"].Value);
            string ORDQTY_S = Convert.ToString(DGV1.SelectedRows[0].Cells["ORDQTY(S)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ORDQTY(S)"].Value);
            string TOTALQTY_B = Convert.ToString(DGV1.SelectedRows[0].Cells["TOTALQTY(B)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["TOTALQTY(B)"].Value);
            string TOTALQTY_S = Convert.ToString(DGV1.SelectedRows[0].Cells["TOTALQTY(S)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["TOTALQTY(S)"].Value);
            string PAYUPTIEKS = Convert.ToString(DGV1.SelectedRows[0].Cells["PAYUPTIEKS"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["PAYUPTIEKS"].Value);
            string W_T_C = Convert.ToString(DGV1.SelectedRows[0].Cells["W_T_C"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["W_T_C"].Value);

            string ATP_S = Convert.ToString(DGV1.SelectedRows[0].Cells["ATP(S)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ATP(S)"].Value);
            string ATP_b = Convert.ToString(DGV1.SelectedRows[0].Cells["ATP(B)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["ATP(B)"].Value);
            string TRDQTY_s = Convert.ToString(DGV1.SelectedRows[0].Cells["TRDQTY(S)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["TRDQTY(S)"].Value);
            string TRDQTY_b = Convert.ToString(DGV1.SelectedRows[0].Cells["TRDQTY(B)"].Value == DBNull.Value ? "0" : DGV1.SelectedRows[0].Cells["TRDQTY(B)"].Value);

            //=========================================================================================================

             //   DGV1.Rows.RemoveAt(DGV1.SelectedRows[0].Index);

            DataTable dt = SpreadTable;

            using (AddSpreadToken _AddToken = new AddSpreadToken())
            {
                _AddToken.Token1sp = Token1;
                _AddToken.Token2sp = Token2;
                _AddToken.NEARSP = NEAR;
                _AddToken.FARSP = FAR;
                _AddToken.button1.Text = "Modify";
                _AddToken.lblPfName.Visible = true;
                _AddToken.txtpfName.Visible = true;
                _AddToken.Text = "Modify ";

                _AddToken.txtpfName.Text = pf;
                _AddToken.combox_OrderType.Text = Order_Type;

                _AddToken.OppsitToken1 = OppsitToken1;

                _AddToken.OppsitToken2 = OppsitToken2;

               // _AddToken.combox_OrderType.SelectedIndex = _AddToken.combox_OrderType.FindStringExact(Order_Type);

               // var item = _AddToken.combox_OrderType.GetItemText(_AddToken.combox_OrderType.Order_Type);

                if (Order_Type == "Bidding")
                {
                    _AddToken.comb_1stleg.Visible = true;
                    _AddToken.combox_optTrick.Visible = true;
                    _AddToken.comb_OrderDepth.Visible = true;
                    _AddToken.com2nd_leg.Visible = true;
                    _AddToken.textBox_Threshold.Visible = true;
                    _AddToken.comb_BidRange.Visible = true;
                    _AddToken.label9.Visible = true;
                    _AddToken.label10.Visible = true;
                    _AddToken.label11.Visible = true;
                    _AddToken.label12.Visible = true;
                    _AddToken.label13.Visible = true;
                    _AddToken.label15.Visible = true;
                    _AddToken.label17.Visible = true;
                    _AddToken.txtReqConnt.Visible = true;

                    if (Strategy_Type == "3_LEG")
                    {
                        _AddToken.Strategy_type_comboBox1.Text = Strategy_Type;
                       _AddToken.EXcomboBox3.Visible = true;
                        _AddToken.ORcomboBox4.Visible = true;
                        _AddToken.INSTcomboBox5.Visible = true;
                        _AddToken.SYMcomboBox6.Visible = true;
                        _AddToken.EXPcomboBox7.Visible = true;
                        _AddToken.OPcomboBox8.Visible = true;
                        _AddToken.STRIKecomboBox9.Visible = true;
                        _AddToken.textBox_Rati3.Visible = true;
                        _AddToken.cmd_buy_sell3.Visible = true;

                        _AddToken.INSTcomboBox5.Text = InstType3;
                        _AddToken.SYMcomboBox6.Text = Symbol3;
                        _AddToken.EXPcomboBox7.Text = Expiry3;
                        _AddToken.OPcomboBox8.Text = OptionType3;
                        _AddToken.STRIKecomboBox9.Text = StrikePrice3;
                        _AddToken.textBox_Rati3.Text = ratio3;
                        _AddToken.textBox_Rati3.Text = buy_sel3;
                        _AddToken.Token3sp = Token3;
                        _AddToken.tok3sp = tok3;
                        _AddToken.OppsitToken3 = OppsitToken3;

                        _AddToken.INSTcomboBox5.Enabled = false;
                        _AddToken.SYMcomboBox6.Enabled = false;
                        _AddToken.EXPcomboBox7.Enabled = false;
                        _AddToken.OPcomboBox8.Enabled = false;
                        _AddToken.STRIKecomboBox9.Enabled = false;
                        _AddToken.textBox_Rati3.Enabled = false;
                        _AddToken.cmd_buy_sell3.Enabled = false;
                        _AddToken.show();
                    }

                }

                _AddToken.EXcomboBox1.Enabled = false;
                _AddToken.ORcomboBox2.Enabled = false;
                _AddToken.EXcomboBox2.Enabled = false;
                _AddToken.ORcomboBox3.Enabled = false;
                _AddToken.OPcomboBox6.Enabled = false;
                _AddToken.STRIKecomboBox7.Enabled = false;
             _AddToken.EXcomboBox3.Enabled = false;
             _AddToken.ORcomboBox4.Enabled = false;

                _AddToken.combox_OrderType.Enabled = false;
                _AddToken.Strategy_type_comboBox1.Text = Strategy_Type;
                _AddToken.Strategy_type_comboBox1.Enabled = false;
                _AddToken.Calc_typecomboBox1.Text = Calc_type;
                _AddToken.Calc_typecomboBox1.Enabled = false;
                _AddToken.INSTcomboBox3.Text = InstType;
                _AddToken.INSTcomboBox3.Enabled = false;
                _AddToken.SYMcomboBox4.Text = Symbol1;
                _AddToken.SYMcomboBox4.Enabled = false;
                _AddToken.EXPcomboBox5.Text = Expiry;
                _AddToken.EXPcomboBox5.Enabled = false;
                _AddToken.OPcomboBox6.Text = OptionType;
                _AddToken.OPcomboBox6.Enabled = false;
                _AddToken.STRIKecomboBox7.Text = StrikePrice;
                _AddToken.STRIKecomboBox7.Enabled = false;
                _AddToken.textBox_Ratio.Text = ratio1;
                _AddToken.textBox_Ratio.Enabled = false;
                _AddToken.cmd_buy_sell1.Text = buy_sel;
                _AddToken.cmd_buy_sell1.Enabled = false;
                _AddToken.INSTcomboBox4.Text = InstType2;
                _AddToken.INSTcomboBox4.Enabled = false;
                _AddToken.SYMcomboBox5.Text = Symbol2;
                _AddToken.SYMcomboBox5.Enabled = false;
                _AddToken.EXPcomboBox6.Text = Expiry2;
                _AddToken.EXPcomboBox6.Enabled = false;
                _AddToken.OPcomboBox7.Text = OptionType2;
                _AddToken.OPcomboBox7.Enabled = false;
                _AddToken.STRIKecomboBox8.Text = StrikePrice2;
                _AddToken.STRIKecomboBox8.Enabled = false;
                _AddToken.textBox_Ratio2.Text = " ";
                _AddToken.txtReqConnt.Text = ReqConnt1;

                _AddToken.textBox_Ratio2.Text = ratio2;
                _AddToken.textBox_Ratio2.Enabled = false;
                _AddToken.cmd_buy_sell2.Text = buy_sel2;
                _AddToken.cmd_buy_sell2.Enabled = false;
                _AddToken.comb_1stleg.Text = First_LEG;
                _AddToken.comb_1stleg.Enabled = false;
                _AddToken.combox_optTrick.Text = OPT_TICK;
                // _AddToken.combox_optTrick.Enabled = false;
                _AddToken.comb_OrderDepth.Text = ORDER_DEPTH;
                // _AddToken.comb_OrderDepth.Enabled = false;
                _AddToken.com2nd_leg.Text = Second_Leg;
                _AddToken.com2nd_leg.Enabled = false;
                _AddToken.textBox_Threshold.Text = THRESHOLD;

                // _AddToken.textBox_Threshold.Enabled = false;
                _AddToken.comb_BidRange.Text = BIDDING_RANGE;

                // _AddToken.comb_BidRange.Enabled = false;
                _AddToken.txtReqConnt.Text = reqCON;

                if (_AddToken.ShowDialog() == DialogResult.OK)
                {
                  //  DataRow dr1 = SpreadTable.NewRow();

                    DataRow[] dr = SpreadTable.Select("PF  = '" + (_AddToken._objOut2.PFName).ToString() + "'");

               //     DataRow[] dr = Global.Instance.TradeTracker.("PF_ID  = '" + (_AddToken._objOut2.PFName.ToString()) + "'");

                    dr[0]["PF"] = _AddToken._objOut2.PFName;
                    dr[0]["NEAR"] = _AddToken._objOut2.Desc1;
                    dr[0]["Token1"] = _AddToken._objOut2.Token1;

                    dr[0]["FAR"] = _AddToken._objOut2.Desc2;
                    dr[0]["Token2"] = _AddToken._objOut2.Token2;
                    dr[0]["tok3"] = _AddToken._objOut2.Desc3;
                    dr[0]["Token3"] = _AddToken._objOut2.Token3;
                    dr[0]["Token4"] = _AddToken._objOut2.Token4;
                    dr[0]["Calc_type"] = _AddToken._objOut2.Calc_type;

                    dr[0]["ratio1"] = Convert.ToString(_AddToken._objOut2.ratio1) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio1);
                    dr[0]["ratio2"] = Convert.ToString(_AddToken._objOut2.ratio2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio2);
                    dr[0]["ratio3"] = Convert.ToString(_AddToken._objOut2.ratio3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio3);
                    dr[0]["ratio4"] = Convert.ToString(_AddToken._objOut2.ratio4) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio4);

                    dr[0]["Strategy_Type"] = Convert.ToString(_AddToken._objOut2.Strat_type) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Strat_type);
                    dr[0]["Symbol1"] = Convert.ToString(_AddToken._objOut2.Symbol1) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Symbol1);
                    dr[0]["Symbol2"] = Convert.ToString(_AddToken._objOut2.Symbol2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Symbol2);
                    dr[0]["Expiry"] = Convert.ToString(_AddToken._objOut2.Expiry) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Expiry);
                    dr[0]["Expiry2"] = Convert.ToString(_AddToken._objOut2.Expiry2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Expiry2);
                    dr[0]["OptionType"] = Convert.ToString(_AddToken._objOut2.OptionType) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OptionType);
                    dr[0]["OptionType2"] = Convert.ToString(_AddToken._objOut2.OptionType2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OptionType2);
                    dr[0]["StrikePrice"] = Convert.ToString(_AddToken._objOut2.StrikePrice) == "" ? "0" : Convert.ToString(_AddToken._objOut2.StrikePrice);
                    dr[0]["StrikePrice2"] = Convert.ToString(_AddToken._objOut2.StrikePrice2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.StrikePrice2);
                    dr[0]["ReqConnt"] = Convert.ToString(_AddToken._objOut2.ReqConnt) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ReqConnt);

                    dr[0]["Symbol3"] = Convert.ToString(_AddToken._objOut2.Symbol3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Symbol3);
                    dr[0]["Expiry3"] = Convert.ToString(_AddToken._objOut2.Expiry3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Expiry3);
                    dr[0]["OptionType3"] = Convert.ToString(_AddToken._objOut2.OptionType3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OptionType3);
                    dr[0]["StrikePrice3"] = Convert.ToString(_AddToken._objOut2.StrikePrice3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.StrikePrice3);

                    dr[0]["Order_Type"] = Convert.ToString(_AddToken._objOut2.Order_Type) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Order_Type);
                    dr[0]["First_LEG"] = Convert.ToString(_AddToken._objOut2.first_LEG) == "" ? "0" : Convert.ToString(_AddToken._objOut2.first_LEG);
                    dr[0]["OPT_TICK"] = Convert.ToString(_AddToken._objOut2.OPT_TICK) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OPT_TICK);
                    dr[0]["ORDER_DEPTH"] = Convert.ToString(_AddToken._objOut2.ORDER_DEPTH) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ORDER_DEPTH);
                    dr[0]["Second_Leg"] = Convert.ToString(_AddToken._objOut2.second_Leg) == "" ? "0" : Convert.ToString(_AddToken._objOut2.second_Leg);
                    dr[0]["THRESHOLD"] = Convert.ToString(_AddToken._objOut2.THRESHOLD) == "" ? "0" : Convert.ToString(_AddToken._objOut2.THRESHOLD);
                    dr[0]["BIDDING_RANGE"] = Convert.ToString(_AddToken._objOut2.BIDDING_RANGE) == "" ? "0" : Convert.ToString(_AddToken._objOut2.BIDDING_RANGE);

                    dr[0]["Tok1B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell);
                    dr[0]["Tok2B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell2);
                    dr[0]["Tok3B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell3);
                    dr[0]["Tok4B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell4) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell4);

                    dr[0]["tok1inst"] = _AddToken._objOut2.tok1_inst;
                    dr[0]["tok2inst"] = _AddToken._objOut2.tok2_inst;
                    dr[0]["tok3inst"] = _AddToken._objOut2.tok3_inst;
                    dr[0]["F_BID"] = 0;
                    dr[0]["F_ASK"] = 0;

                    dr[0]["F_LTP"] = 0;
                    dr[0]["NBID"] = 0;

                    dr[0]["NASK"] = 0;
                    dr[0]["NLTP"] = 0;

                    dr[0]["FBID"] = 0;
                    dr[0]["FASK"] = 0;

                    dr[0]["FLTP"] = 0;
                    dr[0]["NETDelta1"] = 0;
                    dr[0]["NETDelta2"] = 0;
                    dr[0]["NETDelta3"] = 0;

                    dr[0]["OppsitLTP1"] = 0;
                    dr[0]["OppsitLTP2"] = 0;
                    dr[0]["OppsitLTP3"] = 0;
                    dr[0]["OppsitToken1"] = _AddToken._objOut2.OppositeToken1;
                    dr[0]["OppsitToken2"] = _AddToken._objOut2.OppositeToken2;
                    dr[0]["OppsitToken3"] = _AddToken._objOut2.OppositeToken3;

                    //  dr["ratio2"] = Convert.ToString(_AddToken._objOut2.ratio2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio2);

                  //  SpreadTable.Rows.Add(dr);

                    //dr["BFSNDIFF"] =  0.0000;
                    //dr["BNSFDIFF"]=0.0000;
                    //dr["BNSFMNQ"] = 0.0000;
                    //dr["BFSNMNQ"] = 0.0000;
                    //dr["BNSFMXQ"] = 0.0000;
                    //dr["BFSNMXQ"] = 0.0000;

                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["BUYPRICE"].Value = BUYPRICE;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["SELLPRICE"].Value = SELLPRICE;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ORDQTY(B)"].Value = ORDQTY_b;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ORDQTY(S)"].Value = ORDQTY_S;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TOTALQTY(B)"].Value = TOTALQTY_B;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TOTALQTY(S)"].Value = TOTALQTY_S;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["PAYUPTIEKS"].Value = PAYUPTIEKS;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["W_T_C"].Value = W_T_C;

                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ATP(S)"].Value = ATP_S;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ATP(B)"].Value = ATP_b;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TRDQTY(S)"].Value = TRDQTY_s;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TRDQTY(B)"].Value = TRDQTY_b;

                  //  UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token1;
                //    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token2;
                //    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token3;
                //    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token4;

                 //   UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.OppositeToken1;
                 //   UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.OppositeToken2;
                 //   UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.OppositeToken3;

                        LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token1;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token2;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token3;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token4;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.OppositeToken1;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.OppositeToken2;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.OppositeToken3;

                    //   FOPAIRDIFF

                    // portFolioCounter++;

                }
            }
        }
        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            if (portFolioCounter == 0)
                portFolioCounter = 1;
            using (AddSpreadToken _AddToken = new AddSpreadToken())
            {
                _AddToken.txtpfName.Text = portFolioCounter.ToString();
                _AddToken.lblPfName.Visible = true;
                _AddToken.txtpfName.Visible = true;
                _AddToken.Text = "Add Near Month Token";
                _AddToken.button1.Text = "Add Token";

                _AddToken.combox_OrderType.Text = "Bidding";
                _AddToken.comb_1stleg.Text = "NORMAL";
                _AddToken.combox_optTrick.Text = "1";
                _AddToken.comb_OrderDepth.Text = "1";
                _AddToken.com2nd_leg.Text = "MKT";
                _AddToken.textBox_Threshold.Text = "50";
                _AddToken.comb_BidRange.Text = "1";
                _AddToken.txtReqConnt.Text = "25";

                if (_AddToken.ShowDialog() == DialogResult.OK)
                {
                    DataRow dr = SpreadTable.NewRow();

                    dr["PF"] = _AddToken._objOut2.PFName;
                    dr["NEAR"] = _AddToken._objOut2.Desc1;
                    dr["Token1"] = _AddToken._objOut2.Token1;

                    dr["FAR"] = _AddToken._objOut2.Desc2;
                    dr["Token2"] = _AddToken._objOut2.Token2;
                    dr["tok3"] = _AddToken._objOut2.Desc3;
                    dr["Token3"] = _AddToken._objOut2.Token3;
                    dr["Token4"] = _AddToken._objOut2.Token4;
                    dr["Calc_type"] = _AddToken._objOut2.Calc_type;

                    dr["ratio1"] = Convert.ToString(_AddToken._objOut2.ratio1) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio1);
                    dr["ratio2"] = Convert.ToString(_AddToken._objOut2.ratio2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio2);
                    dr["ratio3"] = Convert.ToString(_AddToken._objOut2.ratio3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio3);
                    dr["ratio4"] = Convert.ToString(_AddToken._objOut2.ratio4) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio4);

                    dr["Strategy_Type"] = Convert.ToString(_AddToken._objOut2.Strat_type) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Strat_type);
                    dr["Symbol1"] = Convert.ToString(_AddToken._objOut2.Symbol1) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Symbol1);
                    dr["Symbol2"] = Convert.ToString(_AddToken._objOut2.Symbol2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Symbol2);
                    dr["Expiry"] = Convert.ToString(_AddToken._objOut2.Expiry) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Expiry);
                    dr["Expiry2"] = Convert.ToString(_AddToken._objOut2.Expiry2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Expiry2);
                    dr["OptionType"] = Convert.ToString(_AddToken._objOut2.OptionType) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OptionType);
                    dr["OptionType2"] = Convert.ToString(_AddToken._objOut2.OptionType2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OptionType2);
                    dr["StrikePrice"] = Convert.ToString(_AddToken._objOut2.StrikePrice) == "" ? "0" : Convert.ToString(_AddToken._objOut2.StrikePrice);
                    dr["StrikePrice2"] = Convert.ToString(_AddToken._objOut2.StrikePrice2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.StrikePrice2);
                    dr["ReqConnt"] = Convert.ToString(_AddToken._objOut2.ReqConnt) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ReqConnt);

                    dr["Symbol3"] = Convert.ToString(_AddToken._objOut2.Symbol3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Symbol3);
                    dr["Expiry3"] = Convert.ToString(_AddToken._objOut2.Expiry3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Expiry3);
                    dr["OptionType3"] = Convert.ToString(_AddToken._objOut2.OptionType3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OptionType3);
                    dr["StrikePrice3"] = Convert.ToString(_AddToken._objOut2.StrikePrice3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.StrikePrice3);

                    dr["Order_Type"] = Convert.ToString(_AddToken._objOut2.Order_Type) == "" ? "0" : Convert.ToString(_AddToken._objOut2.Order_Type);
                    dr["First_LEG"] = Convert.ToString(_AddToken._objOut2.first_LEG) == "" ? "0" : Convert.ToString(_AddToken._objOut2.first_LEG);
                    dr["OPT_TICK"] = Convert.ToString(_AddToken._objOut2.OPT_TICK) == "" ? "0" : Convert.ToString(_AddToken._objOut2.OPT_TICK);
                    dr["ORDER_DEPTH"] = Convert.ToString(_AddToken._objOut2.ORDER_DEPTH) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ORDER_DEPTH);
                    dr["Second_Leg"] = Convert.ToString(_AddToken._objOut2.second_Leg) == "" ? "0" : Convert.ToString(_AddToken._objOut2.second_Leg);
                    dr["THRESHOLD"] = Convert.ToString(_AddToken._objOut2.THRESHOLD) == "" ? "0" : Convert.ToString(_AddToken._objOut2.THRESHOLD);
                    dr["BIDDING_RANGE"] = Convert.ToString(_AddToken._objOut2.BIDDING_RANGE) == "" ? "0" : Convert.ToString(_AddToken._objOut2.BIDDING_RANGE);

                    dr["Tok1B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell);
                    dr["Tok2B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell2);
                    dr["Tok3B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell3);
                    dr["Tok4B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell4) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell4);

                    dr["tok1inst"] = _AddToken._objOut2.tok1_inst;
                    dr["tok2inst"] = _AddToken._objOut2.tok2_inst;
                    dr["tok3inst"] = _AddToken._objOut2.tok3_inst;
                    dr["F_BID"] = 0;
                    dr["F_ASK"] = 0;

                    dr["F_LTP"] = 0;
                    dr["NBID"] = 0;

                    dr["NASK"] = 0;
                    dr["NLTP"] = 0;

                    dr["FBID"] = 0;
                    dr["FASK"] = 0;

                    dr["FLTP"] = 0;
                    dr["NETDelta1"] = 0;
                    dr["NETDelta2"] = 0;
                    dr["NETDelta3"] = 0;

                    dr["OppsitToken1"] = _AddToken._objOut2.OppositeToken1;
                    dr["OppsitToken2"] = _AddToken._objOut2.OppositeToken2;
                    dr["OppsitToken3"] = _AddToken._objOut2.OppositeToken3;

                    ///   \\\\\    /////   \\\\\\\\  /////   \\\\   ////   \\\\
                    //dr["OppsitDesc1"] = _AddToken._objOut2.OppositeDesc1;
                   // dr["OppsitDesc2"] = _AddToken._objOut2.OppositeDesc2;
                   // dr["OppsitDesc3"] = _AddToken._objOut2.OppositeDesc3;
                    dr["OppsitLTP1"] = 0;
                    dr["OppsitLTP2"] = 0;
                    dr["OppsitLTP3"] = 0;
                    //  dr["ratio2"] = Convert.ToString(_AddToken._objOut2.ratio2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio2);

                    SpreadTable.Rows.Add(dr);

                    //dr["BFSNDIFF"] =  0.0000;
                    //dr["BNSFDIFF"]=0.0000;
                    //dr["BNSFMNQ"] = 0.0000;
                    //dr["BFSNMNQ"] = 0.0000;
                    //dr["BNSFMXQ"] = 0.0000;
                    //dr["BFSNMXQ"] = 0.0000;

                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["BUYPRICE"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["SELLPRICE"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ORDQTY(B)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ORDQTY(S)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TOTALQTY(B)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TOTALQTY(S)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["PAYUPTIEKS"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["W_T_C"].Value = 0.00;

                    //UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token1;
                    //UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token2;
                    //UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token3;
                    //UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token4;

                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token1;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token2;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token3;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.Token4;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.OppositeToken1;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.OppositeToken2;
                    LZO_NanoData.LzoNanoData.Instance.Subscribe = _AddToken._objOut2.OppositeToken3;

                    //   FOPAIRDIFF

                    portFolioCounter++;

                }

            }
        }
Esempio n. 3
0
        private void toolStripLabel1_Click(object sender, EventArgs e)
        {
            if (portFolioCounter==0)
             portFolioCounter = 1;
            using (AddSpreadToken _AddToken = new AddSpreadToken())
            {
                _AddToken.txtpfName.Text = portFolioCounter.ToString();
                _AddToken.lblPfName.Visible = true;
                _AddToken.txtpfName.Visible = true;
                _AddToken.Text = "Add Near Month Token";
                _AddToken.button1.Text = "Add Token";
                if (_AddToken.ShowDialog() == DialogResult.OK)
                {
                     DataRow dr = SpreadTable.NewRow();

                    dr["PF"] = _AddToken._objOut2.PFName;
                    dr["NEAR"] = _AddToken._objOut2.Desc1;
                    dr["Token1"] = _AddToken._objOut2.Token1;

                    dr["FAR"] = _AddToken._objOut2.Desc2;
                    dr["Token2"] = _AddToken._objOut2.Token2;
                    dr["tok3"] = _AddToken._objOut2.Desc3;
                    dr["Token3"] = _AddToken._objOut2.Token3;
                    dr["Token4"] = _AddToken._objOut2.Token4;
                    dr["Calc_type"] = _AddToken._objOut2.Calc_type;

                    dr["ratio1"] = Convert.ToString(_AddToken._objOut2.ratio1) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio1);
                    dr["ratio2"] = Convert.ToString(_AddToken._objOut2.ratio2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio2);
                    dr["ratio3"] = Convert.ToString(_AddToken._objOut2.ratio3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio3);
                    dr["ratio4"] = Convert.ToString(_AddToken._objOut2.ratio4) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio4);

                    dr["Tok1B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell);
                    dr["Tok2B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell2);
                    dr["Tok3B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell3) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell3);
                    dr["Tok4B_S"] = Convert.ToString(_AddToken._objOut2.buy_sell4) == "" ? "0" : Convert.ToString(_AddToken._objOut2.buy_sell4);

                    dr["tok1inst"] = _AddToken._objOut2.tok1_inst;
                    dr["tok2inst"] = _AddToken._objOut2.tok2_inst;

                    dr["F_BID"] = 0;
                    dr["F_ASK"] = 0;

                    dr["F_LTP"] = 0;
                    dr["NBID"] = 0;

                    dr["NASK"] = 0;
                    dr["NLTP"] = 0;

                    dr["FBID"] = 0;
                    dr["FASK"] = 0;

                    dr["FLTP"] = 0;

                  //  dr["ratio2"] = Convert.ToString(_AddToken._objOut2.ratio2) == "" ? "0" : Convert.ToString(_AddToken._objOut2.ratio2);

                    SpreadTable.Rows.Add(dr);
                    //dr["BFSNDIFF"] =  0.0000;
                    //dr["BNSFDIFF"]=0.0000;

                    //dr["BNSFMNQ"] = 0.0000;
                    //dr["BFSNMNQ"] = 0.0000;

                    //dr["BNSFMXQ"] = 0.0000;
                    //dr["BFSNMXQ"] = 0.0000;

                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["BUYPRICE"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["SELLPRICE"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ORDQTY(B)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["ORDQTY(S)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count - 1].Cells["TOTALQTY(B)"].Value = 0.00;
                    DGV1.Rows[DGV1.Rows.Count-1].Cells["TOTALQTY(S)"].Value = 0.00;

                    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token1;
                    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token2;
                    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token3;
                    UDP_Reciever.Instance.Subscribe = _AddToken._objOut2.Token4;

                 //   FOPAIRDIFF

                    portFolioCounter++;

                }

            }
        }