Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Market Making Algo

Is someone interested in collaborating on a market making algo? It would use the minutely data (highest frequency available on Quantopian), and then we can expand to longer windows as needed.

I am not saying that this algo would perform better than a simple buy-and-rebalance, but I am curious as to what might come out of it. I have ideas, but I can not implement them in code...as I am new to Python and I am a code tweaker at best, not a code developer or originator.

I suspect that Quantopian is looking for this sort of stuff, for their fund - low risk, low beta, high turnover, etc. As someone else pointed out, the only way to be a pro in the market making game is to have tick and order book data, but we do not, so this is the best we can do here, as enthusiastic amateurs. I said it in the past - making it too complex is costly (your time and my time spent) so we should keep it as simple as possible, run a few tests, and be done.

I started with the sample mean reversion algo, but I am unable to make it scan and trade each minute.

Regards,
BT

11 responses

handle_data is called every minute, so it can be used for minutely trading.

Grant, thank you, I will try to do what I can with it!

Regards!

I'd recommend posting your code, without the secret sauce. For a long time, I basically posted every crack-pot idea I could come up with. Little by little, you'll pick up the coding and you'll be better off in the end. --Grant

Grant, I understand, however....I don't have many ideas...For a long time I thought the markets are so inefficient that you can pretty much pick off the "dummies" out there and get rich. Not so much. However, I still think that human traders who trade in the middle of the spectrum (between forever and a millisceond) are taking unjustified risk, and many of them can't take the heat, so they make mistakes. The bottom line from my perspective is that most traders are better off with buy and hold, or buy and rebalance, but SOME (like the Quantopian users) can try to do better if they are the other side of the market when the human traders mentioned above make their mistakes. Still, this effort must not be costly in terms of time spent, and the risk must be justified in terms of higher return, lower vol, etc.

I am a proponent of keep it simple and stupid, hence I have been vocal about buy and rebalance. One of my contest algos is scalable to billions of dollars and has made 5% since I submitted it a month ago (adjusted for leverage), actually it's made about 10% with 2X leverage inside a month. This is basically where I am, philosophically, and I put my "money" where my mouth is for the contest.

But what I think Quantopian WANTS for the final algo offering is a market maker algo, a liquidity provider, much like the algo I described above, where you take the other side of dumb money. Now, the secret is what you think dumb money represents, and the secret sauce is how to take their money on a regular basis.

One thing to consider is how Quantopian works with respect to minutely trading. They get a feed from Nanex Nxcore, contruct the minute bars (I think, using their proprietary injestor code), and then feed the data to algos. If an order is generated by an algo, it is sent immediately (asynchronously) to IB, where it ends up getting filled/rejected/whatever. Then, on the next whole minute, your algo will find out what happened at IB, and get its next slug of data from the data feed. So, in theory, every whole minute, you should be able to do quickie trades, since "fresh" data comes in and you can "immediately" act on it. But I have never seen Quantopian provide specs. on the latency/timing jitter of this whole process. And they've made it clear that their platform is not suitable for the kind of thing you may be considering, for which tight, deterministic timing could be important. Just some food for thought, before you get to deep into it.

"So, in theory, every whole minute, you should be able to do quickie trades"

Grant, thanks for the note of caution. We all know that Quantopian algos will be picked clean by the HTFs. My goal is not to compete with them. Rather, I would like to see what will happen if you take the other side of "dumb money" at varying intervals, starging with one minute. Theoretically, the more you hold a position the more risk you assume so therefore it should follow that you should reap a greater return. But at some point, holding longer reduces risk, as you start embracing the Warren Buffett investment window - forever.

Any takers on this one?

The pseudo code is below, in parenthesis are the variations which I would like to try in backtests:

Select most traded 4000 stocks
Evaluate each minute price to the prior minute closing price (or each 5m, 15m, 30m, 1h, 4h, 1d, 5d, 10d, 20d, 30d, 60d, 90d, 180d, 360d)
Evaluate if SPY, TLT, or GLD are up (down) and if such conditions are met, then
If price >(<) prior price*x, then enter order with a x% profit taking and X% stop loss targets, AND/OR
enter a time stop to close out the position irrespective of price
Keep size to x% of total cash, keep leverage 1X (or 2 or 3)
If opening trade order is not completely filled, keep whatever is filled and move on to the next trade
Set a close_by variable to be able to close opened trades by end of day (or end of week, or end of month, or end of quarter, or end of year, to hold a specified number of days)

I know this is a tall order, but if some one is interested in partnering on this, it would be great. The secret sauce is what to do with all these variables, and I will gladly provide the finance theory on it, once we agree to work together etc.

I guess I will need to learn to code or pay someone to do this...

OK, how much would it cost for an expert coder to convert these requirements in Quantopian? Please post your price here publicly, or if you wish to collaborate, then send me a private message.

Best,
BT

BT, can you go into more of the background/theory behind the pseudo-code? I could build this for you or partner. I'm curious to learn though.

Feel free to PM me if you prefer.

Check out Upwork.com. I've found a few quantopian coders. I'm sure other freelance sites have them as well.

Just seen this. The code you are after is not hard. I think you just need to see something that you can tweak. I can help but would want to understand the "why", like Adam.