Ejemplo n.º 1
0
        public virtual void Display()
        {
            int count = 0;

            foreach (object o in array)
            {
                count++;
                Console.WriteLine("item: " + count);

                Console.WriteLine("Is Tradable?");
                Tradable test = o as Tradable;
                if (test != null)
                {
                    Console.WriteLine("YES symbol = " + test.symbol);
                }

                Console.WriteLine("Is Security?");
                Security test1 = o as Security;
                if (test1 != null)
                {
                    Console.WriteLine("YES symbol = " + test1.symbol);
                }

                Console.WriteLine("Is Futures?");
                Futures test2 = o as Futures;
                if (test2 != null)
                {
                    Console.WriteLine("YES Futures underlying=" + test2.underlying);
                    Console.WriteLine("Theroratical Price=" + test2.TheoraticalPrice());
                }

                Console.WriteLine("Is Option?");
                Option test3 = o as Option;
                if (test3 != null)
                {
                    Console.WriteLine("YES Option underlying=" + test3.underlying);
                    Console.WriteLine("Theroratical Price=" + test3.TheoraticalPrice());
                }

                Console.WriteLine("Is CFD?");
                CFD test4 = o as CFD;
                if (test4 != null)
                {
                    Console.WriteLine("YES symbol = " + test4.symbol);
                }


                Console.WriteLine("Is Exchange?");
                Exchange t5 = o as Exchange;
                if (t5 != null)
                {
                    Console.WriteLine("YES name = " + t5.name);
                }


                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
        public override void Create()
        {
            Tradable t = new Security("0002");

            AddTradable(t);

            Tradable t2 = new Futures("CLPF7", "0002", 2017, 1);

            AddTradable(t2);

            Tradable t3 = new Option("CLPF7_100C", "0002", 2017, 1, 100, 'C');

            AddTradable(t3);
        }