Example #1
0
        public async Task CalculateRequiredAmount()
        {
            _fakeHttpMessageHandler.HandleRequestAsync = TestHelper.HandleContent(form =>
            {
                Assert.Equal("BTC_USD", form["pair"]);
                Assert.Equal("0.01", form["quantity"]);
            });
            _fakeHttpMessageHandler.ResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent("{\"quantity\":\"0.01\",\"amount\":\"69.07831279\",\"avg_price\":\"6907.831279\"}")
            };

            var request = new RequiredAmountRequest
            {
                Pair     = "BTC_USD",
                Quantity = 0.01m
            };
            var result = await _publicApi.CalculateRequiredAmountAsync(request);

            Assert.Equal(0.01m, result.Quantity);
            Assert.Equal(69.07831279m, result.Amount);
            Assert.Equal(6907.831279m, result.AveragePrice);
        }
Example #2
0
 public Task <RequiredAmount> CalculateRequiredAmountAsync(RequiredAmountRequest request, CancellationToken cancellationToken = default)
 {
     return(_client.PostAsync <RequiredAmount>("required_amount", request, cancellationToken));
 }