Пример #1
0
        public static double GetDownPriceOfTick(string itemCode, double p1, int tickNum)
        {
            double tick = ItemCodeSet.GetTick(itemCode);

            int round = ItemCodeUtil.GetItemCodeRoundNum(itemCode);

            p1 = Math.Round(p1, round);

            double p2 = Math.Round((tick * tickNum), round);

            double newPrice = Math.Round(p1 - p2, round);

            return(newPrice);
        }
Пример #2
0
        //Console.WriteLine(PriceTick.GetTickDiff("CL", 50.0, 55.0));

        //    Console.WriteLine(PriceTick.GetDownPriceOfRate("CL", 46.23, 6.64));

        //    Console.WriteLine(PriceTick.GetRate("CL", 46.23, 43.16));

        //    Console.WriteLine(PriceTick.GetDownPriceOfTick("CL", 50.0, 10));

        //    Console.WriteLine(PriceTick.GetUpPriceOfRatek("CL", 50.0, 10.0));

        //    Console.WriteLine(PriceTick.GetUpPriceOfTick("CL", 50.0, 10));
        public static int GetTickDiff(string itemCode, double p1, double p2)
        {
            double tick = ItemCodeSet.GetTick(itemCode);

            int round = ItemCodeUtil.GetItemCodeRoundNum(itemCode);

            p1 = Math.Round(p1, round);

            p2 = Math.Round(p2, round);

            double diff = Math.Round(Math.Abs(p1 - p2), round);

            return((int)(diff / tick));
        }