Sunday, December 27, 2015

Infrastructure


Hello, welcome back to my blog about the automated trading. Last week I have stated that this blog will be about how to build up your own automated trading system. Today's post will be about infrastructure. First I will look at what is possible to get for free and then compare it to the what big institutions have. This will result into a conclusion about my system.

Free environment

I have started the whole work with nothing in my pocket. No single penny spent on hardware or software. Thanks to the modern cloud services this is possible. For me the system has layout as image below. And if anyone tries to make the same, then there is a good chance it will end up in the same way.

Simply there is a Trading System on the left side. This is the part I am creating and having full control over it. Trading system is connected to the broker. There are few brokers which expose API for connection (see below) and choice is up to everyone. And finally broker is connected to one or more exchanges where the actual trades get executed. Exchanges are selected by broker.

Technology choice

I personally made the following choices.
  • Trading System - running on OpenShift platform using Tomcat 7 with PostgreSQL cartrige. I have very good experience and there is a free tier for anyone to develop up to 3 applications.
  • Broker - I have made fully working connection with MbTrading (will publish later), but unfortunately can't open real trading account there. My residency is in Japan and regulations prevents me to do that. But if you are from Europe or US, then I can recommend them, because they were so handful. Actually they were the only broker who opened me API for free at the beginning (in demo account) so I could code everything without spending any single penny. Other brokers requested to open real account first usually with at least 10000 USD. Now working out on the different way to get into it.

Institutional environment

Now let's look to the institutions. Ideally (not all) they have more simple layout. Like the image below.
Idea behing is like this. Get rid of the middle man and be close to the exchange as much as you can. This will give you an advantage. So let's see why.

Many friends asked me about high frequency trading. Meaning was always the same, open position and close it within a fractions of seconds, like in the movies. As Barry Johnson stated in his book Algorithmic Trading & DMA the result of shortening the time frame is decreasing the risk. On the other hand it increases the cost (commissions, market impact). Trick here is that costs can be better predicted (although it is still not easy) and this is the advantage. Now question - can I do this? Answer is no - there is no chance for me to win this game. Even if I outsmart all the clever people working there and get enough capital to operate with (both I doubt), my system will be still slow just by nature. In my case any message needs to go thousands kilometers and thrgouh many routers and switches. So I can easily count that roundtrip takes a second. Compare this to the super powerfull machines sitting next to the exchange with clever dedicated people around. They are searching for every little improvement in the system to speed it up or make it better. So no way. Then let me state what I am focusing on.
My trading system will consider only strategies where smallest time frame which maters is one minute.
I know this doesn't sounds sexy. Fortunately even with this limitation, there are a numerous great oportunities. And this is what I am searching for!

That's it for today. Next week I will show the actions which are performed through the day and night. Thank you for reading!

Monday, December 21, 2015

Introduction

This blog is all about the automated trading ...

For past 2 years (since 2014) I have been creating system which can trade stocks for me. Let's call it simply "Trading System". It has been an excellent challenge, partially because of my life situation. I have 2 beautiful kids to take care so not much free money I can put in. I have full time job, lot of hobbies and many friends so not much spare time left. And finally I have zero education in finance or trading. But actually it turned out to be pretty good. Over the time I have learned how to maximize usage of the free or nearly free sources. I have learned how to manage my time and how to be super productive. I studied finance, risk management and trading. And I have done a lot more. All this is already helping me in my current work, where I am in the role of IT product developer and manger. Therefore I think now is a good time to show what I have and see the reactions. Perhaps someone will help me to make it even better.

What will be here

This blog is about building the system for automated trading. I decided to make one post per week, usually on Monday. Every post will be about one part of the whole process. This includes for example connection to the broker, real time quote processing, trading strategy development or back testing. All this will be presented from the point of system developer and there will be included code parts written in Java. Therefore I expect readers to know little bit about Java, Maven, Mercurial and trading itself. If you are missing some knowledge, then just learn it. There are plenty of tutorials on web. Finally as this blog progress I will step by step allow features on my system for everybody. Starting right now with my stock screener which compares closing prices of most recent X days to the pattern image. So please try it and give me a comment.

That's it for today. Next week I will focus on physical layout of the system. This will set up some of expectations about the system capability. Thank you for reading!