Back to Community
Robinhood and zipline-Live.io as Quantopian stops trading support

Hello,

I have developed a robust long only commission free trading algorithm using RH. This has been trading favourably for a few month with some bugs worked out.

With Quantopian moving away from supporting individual traders I noticed the zipline-live.io website supports IB and not RH.

I would very much like to continue learning and trading like this.

Super sad panda over here..

21 responses

I would like to continue algo-trading with RH too. I just started using Quantopian this year and have made thousands from my algo on here. Now it will end in a few weeks and I don't know what alternatives I have. Does anyone know any alternatives out there?

The problem is that Robinhood doesn't have an official API. Some have tried to cobble one together, but risk either being shut down by RH or guessing at fixes when RH changes things on their end. IB isn't a bad option, but you're still looking at around $30 a month in fees.

The official API is not released by RH yet. This is true... But my trades execute after 15 mins into market and before close. I have close to 100% success rate now...

The fact of the matter is the resources have already been allocated to developing the 90 percentile of the system... RH may change a few things. However the scope and change of that project is likely not as burdensome especially if features are halted.

This is very scary to see as a political observer. This is 100% a move by the company to please the exact people they set out to allow the common person to compete with.

Im reading up on the zipline system... they don't even have pipeline developed yet. So even i dedicated a computer and ported everything it seems like they are coming up short... September a not far long away.... WTF happened here. Im disgusted with this management. At least allow me more than 30 days to get a real internet connection... Im moving apartment to apartment for jobs and i can't run this on my cell phone internet. Super sad...

Same here. I've put a lot of time and energy on an long-term algorithm on Quantopian. Super sad for the move.

There is an unofficial doc for the RH private API: https://github.com/sanko/Robinhood. And also a Python framework built on top of that: https://github.com/Jamonek/Robinhood. But I haven't tested how reliable they are.

Thomas: You probably can try deploying your application on a AWS EC2. It's simply a VM in the cloud. And it's quite affordable.

Please pardon me for cross-posting this, but I just started another thread where I'm hoping to collect everybody's stories about how they have been using the live-trading platform. My hope is that a clear portrait of the community's needs will inspire somebody to create a solution, be that supporting Robinhood on one of these alternative platforms or whatever may be. I think this situation can be remedied. Here's the thread, please add your story:
https://www.quantopian.com/posts/questionnaire-for-quantopian-live-brokerage-traders

I’m in the process of creating a bridge between RH and Quantopian. Should be ready this weekend. Then I’ll be testing it.

If anyone knows JavaScript, I could use a hand.

@Zack Kirsh I can help

@Zach Kirsh I could try helping.

@Peichao Zhang , thoughts on scheduling the algorithm to run on only trading days? I am exploring the Robinhood python framework, though am running into trouble with scheduling the function so that it does not run into an exception and cut off.

I’m not a python developer

However, you should be able to check if the market is open some how? I know there’s a moment.js function which can tell if the market is open.

In other news. My bridge is running and now live trading with Robinhood. There’s been a few bugs but hopefully today it’s smooth sailing.

Can you share it?

@Andrew Hamlet, I don't know if there is a python package with trading days detection. But I think the trading holidays is a subset of the regular holidays. So maybe you can implement one yourself using a regular holiday library. Like below:

https://stackoverflow.com/a/36525605/855254

Another approach with guaranteed correctness is to write a web crawler to parse the NYSE holiday website (https://www.nyse.com/markets/hours-calendars).

Another kind of hacking approach, is to check if you could trade SPY through Robinhood at the start of the trading day. If not, you may assume it's a trading holiday.

The above are just some of my thoughts. I haven't got time to try any of them. So proceed in caution.

@Zack Kirsh, glad to hear your bridge is working! I'm writing one myself and one of the issue I get is how to properly test it. Looks like Robinhood doesn't have a paper trading account. I guess I have to test it with my own money. This doesn't sound like a great idea. How do you tackle this?

If anyone is willing to make there code public im sure we would all appreciate it.

Just google moment js stock trade. It’s on npm. I’ll try to find it again

Okay for trading, there’s a few things to watch out for.

First, RH limits their api heavily. When you query your orders or portfolio, you are givin info, but not the stocks name. So you have to also query the instrument url.

The calls rack up quick, I built a cache mechanism, when an order comes in, I create a hash of that object for the key, I use the instrument url as the key for instruments. So when I requested it, I’ll find it in cache.

Pretty much I have a cache first system. Everything hits the cache first which then calls the api. I hardly speak to RH unless I’m placing a order. Testing is important. What o did is log each function to make sure they all worked when I detected something in Q

The next thing I did was modify the order, day one, I only let it place quantity of 2, today I let it work with 10. If something goes wrong. It’s only got a little

Big thing is keeping track of the data. Especially around canceling orders and placing new ones.

Best way is to hash the incoming object, then hash the order response from RH, that way if you want to cancel something, take the existing Q order and change the value back to Open instead of canceled. Then use that hash to get the order ID you placed originally. Booya. You can not rely on RH to reliabily call again and again. Build a persistent layer to speak to before even connect

Well sure, but im most interested in the integration to quantopian, how exactly did you do that? I mean your not just building a module for zipline, but to the website.

Oh.

I used mutation observers on the tables.

You can also build a chrome plugin to redirect their scripts to ones your write if you wanted to control their trading application

For the passed month I worked on this python framework to mirror Quantopian, it's using https://github.com/Jamonek/Robinhood... I believe it solves a lot of the issues mentioned above.. checkout this framework... it's a simple lightweight framework, the project is looking for quants/developers willing to use, test and grow it. it's still in it's infancy but has potential.
FriarTuck

Great that you followed most function call of Q. It looks like it could be integrated in zipline-live. Zipline live is less lightweight off course but it would be good to merge it in there as the data providers are more flexible and pipeline is now also close to be released, expanding the algo types you can trade.

@Zack Kirsch: were you able to build that cached integration?

@Zach Kirsch so glad to see someone further along using a similar approach ( hooking into Q Live updates using mutation observers).. Have you tried it on PhantomJS? I did. Apparently I get blocked at login now . I hit the site a few hundred times testing over a couple days and suddenly I got stuck at login page. I hope it'll reset. they must be detecting headless browser somehow, and not mac or IP because I can still run my chrome extension version. With chrome however, I noticed today some javascript errors on their website (like missing library or something [sorry didn't log it, was at work]). Have you had to handle quantopian side exceptions at all?

Also are you having to page refresh, and can you run extensions while logged off or locked machine? These foreseeable issues where my initial reasons for trying to use phantomjs over chrome extension.