7 ms·
Building AI Trading Systems
- deleted 6y ago[deleted]
- The_rationalist 6y agowill you use state of the art time series forecasting? https://paperswithcode.com/sota/multivariate-time-series-forecasting-on-mimic https://paperswithcode.com/sota/multivariate-time-series-for... If so how well do GRU-ODE-bayes perform in practice?
- justicezyx 6y agoWhat's the real performance of the system so far?
- nv-vn 6y agoProbably not very good. Voleon does all ML-based trading and what I've seen of their returns does not give me any confidence in ML-based trading having alpha. I would estimate that at best in a good year returns would be like 5% y/y in the long term, much less than the sustained ~7% that index funds offer especially when adjusting for risk. Just speculation but there's a lot of firms with much more capital, better tools, and teams of extremely intelligent people who have pretty poor returns because of how good the competition already is.
- dennybritz 6y agoI think you're comparing apples to oranges here. These funds manage billions of dollars of client money, which forces them into highly liquid markets with scalable strategies. That's quite different from how individuals or smaller prop funds can operate, trading off capacity for higher returns by trading in less liquid markets or with strategies that are "not worth it" for large hedge funds. If you must manage billions of client money then you are right in terms of competition, but as someone who only trades his own capital, you can see a lot higher returns.
- g10r 6y agoAgreed. Many smaller, yet successful Hedge Funds limit the capital they manage for this very reason. Some strategies just don't work at certain scale.
- nv-vn 6y agoIf the above is true, why would a fund not just allocate a small amount of resources to trade on OP's strategies. Either: (1) OP's strategy performs worse than the alternative (2) They already do this, and have resources that allow them to outperform OP at their own strategy If the returns are really meaningful, i.e. better Sharpe ratio than just holding $SPY or some dead simple strategy like that, then (2) must be true at least _somewhere_.
- nv-vn 6y ago>These funds manage billions of dollars of client money, which forces them into highly liquid markets with scalable strategies. Obviously this is true, but I think you're missing the point. Trading with ML on price data is a strategy that literally anyone can reproduce and, as is evident by reading the comments in this thread, is something that many people have tried to replicate. In that context, everyone using that strategy is effectively acting as a large fund. Further, a large fund or prop shop can deploy small-scale strategies, I think the limiting factor really tends to be leverage. But if they are just trying to make 5% returns for example, they can deploy a lot of small strategies that make ~5% returns. And that's not mentioning the countless tiny shops operating under the radar trading <10-50 million AUM (really, I think the average fund is much smaller than what you would imagine). What I'm getting at is that there are a lot more market players than the "big guys" and they will either have an equivalent strategy to you or will be better equipped to take advantage of that same alpha because of more capital/better data sources/smarter stats. With that in mind, it seems insane to suggest that you can find significant alpha in such a low-hanging fruit. Remember that you are trading during one of the longest bull markets in history. It's not hard to make good returns, but it is hard to analyze risk. There are a million and one ways to make 100% y/y, but a fraction of a percent of those will continue to work in the long-term. With a black-box model you cannot properly assess risk. Even with well-understood models, this is something that real industry players struggle with: backtrading alpha != simulation alpha != profitable alpha != long-term alpha.
- scottlocklin 6y agoThey don't do "all ML based" trading. By definitions of the smurf who wrote OP about "AI trading systems," they don't do ANY ML based trading. Their returns kind of suck, but it's more to do with their trading frequency and correlations than anything else.
- smabie 6y agoReturns don't matter. People always compare strategies to the S&P 500's return, but it doesn't make any sense. In finance, strategies are compared on their Sharpe ratio, not on their returns. This is because leverage can be applied to make the returns better. For example, if you had a strategy that, unlevered, returned 5% with 2% volatility, that would be pretty amazing. If you wanted, you could lever up 4x and get around 20% return and 8% volatility (though, it's not that simple, since you are going to pay a volatility tax, but we'll ignore that). Another thing to look at is correlation to the market. The less correlated to the market your strategy is, the more valuable it is. This is because investors like uncorrelated strategies. For example, lets say you have n strategies, each with a volatility of sigma and mean return of mu. Allocating all of your money to one strategy or two or all of them won't change your return, it will still be mu. But if the strategies are uncorrelated, and you equal weight each one, your vol will be sigma/sqrt(n) and your return will be mu. This is the essence of Modern Portfolio Theory (MPT): add as many uncorrelated assets that you can. In no particular order, here's a list of things that matter when evaluating an (equity) strategy: turnover, size of alpha being exploited, Sharpe ratio, correlation to market and sector, correlation to style factors (value, momentum, oil, etc), and net exposure (long or short).
- nv-vn 6y agoI mentioned the idea of adjusting for risk in the GP post, though you are correct that I didn't call out any specific measure like the Sharpe ratio by name. If your risk-adjusted returns are worse than S&P 500 then obviously leverage isn't going to fix that problem. Simply put, I don't think OP's strategy really has any of these desirable features like a good sharpe, market neutrality, low exposure, etc. I think OP is just naively building a portfolio based on price predictions extrapolated from price data, and it happens to work in a bull market. Since OP probably doesn't have the resources to really evaluate risk (good simulation tools, good historical data sets, & even the industry know-how of how to look at risk) it seems rather meaningless to hear "I used to have very good returns." Apologies if I misinterpreted your comment, just my thoughts when reading it.
- smabie 6y agoI guess all I'm saying is that a strategy that has a worse Sharpe ratio than the market but zero correlation could still be valuable to a lot of investors for the same reason that sometimes it makes sense to add a asset to your portfolio that lowers your expected return. It's possible that that one strategy with the worse Sharpe ratio when combined with your pure beta investments would yield a portfolio with a better Sharpe ratio than either allocation alone.
- linus_torvalds 6y ago"Then, profits started decreasing and I decided to move on to other things and I lacked the motivation to go back into it." Is this post about the one with decreasing profits, or a new one that is profitable?
- deleted 6y ago[deleted]
- mfalcon 6y agoI've never tried the AI trading path but I imagine that you can't get huge gains with public data, unless you find a way to extract "hidden" information by processing real time news. I wonder nevertheless if there's a sweet spot where you can build a simple AI trading algorithm and get modest earnings from it.
- deleted 6y ago[deleted]
- nv-vn 6y agoI think the answer is yes & no. If you come up with a sufficiently clever strategy using public data that other people haven't thought to use it's definitely doable. For example, someone with a good understanding of meteorology would've had a significant advantage a few decades ago (though trading firms have since caught on). You wouldn't need a perfect data set if the strategy isn't being used. In terms of strategies based purely on market data, you are definitely correct. Any publicly (freely/cheaply) available market data is low resolution, lacking the full data from any point in time, and generally based on poor approximations of the actual data (elsewhere in this thread someone mentions that IEX's data is based on trades that get routed through the IEX exchange, which obviously misses any data you could get from the markets that make up 99% of the volume, dark pools, etc.). I think the "sweet spot" is simply coming up with a strategy that nobody else has thought about, or else executing a better-known strategy more effectively than other market participants. Both are hard, but somewhat in the realm of possibility. The problem is that many people think there's free money to be made without either of these.
- shoo 6y agoreaders may also be interested in Benter's paper "Computer Based Horse Race Handicapping and Wagering Systems: A Report" -- https://www.gwern.net/docs/statistics/decision/1994-benter.pdf https://www.gwern.net/docs/statistics/decision/1994-benter.p... > This paper examines the elements necessary for a practical and successful computerized horse race handicapping and wagering system. Data requirements, handicapping model development, wagering strategy, and feasibility are addressed. A logit-based technique and a corresponding heuristic measure of improvement are described for combining a fundamental handicapping model with the public's implied probability estimates. The author reports significant positive results in five years of actual implementation of such a system. This result can be interpreted as evidence of inefficiency in pari-mutuel racetrack wagering. This paper aims to emphasize those aspects of computer handicapping which the author has found most important in practical application of such a system Arguably the paper describes the state of the art from three decades ago, applied to betting on Hong Kong horse races, not market price movements.
- linus_torvalds 6y agoYeah this is a great paper on the subject. Although horse betting is different than financial markets due to the parimutuel system.
- HighlandSpring 6y agoDoes that mean you have to find a greater edge to cover the house edge?
- mafm 6y agoThe parent comment is the most useful one in the thread so far for anyone who seriously wants to learn about quantitative trading. Sports betting is essentially the same thing as proprietary trading in financial markets. The paper gives a good summary of a technique that was very successful in its day. There is very little publicly available material on quantitative techniques that are useful for proprietary trading. Lo and Mackinlay's "non-random walk down wall st" was good, but that's 20 years old. The mathematical literature on gambling is a lot more accessible. It's also probably easier to consistently make at least small money gambling, because the barriers to entry are lower.
- henning 6y agoI tried doing some forecasting with various neural network models after assembling what I thought was a good amount of forex data. The neural net (I tried various architectures) couldn't do any better than chance. After playing around with it and trying to double-check everything, that was as far as I could get. This puts me ahead of most traders, since most of them lose money, then quit. This makes me wonder what kind of trading systems can actually have any kind of edge, since some kind of autoregressive time series forecasting system seems pretty unreliable. On a more general note, how do you move beyond it being gambling? Just because a system backtests well doesn't mean a phenomenon will continue to happen, especially if your system will significantly impact the market you're in. If you make a trend-following system, every time you trade, you're gambling that the trend is more likely to continue than not. If you're right, you'll come out ahead over many trades. If you don't have enough capital to withstand drawdown the way most beginners don't, you won't be able to last long enough for whatever phenomenon you've found to average out. It takes a lot of time, effort and risk to do all this, so, this is a long-winded way of saying I don't think it's for me. If you build a SaaS product and it fails, at least you can talk about what you learned from building it and use that in future endeavors. If you lose money trading because your algorithm doesn't work, what do you learn from that besides that your algorithm doesn't work?
- wavepruner 6y agoYou need more data to input besides just the price time-series. Successful human traders balance and synthesize a myriad of data sources to make decisions. I depend on an in-depth understanding of human psychology as one of my data sources. You can't turn something like that into data and input to a model. It is something learned through life experience and study.
- henning 6y agoThis is another unhelpful thing about trading: when you seek out information, everyone pipes in telling you that what you're doing is wrong, what they do is right, what you want to do can't be done without giving any explanation or elaboration, etc.
- mraza007 6y agoJust curious to know do financial firms have implemented something similar to this
- nv-vn 6y agoModern finance is built on top of this type of technology. There are hundreds if not thousands of firms participating in "quantitative finance," attempting to use computers/statistics to predict markets. The vast majority of trades go through major practitioners of this exact idea.
- person_of_color 6y agoDon't do this. It's the programmers Moby Dick. You are better off self learning stats/ML skills in your free time and joining a quant fund than to try and do it yourself.
- keyle 6y agoAgreed. It's a goose chase, the house always wins and even a winning system works one week and not the next.
- dilandau 6y agoIn some markets it is necessary to put the same length of fiber-optic cable between the colocated servers, so that being closer to the exchange's cabinet doesn't translate into an advantage. So obviously we're talking about extremely low latency, high-frequency trading. This carries a huge amount of prerequisites to even get started. Not only are that, but there are many different order types besides "buy at market price, sell at market price". Then there's options, short sales, and more. It goes deep. People devote 30 years of their career to this. Read the authors experience as a kind of warning, if you will.
- nv-vn 6y agoAgree to an extent, but not all money in quant finance is generated through HFT. Notably, I don't think funds like Rentec are really doing much to get low-latency [1]. Latency obviously does matter for any kind of quant trading, but to my understanding a good enough strategy + slippage models & the likes can overcome this. [1] You can find a list of NYSE broker/dealers here: https://www.nyse.com/publicdocs/nyse/markets/nyse/members/NYSE_Member_Organizations.csv https://www.nyse.com/publicdocs/nyse/markets/nyse/members/NY... -- any firm where latency matters will need to be on this list to colo on the exchange.
- rezahussain 6y agoWriting ai trading systems is the coding I do for fun since 2012. I'm a little under break even so far but I keep at it because find it so interesting. Since I started every single week I have learned a new way of thinking about a problem I encountered or a new approach to problems that still stand in my way. Questions like, how do you choose a stoploss? Well you can pick it statistically based on history or you can use a supervised label. You can even use stock A calculated stoploss to pick the stoploss you use on stock B because you found a condition under which those two stocks became almost identicall correlated. How do you want to pick the supervised label? You can do spectral analysis to pick the stoploss too. You can use sentiment as a stoploss, source from google news or twitter or stocktwits. It doesn't have to be, 'well I measured the average profitable stoploss to use over the last 10 years across all stocks and that isn't working so I quit' Things like that, you get to fit the ideas together and then test them in the real world. There are some things I would like to share. 1. Just because you have a good forecast doesn't translate into cash. It has to be paired with a trading strategy. This is probably why the author thinks the answer is RL, because coincidentally if you approach this problem with RL, it does the forecasting + strategy. 2. I have measured a correlation between heavier processing(using a higher big O) and better out of sample performance. The criticisms with the NN approach like non stationary data have obvious solutions that a 'by the book' trading approach + ml approach don't really teach beginners so they dismiss it. It is my belief right now that there are people who are prepping data from sources like iextrading then using things like sagemaker to develop good enough forecasting and combining it with a statistics+rules based trading strategy to make living wages. That said, I have 5k account size for my NN obsessions, and my 401k is 'by the book'. person_of_color is totally right when he says it is a Moby Dick of programming.
- discordance 6y agoIt sounds like a lot of fun! I love the idea that there’s one metric ($) to measure the effectiveness of your strategy/code. Any recommendations or hints on where to get started (assuming I’m decent with python/pandas etc)?
- rezahussain 6y ago
- thedudeabides5 6y ago"Actually, many months my PnL graph looked something like this: (this is generated to get a point across, but my real data looked extremely similar):" I'd love to see the actual data
- halfcat 6y agoI find most of this article to be “successful people can’t explain why they are successful so they say a bunch of arbitrary things they’ve noticed”. He found success pursuing relative advantages, infrastructure advantages, and building custom tools from scratch. But absolute vs relative advantages, plumbing together canned solutions vs building your own from scratch, infrastructure-level advantages vs decision making advantages...all of those contrasts exist in other businesses everywhere. None of those are specific to trading. > “in my experience, nothing beats learning by doing or finding a mentor” This hits the nail on the head. The best way to become a profitable trader is with a mentor, but it’s nearly entirely luck. You drive an Uber or tend bar and happen to make friends with someone successful who is willing to guide you. Trying to seek out a mentor online is nearly impossible, as everyone who is findable and willing is almost certainly a better marketer than trader. The other way to become a profitable trader is to start trading with real money. It’s amazing how quickly one can learn how to mend a boat, when the boat starts sinking.
- anonu 6y agoJust a reminder: nobody ever wrote about their super successful trading strategy. Its just never happened. If you have the wherewithal to research and build a trading system that works, then you're smart enough to know that the moment you reveal your edge to the world - it disappears. Even if you dont discuss the innards of your strategy, but you talk about your process or the system youre strategy is built on, you've revealed too much.
- marketgod 6y agoI agree except if your strategy is something everyone uses then it becomes a self-fulfilling prophecy of winning.
- anonu 6y agoIf thats the case, more often than not you wont be in the high-frequency realm. In other words, the "self-fulfilling" trades are usually short ideas that hedge funds highly publicize or maybe a penny stock someone wants to pump (illegally) - and everything in between. Where higher frequency trades do become "self fulfilling" can be in intraday technical analysis. For example, there are many people that follow RSI signals in options. Youll see retail people trade this, and then market makers will step in and bring things back in line - because options dont trade on technicals...
- kristjansson 6y agoWith the notable exception of Ed Thorp, who managed to write Beat the Market first, and then start a hedge fund to exploit the strategy 7 years later, and only when a reader proposed they go into business together. Though it helped that the period was 1967 to 1974. The piranhas were a little slower back then
- deleted 6y ago[deleted]
- dennybritz 6y agoYup. The only reason I am starting to write about it now is that I am no longer running the system. You could argue that it's not useful to write about systems that worked in the past, but I would disagree. New systems can work 99% the same way, but get an additional edge from somewhere else, like new data or better models. Most of the engineering will always be the same.
- MichaelRazum 6y agoTo be honest. I don’t believe a word about the performance using AI. Especially if the article doesn’t present the features and the NN architecture. Its always the question: would a super simple model perform the same way? And very ofter the answer is yes.
- rawoke083600 6y agoLol this.. I once build a model (btc) that assumes this "we can't know the direction of market so we might as well guess", after spending months reading papers and trying to be "clever" It starts off picking a random market direction (up/down) places bid (sorry I mean makes a trade). Then based on lots of tuning/backtest decided how long to be in position and what is the stoploss.. Think in the end the most "profitable settings" where something like : $proft_size = 0.38% $stop_loss_size = 0.35% Win-Continue-Direction = 3 rounds (after winning/losing do we change direction) So it probably in the end was Markov-model with random-start - if we had to label it :) Oh and for fun it would also "martingale for x rounds" :P Worked quite well for 3-4 days and was fun implementing it while watching "Billions" on TV in the background :D
- MichaelRazum 6y agoActually I'm not saying that you can't be profitable. Just saying that the fancy NN, won't work like magic in a noisy environment like financial time series. For other time series with periodic and other anomalies you can apply NN and you may have an edge - BUT for that kind of environments also classical methods are working quite good.
- pinouchon 6y agoFor the last year or so I have been working on a ML-based trading system in the domain of crypto with two friends. I made more in 2 months than I used to in a year. This is after thousands of "full positions swings" and millions of trades (short and long). We are now experimenting with different classes of trading strategies to reduce risk. We would like to find 1 or 2 more people to work on this project, we need people who can tolerate risk and skilled at data engineering: data pipelines, psql, pandas, numpy, data visualisation, setting up servers. Ideally also skilled at machine learning / deep learning and who has tried his hand at trading systems. If interested, my email is in my about info.
- known 6y agotrading != investing
- pinouchon 6y agoor trading == investing (and changing your mind very often)
- DoctorOetker 6y agoI would love to try trading as a hobby with a little side money, but I would abhor a hobby that reduces to effectively buying the trader-feel-good experience, where you're essentially sponsoring incumbents as a fanboy chipping in his pocket money. What I would require from a trading platform: 1) decentralized and permissionless 2) provably fair trading With 'provably fair trading' I mean the protocol should be such that I can prove you are not simply held captive by an intermediary, regardless in what shape or form. It should also be fair with respect to latency. For example consider a trading market where token X can be exchanged for token Y and vice versa. Each holder of X demands her minimum of Y per X, and each holder of Y demands his minimum of X per Y. What if everyone salty hashed their demands, and pays the market contract (proportional to how much they will actually be allowed to trade) to register their salted hash. When the round has closed, people reveal their salt and plaintext, and the incompatible trading offers get their money back (minus a usage fee perhaps). The compatible ones can have their trades go through at the rate of 'total compatible X offered' to 'total compatible Y offered' (or some variation thereof, say rewarding those that helped close the gap). In this way there is no high frequency trading, and you could have a family of such markets operating at different timescales...