Back

Attribution of trades/positions

Hi, 

I think it would be very useful to analyse the results of backtests if there's attribution tables available. I was looking at creating an attribution table for each trade, essentially seeing which names/trades were the most profitable / most costly. Average return per day etc.

I was looking at the securities and trade methods but couldn't find anything that seems to give the data needed there. Has anyone else looked at this and maybe have some ideas? 

 

Thinking the most simple method would be to take each trade and calculate the profit or loss on that trade, allocate to the stock and add number of days held. 

Update Backtest







0

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.


I feel like you would need a trade ID to determine specific trade details, no? I dont think trade IDs are handled in Quantconnect, unless there is some other way of tracking trades that I am missing.

0

Hey Quanter123 there are various methods of calculating what is a "trade" as the quantity of stock you're buying and selling do not always equal. These broadly speaking as FIFO and LIFO. We've opened sourced the techniques we used to create our "trades" for the trade statistics and you can use this as a basis for your research:

https://github.com/QuantConnect/Lean/blob/master/Common/Statistics/TradeBuilder.cs

 

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed