public async Task Is_GetAmountInBase_Correct() { var marketProfile = new Core.Domain.MarketProfile(); var feedData = new List <FeedData> { new FeedData { Asset = "BTCUSD", Ask = 2656.381, Bid = 2652, DateTime = DateTime.UtcNow } }; marketProfile.Profile = feedData; var amountInBase = await _service.GetAmountInBaseWithProfile("BTC", 1, "USD", marketProfile); Assert.Equal(2652, amountInBase); }
public async Task StraightTrueTrueConversion() { var marketProfile = new Core.Domain.MarketProfile(); var btcBid = 8600; var chfBid = 0.97925; var feedData = new List <FeedData> { new FeedData { Asset = "BTCUSD", Ask = 9000, Bid = btcBid, DateTime = DateTime.UtcNow }, new FeedData { Asset = "USDCHF", Ask = 0.98599, Bid = chfBid, DateTime = DateTime.UtcNow }, }; marketProfile.Profile = feedData; var amountInBase = await _service.GetAmountInBaseWithProfile("BTC", 1, "CHF", marketProfile); Assert.Equal((btcBid * chfBid).TruncateDecimalPlaces(TestsUtils.FiatAccuracy), amountInBase); }
public async Task <double> GetAmountInBaseWithProfile(string assetFrom, string assetTo, double amount, [FromBody] Core.Domain.MarketProfile marketProfile) { return(await _rateCalculatorService.GetAmountInBaseWithProfile(assetFrom, amount, assetTo, marketProfile)); }