//This will place an buy order in BuyAndSell page
        public void PlaceBuyOrder(string instrument, string side)
        {
            VerifyOrdersTab objVerifyOrdersTab      = new VerifyOrdersTab(driver, logger);
            string          bTCBalanceTextValue     = BTCBalances().Text;
            double          bTCBalanceInDoubleValue = Double.Parse(bTCBalanceTextValue);
            string          actualBTCBalance        = GenericUtils.ConvertToDoubleFormat(bTCBalanceInDoubleValue);


            string usdBalanceTextValue = USDBalances().Text;
            string usdBalance          = usdBalanceTextValue.Split("$")[1];

            Thread.Sleep(1000);
            RadioBtn();
            Thread.Sleep(1000);
            var    transactionOverviewDetails = GetBuyTransactionOverView();
            var    priceText   = transactionOverviewDetails["Price"].Split(" ")[0];
            string USDCurrency = TestData.GetData("USDCurrency");
            string selected100DollarTextValue   = selected100USD().Text;
            string selected100DollarPrice       = selected100DollarTextValue.Split("$")[1];
            Double selected100DollarDoublePrice = Double.Parse(selected100DollarPrice);
            string selected100DollarPriceValue  = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + " " + USDCurrency;

            string selectedBTCToBuyTextValue = SelectedBTCToBuy().Text;
            string feeCurrency = TestData.GetData("CurrencyName");
            Double selectedBTCToBuyDoubleValue = Double.Parse(selectedBTCToBuyTextValue);
            string selectedBTCToBuyStringValue = GenericUtils.ConvertToDoubleFormat(selectedBTCToBuyDoubleValue);

            string feeValue       = CalculateFee(selectedBTCToBuyStringValue);
            string feeValues      = feeValue + " " + feeCurrency;
            string btcToBuyAmount = SelectedBTCToBuy().Text;

            Thread.Sleep(1000);
            if (transactionOverviewDetails["TransactionCost"].Contains(selected100DollarPriceValue) &&
                transactionOverviewDetails["BTCToBuy"].Contains(selectedBTCToBuyStringValue) &&
                transactionOverviewDetails["Fee"].Contains(feeValues))
            {
                logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsPassed, side));
                UserSetFunctions.Click(BuyBitcoinWithUSDButton());
            }
            else
            {
                logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsFailed, side));
            }

            string placeOrderTime                     = GenericUtils.GetCurrentTime();
            string placeOrderTimePlusOneMin           = GenericUtils.GetCurrentTimePlusOneMinute();
            string limitPriceOnConfirmationOrderValue = GenericUtils.ConvertDoubleToString(selected100DollarDoublePrice) + " " + USDCurrency;
            string feeOnConfirmationOrderValue        = feeCurrency + " " + feeValue;

            string finalQtyDiff = GenericUtils.GetDifferenceFromStringAfterSubstraction(btcToBuyAmount, feeValue);
            var    finalQtyConfirmationOrderValues = feeCurrency + " " + Decimal.Parse(finalQtyDiff).ToString("0.00");

            Thread.Sleep(2000);
            var buyConfirmationDetails = GetBuyConfirmationOverView();

            if (buyConfirmationDetails["BTCToBuy"].Contains(btcToBuyAmount) &&
                buyConfirmationDetails["LimitPrice"].Contains(selected100DollarPriceValue) &&
                buyConfirmationDetails["Fee"].Contains(feeOnConfirmationOrderValue) &&
                buyConfirmationDetails["FinalQantity"].Contains(finalQtyConfirmationOrderValues) &&
                (buyConfirmationDetails["Date"].Contains(placeOrderTime) || buyConfirmationDetails["Date"].Contains(placeOrderTimePlusOneMin)))
            {
                logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsPassed, side));
            }
            else
            {
                logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsFailed, side));
            }

            UserSetFunctions.Click(ConfirmBuyOrderButton());
            string orderPlacedSuccessMsg = SuccessMsg().Text;

            try
            {
                Assert.Equal(orderPlacedSuccessMsg, Const.SuccessBuySellOrderMsg);
                logger.LogCheckPoint(String.Format(LogMessage.VerifiedBuySellOrderSuccessMsg, side));
            }
            catch (Exception)
            {
                logger.LogCheckPoint(String.Format(LogMessage.VerifiedBuySellOrderFailedMsg, side));
            }
            Thread.Sleep(1000);
            UserSetFunctions.Click(OKBuyButton());
            UserSetFunctions.Click(BuyAndSellMenuButton());
            UserCommonFunctions.SelectAnExchange(driver);
            UserCommonFunctions.ScrollingDownVertical(driver);
            Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTabForBuyAndSell(instrument, side, Double.Parse(selectedBTCToBuyStringValue), feeValue, placeOrderTime, placeOrderTimePlusOneMin));

            Thread.Sleep(1000);
            UserCommonFunctions.DashBoardMenuButton(driver);
            Thread.Sleep(1000);
            UserSetFunctions.Click(BuyAndSellButton());
            Thread.Sleep(1000);

            string btcQty = GetBuyBitcoinQuantity(bTCBalanceInDoubleValue, selectedBTCToBuyDoubleValue, feeValue);
            string usdBal = "$" + GetBuyUSDBalances(usdBalance);

            Thread.Sleep(1000);

            string currentbTCQuantity = BTCBalances().Text;
            string finalbTCQuantity   = GenericUtils.RemoveCommaFromString(currentbTCQuantity);

            string currentUSDBalance  = USDBalances().Text;
            string finalUSDBalance    = GenericUtils.RemoveCommaFromString(currentUSDBalance);
            string usdDeductionAmount = TestData.GetData("TC42_USDDeductionAmount");

            try
            {
                Assert.Equal(currentbTCQuantity, btcQty);
                logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
            }

            catch (Exception e)
            {
                logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                throw e;
            }

            try
            {
                Assert.Equal(currentUSDBalance, usdBal);
                logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalancePassed, side, usdDeductionAmount));
            }

            catch (Exception e)
            {
                logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalanceFailed, side, usdDeductionAmount));
                throw e;
            }
        }
        // This will place an buy order in BuyAndSell page
        public void PlaceBuyOrder(string instrument, string side)
        {
            VerifyOrdersTab objVerifyOrdersTab = new VerifyOrdersTab(driver, logger);

            try
            {
                // Get BTC balance from Balances section on UI and convert into Double format
                string bTCBalanceTextValue     = BTCBalances().Text;
                Double bTCBalanceInDoubleValue = Double.Parse(bTCBalanceTextValue);
                string actualBTCBalance        = GenericUtils.ConvertToDoubleFormat(bTCBalanceInDoubleValue);
                // Get USD balance from Balances section on UI and convert into Double format
                string usdBalanceTextValue = USDBalances().Text;
                string usdBalance          = usdBalanceTextValue.Split(Const.AddDollarSign)[1];
                Thread.Sleep(1000);
                // This method will click on first radio button having option - $100
                RadioBtn();
                Thread.Sleep(1000);
                // Store all the details present in TransactionOverView Section
                var transactionOverviewDetails = GetBuyTransactionOverView();
                // Get price text from transactionOverviewDetails and split based on white space
                var priceText = transactionOverviewDetails["Price"].Split(Const.AddWhiteSpace)[0];
                // Gets "USD" as string to append with currency value for comparison
                string USDCurrency = TestData.GetData("USDCurrency");
                // Get 100DollarTextValue from Amount section on UI and convert into Double format
                string selected100DollarTextValue   = selected100USD().Text;
                string selected100DollarPrice       = selected100DollarTextValue.Split(Const.AddDollarSign)[1];
                Double selected100DollarDoublePrice = Double.Parse(selected100DollarPrice);
                string selected100DollarPriceValue  = GenericUtils.ConvertToDoubleFormat(selected100DollarDoublePrice) + Const.AddWhiteSpace + USDCurrency;
                // Get BTCToBuyTextValue from Amount section on UI and convert into Double format
                string selectedBTCToBuyTextValue = SelectedBTCToBuy().Text;
                string feeCurrency = TestData.GetData("CurrencyName");
                Double selectedBTCToBuyDoubleValue = Double.Parse(selectedBTCToBuyTextValue);
                string selectedBTCToBuyStringValue = GenericUtils.ConvertToDoubleFormat(selectedBTCToBuyDoubleValue);
                string feeValue  = CalculateFee(selectedBTCToBuyStringValue);
                string feeValues = feeValue + Const.AddWhiteSpace + feeCurrency;
                Thread.Sleep(1000);

                // This will verify the details of "TransactionCost", "BTCToBuy" and "Fee" components in Buy&Sell page
                if (transactionOverviewDetails["TransactionCost"].Contains(selected100DollarPriceValue) &&
                    transactionOverviewDetails["BTCToBuy"].Contains(selectedBTCToBuyStringValue) &&
                    transactionOverviewDetails["Fee"].Contains(feeValues))
                {
                    logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsPassed, side));
                    UserSetFunctions.Click(BuyBitcoinWithUSDButton());
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.TransactionOverviewDetailsFailed, side));
                }

                string placeOrderTime           = GenericUtils.GetCurrentTime();
                string placeOrderTimePlusOneMin = GenericUtils.GetCurrentTimePlusOneMinute();
                // This gets the limit Price On Confirmation Order Value
                string limitPriceOnConfirmationOrderValue = GenericUtils.ConvertDoubleToString(selected100DollarDoublePrice) + Const.AddWhiteSpace + USDCurrency;
                string feeOnConfirmationOrderValue        = feeCurrency + Const.AddWhiteSpace + feeValue;

                // Get the final quantity amount(btcToBuyAmount-feeValue)
                string finalQtyDiff = GenericUtils.GetDifferenceFromStringAfterSubstraction(selectedBTCToBuyTextValue, feeValue);
                var    finalQtyConfirmationOrderValues = feeCurrency + Const.AddWhiteSpace + Decimal.Parse(finalQtyDiff).ToString("0.00");

                Thread.Sleep(2000);
                var buyConfirmationDetails = GetBuyConfirmationOverView();

                // This will verify the details of "BTCToBuy", "LimitPrice", "Fee", "FinalQantity" and "Date" in the confirmation window
                if (buyConfirmationDetails["BTCToBuy"].Contains(selectedBTCToBuyTextValue) &&
                    buyConfirmationDetails["LimitPrice"].Contains(selected100DollarPriceValue) &&
                    buyConfirmationDetails["Fee"].Contains(feeOnConfirmationOrderValue) &&
                    buyConfirmationDetails["FinalQantity"].Contains(finalQtyConfirmationOrderValues) &&
                    (buyConfirmationDetails["Date"].Contains(placeOrderTime) || buyConfirmationDetails["Date"].Contains(placeOrderTimePlusOneMin)))
                {
                    logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsPassed, side));
                }
                else
                {
                    logger.LogCheckPoint(String.Format(LogMessage.ConfirmationModalDetailsFailed, side));
                }

                // Click on "Confirm Buy Order" button
                UserSetFunctions.Click(ConfirmBuyOrderButton());
                string orderPlacedSuccessMsg = SuccessMsg().Text;

                // This will verify the success message of placed buy order
                try
                {
                    Assert.Equal(orderPlacedSuccessMsg, Const.SuccessBuySellOrderMsg);
                    logger.LogCheckPoint(String.Format(LogMessage.BuySellOrderPassedMsg, side));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.BuySellOrderFailedMsg, side));
                }
                Thread.Sleep(1000);
                for (int i = 0; i <= 2; i++)
                {
                    try
                    {
                        // Click on "OK" button
                        UserSetFunctions.Click(OKBuyButton());
                        break;
                    }
                    catch (StaleElementReferenceException)
                    {
                    }
                }
                for (int i = 0; i <= 2; i++)
                {
                    try
                    {
                        UserSetFunctions.Click(BuyAndSellMenuButton());
                        break;
                    }
                    catch (StaleElementReferenceException)
                    {
                    }
                }

                // Click on exchange Menu button
                UserCommonFunctions.SelectAnExchange(driver);

                //Scroll down to the Filled order tabs
                UserCommonFunctions.ScrollingDownVertical(driver);

                // verify the order placed in Filled orders tab through Order Entry
                Assert.True(objVerifyOrdersTab.VerifyFilledOrdersTabForBuyAndSell(instrument, side, Double.Parse(selectedBTCToBuyStringValue), feeValue, placeOrderTime, placeOrderTimePlusOneMin));

                Thread.Sleep(1000);

                //Click on Dashboard menu button --> Buy&Sell menu button
                UserCommonFunctions.DashBoardMenuButton(driver);
                Thread.Sleep(1000);
                UserSetFunctions.Click(BuyAndSellButton());
                Thread.Sleep(1000);

                // Calculate the buy BTC amount
                string btcQty = GetBuyBitcoinQuantity(bTCBalanceInDoubleValue, selectedBTCToBuyDoubleValue, feeValue);
                // Calculate the buy USD amount
                string usdBal = Const.AddDollarSign + GetBuyUSDBalances(usdBalance);

                Thread.Sleep(1000);
                // BTC balance from the Balances section post transaction
                string currentbTCQuantity = BTCBalances().Text;
                string finalbTCQuantity   = GenericUtils.RemoveCommaFromString(currentbTCQuantity);
                // USD balance from the Balances section post transaction
                string currentUSDBalance  = USDBalances().Text;
                string finalUSDBalance    = GenericUtils.RemoveCommaFromString(currentUSDBalance);
                string usdDeductionAmount = TestData.GetData("TC42_USDDeductionAmount");

                // This will verify the value of final btc amount with the caluclated amount
                try
                {
                    Assert.Equal(finalbTCQuantity, btcQty);
                    logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                }
                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.FinalBTCQantityPassed, side));
                    throw;
                }

                // This will verify the value of final USD balance with the caluclated amount
                try
                {
                    Assert.Equal(finalUSDBalance, usdBal);
                    logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalancePassed, side, usdDeductionAmount));
                }

                catch (Exception)
                {
                    logger.LogCheckPoint(String.Format(LogMessage.FinalUSDBalanceFailed, side, usdDeductionAmount));
                    throw;
                }
            }

            catch (Exception)
            {
                throw;
            }
        }