Ejemplo n.º 1
0
        public static TickValue GetElwTick(double price)
        {
            double upTickSize = GetElwUpTickSize_Raw(price);
            double downTickSize = GetElwDownTickSize_Raw(price);

            TickValue tv = new TickValue(upTickSize, downTickSize);
            return tv;
        }
Ejemplo n.º 2
0
        public void GetOptionTickTest()
        {
            {
                double price = 1.00F;
                TickValue expected = new TickValue(0.01F, 0.01F);
                TickValue actual;
                actual = OptionUtil.GetOptionTick(price);
                Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
                Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
            }

            {
                double price = 2.99F;
                TickValue expected = new TickValue(0.01F, 0.01F);
                TickValue actual;
                actual = OptionUtil.GetOptionTick(price);
                Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
                Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
            }

            {
                double price = 3.00F;
                TickValue expected = new TickValue(0.05F, 0.01F);
                TickValue actual;
                actual = OptionUtil.GetOptionTick(price);
                Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
                Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
            }

            {
                double price = 3.05F;
                TickValue expected = new TickValue(0.05F, 0.05F);
                TickValue actual;
                actual = OptionUtil.GetOptionTick(price);
                Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
                Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
            }

            {
                double price = 10.75F;
                TickValue expected = new TickValue(0.05F, 0.05F);
                TickValue actual;
                actual = OptionUtil.GetOptionTick(price);
                Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
                Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
            }
        }
Ejemplo n.º 3
0
 public void GetElwTickTest()
 {
     {
         double price = 1F;
         TickValue expected = new TickValue(5, 0);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 4F;
         TickValue expected = new TickValue(5, 0);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 5F;
         TickValue expected = new TickValue(5, 0);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 6F;
         TickValue expected = new TickValue(5, 5);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 10F;
         TickValue expected = new TickValue(5, 5);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 5000F;
         TickValue expected = new TickValue(10, 5);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 4995F;
         TickValue expected = new TickValue(5, 5);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 5010F;
         TickValue expected = new TickValue(10, 10);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 9990F;
         TickValue expected = new TickValue(10, 10);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 10000F;
         TickValue expected = new TickValue(50, 10);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
     {
         double price = 10050F;
         TickValue expected = new TickValue(50, 50);
         TickValue actual;
         actual = ElwUtil.GetElwTick(price);
         Assert.AreEqual(expected.UpTickValue, actual.UpTickValue);
         Assert.AreEqual(expected.DownTickValue, actual.DownTickValue);
     }
 }