Пример #1
0
        public static void LimitOrder(TickTraderWebClient client)
        {
            // Create, modify and cancel limit order
            TTAccount account = client.GetAccount();

            if ((account.AccountingType == TTAccountingTypes.Gross) || (account.AccountingType == TTAccountingTypes.Net))
            {
                // Create limit order
                var limit = client.CreateTrade(new TTTradeCreate
                {
                    Type    = TTOrderTypes.Limit,
                    Side    = TTOrderSides.Buy,
                    Symbol  = (account.AccountingType == TTAccountingTypes.Gross) ? "EURUSD" : "EUR/USD",
                    Amount  = 10000,
                    Price   = 1.0M,
                    Comment = "Buy limit from Web API sample"
                });

                // Modify limit order
                limit = client.ModifyTrade(new TTTradeModify
                {
                    Id      = limit.Id,
                    Comment = "Modified limit from Web API sample"
                });

                // Cancel limit order
                client.CancelTrade(limit.Id);
            }
        }
Пример #2
0
        public static void GetAccount(TickTraderWebClient client)
        {
            // Account info
            TTAccount account = client.GetAccount();

            Console.WriteLine("Account Id: {0}", account.Id);
            Console.WriteLine("Account name: {0}", account.Name);
            Console.WriteLine("Account group: {0}", account.Group);
        }
Пример #3
0
        public static void GetPositions(TickTraderWebClient client)
        {
            // Account positions
            TTAccount account = client.GetAccount();

            if (account.AccountingType == TTAccountingTypes.Net)
            {
                List <TTPosition> positions = client.GetAllPositions();
                foreach (var p in positions)
                {
                    Console.WriteLine("{0} position: {1} {2}", p.Symbol, p.LongAmount, p.ShortAmount);
                }
            }
        }
Пример #4
0
        public static void GetAssets(TickTraderWebClient client)
        {
            // Account assets
            TTAccount account = client.GetAccount();

            if (account.AccountingType == TTAccountingTypes.Cash)
            {
                List <TTAsset> assets = client.GetAllAssets();
                foreach (var a in assets)
                {
                    Console.WriteLine("{0} asset: {1}", a.Currency, a.Amount);
                }
            }
        }