コード例 #1
0
    public static void Main3(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;
        }

        // POSITION STREAMING

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

        string tinterface1 = tinterfaceTickList[0].name;
        ArthikaHFT.orderRequest order1 = new ArthikaHFT.orderRequest();
        order1.security = "EUR/USD";
        order1.tinterface = tinterface1;
        order1.quantity = 400000;
        order1.side = ArthikaHFT.SIDE_SELL;
        order1.type = ArthikaHFT.TYPE_LIMIT;
        order1.timeinforce = ArthikaHFT.VALIDITY_DAY;
        order1.price = 1.15548;

        string tinterface2;
        if (tinterfaceTickList.Count > 1)
        {
            tinterface2 = tinterfaceTickList[1].name;
        }
        else
        {
            tinterface2 = tinterfaceTickList[0].name;
        }
        ArthikaHFT.orderRequest order2 = new ArthikaHFT.orderRequest();
        order2.security = "GBP/USD";
        order2.tinterface = tinterface2;
        order2.quantity = 500000;
        order2.side = ArthikaHFT.SIDE_BUY;
        order2.type = ArthikaHFT.TYPE_LIMIT;
        order2.timeinforce = ArthikaHFT.VALIDITY_FILLORKILL;
        order2.price = 1.67389;

        // Open position streaming
        string id1 = wrapper.getPositionBegin(null, new List<string> { "EUR/USD", "GBP/USD" }, null, interval, new ArthikaHFTListenerImp3());
        Thread.Sleep(5000);

        // Create two orders
        List<ArthikaHFT.orderRequest> orderList = wrapper.setOrder(new List<ArthikaHFT.orderRequest> { order1, order2 });
        foreach (ArthikaHFT.orderRequest orderresponse in orderList)
        {
            Console.WriteLine("Id: " + orderresponse.tempid + " Security: " + orderresponse.security + " Side: " + orderresponse.side + " Quantity: " + orderresponse.quantity + " Price: " + orderresponse.price + " Type: " + orderresponse.type);
        }
        Thread.Sleep(5000);

        // Close position streaming
        wrapper.getPositionEnd(id1);

        Console.WriteLine("Press Enter to exit");
        Console.Read();
    }
コード例 #2
0
    public static void Main3(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;
        }

        // POSITION STREAMING

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

        string tinterface1 = tinterfaceTickList[0].name;

        ArthikaHFT.orderRequest order1 = new ArthikaHFT.orderRequest();
        order1.security    = "EUR/USD";
        order1.tinterface  = tinterface1;
        order1.quantity    = 400000;
        order1.side        = ArthikaHFT.SIDE_SELL;
        order1.type        = ArthikaHFT.TYPE_LIMIT;
        order1.timeinforce = ArthikaHFT.VALIDITY_DAY;
        order1.price       = 1.15548;

        string tinterface2;

        if (tinterfaceTickList.Count > 1)
        {
            tinterface2 = tinterfaceTickList[1].name;
        }
        else
        {
            tinterface2 = tinterfaceTickList[0].name;
        }
        ArthikaHFT.orderRequest order2 = new ArthikaHFT.orderRequest();
        order2.security    = "GBP/USD";
        order2.tinterface  = tinterface2;
        order2.quantity    = 500000;
        order2.side        = ArthikaHFT.SIDE_BUY;
        order2.type        = ArthikaHFT.TYPE_LIMIT;
        order2.timeinforce = ArthikaHFT.VALIDITY_FILLORKILL;
        order2.price       = 1.67389;

        // Open position streaming
        string id1 = wrapper.getPositionBegin(null, new List <string> {
            "EUR/USD", "GBP/USD"
        }, null, interval, new ArthikaHFTListenerImp3());

        Thread.Sleep(5000);

        // Create two orders
        List <ArthikaHFT.orderRequest> orderList = wrapper.setOrder(new List <ArthikaHFT.orderRequest> {
            order1, order2
        });

        foreach (ArthikaHFT.orderRequest orderresponse in orderList)
        {
            Console.WriteLine("Id: " + orderresponse.tempid + " Security: " + orderresponse.security + " Side: " + orderresponse.side + " Quantity: " + orderresponse.quantity + " Price: " + orderresponse.price + " Type: " + orderresponse.type);
        }
        Thread.Sleep(5000);

        // Close position streaming
        wrapper.getPositionEnd(id1);

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