public void AllocationHistory_Update() { FXMarketHistory fxmh = MarketTestTools.CreateMktHistory(); AllocationHistory allocH = AllocationsTools.GetAllocationHistory(fxmh, Fiat: Currency.EUR); CurrencyPair testCP = new CurrencyPair(Currency.EUR, Currency.USD); //fxmh.ConstructQuotes(testCP); allocH.UpdateHistory(Currency.EUR, fxmh); Price total = allocH.GetLastAllocation().Total; Assert.IsTrue(total .Equals(new Price(932.687, Currency.EUR), precision: 2)); }
public void Update(Currency fiat, Frequency freq, List <ITimeSeriesKey> tskl, bool useLowerFrequencies) { TimeSeriesKeyList = tskl; DataProvider.LoadPrices(TimeSeriesKeyList, useLowerFrequencies: useLowerFrequencies); Fiat = fiat; if (FXMH.Freq != freq || ChangeLedger) { SetUpAllHistory(freq); } DataProvider.UpdateFXMarketHistory(FXMH, Fiat, StartDate, freq); APnL.ChangeCcyRef(fiat, FXMH); bool ReloadAllocationHistory = tskl.Where(x => x.GetKeyType() == TimeSeriesKeyType.AllocationHistory).Count() > 0; if (ChangeLedger || ReloadAllocationHistory) { ChangeLedger = false; APnL.AddTransactions(DataProvider.GetTransactionList(), FXMH, fullReload: true); } if (ReloadAllocationHistory) { AH.AddTransactions(fiat, DataProvider.GetTransactionList(), FXMH); AH.UpdateHistory(fiat, FXMH); } }