Going to apologize in advance because this may be a newbie question, but I have a paper trading algo that when the orders are submitted in the OnData object, they get 'stuck' as just submitted and never filled. I'm scratching my head a bit - I'm using custom universe selection and that seems to be returning data OK, the error just seems to occur when orders are being placed. I'm also only interested in filling the orders once per day - not sure if how I'm accomodating that below is the most efficient way.
Any insight would be greatly appreciated! Thanks in advance!
def OnData(self, slice):
# only once per day
if self.previous is not None and self.previous.date() == self.Time.date(): return
if slice.Bars.Count == 0: return
percentage = 1 / d.Decimal(slice.Bars.Count)
for tradeBar in slice.Bars.Values:
self.SetHoldings(tradeBar.Symbol, percentage)
self.previous = self.Time
self.Log(self.previous)
Alexandre Catarino
Hi Marty Ernst, we cannot see anything wrong with your algorithm.
Could you please share your algorithm with support so that we can try to reproduce the issue?
Marty Ernst
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!