public async Task CashInstrumentLocalRequestsUseFxRates() { DateTime startDate = new DateTime(2000, 1, 1); DateTime endDate = new DateTime(2000, 1, 3); var inst = new Instrument { ID = 1, Symbol = "EUR.USD", AssetCategory = AssetClass.Cash, QDMSInstrumentID = 2 }; var eur = new Currency { ID = 2, Name = "EUR" }; _data.Currencies.Add(eur); _data.FXRates.Add(new FXRate() { FromCurrencyID = 2, FromCurrency = eur, Rate = 1.5m, Date = endDate }); _externalSourceMock.Setup( x => x.GetData(It.IsAny <Instrument>(), It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <BarSize>())) .ReturnsAsync(new List <OHLCBar>()); var resultData = await _datasourcer.GetData(inst, startDate, endDate); Assert.That(resultData.Any(x => x.Date.ToDateTime() == endDate)); }
public decimal GetLastFxRate(Currency currency) { return(Context.FXRates.Where(x => x.FromCurrencyID == currency.ID).OrderByDescending(x => x.Date).First().Rate); }
public void SetUp() { _currency = new Currency { ID = 2, Name = "EUR" }; }