public static void Main12(string[] args)
    {
        // get properties from file
        getProperties();

        wrapper = new ArthikaHFT(domain, url_stream, url_polling, url_challenge, url_token, user, password, authentication_port, request_port, ssl, ssl_cert);

        bool auth = wrapper.doAuthentication();

        if (!auth)
        {
            Console.WriteLine("Authentication failed");
            Console.Read();
            return;
        }

        // STRATEGY

        // get tinterfaces
        List <ArthikaHFT.tinterfaceTick> tinterfaceTickList = wrapper.getInterface();

        tinterface1 = tinterfaceTickList[0].name;
        if (tinterfaceTickList.Count > 1)
        {
            tinterface2 = tinterfaceTickList[1].name;
        }
        else
        {
            tinterface2 = tinterfaceTickList[0].name;
        }
        List <string> tinterfacelist = null;

        if (tinterfaceTickList != null && tinterfaceTickList.Count > 1)
        {
            tinterfacelist = new List <string>();
            tinterfacelist.Add(tinterface1);
            tinterfacelist.Add(tinterface2);
        }

        // Open price streaming
        string id1 = wrapper.getPriceBegin(new List <string> {
            "EUR/USD"
        }, tinterfacelist, ArthikaHFT.GRANULARITY_TOB, 1, interval, new ArthikaHFTListenerImp12());

        Thread.Sleep(20000);

        // Close price streaming
        wrapper.getPriceEnd(id1);

        Console.WriteLine("Press Enter to exit");
        Console.Read();
    }
Exemplo n.º 2
0
    public static void Main1(string[] args)
    {
        // get properties from file
        getProperties();

        wrapper = new ArthikaHFT(domain, url_stream, url_polling, url_challenge, url_token, user, password, authentication_port, request_port, ssl, ssl_cert);

        bool auth = wrapper.doAuthentication();

        if (!auth)
        {
            Console.WriteLine("Authentication failed");
            Console.Read();
            return;
        }

        // PRICE STREAMING

        // get tinterfaces
        List <ArthikaHFT.tinterfaceTick> tinterfaceTickList = wrapper.getInterface();

        // Open first price streaming for one security in all tinterfaces
        string id1 = wrapper.getPriceBegin(new List <string> {
            "GBP/USD"
        }, null, ArthikaHFT.GRANULARITY_TOB, 1, interval, new ArthikaHFTListenerImp1());

        Thread.Sleep(5000);

        // Open second price streaming for two securities in the two first tinterfaces
        List <String> tinterfacelist = null;

        if (tinterfaceTickList != null && tinterfaceTickList.Count > 1)
        {
            tinterfacelist = new List <string>();
            tinterfacelist.Add(tinterfaceTickList.ElementAt(0).name);
            tinterfacelist.Add(tinterfaceTickList.ElementAt(1).name);
        }
        string id2 = wrapper.getPriceBegin(new List <string> {
            "EUR/USD", "GBP/JPY"
        }, tinterfacelist, ArthikaHFT.GRANULARITY_FAB, 2, interval, new ArthikaHFTListenerImp1());

        Thread.Sleep(5000);

        // Close second price streaming
        wrapper.getPriceEnd(id2);
        Thread.Sleep(5000);

        // Close first price streaming
        wrapper.getPriceEnd(id1);
        Thread.Sleep(5000);

        // Open third price streaming for six securities in the first tinterface
        if (tinterfaceTickList != null && tinterfaceTickList.Count > 0)
        {
            tinterfacelist = new List <string>();
            tinterfacelist.Add(tinterfaceTickList.ElementAt(0).name);
        }
        string id3 = wrapper.getPriceBegin(new List <string> {
            "EUR/USD", "EUR/GBP", "EUR/JPY", "GBP/JPY", "GBP/USD", "USD/JPY"
        }, tinterfacelist, ArthikaHFT.GRANULARITY_TOB, 1, interval, new ArthikaHFTListenerImp1());

        Thread.Sleep(5000);

        // Close third price streaming
        wrapper.getPriceEnd(id3);

        Console.WriteLine("Press Enter to exit");
        Console.Read();
    }
    public static void Main1(string[] args)
    {
        // get properties from file
        getProperties();

        wrapper = new ArthikaHFT(domain, url_stream, url_polling, url_challenge, url_token, user, password, authentication_port, request_port, ssl, ssl_cert);

        bool auth = wrapper.doAuthentication();
        if (!auth)
        {
            Console.WriteLine("Authentication failed");
            Console.Read();
            return;
        }

        // PRICE STREAMING

        // get tinterfaces
        List<ArthikaHFT.tinterfaceTick> tinterfaceTickList = wrapper.getInterface();

        // Open first price streaming for one security in all tinterfaces
        string id1 = wrapper.getPriceBegin(new List<string> { "GBP/USD" }, null, ArthikaHFT.GRANULARITY_TOB, 1, interval, new ArthikaHFTListenerImp1());
        Thread.Sleep(5000);

        // Open second price streaming for two securities in the two first tinterfaces
        List<String> tinterfacelist = null;
        if (tinterfaceTickList != null && tinterfaceTickList.Count > 1)
        {
            tinterfacelist = new List<string>();
            tinterfacelist.Add(tinterfaceTickList.ElementAt(0).name);
            tinterfacelist.Add(tinterfaceTickList.ElementAt(1).name);
        }
        string id2 = wrapper.getPriceBegin(new List<string> { "EUR/USD", "GBP/JPY" }, tinterfacelist, ArthikaHFT.GRANULARITY_FAB, 2, interval, new ArthikaHFTListenerImp1());
        Thread.Sleep(5000);

        // Close second price streaming
        wrapper.getPriceEnd(id2);
        Thread.Sleep(5000);

        // Close first price streaming
        wrapper.getPriceEnd(id1);
        Thread.Sleep(5000);

        // Open third price streaming for six securities in the first tinterface
        if (tinterfaceTickList != null && tinterfaceTickList.Count > 0)
        {
            tinterfacelist = new List<string>();
            tinterfacelist.Add(tinterfaceTickList.ElementAt(0).name);
        }
        string id3 = wrapper.getPriceBegin(new List<string> { "EUR/USD", "EUR/GBP", "EUR/JPY", "GBP/JPY", "GBP/USD", "USD/JPY" }, tinterfacelist, ArthikaHFT.GRANULARITY_TOB, 1, interval, new ArthikaHFTListenerImp1());
        Thread.Sleep(5000);

        // Close third price streaming
        wrapper.getPriceEnd(id3);

        Console.WriteLine("Press Enter to exit");
        Console.Read();
    }
    public static void Main12(string[] args)
    {
        // get properties from file
        getProperties();

        wrapper = new ArthikaHFT(domain, url_stream, url_polling, url_challenge, url_token, user, password, authentication_port, request_port, ssl, ssl_cert);

        bool auth = wrapper.doAuthentication();
        if (!auth)
        {
            Console.WriteLine("Authentication failed");
            Console.Read();
            return;
        }

        // STRATEGY

        // get tinterfaces
        List<ArthikaHFT.tinterfaceTick> tinterfaceTickList = wrapper.getInterface();
        tinterface1 = tinterfaceTickList[0].name;
        if (tinterfaceTickList.Count > 1)
        {
            tinterface2 = tinterfaceTickList[1].name;
        }
        else
        {
            tinterface2 = tinterfaceTickList[0].name;
        }
        List<string> tinterfacelist = null;
        if (tinterfaceTickList != null && tinterfaceTickList.Count > 1)
        {
            tinterfacelist = new List<string>();
            tinterfacelist.Add(tinterface1);
            tinterfacelist.Add(tinterface2);
        }

        // Open price streaming
        string id1 = wrapper.getPriceBegin(new List<string> { "EUR/USD" }, tinterfacelist, ArthikaHFT.GRANULARITY_TOB, 1, interval, new ArthikaHFTListenerImp12());
        Thread.Sleep(20000);

        // Close price streaming
        wrapper.getPriceEnd(id1);

        Console.WriteLine("Press Enter to exit");
        Console.Read();
    }