Пример #1
0
        public void AggPnL_AddTransaction()
        {
            FXMarketHistory fxmh = MarketTestTools.CreateMktHistory(true, true);
            SortedList <DateTime, Transaction> txL = AllocationsTools.GetTransactionList();
            AggregatedPnL pnl = new AggregatedPnL(Currency.USD);

            pnl.AddTransactions(txL, fxmh);
            Dictionary <string, PnLElement> table = pnl.ToTable(fxmh);

            TestTools <PnLElement> .DictionaryTest(pnlref, table);
        }
Пример #2
0
        public void AggPnL_Equation()
        {
            FXMarketHistory fxmh = MarketTestTools.CreateMktHistory(true, true);
            SortedList <DateTime, Transaction> txL = AllocationsTools.GetTransactionList();
            AggregatedPnL pnl = new AggregatedPnL(Currency.USD);

            pnl.AddTransactions(txL, fxmh);
            PnLElement elmt = pnl.ToTable(fxmh)["Total"];

            Assert.IsTrue(elmt.Position - elmt.Deposit + elmt.Withdrawal == elmt.TotalPnLWithFees);
        }
Пример #3
0
        public void AggPnL_EquationXCCY()
        {
            FXMarketHistory fxmh = MarketTestTools.CreateMktHistory(true, true);

            fxmh.ConstructQuotes(new CurrencyPair(Currency.EUR, Currency.USD));
            SortedList <DateTime, Transaction> txL = AllocationsTools.GetTransactionList();
            AggregatedPnL pnl = new AggregatedPnL(Currency.EUR);

            pnl.AddTransactions(txL, fxmh);
            PnLElement elmt = pnl.ToTable(fxmh)["Total"];

            Assert.IsTrue(Math.Abs(elmt.Position - elmt.Deposit + elmt.Withdrawal - elmt.TotalPnLWithFees) < 0.00001);
        }
        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);
        }