Robin hood rejects or cancels my orders after market open. Why??
Robin hood rejects or cancels my orders after market open. Why??
Are the orders being canceled or rejected? I had problems with orders being canceled. If it's rejected, that's something that Robinhood is doing (maybe not enough funds or trying to short or something). If it's canceled, that's the order never getting through to Robinhood. I added the code below to re-submit any canceled orders and it seems to work. As an aside, I noticed this happening a lot when I first had my trades scheduled for market open. I subsequently schedule them for 10-30 minutes after market opens and really haven't seen the problem.
Somewhere in 'initialize' add some code to first create the order list.
# Create a list of daily orders. Initially it's empty. context.todays_orders = 
When placing an order I store the order ID in ' context.todays_orders' like this
order_id = order(stock, context.output.get_value(stock, 'order_shares'), style=LimitOrder(context.output.get_value(stock, 'latest_price')) ) context.todays_orders.append(order_id)
This is the retry method
def retry_cancelled_order(context, data): for order_id in context.todays_orders[:]: my_order = get_order(order_id) if my_order and my_order.status == 2 : # The order was somehow cancelled so retry retry_id = order( my_order.sid, my_order.amount, style=LimitOrder(my_order.limit) ) context.todays_orders.append(retry_id) log.info('order for %i shares of %s cancelled - retrying' % (my_order.amount, my_order.sid)) # Remove the original order (typically can't do but note the [:] above context.todays_orders.remove(order_id)
The orders and retrys are scheduled with 'retry_cancelled_order' function to run 3 times after my initial buy and sell functions
# Try to place orders schedule_function(enter_sells, date_rules.every_day(), time_rules.market_open(minutes = 10)) schedule_function(enter_buys, date_rules.every_day(), time_rules.market_open(minutes = 30)) # Retry any cancelled orders 3 times for 10 minutes schedule_function(retry_cancelled_order, date_rules.every_day(), time_rules.market_open(minutes = 35)) schedule_function(retry_cancelled_order, date_rules.every_day(), time_rules.market_open(minutes = 45)) schedule_function(retry_cancelled_order, date_rules.every_day(), time_rules.market_open(minutes = 55))
Finally, I clear the list every morning in 'before_trading_start'
# Clear the list of todays orders and start fresh # Would like to do this 'context.today_orders.clear()' but not supported del context.todays_orders[:]
Thanks to @Blue for catching a bug in the original post
Yes. Most of them are cancelled orders which did not even reach Robinhood. And a few of them rejected by Robinhood itself.
@Dan, my algorithm anyway places a new order in the next minute for any cancelled order. Thanks for your code. If the cancelled order changes in the same minute, I could probably use part of your techinque to resend the cancelled order in the same minute. I am afraid this is even possible.
Quantopian guys can pitch in and let us know why this is happening.
Unfortunately, it's difficult to troubleshoot with the information available. I'm not aware of any general problems with Robinhood orders.
If you have a specific algorithm and set of orders we can check the logs and find more information. For that, it's best if you go to the live algo dashboard and hit the "contact support" menu item, and put in the detail about the orders you'd like us to look at.
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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.
I have found there a some very serious issues on RobinHoods side for its Bid/Ask data. If I connect to Robinhoods API through another project I am working on i find that their data for bid and ask is way out of wack and can be off several cents to dollars. If your algo here is depending on bid ask data you may get some cancled orders if your using limit orders such as I have found.
I haven't solved my problems, and I also scheduled my orders at market open. I am trying to schedule them before market open and after market open 5 minutes to see what happened.
This is what it looks like for me this morning and most mornings: http://imgur.com/a/JByiR
These are simple market orders order(sid, num_shares) placed in live trading with Robinhood. I have code that checks whether my allocation is fufilled after each trade so you can see it re-places the order after it detects the canceled order. Whatever is causing the problem seems to fade out by 8:45 AM (I'm on US central time).
Quantopian support unfortunately blamed it on Robinhood being down just after market open. What I do not understand is, if Robinhood was really down for the first 1-13 min, I shouldn't be able place an order through my app, which I am able to.
Need to find a quick solution to this.
It might be that just robinhood's API is down during market open, allowing the app to still work. I could see it if it was a one off event but it's been doing it every day for over two weeks now. I hope they are working on it
Same here. Luke's screenshot shows cancelled on highly liquid SPY and TLT, surprise. Luke, do you have Dan's canceled retry implemented?
No, I have it implemented in another algorithm that will start trading live tomorrow. This algorithm just happens to have one of my attempts at a robust ordering setup which checks to make sure the allocation is met after each order is placed which luckily catches the cancelled orders.
This is happening to me too!!!! It has been working for several days now and all of the sudden for the past 2 days, all of the orders were CANCELLED!. I missed some good upswing today :(
My algo is stateful - so I restart, i lose my current positions. So I prefer not to restart and try to move the orders in as Dan Whitable suggested. I'm NOT very happy with Robinhood integration. At least one MAJOR problem shows up every week. IB has been working quite smoothly for me.
Nice suggestions on the retry, and time. Thanks for sharing.
Today I couldn't have my algo running just after market open as it was disconnected from Robinhood overnight. It was too late by the time I realized what happened.
If someone had their algo running today, did you face the cancelled order issue again?
I encountered the random disconnect too, sooo bad. My orders cancelled this morning. I subscribe to $10 gold plan since it has extended hours, and see what happens.
@ Quoc Le
Out of luck if trying to use the after hours Gold feature. Quantopian only supports (currently) market hour trading. The only place trades are allowed in algorithms is either in a scheduled function or in 'handle_data'. Both only execute during market hours.
Canceled orders that are part of the Ticker Pilot Program are also making me wish i could identify the rejection comment comment in my code and then apply a 5 cent limit order if that was the grounds for rejection. I might just re-order the second time ( third order attempt) and apply a 5 cent bound.