void AdharaHFTListener.priceEvent(List <AdharaHFT.priceTick> priceTickList)
 {
     foreach (AdharaHFT.priceTick tick in priceTickList)
     {
         Console.WriteLine("Security: " + tick.security + " Price: " + tick.price.ToString("F" + tick.pips) + " Side: " + tick.side + " TI: " + tick.tinterface + " Liquidity: " + tick.liquidity);
         if (tick.side.Equals("ask"))
         {
             if (tick.tinterface.Equals(Example12.tinterface2))
             {
                 Example12.bestcanask          = tick.price;
                 Example12.bestcanaskliquidity = tick.liquidity;
             }
             if (tick.tinterface.Equals(Example12.tinterface1))
             {
                 Example12.bestbaxask          = tick.price;
                 Example12.bestbaxaskliquidity = tick.liquidity;
             }
         }
         if (tick.side.Equals("bid"))
         {
             if (tick.tinterface.Equals(Example12.tinterface2))
             {
                 Example12.bestcanbid          = tick.price;
                 Example12.bestcanbidliquidity = tick.liquidity;
             }
             if (tick.tinterface.Equals(Example12.tinterface1))
             {
                 Example12.bestbaxbid          = tick.price;
                 Example12.bestbaxbidliquidity = tick.liquidity;
             }
         }
     }
     Example12.checkPrices();
 }
Beispiel #2
0
        public void PermutationShouldPrintWhenGivenAString()
        {
            Example12 example = new Example12();

            example.Permutation("abc");
            Assert.True(true);
        }
Beispiel #3
0
    static void Main(string[] args)
    {
        int sel = -1;

        if (args != null && args.Count() > 0)
        {
            if (!Int32.TryParse(args[0], out sel))
            {
                sel = -1;
            }
        }
        switch (sel)
        {
        case 0:
            Console.WriteLine("Example 0: GET ACCOUNTS AND TINTERFACES");
            Example0.Main0(args);
            break;

        case 1:
            Console.WriteLine("Example 1: PRICE STREAMING");
            Example1.Main1(args);
            break;

        case 2:
            Console.WriteLine("Example 2: PRICE POLLING");
            Example2.Main2(args);
            break;

        case 3:
            Console.WriteLine("Example 3: POSITION STREAMING");
            Example3.Main3(args);
            break;

        case 4:
            Console.WriteLine("Example 4: POSITION POLLING");
            Example4.Main4(args);
            break;

        case 5:
            Console.WriteLine("Example 5: ORDER STREAMING");
            Example5.Main5(args);
            break;

        case 6:
            Console.WriteLine("Example 6: ORDER POLLING");
            Example6.Main6(args);
            break;

        case 7:
            Console.WriteLine("Example 7: ORDER CREATION");
            Example7.Main7(args);
            break;

        case 8:
            Console.WriteLine("Example 8: CANCEL PENDING ORDER WITH ORDER POLLING");
            Example8.Main8(args);
            break;

        case 9:
            Console.WriteLine("Example 9: MODIFY PENDING ORDER WITH ORDER POLLING");
            Example9.Main9(args);
            break;

        case 10:
            Console.WriteLine("Example 10: CANCEL PENDING ORDER WITH ORDER STREAMING");
            Example10.Main10(args);
            break;

        case 11:
            Console.WriteLine("Example 11: MODIFY PENDING ORDER WITH ORDER STREAMING");
            Example11.Main11(args);
            break;

        case 12:
            Console.WriteLine("Example 12: STRATEGY");
            Example12.Main12(args);
            break;

        case 13:
            Console.WriteLine("Example 13: MULTIPLE ORDER CREATION");
            Example13.Main13(args);
            break;

        case 14:
            Console.WriteLine("Example 14: GET HISTORICAL PRICE");
            Example14.Main14(args);
            break;

        default:
            Console.WriteLine("Choose option: ");
            Console.WriteLine("-1: EXIT");
            Console.WriteLine(" 0: GET ACCOUNTS AND TINTERFACES");
            Console.WriteLine(" 1: PRICE STREAMING");
            Console.WriteLine(" 2: PRICE POLLING");
            Console.WriteLine(" 3: POSITION STREAMING");
            Console.WriteLine(" 4: POSITION POLLING");
            Console.WriteLine(" 5: ORDER STREAMING");
            Console.WriteLine(" 6: ORDER POLLING");
            Console.WriteLine(" 7: ORDER CREATION");
            Console.WriteLine(" 8: CANCEL PENDING ORDER WITH ORDER POLLING");
            Console.WriteLine(" 9: MODIFY PENDING ORDER WITH ORDER POLLING");
            Console.WriteLine("10: CANCEL PENDING ORDER WITH ORDER STREAMING");
            Console.WriteLine("11: MODIFY PENDING ORDER WITH ORDER STREAMING");
            Console.WriteLine("12: STRATEGY");
            Console.WriteLine("13: MULTIPLE ORDER CREATION");
            Console.WriteLine("14: GET HISTORICAL PRICE");
            string input = Console.ReadLine();
            if (input.Equals("-1"))
            {
                Console.WriteLine("Exit");
                return;
            }
            string[] newargs = new string[1];
            newargs[0] = input;
            Main(newargs);
            break;
        }
    }
Beispiel #4
0
        private static void RunExample12()
        {
            Example12.CreateFile("file1", "aaaa", true);

            Example12.CreateFile("file2", "bbbbbbb", false);
        }