Exemple #1
0
        public double GetRevenuePrice2()
        {
            double revenuePrice = 0;

            try
            {
                if (RevenueRate != 0)
                {
                    if (Position == "2")
                    {
                        revenuePrice = PriceTick.GetDownPriceOfRate(ItemCode, HPrice, RevenueRate);
                    }
                    if (Position == "1")
                    {
                        revenuePrice = PriceTick.GetUpPriceOfRate(ItemCode, LPrice, RevenueRate);
                    }
                }
                if (Position == "2" && revenuePrice < AvgPrice2)
                {
                    revenuePrice = 0;
                }
                if (Position == "1" && revenuePrice > AvgPrice1)
                {
                    revenuePrice = 0;
                }
            }
            catch (Exception) { }

            return(revenuePrice);
        }
Exemple #2
0
        public double GetRevenuePrice(double basePrice)
        {
            double revenuePrice = 0;

            try
            {
                if (ruleInfo.RevenuePrice != "0")
                {
                    revenuePrice = Convert.ToDouble(ruleInfo.RevenuePrice);
                }
                else if (ruleInfo.RevenueTick != "0")
                {
                    if (ruleInfo.Position == "매수")
                    {
                        revenuePrice = PriceTick.GetDownPriceOfTick(ItemCode, HPrice, Convert.ToInt32(ruleInfo.RevenueTick));
                    }
                    if (ruleInfo.Position == "매도")
                    {
                        revenuePrice = PriceTick.GetUpPriceOfTick(ItemCode, LPrice, Convert.ToInt32(ruleInfo.RevenueTick));
                    }
                }
                else if (ruleInfo.RevenueRate != "0")
                {
                    if (ruleInfo.Position == "매수")
                    {
                        revenuePrice = PriceTick.GetDownPriceOfRate(ItemCode, HPrice, Convert.ToDouble(ruleInfo.RevenueRate));
                    }
                    if (ruleInfo.Position == "매도")
                    {
                        revenuePrice = PriceTick.GetUpPriceOfRate(ItemCode, LPrice, Convert.ToDouble(ruleInfo.RevenueRate));
                    }
                }

                if (ruleInfo.Position == "매수" && revenuePrice <= basePrice)
                {
                    revenuePrice = 0;
                }
                if (ruleInfo.Position == "매도" && revenuePrice >= basePrice)
                {
                    revenuePrice = 0;
                }
            }
            catch (Exception ex) { string err = ex.Message; }

            return(revenuePrice);
        }
Exemple #3
0
        public double GetLossPrice(double basePrice)
        {
            double lossPrice = 0;

            try
            {
                if (ruleInfo.LossPrice != "0")
                {
                    lossPrice = Convert.ToDouble(ruleInfo.LossPrice);
                }
                else if (ruleInfo.LossTick != "0")
                {
                    if (ruleInfo.Position == "매수")
                    {
                        lossPrice = PriceTick.GetDownPriceOfTick(ItemCode, basePrice, Convert.ToInt32(ruleInfo.LossTick));
                    }
                    if (ruleInfo.Position == "매도")
                    {
                        lossPrice = PriceTick.GetUpPriceOfTick(ItemCode, basePrice, Convert.ToInt32(ruleInfo.LossTick));
                    }
                }
                else if (ruleInfo.LossRate != "0")
                {
                    if (ruleInfo.Position == "매수")
                    {
                        lossPrice = PriceTick.GetDownPriceOfRate(ItemCode, basePrice, Convert.ToDouble(ruleInfo.LossRate));
                    }
                    if (ruleInfo.Position == "매도")
                    {
                        lossPrice = PriceTick.GetUpPriceOfRate(ItemCode, basePrice, Convert.ToDouble(ruleInfo.LossRate));
                    }
                }

                if (ruleInfo.Position == "매수" && lossPrice <= CPrice)
                {
                    lossPrice = 0;
                }
                if (ruleInfo.Position == "매도" && lossPrice >= CPrice)
                {
                    lossPrice = 0;
                }
            }
            catch (Exception ex) { string err = ex.Message; }

            return(lossPrice);
        }
        public double GetRevenuePrice2()
        {
            double revenuePrice = 0;
            try
            {
                if (RevenueRate != 0)
                {
                    if (Position == "매수")
                        revenuePrice = PriceTick.GetDownPriceOfRate(ItemCode, HPrice, RevenueRate);
                    if (Position == "매도")
                        revenuePrice = PriceTick.GetUpPriceOfRate(ItemCode, LPrice, RevenueRate);
                }
                if (Position == "매수" && revenuePrice < BuyPrice) revenuePrice = 0;
                if (Position == "매도" && revenuePrice > BuyPrice) revenuePrice = 0;
            }
            catch (Exception ) { }

            return revenuePrice;
        }
Exemple #5
0
        private void btnCal_Click(object sender, EventArgs e)
        {
            double buyRate     = Convert.ToDouble(tbBuyRate.Text);
            double revenueRate = Convert.ToDouble(tbRevenueRate.Text);
            double lossRate    = Convert.ToDouble(tbLossRate.Text);

            string itemCode  = tbItem.Text;
            string position  = tbTimeType.Text;
            double basePrice = Convert.ToDouble(tbBasePrice.Text);

            double baseRevenueRate = 1.0;

            if (position == "매수")
            {
                tbBuyPrice.Text = PriceTick.GetDownPriceOfRate(itemCode, basePrice, buyRate).ToString();
                tbBuyTick.Text  = PriceTick.GetTickDiff(itemCode, basePrice, Convert.ToDouble(tbBuyPrice.Text)).ToString();

                double hPrice = PriceTick.GetUpPriceOfRate(itemCode, basePrice, baseRevenueRate);
                tbRevenuePrice.Text = PriceTick.GetDownPriceOfRate(itemCode, hPrice, revenueRate).ToString();
                tbRevenueTick.Text  = PriceTick.GetTickDiff(itemCode, hPrice, Convert.ToDouble(tbRevenuePrice.Text)).ToString();

                tbLossPrice.Text = PriceTick.GetDownPriceOfRate(itemCode, basePrice, lossRate).ToString();
                tbLossTick.Text  = PriceTick.GetTickDiff(itemCode, basePrice, Convert.ToDouble(tbLossPrice.Text)).ToString();
            }
            if (position == "매도")
            {
                tbBuyPrice.Text = PriceTick.GetUpPriceOfRate(itemCode, basePrice, buyRate).ToString();
                tbBuyTick.Text  = PriceTick.GetTickDiff(itemCode, basePrice, Convert.ToDouble(tbBuyPrice.Text)).ToString();

                double lPrice = PriceTick.GetDownPriceOfRate(itemCode, basePrice, baseRevenueRate);
                tbRevenuePrice.Text = PriceTick.GetUpPriceOfRate(itemCode, lPrice, revenueRate).ToString();
                tbRevenueTick.Text  = PriceTick.GetTickDiff(itemCode, lPrice, Convert.ToDouble(tbRevenuePrice.Text)).ToString();

                tbLossPrice.Text = PriceTick.GetUpPriceOfRate(itemCode, basePrice, lossRate).ToString();
                tbLossTick.Text  = PriceTick.GetTickDiff(itemCode, basePrice, Convert.ToDouble(tbLossPrice.Text)).ToString();
            }
        }
Exemple #6
0
        public double GetBuyPrice(double basePrice)
        {
            double buyPrice = 0;

            try
            {
                if (ruleInfo.BuyPrice != "0")
                {
                    buyPrice = Convert.ToDouble(ruleInfo.BuyPrice);
                }
                else if (ruleInfo.BuyTick != "0")
                {
                    if (ruleInfo.Position == "매수")
                    {
                        buyPrice = PriceTick.GetDownPriceOfTick(ItemCode, basePrice, Convert.ToInt32(ruleInfo.BuyTick));
                    }
                    if (ruleInfo.Position == "매도")
                    {
                        buyPrice = PriceTick.GetUpPriceOfTick(ItemCode, basePrice, Convert.ToInt32(ruleInfo.BuyTick));
                    }
                }
                else if (ruleInfo.BuyRate != "0")
                {
                    if (ruleInfo.Position == "매수")
                    {
                        buyPrice = PriceTick.GetDownPriceOfRate(ItemCode, basePrice, Convert.ToDouble(ruleInfo.BuyRate));
                    }
                    if (ruleInfo.Position == "매도")
                    {
                        buyPrice = PriceTick.GetUpPriceOfRate(ItemCode, basePrice, Convert.ToDouble(ruleInfo.BuyRate));
                    }
                }
            }
            catch (Exception ex) { string err = ex.Message; }

            return(buyPrice);
        }