Example #1
0
        public async Task LimitOrder()
        {
            // Create, modify and cancel limit order
            TTAccount account = await _client.GetAccountAsync();

            if ((account.AccountingType == TTAccountingTypes.Gross) || (account.AccountingType == TTAccountingTypes.Net))
            {
                // Create limit order
                var limit = await _client.CreateTradeAsync(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 = await _client.ModifyTradeAsync(new TTTradeModify
                {
                    Id      = limit.Id,
                    Comment = "Modified limit from Web API sample"
                });

                // Cancel limit order
                await _client.CancelTradeAsync(limit.Id);
            }
        }