The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
var resultJsonString = File.ReadAllText("my-backtest-result.json");
var results = JsonConvert.DeserializeObject(resultJsonString);
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
var dailyStatisticsByStock = TradeBuilder.ClosedTrades
.GroupBy(trades => trades.Symbol,
(symbol, trades) => new
{
ticket = symbol,
dailyValues = trades
.GroupBy(trade => trade.ExitTime.Date,
(day, trade) => new
{
index = day.Date,
profit = trade.Sum(t => t.ProfitLoss),
volShares = trade.Sum(t => t.Quantity),
volDollars = trade.Sum(t => t.Quantity * (t.ExitPrice + t.EntryPrice))
// Any other daily statistic by stock.
}
)
});
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Can you please give a python example of how to do this... and what the name of the backtest object is after I have run a backtest.
I am quite happy to contibute time to developing advanced analytics, but it is unclear how to obtain the data to start with,
cheers,
Bruce
Hi Bruce,
To get the backtest results into the research environment, we can use
backtest = api.ReadBacktest(projectId, backtestId)
We are working on tools to help process the `backtest` result object. For now, we can access the Sharpe ratio for example with
backtest.Result.TotalPerformance.PortfolioStatistics.SharpeRatio
See the attached research notebook for an example.
The backtestId can be seen under the "Share" tab of the backtest results page
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Hi I just tried to replicate this, but it did not work. Can someone confirm that this is functional please?
It didn't work for me, too.
The commands api.Connected and backtest = api.ReadBacktest(projectId, backtestId) were successful, but backtest.Result yields a NoneType object.
I'm getting the same error, the API is not finding my backtest and retuirning it, rather it is creating a empty object.
AttributeError Traceback (most recent call last)
Sorry about we made some fast-breaking changes before the holiday weekend and will push the fixes for them today. We move quickly and there will always be bugs in complex software. Microsoft is still patching Windows since 1989 =). But please respect the forum etiquette and not post bug reports to the forum -- please submit all bug reports to support@quantconnect.com so we can keep the forum focused on algorithm development.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can
continue your Boot Camp training progress from the terminal. We
hope to see you in the community soon!