HNHacker News
TopNewBestAskShowJobs

_this

53 karma · joined March 8, 2013

submissionscomments
_this··on Show HN: Bateman, a stock trading system I'm working on
Writing a framework for running trading strategies is certainly an interesting idea. I too am dissatisfied with most commercial platforms due to lack of features and flexibility. Unfortunately, there seems to be a lack of open source code in this sector. Eclipse Trader looked kind of interesting but the project appears to be dormant now. So expanding on this project could fill that gap.

However, from experience developing and testing algorithmic trading systems I can tell you that your strategy probably has some issues in its current form. I haven't looked into the code but from your description it appears you (correct me if I'm wrong): 1.) Pick a stock 2.) Use PSO to figure out the parameters 3.) If profitable, run the strategy on the stock with the optimised parameters

This means you're making a well known error in the system development community which is curve fitting parameters to historical data. This'll look very good in the simulations, but there is a high probablity that it will break down when trading it forward with real money, because it is optimised for the past. This is why there are a couple of widely accepted best practices when it comes to developing and testing trading systems.

First of all, your system should not have or need too many parameters. As a rule of thumb a robust system shouldn't have more than a handful of parameters and it should ideally show profits in simulations without a great deal of optimisation on those. When optimising make sure that the optimised parameter values are robust. This means that changing the value by a small increment only changes the resulting performance of your system by a small margin (somewhat analagous to numerical stability). If the performance changes by a big margin, then those values aren't robust and should be discarded. Furthermore, don't run optimisation on all of your historical data. Instead, optimise on portion of that data (the 'in-sample' data) and then test the optimised parameter values on the more recent data your didn't optimise on (the 'out-of-sample' data) and see if the performance of your system stays the same or breaks down. Another popular approach is 'Walk forward optimisation' [1] which takes the above one step further by repeatedly optimising and forward-testing on your historical data to find robust parameter values.

Some other things to consider: You need to factor in transaction costs, spread and slippage (the difference between the price you enter the order at and the price at which you get the fill). Transaction costs are easy to determine. Spread and slippage only apply when using market orders and can be reduced by trading with limit order if your system isn't negatively affected by this. Trading with market orders in a fast-moving market may incur siginificant slippage and there are predatory HF algos out there making money from screwing you on your execution. To get a better sense of this, it is considered a best practice to run your simulations on a lower timeframe than the one your system is supposed to work on in order to eliminate inaccuracies in the results. Ideally, you run simulations against unfiltered tick-by-tick data and additionally used bid and ask data series to factor in the spread. This may, however, be overkill and not needed for a system that runs on a daily timeframe, but it may make all the difference for a faster system.

[1] http://en.wikipedia.org/wiki/Walk_forward_optimization

_this··on Germans and Jaywalking: An American's Perspective on the Berlin Tech Scene
Berlin may not be the best representation of Germany as a whole right now. It is somewhat of an anomaly and may be the least German city in Germany right now due to attracting a large number of foreigners (which I'm not saying is a bad thing). Anecdotal evidence: Last time I was walking through Kreuzberg on a Saturday night at least half of the people on the streets seemed to speak English. However, as a German I have to say that he has a point. People not jaywalking is a symptom of a certain mindset in Germany with regard to rules and respect for authority. Along with this comes a lack of individual initiative and risk-averse behaviour. Being self-employed or starting a company is not seen as something to strive for but to avoid due to its inherent risks. People will actually give you funny looks when you tell them that you don't have a 9-5 job and they may actually pity you. When I quit my job to go freelance, everyone always pointed out the risk of not being in steady employment but interestingly nobody pointed out the benefits. This is curious as our social security system is rather extensive (expecially compared to the US). Even if you fail and fall, you're not going to starve or end up homeless and it'll be a comparatively soft landing. In theory this should benefit risk taking, but it does not. In fact, studies show that numbers of companies being founded and people going freelance go up in times of economic distress (e.g. '07-'09) and go down in times of a booming economy. When asked, the people answered that the did it out of necessity and not out of genuine desire to be independent. So we can conclude that Germans do prefer a 9-5 over the risk of being on their own despite the social security net. My interpretation of this is that most German's perception appears to be biased towards seeing the risks and not the possibilities even when the risks are objectively much smaller than perceived. Coming back to jaywalking this may mean that saving a minute or so may in their perception not be worth the risk of being run over or stopped by the cops however unlikely that may be in reality.

I also think that this mindset is a bad thing and has larger ramifications in a world that appears to be changing at an ever increasing pace than most people realise yet. Germany as an economy is highly dependent on the ability to export innovative premium products due to the relatively high costs of labour. Mechanical and chemical engineering are two of the main contributing sectors when it comes to exports. The extent of this becomes obvious if you take a look at the 30 stocks in our DAX index most of which stem from these sectors. What is also obvious is the distinct lack of IT companies. There is SAP and then there's Infineon, that's it and those are neither new nor particularly innovative companies. SAP is a 40 year old enterprise software company. I've never used their products but everybody I know who has, hates it. They may be very well on the forefront of companies ripe for disruption in the coming years. Infineon is a chipmaker that was spun off by Siemens (yes, THAT 165 year old Siemens). They have been struggling for years and had to spin off some of their departments which subsequently filed for bankruptcy to save themselves. There is really no company in Germany that would compare to the likes of Apple, Google or Microsoft in size or innovative potential and this looks like a major deficit in our economic structure to me. What I find notable is that nobody in Germany seems to be noticiing or even talking about this. Given that in the future IT will probably become even more important, this may very well come back to bite us.