When testing on futures tick data, I end up with $0 strategy capacity in my back tests.
Since I discovered that strategy capacity uses volume in it's calculation, I updated my logic to use self.MarketOrder(symbol, self.liquid_contract.Volume - 1) to guarantee that the number of contracts requested in the order is less than the current volume available, but still end up with $0 strategy capacity in my back tests.
note - self.liquid_contract updates before placing each order using logic from the bootcamp code
To achieve the required volume for the order, my code simply keeps placing orders on the next tick until the required total order volume is achieved - using an entry based off an external time signal from .csv
Other than not fixing the $0 capacity, the other problem with this is that it creates an enourmous number of trades, which seems to limit the length of the period I can backtest over.
Is there a way that I can access depth of market data to be able to place my whole order on a single tick? I.e. 10 contracts at the current price, 20 at the lext level below.. and so on.
Thanks for any or your consideration towards my problem.
Mak K
Hi Bevan,
are you able to share a backtest for this?
Thanks!
Bevan Cranston
HI Matt,
Sure! Here's one that was originally set to run for a few years but finished early - I guess once it hits around a certain # of trades.
Thanks for your response
Mak K
Thanks Bevan,
I will try to get to the bottom of this later tonight.
Mak K
Hey Bevan Cranston n,
Just FYI,
I wanted to continue working on the problem today but the code suddenly produces error's even in the version that you uploaded,
“Runtime Error: IndexError : list index out of range”
This shows up at a bunch of points in the code, since you wrote the code maybe you know why this is happening ,thanks!
Bevan Cranston
Hi Mak,
Sorry about that! The link for my data broke. Should be fine now:)
Many thanks
Bevan Cranston
This backtest works
Mak K
Hey Bevan,
The code still doesn't work, the same error as before :/
Thanks!
Bevan Cranston
Hey Mak,
Are you sure you are using the code from the most recent backtest that I attached?
It seems to be running fine for me
Bevan Cranston
Hey Mak,
Hopefully you have had some luck with getting my code to run!
While looking into the problem myself thismorning, I have found in a discussion that QuantConnect punishes HFT strategies in terms of strategy capacity, and that this behavious is intended for buy to sell trade patterns, but still could affect patterns where orders are executed in the same direction one after the other - how my code currently works. So I'm wondering if this is my problem but unsure on how I can find out for certain.
Also, I've attached another backtest that definitely runs - incase you are still having problems getting my code to run
Bevan Cranston
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!