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

        wrapper = new AdharaHFT(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;
        }

        List <AdharaHFT.accountTick> accountTickList = wrapper.getAccount();

        foreach (AdharaHFT.accountTick tick in accountTickList)
        {
            Console.WriteLine("Name: " + tick.name + " Style: " + tick.style + " Leverage: " + tick.leverage);
        }

        List <AdharaHFT.tinterfaceTick> tinterfaceTickList = wrapper.getInterface();

        foreach (AdharaHFT.tinterfaceTick tick in tinterfaceTickList)
        {
            Console.WriteLine("Name: " + tick.name + " Account: " + tick.account + " Commissions: " + tick.commissions);
        }

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

        wrapper = new AdharaHFT(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 POLLING

        // get accounts
        List <AdharaHFT.accountTick> accountTickList = wrapper.getAccount();

        Console.WriteLine("Starting Polling1");
        AdharaHFT.positionTick positionTickList1 = wrapper.getPosition(null, new List <string> {
            "EUR/USD", "GBP/JPY", "GBP/USD"
        }, null);
        Console.WriteLine("StrategyPL: " + positionTickList1.accountingTick.strategyPL + " TotalEquity: " + positionTickList1.accountingTick.totalequity + " UsedMargin: " + positionTickList1.accountingTick.usedmargin + " FreeMargin: " + positionTickList1.accountingTick.freemargin);
        foreach (AdharaHFT.assetPositionTick tick in positionTickList1.assetPositionTickList)
        {
            Console.WriteLine("Asset: " + tick.asset + " Account: " + tick.account + " Exposure: " + tick.exposure + " TotalRisk: " + tick.totalrisk);
        }
        foreach (AdharaHFT.securityPositionTick tick in positionTickList1.securityPositionTickList)
        {
            Console.WriteLine("Security: " + tick.security + " Account: " + tick.account + " Equity: " + tick.equity + " Exposure: " + tick.exposure + " Price: " + tick.price.ToString("F" + tick.pips) + " Pips: " + tick.pips);
        }
        Console.WriteLine("Polling1 Finished");

        Console.WriteLine("Starting Polling2");
        List <string> accountlist = null;

        if (accountTickList != null && accountTickList.Count > 1)
        {
            accountlist = new List <string>();
            accountlist.Add(accountTickList[0].name);
            accountlist.Add(accountTickList[1].name);
        }
        AdharaHFT.positionTick positionTickList2 = wrapper.getPosition(new List <string> {
            "EUR", "GBP", "JPY", "USD"
        }, null, accountlist);
        Console.WriteLine("StrategyPL: " + positionTickList2.accountingTick.strategyPL + " TotalEquity: " + positionTickList2.accountingTick.totalequity + " UsedMargin: " + positionTickList2.accountingTick.usedmargin + " FreeMargin: " + positionTickList2.accountingTick.freemargin);
        foreach (AdharaHFT.assetPositionTick tick in positionTickList2.assetPositionTickList)
        {
            Console.WriteLine("Asset: " + tick.asset + " Account: " + tick.account + " Exposure: " + tick.exposure + " TotalRisk: " + tick.totalrisk);
        }
        foreach (AdharaHFT.securityPositionTick tick in positionTickList2.securityPositionTickList)
        {
            Console.WriteLine("Security: " + tick.security + " Account: " + tick.account + " Equity: " + tick.equity + " Exposure: " + tick.exposure + " Price: " + tick.price.ToString("F" + tick.pips) + " Pips: " + tick.pips);
        }
        Console.WriteLine("Polling2 Finished");

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