public void Calculate() { // ReSharper disable SuspiciousTypeConversion.Global ((IMockableProxy)fakeTradeAccount).IncludeMockMethod(getHistoryOrdersName, getHistoryOrdersFake); ((IMockableProxy)fakeTradeAccount).IncludeMockMethod(getMarketOrdersName, getMarketOrdersFake); ((IMockableProxy)fakeTradeAccount).IncludeMockMethod(getBalanceChangesName, getBalanceChangesFake); // ReSharper restore SuspiciousTypeConversion.Global var accEff = new AccountEfficiency(new PerformerStat { Account = AccountId, DepoCurrency = "USD" }); //accEff.Statistics.Account = accountId; efficiencyCalculator = new EfficiencyCalculator(dailyQuoteStorage, new EquityCurveCalculator()); efficiencyCalculator.Calculate(accEff); }
//[Test] public void CalculateEquityCurveVoid() { // ReSharper disable SuspiciousTypeConversion.Global ((IMockableProxy)fakeTradeAccount).IncludeMockMethod(getHistoryOrdersName, getHistoryOrdersFake); ((IMockableProxy)fakeTradeAccount).IncludeMockMethod(getMarketOrdersName, getMarketOrdersFake); ((IMockableProxy)fakeTradeAccount).IncludeMockMethod(getBalanceChangesName, getBalanceChangesFake); // ReSharper restore SuspiciousTypeConversion.Global var dailyQuoteStorage = new DailyQuoteStorage(); var curveCalculator = new EquityCurveCalculator(); try { var calc = new EfficiencyCalculator(dailyQuoteStorage, curveCalculator); calc.Calculate(new AccountEfficiency(new PerformerStat { Account = 0, DepoCurrency = "USD" })); Assert.Fail("NuEfficiencyCalculator.Calculate() - не выбросил ArgumentException"); } catch (ArgumentException) // Это не трогать { } /* ((IMockableProxy) fakeTradeAccount).IncludeMockMethod(getHistoryOrdersName, getHistoryOrdersFake); ((IMockableProxy) fakeTradeAccount).IncludeMockMethod(getMarketOrdersName, getMarketOrdersFake); ((IMockableProxy) fakeTradeAccount).IncludeMockMethod(getBalanceChangesName, getBalanceChangesFake); var accEff1 = new AccountEfficiency(new PerformerStat { Account = accountId, DepoCurrency = "USD" }); var calc = new EfficiencyCalculator(dailyQuoteStorage, equityCurveCalculator); calc.Calculate(accEff1); ((IMockableProxy) fakeTradeAccount).IncludeMockMethod(getBalanceChangesName, getBalanceChangesVoidFake); EfficiencyCalculator.Calculate(accEff1); ((IMockableProxy) fakeTradeAccount).IncludeMockMethod(getHistoryOrdersName, getHistoryOrdersEmptyFake); ((IMockableProxy) fakeTradeAccount).IncludeMockMethod(getMarketOrdersName, getMarketOrdersEmptyFake); EfficiencyCalculator.Calculate(accEff1); */ }
public void CalculateProfitCoeffs() { var accEff = new AccountEfficiency(new PerformerStat { Account = AccountId, DepoCurrency = "USD" }) { listEquity = TestDataGenerator.GetEquityOnTime(), listTransaction = TestDataGenerator.GetBalanceChange().Select(LinqToEntity.DecorateBalanceChange).ToList() }; efficiencyCalculator = new EfficiencyCalculator(dailyQuoteStorage, new EquityCurveCalculator()); efficiencyCalculator.CalculateProfitCoeffs(accEff); }