Ask HN: How to launch an algo trading side project?
I've been writing my own implementations and using 20 year historical stock data. Have been test trading to see how my logic is working.
However, I have an issue. When I think I am ready to use real money how do I do this? Do I need to get ETrade or Robinhood to actually start automated trading?
91 comments
[ 2.6 ms ] story [ 187 ms ] threadApologies if you already considered this, but make sure you consider execution costs. Depending on your type of strategy and selection of stocks, it may be a major determinant of the success or failure of the strategy.
TBH I've never used them, I just remember looking at a platform that was much more tech agnostic, I'm not sure if this was what I looked at, but looked potentially useful.
2. Once (if..) you've made some profit, take out your initial investment and now you're gambling with free money.
I never understood this sentiment, and I'm surprised to see it so often on Hacker News. It's irrelevant whether the money came from profits or initial investment - money is money? There is no need to distinguish the both, it's purely psychological.
[0] https://en.wikipedia.org/wiki/Loss_aversion
[1] I'm all for risk, but Vegas has better odds.
There is zero reasons to lose money or carry on running a losing strategy. If you are trading professionally and quantitatively, you are runnings lots of positions. Unless you have a technical issue, you should not worry about losses on one or a few positions since you only care about what your average is doing.
That assuming your models work but you should not start trading with real money before you are certain of that.
HFT is like picking up pennies in front of a steamroller.
here's to hoping I can stay one step ahead, lol. It's risky.
That said, I do think ultimately you'd want to find something with a fast api for yourself lately.
Oh, and for entertainment purposes read /r/wallstreetbets
In fact all podcasts of this guy are like than, a lot of charlatans and scammers are appearing on the podcast all the time, probably 99% of the guests...
I would never copy anything they say or buy anything they offer.
2. a) Realize how CRAZILY far many HFT firms have gone to inch out literally every single microsecond and achieve economies of scale with billions in assets
2. b) individual user-scale tools like ETrade won't get your trades in fast enough/any cost per transaction fees will erase any gains
3. Invest said capital in something like Betterment
If your model has been truly beating the market for a sustainable amount of time, I apologize for my comment and go all out :)
Edit: granted not FY ahead.
You can make money with simple trend following algos that execute perhaps only a few times a week.
To the OP, if you aren't sure about market execution, it makes me think you haven't modeled for slippage. Make sure you do, as that nudges many profitable algos into the red.
For an example, a value based investment strategy can be implemented as an algorithm.
Remember hindsight bias, and as others have said, don't invest more than you can lose.
Their live market data is gated at 250 ms, so definitely not for HFT. Market data subscriptions are only $5 / month (US Equities, and others I don't remember), and commissions are low.
You can program in C#, Java, VB, C++, or Python. I use their C++ platform. It is not particularly pretty, but it seems well-tested and works. Perhaps most importantly, they have an awesome support phone number. They are responsive and very helpful.
What instruments are you trading?
What frequency?
What size?
Why does it need to be automated?
Apologies for the burst of questions. Am interested in testing out some ideas too
Thanks for mentioning Alpha Vantage. I will check them out.
I was thinking of using their data to help test and run a system I am working on. I was excited to see that their stuff is free for what I need, as long as I wait until after a specified time to grab it (9 PM EST). I started looking at the data and noticed that it doesn't track corporate actions well at all. This becomes very problematic when you need to track your day over day returns for a security. There were also unexplained gaps and spikes in historical data. For index data, the lists seemed inconsistent in that things would seemingly drop out and then back in from day to the next leaving you with having to manually acquire the value of certain indices manually or having to process a historical file for that index to fill the gap. Historical files are not adjusted properly for actions like splits and ticker changes. Basically it boils down to there being a very, very limited use case for a provider like EODdata. Also, it should be noted that while I was never a paying subscriber, their subscribers have said there is virtually no customer service. I thought that might be the case looking at the website. It seems like EODdata was basically put on autopilot a long time ago and just left to run with no one at the helm. From a security standpoint, I recall them not using HTTPS (that should give you an idea of how long they haven't updated their site or security) and I clearly remember them storing passwords as plain text because I did a "forgot password" and it emailed it to me. In fact, I just did it again now to make sure I wasn't crazy, and sure enough, they haven't fixed anything. Still no HTTPS (even when manually typing in the HTTPS:// prefix) and it just emailed me my password (which was set to a bullshit password that I would never remember after discovering this gaping, unforgivable security travesty). I also remember having issues with some of the downloads not working correctly.
All in all, I'm damn near certain someone has this site on full autopilot and never fixes, updates, or even maintains anything. The plain text password nonsense should be enough right there to disqualify its usage, even if you are only using the free service(s) and never provide your payment details, and even if you use a unique password. If you were actually thinking of providing payment details, it's a clear and total no-go.
There are additional reviews from other people at these links: https://quant.stackexchange.com/questions/3284/is-eoddata-a-... http://www.trade2win.com/reviews/data_feeds/82-eod-data#revi...
They mention a lot of what I have talked about and more.
Don’t take this the wrong way, but it seems like you haven’t done a lot of research into this: Interactive Brokers is one of the first things that comes up when you search on Google (etrade, Robin Hood or any other retail trading just isn’t credible).
Finally, is your 20 years of historical data for just open/close? Is that your execution plan? (Otherwise you can get really tripped up as you move to intraday trading)
I have been using 1 minute bar data.
Have you looked at Lightspeed Trading?
https://www.interactivebrokers.com/en/index.php?f=5041
I strongly urge you to paper-trade the live market before risking real money. https://www.interactivebrokers.com/en/software/am/am/managea...
Go with whatever broker offers a trading API obviously, and has a fee structure that matches your trading strategy. If you can afford to lose a bit on the trade through commissions and your strategy is swing trading then you can pick pretty much any broker. If you need specific fill times and commission percentages before your strategy pays off then you are stuck with Interactive Brokers ($10k minimum[1], low comms, fast exec) or Robinhood (low minimum, free comms, slow exec). And technically Robinhood doesn't have a public API[2] so you would have to do a little reversing of their app's messaging. And then there's terms of service... yeah. Probably not a big deal for a small fry like yourself.
Next would be testing. You've got isolated tests with historic data but try get a broker that has a paper money version. TDAmeritrade's paper & api is good (but they are expensive). To be clear you would be using your algo to trade in a paper money account. That lets you get more realistic trade tests and if you blow something up you are still ok!
Keep in mind Robinhood is free because they are paid to route your orders to hedge funds and they are re-ordered in the book. You will get ok price execution through them but never the best. One thing you should include in your backtests/simulations is order execution delay and fill price variance. If you place market orders they won't always fill at the quote price. If you place limit orders they may take a while to fill (or not at all) unless the price is within the other side's order prices.
Last is the pattern day trading rule. Make sure you have a strategy that won't make more than 3 day trades in a 5 day window, otherwise your account might get suspended for a few months. It's a pile of horses but you can get around that by simply having more money in your account. > $25k will buy you unlimited day trading privileges.
Just curious what your strategy is based on if you don't mind giving a few details.
Good luck!
[1]https://www.interactivebrokers.com/en/index.php?f=4969 [2]https://support.robinhood.com/hc/en-us/articles/210216823-Ro...
Also, the fact that you're asking this question tells me this is very very unlikely to be a good idea. Be careful.
What is your average yearly return on the 20 years back testing?
I was hoping you would chime in on this thread. I was not so comfortable with the work I was doing and felt like my direction was wrong and I was questioning why I was even going to try this. Your advice helped me decide to continue.
Before you start with the execution, make sure you did use the 20 years of data, go and back test all the years, they encompass few market cycles, so you will know how your strategy will perform in bull and bear markets.
For the execution part, when I started, I had an ssh session open to my server with the output of my bot running on the screen and had it configured to chime with something like” EXECUTE buy 2000 HYZ at $65 stop 56. I did it manually for a few weeks until I made sure everything worked properly and then did the order execution with the API. Interactive Brothers are a good choice with a good API.
I would stay away from Quantopian and other platforms that are holding your code, because this is the prefect target for a hacker and the perfect crime – nothing to steal or sell, they will just copy your winning strategy…
If it's short one like say in minutes, then you might want to test it with small amount of real money before going all in. The reason is orders fills are imperfect. So, cost price you had during backtests vs realtime might differ a lot.
Here are a few words of advice regarding IB:
- Thoroughly read and understand the IB documentation. - Be sure that you never get close to any of IB’s risk limits that can result in the automatic liquidation of some, or all, of your positions. - If you don’t want to put up enough cash in your IB account for day trading, be sure you don’t exceed the trading limits that will get you classified as a day trader and thus prevent you from further trading until you add more cash. - Be aware that the IB market data can have significant inaccuracies and/or delays.
Here are a few words of advice on automated trading:
- Thoroughly understand the exchanges that handle the instruments you want to trade. Each exchange has online documentation explaining details of traded instruments, matching algorithms, pricing, and market data. Even though you won’t be accessing the exchanges directly, these details have an effect. - Thoroughly understand IB’s order routing and how they construct their market data (if you use it). - Just because your historical data says an instrument closed at a particular price, that does not mean you could have actually bought or sold at that price with IB or even with direct market access. The same is true of tick data constructed at 1 minute, 1 second, or even millisecond resolution. Trading simulations can be terribly inaccurate if you don’t have a reasonable approximation of the exchange order books, the exchange latencies, IB’s latencies, and your own trading system latency. To counter this, you need to be extremely conservative in your assumptions about getting an order filled at a particular price. - Even with accurate market data and exact latency measurements, predicting future profits by backtesting over historical data is perilous. I advise having a strong background in the statistical/machine learning methods for constructing and analyzing appropriate training, testing, and validation sets. - Don’t make a trade just because some analysis suggests the market will go in that direction. Doing this will probably get you hurt and it harms markets by pushing them to overshoot or undershoot the correct prices. The trend is your friend until he turns around and stabs you in the back. Make a trade because that’s where the market should go and probably will go eventually.
My best advice for trading profitably is to do something to improve a market. Focus on areas that can benefit from your strongest personal advantages (mathematical, technical, domain knowledge, etc.). Gain an understanding of the exchanges and instruments that allows you to recognize ways to make prices more accurate. This improvement could be in an absolute sense for individual prices or it could be in a relative sense in terms of how instruments should be priced with respect to one another. It could also be in terms of adding liquidity (offering to buy or sell) where needed and justified. Improving markets improves our economy by helping it to better prioritize resources and limit risks. That is a valuable service and the market will pay you for it.