Example #1
0
        public void SellPercent(FunctionObject.AmountType aType, double amount)
        {
            //string exeScript3 = "clickAtag('.ty02', '매도'); " + functionScript;
            string exeScript3 = "clickAtag('.ty02', '매도'); clickJustAtag('매도확인'); " + functionScript;

            if (aType == FunctionObject.AmountType.KRW)
            {
                var typeItem = driver.FindElement(By.XPath("//*[@id='root']/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dt[3]/i"));
                if (typeItem.Text.Contains("KRW"))
                {
                    var item         = driver.FindElement(By.XPath("//*[@id='root']/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dd[2]/input"));
                    var priceElement = driver.FindElement(By.XPath("//*[@id='root']/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dd[3]/div/input"));
                    //*[@id="root"]/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dt[3]/i
                    int price = int.Parse(priceElement.GetAttribute("value"), System.Globalization.NumberStyles.AllowThousands);
                    if (price != 0 && amount != 0)
                    {
                        double result = amount / (double)price;
                        item.SendKeys(result.ToString());
                    }
                    ((IJavaScriptExecutor)driver).ExecuteScript(exeScript3);
                }
                else
                {
                    throw new Exception("KRW 마켓에서만 이용가능합니다.");
                }
            }
            else if (aType == FunctionObject.AmountType.BTC)
            {
                var typeItem = driver.FindElement(By.XPath("//*[@id='root']/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dt[3]/i"));
                if (typeItem.Text.Contains("BTC"))
                {
                    var item         = driver.FindElement(By.XPath("//*[@id='root']/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dd[2]/input"));
                    var priceElement = driver.FindElement(By.XPath("//*[@id='root']/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dd[3]/div/input"));
                    //*[@id="root"]/div/div/div[2]/section[1]/div/div[2]/article[1]/span[2]/div/dl/dt[3]/i
                    double price = double.Parse(priceElement.GetAttribute("value"));
                    if (price != 0 && amount != 0)
                    {
                        double result = amount / (double)price;
                        item.SendKeys(result.ToString());
                    }
                    ((IJavaScriptExecutor)driver).ExecuteScript(exeScript3);
                }
                else
                {
                    throw new Exception("BTC 마켓에서만 이용가능합니다.");
                }
            }
            else
            {
                //string exeScript = "clickAtag('.layerB', '%'); clickJustAtag('" + FunctionObject.getAmountTypeText(aType) + "'); clickAtag('.ty02', '매도'); " + functionScript;
                string exeScript = "clickAtag('.layerB', '%'); clickJustAtag('" + FunctionObject.getAmountTypeText(aType) + "'); clickAtag('.ty02', '매도'); clickJustAtag('매도확인'); " + functionScript;
                ((IJavaScriptExecutor)driver).ExecuteScript(exeScript);
            }
        }
Example #2
0
        public void CurrentSellPercent(CommandType askType, int offset, int detail, FunctionObject.AmountType aType, double amount)
        {
            string exeScript2 = "";

            if (askType == FunctionObject.CommandType.Buy)
            {
                exeScript2 = "clickAtag('.t3', '매도'); clickUp(" + offset + "); " + functionScript;
            }
            else if (askType == FunctionObject.CommandType.Sell)
            {
                exeScript2 = "clickAtag('.t3', '매도'); clickDown(" + offset + "); " + functionScript;
            }
            else
            {
                return;
            }

            ((IJavaScriptExecutor)driver).ExecuteScript(exeScript2);
            clickDetail(detail);
            SellPercent(aType, amount);
        }
Example #3
0
        public void CurrentBuyPercent(FunctionObject.CommandType askType, int offset, int detail, FunctionObject.AmountType aType, double amount)
        {
            string exeScript2 = "";

            if (askType == FunctionObject.CommandType.Buy)
            {
                exeScript2 = "clickAtag('.t2', '매수'); clickUp(" + offset + "); " + functionScript;
            }
            else if (askType == FunctionObject.CommandType.Sell)
            {
                exeScript2 = "clickAtag('.t2', '매수'); clickDown(" + offset + "); " + functionScript;
            }
            else
            {
                return;
            }

            // 0 3 1 2 2 1 3 0
            ((IJavaScriptExecutor)driver).ExecuteScript(exeScript2);
            clickDetail(detail);
            BuyPercent(aType, amount);
            Debug.Print(aType.ToString() + "------------------------");
        }