by nodesocket · 7y ago · 0 comments
Not sure where to go from here honestly. Should the code evaluate the data in real-time for each trade, or wait to the end/start of the trading day and do some evaluations then make a decision?
Obviously, I am not going to be able to compete with the big boys using really sophisticated code (written in a low level language like C), executing in colocation right next to the exchanges, running Apache Hadoop and Spark. Still, I am interested in just tinkering with simple algorithms with the data.
There's a lot I can talk about but here are some points:
- Most of the time you don't trade instruments in isolation. They are all correlated (even if inversely) one way or another , so movements in one will affect others. Having a myopic view of just one instrument will have too much unexplainable randomness.
- The other way to scale is having more data inform your pricing - i.e. don't just look at the prices of one or more instruments. Look at twitter, look at weather reports, news etc. It kind of suggested that in the article. The meaningful movements in the market are most of the time due to truths outside of the price itself.
- You have to decide whether you want to trade directionally and long term (like a hedge fund) and take on positions over time, or trade in and out of positions quickly (like high frequency trading firms) to minimize risk. You can be anywhere along that spectrum. The faster you are, the more myopic you can be and just react to current trading activity of other participants. The more long-term you are, the more you have to look at the big picture, more data, more instruments, making sure you have the right balance in your portfolio (whatever that means to you).
I'd be happy to expand more :)
Recently, when the market got way overdone and oversold, I'd even call some of it panic selling with the bottoming happening Christmas Eve. I am curious how I can be more analytical, and data driven to make decisions during these events, rather than just gut feeling of panicking, negative news, and oversold conditions. Well I did add to my Apple position in this late December, I should have pulled the trigger more. I was somewhat conservative, missing the huge runup last month in January of most all stocks.
I think you're on the right track regarding value investment, if you're thinking about it long-term, and it's for personal investments. Passive index funds like SPY are the best bet for most people. Finding companies or following trends you in particular have some insight on can also help. Things like "having worked in industry X, and having read their whitepapers, this new company is clearly overbought and is all marketing hype".
If you want to get more analytical, look at portfolio theory, different hedging strategies, and try and find "alpha" - roughly meaning the extra factors explaining the price of an instrument that gives you an edge over others. Check out Quantopian - they have some nice articles too. The key is coming up with a model that accurately captures the risk of your assets which would allow you to properly allocate your money amongst them.
I'd say starting a "pure" HFT firm is incredibly hard nowadays. There's a big upfront investment and huge operating costs, and there's a lot of consolidation happening in the industry.
In general, most hardware and software is tailored to high-throughput, and a huge part of the effort of HFT is fighting all that to prioritize latency. If you want to compete with the very best firms, that means renting rackspace in a colocation with the exchanges, overclocked CPUs, expensive network cards, FPGAs, paying out the nose for the most accurate market-data feeds, and many order-entry connections. Then you have to tweak the BIOS, kernel settings, isolate your processes on cores, write your own userspace networking stack etc. etc. etc. On top of that if you want to trade between different colocations, you might need a network of microwave towers because fiber is too slow (light travels about 2/3 slower in fiber because it effectively "bounces" along the fiber). At the end of the day though, if your algorithm or strategy doesn't work, you won't make any money - speed is only a part of it. At the previous firm, we had a market making desk that was very profitable, but was quite "slow" by HFT standards (triple digit microseconds vs sub-microsecond response times). You still need to be smart about it.
Having said all that, I think HFT gets a bad rap, about being a waste of resources/talent, and somehow "stealing" from the common man. The truth is, they are only "stealing" from each other - they compete to remove the tiniest inefficiencies in pricing. They ensure the cost of trading is actually as low as it can possibly be. By themselves they don't have enough capital to move the market in any meaningful way. In fact, most flash crashes occur when HFT firms step out of the way! They move out of the way of huge market movements because they can't cushion the blow without taking an unnecessary risk as a business. It's like asking your plumber to fix your sink while your house is on fire. Market orders, stop orders and panic are most of the problem when it comes to flash crashes. PSA: Please use limit orders :)
I might ruffle some feathers with the comments, but I think overall HFTs aren't the bogeyman most people think them to be. Sure there are some bad apples, but that's true of any industry, and it comes down to the people - not the system itself.
Are you saying, it was guaranteed to make money? I.E. the algorithm never failed, or never made losing trades? That seems insane, to always be able to make money even if it's fractions of a percent.
If you start expanding beyond a small set of specific companies, don't forget to find data for delisted companies to avoid survivorship bias.
E(log(wealth)) - c * std(log(wealth))
or
E(wealth) - c * std(wealth)
The first one is better for building up wealth over a long time, but when I looked at Modern Portfolio Theory, it is suggesting to use the second formula.
I'm also planning to spend about 5% of my wealth every year, and the second number gives me lower risk in the short time frame, so I think something in the middle would be a better criterion.
I try not to worry about stdev and focus on the soundness of my process, but in practice I have money split into higher-risk where I try to be clever, and low-risk failsafe investments to raise the floor of the worst case scenario.
Try this strategy and see if you can automate it. It's called the wheel strategy. What you want to do is setup a $200K account, and sell puts with certain deltas, and then if assigned, sell calls with certain deltas, until you get called. This will get you a relative return of up to 20% per year if done well. You can use your skills to figure out the best delta position to trade, you can look for high volatility to take advantage of. Once you get this completed, you can look for other trends. I always recommend starting with this because it's the easiest way to make some money in the market. It's a lot of work to do it manually, but automated, it would let you earn income while you are not doing much.
You will also want to read and understand what calls and puts are, and what selling/buy calls/puts entails. Probably want to do this with stocks like Disney, GE, and so forth, something with large market caps, small movements, and something you are willing to hold long term and which will not go bankrupt/drop significantly in the near future, disclaimer: I do not like GE at all, however, you also want to try this with 1 contract to start, because 1 contract is 100 shares. You can probably work with a smaller starting capital. If you get this implemented and working, it can generate passive income for you in a sense, or you can blow an account.
Edit: You want to settle/close out around earnings because the volatility is insane at that time.
Generally speaking, if someone offers a simple strategy for getting well-above-market returns, they're either lying or failing to mention that this strategy occasionally bankrupts you. I think this is the latter.
I don't utilize it because my strategy is much better.
The risk with the wheel is getting assigned stock which you hold forever, but you sell calls against it and over time it ends up being profitable.
This is a fairly easy strategy to automate and you can use a small account to do so.
> You’ve already got robo-advisors, which use algorithms to manage assets for retail investors. We’re also probably only a few years away from you being able to log into a brokerage account and run a sophisticated institutional-grade algorithm yourself.
> People tend to assume that the diffusion of these technologies is a good thing. I’m more ambivalent. I think it could be a big mistake to have the population at large play around with algorithms. Some people who are very good at it might benefit from having access to this broadened toolset. But most people will just end up paying too much or make bad decisions because they’re being given access to a technology that they aren’t equipped to do anything useful with. They can lose money with it, however.
Hobby away, friend, but when you start betting money you can't afford to lose, probably worth just turning that hobby into a resume sent to those folks running hadoop with the shortest fiber lines into the exchanges.
Those folks with fiber lines into the exchanges are definitely not running hadoop.
Created it after not being able to do livetrading on Quantopian.
Here's the associated python library and documentation: https://docs.kloudtrader.com/ https://github.com/KloudTrader/libkloudtrader