34 points · by nikhilsaraf9 · 11y ago · 72 comments
There is a learning curve in which I'm developing the initial algorithms that will help gain an advantage over simplistic human investing with the computer providing a more deterministic risk-reward management system that it will apply. Once this has been achieved, the goal would be to increase the ROI and maximize the final take-home profit (minimize tax where possible to increase effective ROI). I'm validating algorithms with a back testing approach, currently obtaining data from Quandl.
I'm planning to host this on AWS and use a combination of Python and R. I haven't decided on the datastore yet, but I'm open to suggestions.
Does HN have any suggestions or any tips from someone who has attempted to do something like this in the past, if so, please also briefly describe your past experience and current position with the project?
Thanks!
The "simplistic human investing" you're talking about probably accounts for 0.01% of trades. The vast majority of trading these days is algorithmic, and the HFT guys will eat you for lunch.
What you won't see in back testing is how the market reacts to your strategy. The market isn't something that stays static: your activity changes things in subtle ways, and I guarantee there are people smarter than you who have designed algorithms to detect and exploit trading strategies such as yours.
Algo trading is very dangerous if you're not coming from an investment finance background. Just be very careful.
Even if it sounds cruel. With enough time and hard work, you can train yourself to detect the pigs getting slaughtered by the professional traders and take a bite of the action. That's what swing trading is all about.
That being said, it's far from easy. It requires a lot of hard work and determination. Reading books is a good start. The book "Trading Your Way to Financial Freedom" by Dr. Van K. Tharp is required for any modern day trader. The most important lesson from the book is probably that you have to always go into a trade knowing how much you are willing to loose on that trade. Using a stop and respecting it should be deeply engraved into your DNA.
But reading books is not enough. Getting a proper trading education is important. The average trading course will cost you anywhere from $2,000 to $5,000. With so many get-rich-quick schemes on the Internet is hard to find a serious an respected trading education program. They are out there. A good place to start would be Trader Planet. They have a list of the Top Trading Schools.
Why pay so much for a trading course? Because in the long term it will save you time and money. In the book "How I made $2,000,000 in the Stock Market" by Nicolas Darvas. The author spent many years of failure paying tuition to the markets until he found his way. Many people read this book and get fascinated by the big number. The fascinating part about the book is that in the 1940s and 1950s this guy created his own form of pseudo technical analysis. That system is what made him the $2,000,000. He spent a lot of time an money developing the system and eventually worked out for him. Keep in mind that Moving Averages started to get used in trading in the 1960s (If I'm not mistaken).
The moral of the story is that spending $2,000 or $3,000 in advance for a proper trading education will save you a lot of time and money.
People with little or no trading experience should not be developing mechanical systems and use them to risk real money. Wanna do it for educational purposes, sure go ahead, but don't risk any money. That shouldn't stop you from diving into the markets though. Once the market bug bites you there's no turning back. You just have to do it the old fashion way. In my case, by reading charts. As a software developer I think technical analysis is the only way to study the markets because that's how my brain is wired.
Professional traders (hedge funds, etc) can get away with risky strategies because they're balancing risk. For every insanely risky, 30x leveraged trade they make, they also hold metric fuck tons of US treasuries. You also never invest in one hedge fund; you invest in 30 or 40 hedge funds because most will lose money. The guys running the funds make their money off of fees because the return of the funds is usually based on economic factors more than 'alpha'.
Trading has changed a lot since the 40s and 50s. Modern finance wasn't really invented until the 80s as the relationship between debt and equity became much more fluid. If you really want a proper investment education, I would suggest a real education in the form of a computational finance degree as offered by many of the top quant business schools (CMU, MIT, etc.) There you can learn about the leveraged trading strategies that HFTs and algo traders use, why they work, and how to exploit them.
The big traders have a word for individuals who try to beat the market: suckers. There is no arbitrage, and even when there is, someone else will beat you to it because your access to the market is inferior to theirs. It's fundamentally unfair, but it's what happens when you have a revolving door between the federal reserve, the SEC and the top investment banks. You're playing a game with asymmetric information from the losing position against very skilled players. If you beat them, it's dumb luck. You're not going to be able to do it consistently.
The guys hosting seminars on investment strategy have found a way to consistently make money: by hosting seminars on investment strategy and charging $3000 to $5000 to attendees. If they had a truly ironclad way to make money consistently in the market, they wouldn't need the money from the seminars because they would be pulling in tens/hundreds of millions a year running a hedge fund or prop trading group.
Your big problem is that the future market doesn't look like the past market. There is a statistical error inherent in excessively curve fitting past data. You could develop a system which says you'll return 25% per year and then lose 100% in he he first six months. So don't fall into that trap of excessively back testing.
What you should be spending time is your money allocation algorithms - the very same set of trades can return high amounts or wipe you out depending on what % of your trading equity you allocate. This is something you can test - by simulating actual trading returns - both upside and downside.
I'm not sure if you're looking for trading advice or development advice, but I woudo recommend these books while you are doing system development:
- http://www.amazon.com/Trade-Your-Way-Financial-Freedom/dp/00... - trade your way to financial freedom by Van Tharp
- the entire 'market wizards' series (http://www.amazon.com/Market-Wizards-Jack-D-Schwager/dp/0887...) - there are three (or four?) books in the series, all are worth reading.
The final problem is designing a system which you truly understand, which you are sure gives you an edge. And which you are willing to stick with if there are periods of high drawdowns.
Also remember you are up against people with very deep pockets and huge computers and phd guys working on there same thing.
It's a great intellectual puzzle and a worthy challenge, but make sure you know what you are getting into.
Like the parent commenter, I was also on the same path and stopped. Despite diving into the topic for over a year, I came to the sobering realization that I had insufficient starting capital to properly manage risk.
Standard commission fees will eat you for breakfast trying to exercise a 1% (position) risk model on an insufficient amount of capital. Things like Robinhood[0] unfortunately didn't exist back then.
As far as books, Trade Your Way To Financial Freedom cannot be praised enough. Though I usually refrain from mentioning it because the title has this get-rich-quick vibe, it's nothing of the sort. Van Tharp was (and for all I know, still may be) the world's premier trading psychologist. The book drives home the concept of risk management in automated trading systems like no other, especially remarkable considering when it was written.
The Market Wizards books, at least the first two, are pretty much required reading.
The only book I might add to the list would be Reminiscences of a Stock Operator[1]. While admittedly I didn't find it as useful as the other books, it's still a good read and widely considered to be the seminal book on trading.
[0] https://www.robinhood.com/
[1] http://www.amazon.com/Reminiscences-Stock-Operator-Edwin-Lef...
At the end of the day, I'm trying to answer the question: can you make money in the stock market with a low-touch (eventually no-touch) approach with the help of advanced software and analytics. Hopefully the answer is yes ;-)
The answer to this has been a resounding "hell yes" for decades across IB/HFT/AlgoTrading shops. The only thing this exercise achieves is whether "you" personally can make money with a low-touch approach using software.
This type of approach is far better than trying to build your own, unless, 'your own' has an edge you have come up with. I stopped when I realised I had no edge, no unique method or insight.
I still believe you could still develop a neat system that deprioritised the entry signal - and focussed just on letting winners run and cutting losses. That requires a very low cost transaction model however.
A bit longer: You're a pig headed for the slaughterhouse. Please do it 'for play money' only for the first 5 years or so, if your method makes money over that period then set yourself a goal and if you reach it stop.
I once attended a predator-prey algorithm seminar on stock trading at the International Conference on Machine Learning. I came away realizing that a ton of people are in this area, and not just the big banks. If you're doing this, go in realizing that you're trying to ride a bike for the first time without training wheels in a race against experienced motorcyclists.
These will be very good for you:
https://news.ycombinator.com/item?id=8994701
https://news.ycombinator.com/item?id=4360742
edit: spelling
Of course, with the amount of money the OP is likely to be investing, it's completely sensible to ignore market impact.
http://www.amazon.com/gp/aw/d/0465054811/ref=mp_s_a_1_sc_1?q...
Good luck though! It sounds interesting!
Had I stuck with the flawed strategy, I'd have made (a small amount of) money.
Dont think that you dont need to manage your psychology simply because you are running an algorithm.
You still have to monitor and read the news , because in our case event if event drivent some things can happen that will negate your result.
Exemple : Elon musk talk too much before a financial report, or feud beetween china governement and Ali Baba.
We still have to monitor the news for this kind of probleme. Even if you automize everything you can't prevent this kind of things. And if you do event driven , you will have to think about this.
Regards
You can go down that road, but this a whole full time career and it usually takes years to be good enough at it.
I could recommend this book (http://www.amazon.com/Building-Algorithmic-Trading-Systems-W...) to get an understanding for the craft.
The most algorithms is just chart reading, playing around with periods, standard deviations etc. You can achieve something really quickly, but it only works if the market jumps up and down within a short time period and stays on the same level if watching a bigger time frame. What if the market drops by 90% suddenly because some bank decided to do something stupid?
The next time I won't work on HFT, but more of risk reduction and long-term investments: - Markowitz diversification model - Multi-Market trading, trade on market differences
Another interesting approach would be to exploit trading algorithms, since 99.9% of all trades are algo trades.
What you theoretically could do is use popular trading algorithms, develop a tool to monitor their decisions, adjust decisions weights and see how a simulated market performs on comparion to the real market. Now that you have something like a "slave" market and can go on to the next step and calculate scenarios e.g. 5min ahead and can 99.9% predict where the market will be in 5min.
What most algorithmic trading models that are looking to prey on other algos do is either wait until their model says the market is already in some bad decision state or move the market in some way to make the bad decision state more likely.
https://news.ycombinator.com/item?id=6832589
The tl;dr version of it is:
Risk management, specifically position sizing, is commonly neglected and yet extremely important.
Psychology is everything, regardless of whatever your approach may be.
Start with a few questions. How often are you targeting trades? Do you anticipate trading thousands of times per day, a few times per day, a few times per week, a few times per month or a few times per year? Know that there are sophisticated algorithmic trading systems in all of those spaces.
Once you know how often you will be trading, you can make more appropriate decisions about execution platforms. What kind of data feeds do you want to use? How will you get the data into your systems, how will you get the outputs out of your system. How will you translate those outputs into orders? Who will take your orders? As an aside, most brokerages will want to know if a computer is making all the trades and will either outright ban fully automated trading or will want a kill switch (see the TSA for your broker of choice).
This leads us to the actual hardest part about automatic trading, operational risk. What are you going to do to prevent your system from making out trades? What is your shut down procedure? How is it triggered? How will you monitor the system? Know that managing automation risk is the last mile of human intervention in the system, and that lots of people have lost a lot of money by not intervening soon enough, or intervening too soon.
You also need to have a target benchmark to compare to. What are you going to benchmark against? How often are you going to evaluate against that benchmark? How long will you allow your system to underperform the benchmark? There are long game algorithmic trading systems that have built into their capital allocation models >10 year underperformance against benchmarks for instance.
Finally, ask yourself, what inefficiency are you taking advantage of, that will allow you to profit from trading? What is it that you bring to the table that isn't already there? Once you honestly assess that, ask why wouldn't that same efficiency be more valuable in some other field that is less crowded because automatic stock trading is a very low percentage game right now.
Now I just throw darts ... unless you can get some insider knowledge like the big boys, you'll never be the early mover.
Based on some of the comments it seems such a system will be the underdog and will be the prey for the large HFT shops. And that's one of the risks of such an experiment. Once I put in real money into this (not too much, but just enough to not be consumed by the fee) there will be a hard point after which I'm ready to throw in the towel. I think of this more like an investment management software that has more knowledge than myself (various trading techniques, tax laws, etc.).
Just look at the number of billionaires who have decades long 20,30,50% average returns - not possible by chance.
The efficient market hypothesis believers say that these people were lucky.
People who say that don't understand probability.
The probability of winning big one year is probably not that rare - lotto win sort of numbers, and given the number of players and the number of iterations - easily explained away.
However, the existence of scores of individuals who have been able to profit for long periods of time completely destroys the efficient market hypothesis, because the hypothesis says they can't exist.
Take one single example ; Richard Dennis. He started off with $1500 and ran it up into hundreds of millions. He then taught a group of people who had zero trading experience his system and then they went off and made hundreds of millions (some are still going).
http://en.wikipedia.org/wiki/Richard_Dennis
That is completely non-random outcomes. The efficient market hypothesis is something that academics wet themselves over while other people laugh at their theories and make millions.
Essentially, for 'systematically beating index performance on the market using publicly available data is not possible' to be true, then the scores of people who have done just that, over decades, cannot exist. And yet they exist.
If anything he is a perfect example of luck...
The fact that Richard Dennis chose to stop taking customer money after a bad loss in the 87 crash proves nothing.
The EMT/EMH states that because all the information is in the he public domain, returns above market over time are not possible. Anyone with the slightest interest in human nature understands that two different people with the same information can come to two entirely separate conclusions. Any glance at election results will tell you that.
Richard Dennis developed a system that produced outsized returns over a long period of time using public information. He then taught this system to others, who then used it to also make outsized returns using public information. Thus disproving the hypothesis.
The fact that he gave back a small portion of his total returns in a particular market event doesn't change the basic facts. Even if his strategy no longer works, the fact that it did work for a long period of time disproves the theory. He was able to use public information to decide to abandon the strategy when it no longer worked.
I'd recommend you read Quantitative Trading by EP Chan for a great overview of the basic methods and some example implementations.
Disclaimer: I've done exactly this successfully for >2yrs now.
No, of course not. Jump in feet first with all that you've got and to hell with common sense.
> It's completely possible to make a profit (with low risk) without resorting to HFT.
Yes it is. For a while at least.
> I'd recommend you read Quantitative Trading by EP Chan for a great overview of the basic methods and some example implementations.
Reading is always good, second that.
> Disclaimer: I've done exactly this successfully for >2yrs now.
I know gamblers that have been on winning streaks too. Unfortunately that's not how the story ends, especially not for novice gamblers.
It's nice you have found a way to consistently beat the market and I really hope that you're outperforming the lowly index funds but without more data 'successfully' is awfully un-specific.
I made some money in the stockmarket too, but I'm not going to dress is up as intelligence, I'd rather admit that it was dumb luck.
If you expect to compete with them on AWS save yourself the loss and just stop right there. However, if your strategy is more or less buy and hold for weeks / months then this doesn't sound entirely unreasonable. From my experience, simply getting into this industry as a serious player is roughly a 10-12 million investment, and that is starting very very small in only a few exchanges.
Only using python , ipython rethinkdb and postgresql.
We are working on a event driven fund to find pattern, but we still need human at the end (the program found pattern and we try to find why and if they are reproductible).
Good luck :)
You have annoucement, but don't forget the regular one.
We are still working on this (we are around 2% per month) but i'am open to share.
Visibly i'am not the only one to do this : http://www.reddit.com/r/stocks/comments/2v7fvk/anyone_make_l...
Mail me if you want to discuss or share
bussiere AT gmail.com
regards
Invest the minimum amount you can in this project to learn that it isn't a great idea.
I have been building also my own platform (with nodejs as for high IO), but you easily loose focus when you have to build it ALL by you're self..
(opensource) platforms like MT4 / MT5 give you more time to spend on actual alghorithmes, then on data structures etc
I'am thinking does anyone will be interested by a specialised forum or a subreddit to share our experience and tips ?
What makes you think there are any simplistic humans in the market for you to take advantage of?
They're the first to be taken advantage of
> I'm planning to host this on AWS and use a combination of Python and R.
Yeah, great idea. NOT. Unless you're doing something like tens of trades per day, or less.
The reason appears to be that there are lots of stock trading packages that people want to use (and to be fair, most brokers' interfaces suck somewhat. Also one interface for 2-3 brokers sounds appealing to me).
Here is an article about one such trading API:
http://www.quantstart.com/articles/Using-Python-IBPy-and-the...
Most API's also let you play with the "fake money" accounts of the brokers. But keep in mind that they usually cheat on transaction costs in those modes.
You may want to read a lot of the algorithms on Quantopian. To be frank, the only one that really makes sense to me is the "auto-rebalancing" approach. What this does it it keeps your investment at what you set it.
Say you invest 50% in automotive stocks and 50% in nasdaq stocks. Nasdaq goes up 10% -> it sells 5% of the profit and invests it into automotrive stocks. This is one of the few algorithms that seems to :
1) beat the market
2) actually spreads risk around (or it seems to me it does, depends on your investment spread I guess)