private async Task PositionsHistoryAsync(CancellationToken cancellationToken)
        {
            // look up documentation to get all available filters
            var request   = new PositionsHistoryRequest(MarginAccountId, symbol: "XBTUSD");
            var positions = await _restClient.PositionsHistoryAsync(request, cancellationToken)
                            .ConfigureAwait(false);

            var toPrint = string.Join("\n", positions.Select(p => p.ToString()));

            _logger.LogInformation($"Positions history: {toPrint}");
        }
示例#2
0
        public async Task Test_PositionsHistory()
        {
            var request = new PositionsHistoryRequest(MarginAccountId)
            {
                //                PositionId =130722413,
                //                Symbol = "XBTUSD",
                //                OpenFrom = DateTime.Parse("2019-08-02T08:04:40Z").ToUniversalTime(),
                //                OpenTo = DateTime.Parse("2019-08-02T08:04:50Z").ToUniversalTime(),
                //                CloseFrom = DateTime.Parse("2019-07-26T13:51:04Z").ToUniversalTime(),
                //                CloseTo = DateTime.Parse("2019-07-26T13:51:06Z").ToUniversalTime(),
                //                PageNumber = 2,
                //                Limit = 2,
            };
            var positions = await _restClient.PositionsHistoryAsync(request, _token).ConfigureAwait(false);

            positions.Should().NotBeNull();
            positions.Should().NotBeNull();
            positions.Length.Should().BeGreaterThan(0);
        }