Example #1
0
        public async Task GetPositions()
        {
            // Account positions
            TTAccount account = await _client.GetAccountAsync();

            List <TTPosition> positions = null;

            if (account.AccountingType == TTAccountingTypes.Net)
            {
                if (string.IsNullOrEmpty(PositionId))
                {
                    positions = await _client.GetAllPositionsAsync();
                }
                else
                {
                    try
                    {
                        TTPosition position = await _client.GetPositionAsync(PositionId);

                        positions = new List <TTPosition>(new[] { position });
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            Positions = positions != null ? new ObservableCollection <TTPosition>(positions) : null;
        }