We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No ArgumentException exception generating stats
2024-04-01T20:52:04.1948498Z ERROR:: BaseResultsHandler.GenerateStatisticsResults(): BaseResultsHandler.GenerateStatisticsResults(): Error generating statistics packet System.ArgumentException: It is not possible to cast a non-finite floating-point value (Infinity) as decimal. Please review math operations and verify the result is valid. (Parameter 'input') ---> System.NotFiniteNumberException: Overflow or underflow in the arithmetic operation. --- End of inner exception stack trace --- at QuantConnect.Statistics.PortfolioStatistics..ctor(SortedDictionary`2 profitLoss, SortedDictionary`2 equity, SortedDictionary`2 portfolioTurnover, List`1 listPerformance, List`1 listBenchmark, Decimal startingCapital, IRiskFreeInterestRateModel riskFreeInterestRateModel, Int32 tradingDaysPerYear, Nullable`1 winCount, Nullable`1 lossCount) in Lean/Common/Statistics/PortfolioStatistics.cs:line 287 at QuantConnect.Statistics.AlgorithmPerformance..ctor(List`1 trades, SortedDictionary`2 profitLoss, SortedDictionary`2 equity, SortedDictionary`2 portfolioTurnover, List`1 listPerformance, List`1 listBenchmark, Decimal startingCapital, Int32 winningTransactions, Int32 losingTransactions, IRiskFreeInterestRateModel riskFreeInterestRateModel, Int32 tradingDaysPerYear) in Lean/Common/Statistics/AlgorithmPerformance.cs:line 71 at QuantConnect.Statistics.StatisticsBuilder.GetAlgorithmPerformance(DateTime fromDate, DateTime toDate, List`1 trades, SortedDictionary`2 profitLoss, SortedDictionary`2 equity, List`1 pointsPerformance, List`1 pointsBenchmark, List`1 pointsPortfolioTurnover, Decimal startingCapital, SecurityTransactionManager transactions, IRiskFreeInterestRateModel riskFreeInterestRateModel, Int32 tradingDaysPerYear) in Lean/Common/Statistics/StatisticsBuilder.cs:line 147 at QuantConnect.Statistics.StatisticsBuilder.GetRollingPerformances(DateTime firstDate, DateTime lastDate, List`1 trades, SortedDictionary`2 profitLoss, SortedDictionary`2 equity, List`1 pointsPerformance, List`1 pointsBenchmark, List`1 pointsPortfolioTurnover, Decimal startingCapital, SecurityTransactionManager transactions, IRiskFreeInterestRateModel riskFreeInterestRateModel, Int32 tradingDaysPerYear) inLean/Common/Statistics/StatisticsBuilder.cs:line 192 at QuantConnect.Statistics.StatisticsBuilder.Generate(List`1 trades, SortedDictionary`2 profitLoss, List`1 pointsEquity, List`1 pointsPerformance, List`1 pointsBenchmark, List`1 pointsPortfolioTurnover, Decimal startingCapital, Decimal totalFees, Int32 totalOrders, CapacityEstimate estimatedStrategyCapacity, String accountCurrencySymbol, SecurityTransactionManager transactions, IRiskFreeInterestRateModel riskFreeInterestRateModel, Int32 tradingDaysPerYear) in Lean/Common/Statistics/StatisticsBuilder.cs:line 74 at QuantConnect.Lean.Engine.Results.BaseResultsHandler.GenerateStatisticsResults(Dictionary`2 charts, SortedDictionary`2 profitLoss, CapacityEstimate estimatedStrategyCapacity) in Lean/Engine/Results/BaseResultsHandler.cs:line 874
Backtesting
# region imports from AlgorithmImports import * # endregion class LogicalRedPig(QCAlgorithm): def Initialize(self): self.SetStartDate(2024, 1, 1) self.SetCash(100000) self.AddEquity("SPY", Resolution.Minute) self.AddEquity("BND", Resolution.Minute) self.AddEquity("AAPL", Resolution.Minute) self.AddCrypto("BTCUSD", Resolution.Minute) def OnData(self, data: Slice): if not self.Portfolio.Invested: self.SetHoldings("BTCUSD", 0.1) else: self.SetHoldings("BTCUSD", 0)
N/A
master
The text was updated successfully, but these errors were encountered:
Marinovsky
Successfully merging a pull request may close this issue.
Expected Behavior
No ArgumentException exception generating stats
Actual Behavior
Potential Solution
Reproducing the Problem
Backtesting
System Information
N/A
Checklist
master
branchThe text was updated successfully, but these errors were encountered: