public static AllocationHistory GetAllocationHistory(FXMarketHistory fxmh, bool addCryptoWD = false, Currency Fiat = Currency.USD) { AllocationHistory AH = new AllocationHistory(); AH.AddTransactions(Fiat, GetTransactionList(addCryptoWD), fxmh); return(AH); }
public void AllocationHistory_Init() { FXMarketHistory fxmh = MarketTestTools.CreateMktHistory(); AllocationHistory allocH = AllocationsTools.GetAllocationHistory(fxmh); Allocation alloc = allocH.GetAllocation(MarketTestTools.date1); Allocation allocTest = AllocationsTools.GetAllocation(); allocTest.Update(MarketTestTools.CreateMarket()); Assert.IsTrue(alloc.Total.Equals(allocTest.Total)); }
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 TimeSeriesManager(Currency fiat, Frequency freq = Frequency.Hour4, bool useKraken = false, bool useInternet = true, string path = null, IView view = null) { if (view != null) { AddLoggingLink(view.PublishLogMessage); } Fiat = fiat; if (path != null) { BasePath = path; } DataProvider = new DataProvider(BasePath, view, useInternet: useInternet); SortedList <DateTime, Transaction> txList = DataProvider.GetTransactionList(useKraken: useKraken); StartDate = txList.First().Key; FXMH = DataProvider.GetFXMarketHistory(Fiat, DataProvider.GetCurrencyPairs(txList), StartDate, freq); AH = new AllocationHistory(view); APnL = new AggregatedPnL(fiat); APnL.AddTransactions(txList, FXMH); }