Back

How to get a list of all trades executed

Hi team,

Not sure this has been asked before.
I want to get a list of trades that has already been filled, and also their price at which they are executed.
What's the best way to achieve this, or is there any examples that I can refer to?
Thanks you!

Jianwei
Update Backtest








Absolutely @Jianwei! If you click on the Trades Summary tab of your backtest result you can download a CSV list by clicking the link in the top right corner of the tab.
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.


Apologies, I did not state the question clearly. I would like to get the list of trades and their fill price as part of the algorithm. what's the best way to achieve that?
Thanks Jared.
0

The easiest way to get info about a filled order propably is through the OnOrderEvent function like this:

public override void OnOrderEvent(OrderEvent orderevent)
{
if(orderevent.Status==OrderStatus.Filled)
Log(orderevent.ToString());
}


I attached a simple example here:
2


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