Hi Guys,
I wonder how the 'Benchmark' line is calculated, shown in the Strategy Equity chart.
It seems to be relative to the equity value. I want to use this data. The 'Download' button does not include this drawn Benchmark line in the series. Second, the Benchmark chart itself contains the unrelated actual values of the benchmark.
Any ideas?
Alexandre Catarino
We use SetBenchmark() for the statistics calculations. The default is SPY.
The line drawn on chart is currently a separate system powered by the drop down selector of the indices on the right of the backtest.
Anne-Mirthe Stam
That explains why it is not exported in the .JSON File. Any hints in how I can recalculate those values based upon the JSON export?
Alexandre Catarino
You can recalculate those values from the daily data you can download for free from Yahoo or Google. Please checkout the downloaders in the Toolbox.
The benchmarks are S&P500, Dow Jones, Russel 3000 and FTSE 100.
Anne-Mirthe Stam
Those tools are indeed handy. But are they really necessary given i 'set' a benchmark in the algorithm, and this data is exported in the chart?
Second, given the data is present, to be more explixit, what is the formula / technique, to calculate the value, relative to the equity, as shown in the web UI?
Alexandre Catarino
Data from the benchmark we choose (or default) is exported into the json file with the results. For instance, if the benchmark is SPY, we get closing prices of SPY.
In order to calculate performance of the benchmark, we need compound the benchmark daily return:
var chartPoints = result.Results .Charts["Benchmark"] .Series["Benchmark"].Values; var benchmarkPerformace = new List<ChartPoint>(); // Assuming the initial capital is $100000 // We can get this value from Equity chart benchmarkPerformace.Add(new ChartPoint(chartPoints[0].x, 100000)); for (var i = 1; i< chartPoints.Count; i++) { var x = chartPoints[i].x; var y = benchmarkPerformace[i - 1].y * (chartPoints[i].y / chartPoints[i - 1].y); benchmarkPerformace.Add(new ChartPoint(x, y)); }
Anne-Mirthe Stam
This is indeed what I was looking for, and i managed to draw it in a local chart using your formula!
Alexandre, Thank you so much for helping me out. :)
Jared Broad
What tool are you using locally Anne-Mirthe? That chart looks great
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.
Anne-Mirthe Stam
Hi Jared. The library is LiveCharts (https://lvcharts.net/) WPF. Next to trying to get international market support (note the EUR symbol and Dutch stocks) I have been playing for a while with visualizing the backtest progress. Meanwhile i'm learning about all kind of charts, indicators, statistics and the LEAN engine etc. on the way, as I am still new to all this financial stuff!
Jared Broad
That is really nice! Are you connected via the API or running entirely locally?
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.
Anne-Mirthe Stam
It is entirely locally at the moment. It uses the 'StreamingMessageHandler' to get its data.
It might be interesting to use the QC.com API as well to get live backtest result information. I should investigate this, and get a subscription as well ;).
Anne-Mirthe Stam
Hi Guys, i've decided to put the tool to GitHub. It is still has many issues, - as it was my personal proof of concept - but maybe someone else likes the idea and want's to help to improve it.
https://github.com/mirthestam/lean-monitor
Jared Broad
Awesome thank you Anne!
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.
Anne-Mirthe Stam
Well, A small update. (See the Develop branch)
I fixed a lot of bugs, and I guess the tool is a bit more usable by now. Bugs fixed, performance issues fixed, scatter series added etc. Stream data merge issues have been fixed. Implemented multiple charts based upon the index.
There is just a major problem that needs fixing: I am still struggling to find how how I can modify the charts to only show trading hours. At the moment, when the resolution is i.e. Hourly, the charts will look weird as they stretch the values over the missing periods. Usable, but a bit frustrating.
To test it, I tried a few simulations from the local lean engine, as well as download test results from QC.com
Please let me know if you guys like it, have improvements, found bugs, or feel like It is totally worthless and I should stop developing it ;-) xD.
JayJayD
Awesome.
Please, keep on the good work!
Jared Broad
Looks awesome Anne; do you know if LV Charts is cross platform? It could be a great addition to LEAN
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.
Anne-Mirthe Stam
@JaredBroad Well they have a Windows Form implementation, It is worth checking out whether it is fully compatible with the mono implementation.
Anne-Mirthe Stam
To make this thing a bit more usable for the Algorithm Lab users, I am busy adding implementation for the QC.com API.
Browsing the API namespace, there is no way to subscribe to updates as far as I can see. Therefore I went for an polling mechanism. However, I noticed some weird responses from the API. Sometimes the progress and completed fields are 1 and true, however the chart data is not updated. It does not feel like a cache problem locally, because the progress is updated. Any ideas? It would be nice to get live backtest results at the desktop ;).
Jared Broad
*Mind blown*! Wow! That is awesome!
Without going into too much detail; the way we store data for backtests is eventually consistent, so you'll need to just poll every few seconds until you get a backtest result. The sheer volume of the backtest data was too large for a traditional database.
We have streaming in the other GUI we ship but its powered by a JS library. Perhaps we could find a C# version of the library and you can stream it from there.
If possible we should integrate some of the work that Ivan did recently with the backtesting plugin -- he's made a Visual Studio plugin which saves all the files to QC. These two projects would work awesomely with each other!
Can you make a new discussion thread about the GUI specifically and then we can post updates to it over time.
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.
Anne-Mirthe Stam
That is a good idea. Currently I'm contributing to LiveCharts to develop a better X axis. I think this is a major requirement. When this has been implemented, I'll integrate it into the monitor tool and create the new discussion thread to introduce the GUI specifically.
After that, we should definitely look into streaming. When Combined with the tool by Ivan, this might be a solid desktop client to QC.com, or the LEAN engine indeed.
Andrestone
How's it going? :)
Anne-Mirthe Stam
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!