Back to Community
The Power and Perils of Financial Machine Learning

We are now at a pivotal moment in history. For the first time, primates (in particular, humans) have developed machines for making informed decisions. It is therefore no surprise that machine learning (ML) is changing virtually every aspect of our lives. Today ML algorithms accomplish tasks that until recently only expert humans could perform. As it relates to finance, this is the most exciting time to adopt a disruptive technology that will transform how everyone invests for generations.

When I ask about potential uses of ML in finance, the most popular response I get is predicting prices. Of course, pricing is a complex problem where ML can achieve greater accuracy than standard quantitative techniques. However, there are plenty of alternative uses of ML in finance, from portfolio construction, to regime switch detection, bet sizing, strategy selection, etc. One popular misconception is that price forecasting is the only way to generate returns. That can be easily counter-argued. For example, one investor could have an edge at predicting prices, however poor bet sizing will easily ruin him.

The great promise of ML is that it will allow researchers to identify patterns never unveiled before by traditional methods. Like any groundbreaking technology, it offers unique opportunities to early adopters. Quantopians are well positioned to take advantage from large firms' reluctance to embrace change. At the same time, ML is fraught with perils. A ML algorithm will always identify a pattern, even if there is none! It is critical for researchers to understand this statement:


Anyone who tells you that you can take a standard ML algorithm, plug-in some financial series and succeed is setting you for failure. Financial ML is a subject in its own right, with its own tools, methods and approaches. If you are interested in learning more about these tools and methods, please visit my free website ( and read my new book:

I would be very interested in hearing from the community about examples of how they have applied ML. What are your favorite ML applications in finance?

63 responses


When you say Machine Learning, does it include Deep Neural Networks? I have been around the Artificial Intelligence world since the early 1990's thru a friend who developed a hybrid neural network / genetic optimization software for financial trading. Today, the evolution of AI has reached its critical mass with plenty of real life applications sprouting and growing. Back then, the big players thought we were doing some "voodoo economics" along with the Chaos Theorists! Today they are starting to embrace this technology.

I guess coming from the old school, to me, Machine Learning is a newer term which I equate to algorithms like Random Forest, ADABoost, SVM, etc.
I have tried cloning Q's ML algo template, played with it with limited success which I attribute more to the limitations of the Q framework and computational resources within its framework. Outside of Q, I am finding more success with Deep Neural Networks / Reinforced Learning in market timing models, regime change modeling and pattern recognition.

Quantopians are well positioned to take advantage from large firms' reluctance to embrace change.

That time will come when Q allocates more resources to this new paradigm.

Well, I ordered your book, so will take a look!

Have any of the funds you've worked with been attempting to use ML techniques?
Seems like you've got to have a handle on how to extract out features from a statistical model and learn something from the features.
Quite a bit different from detecting and recognizing the objects in images, in that reality is an abstract financial model that has no ground truth!

Thank you, @Alan. Yes, I have managed up to $13 billion using machine learning methods.

I hope you find the book useful, as it summarizes many lessons I learned in the process.



Sure, DNN is just one of many ML approaches. I share your view that the financial industry used to be extremely skeptical about ML. Perceptions have changed, and given the success achieved by some early adopters, now they must play catch up.

Please take a look at the book. Chapter 1 ( suggests one way Quantopians can crowdsource ML problems.

I've had the most success with linear models out of sample and non-linear models in sample. Since there is a lot of noise in daily financial data, alpha is hard to find when you include trading costs. So far I've had the most success using quantile regression + fundamentals + common sense. Quantopian's alphalens is great for finding alpha factors.

We are currently trying to build our own end-to-end trading workflow platform utilizing AI technologies and both financial and non-financial data (and also AutoML functionality to automatically find the best scoring algorithms and configurations). Indeed, there are many different uses of AI technology in trading algorithms. I actually think that price prediction will have less success than other uses. For example the accuracy of predicting buy and sell signals or "buckets" of increase is much higher dan predicting actual prices.

I have seen the ML algorithms posted here on Quantopian but they are very limited. Quantopian is not really a good platform to employ AI techniques given its limitations.

Hi Marcos,

I am new to the field of ML. Awhile back, I read through this book (skimming the more advanced sections), just to get a feel for things:

Hands-On Machine Learning with Scikit-Learn and TensorFlow Concepts,
Tools, and Techniques to Build Intelligent Systems
By Aurélien Géron

I would be very interested in hearing from the community about examples of how they have applied ML. What are your favorite ML applications in finance?

Personally, I have not attempted any ML on Quantopian. One area of interest is the so-called alpha combination problem, which Thomas Wiecki is solving with his example ML algo (it is worth noting that the overall Quantopian framework was laid out by their former Chief Investment Officer, Jonathan Larkin in A Professional Quant Equity Workflow). I have not attempted it, but we concluded that the ML algo example from Thomas needed to be re-factored, so that various alpha combination techniques could be applied in a modular fashion, and compared. Presently, I use a simple sum of z-scores to combine a set of Pipeline-based alpha factors; it would be nice to compare this technique to various ML ones.

The other issue I brought up is that it seems one needs first to be able to synthesize a set of alpha factors with known characteristics to test the ML code. The guidance I got is that this is not so easy on Quantopian; one would need to get "under the hood" and feed synthesized data into Pipeline. There is a new feature under development, called My Data, which might facilitate synthesis of data offline (although more ideally, it would be synthesized online using the Quantopian research platform).

There was another project on Quantopian that was never carried through to completion: The 101 Alphas Project. The idea, as I understood it, was that Quantopian would attempt to replicate the results in a published paper and share the results with the community. If you wanted to comment on this approach, I think it would be of interest.

Finally, there is this little gem: I haven't re-visited it, but there is strong evidence of over-fitting, so it could be used as an example of what not to do when applying ML, and how to detect over-fitting.

Generally, I agree with the sentiment above that ML support by Quantopian is a gap. They have provided no guidance on how and when they might close the gap. If you can help them, it would benefit the community.

Given the limitations of Q's framework and computational resources on ML algorithms, I was able to managed and stretched these limitations as shown in the attached notebook by limiting the number of stocks to trade, the number of factors and compacting the ML code. While it passes all contest rules, thresholds and constraints, I would had like to lower the volatility by decreasing position concentrations but always get the dreaded compute timeout error.

Loading notebook preview...

Q is working on the My Data API (see, which de-couples from the Q platform compute limitations (although then one has to supply the input data sets). It would be interesting to hear from Marcos and others how this new API might be used, in the context of the current Q platform and contest/fund needs.

@ Marcos - for your book and research, how do you get data (e.g. OHLCV, fundamental, "alternative", etc.)? Do you know of clean data sets that would be free and applicable to doing offline ML that could then be uploaded using the Q My Data API? The point-in-time stock list is QTradableStocksUS() described on the help page (the universe is not downloadable, so it would need to be re-constructed offline).

Grant, you can get free OHLCH data through the Quandl service. Quandl also has a Python library. Quandl also has many different additional datasets, most of the interesting ones are paid datasets though. Quandl does have global datasets so also OHLCH data from European and Asian stock exchanges.

Marcos Lopez de Prado

I have long followed you blog and find myself perhaps a little taken aback at your very positive attitude towards machine learning.

I have read a number of your papers where I came away with the impression that your skepticism greatly outweighed your optimism as regards quantitative trading methods. The impression I gained from reading your materials in the past had me believe that your approach to investing may have been some sort of indexing technique rather than any trading method.

Perhaps I should buy your book.

Are you still running the bond fund you took over from Guggenheim Partners? Or is that still mired in litigation?

Your website is interesting.

However is it your opinion that finance can be tackled in the same sort of way as Deep Mind approached Go?

I will enjoy your website but it is a cornucopia, an encyclopedia and academics delight. It is not (or so it would seem) a manual to run a hedge fund. Or am I wrong? There is too much choice here. Too many theories almost. And perhaps too little direction. Too much of how people get it wrong and not enough about how to get it right.

Machine learning seems to have had its successes in closed problems where the entirety of the problem is know and can be described. Go being a good example.

As I understand it, most believe financial markets are complex adaptive systems with feedback.

There are not any fixed rules. You can not work out all 10^x rules and crack the market code with a supercomputer.

Or can you?

Are the markets chaotic systems? In which case are we talking about deterministic chaos?

In other words do you believe that if we could discover all the variables prediction would be possible given enough computing power?

I do hope that I do not come across as rude. I do not mean to. If I come across as weary, then perhaps that is how I feel. All credit to you for your reams of academic work but I fear that 200 phds at Winton Capital does not seem to have done very much for their performance in recent years. As for Tudor (one of your past posts) I believe that they too have been through a less successful period in recent years? Or am I wrong? I have not looked at their figures recently.

You have often quoted the successes of DE Shaw in the past and Rentec. Again I have not looked at their figures recently - presumably they continue to prosper?

But has the success of these two firms been based on methods which would now seem to be considered by many as not so much academically brilliant as being in the right place at the right time to take advantage of others?

In other words have these people merely been preying of the rest of the market by smelling out large orders and dealing ahead? Or by getting access to market information before others?

None of this is intended as a statement. I do not have any of the answers. These are questions addressed to Marcos who has great experience in these matters and might be able to shed some light.

If we're asking questions I'd like to humbly add a small technical one about the book to the pile:

In the chapter about fractional differentiation you argue we can often obtain a stationary price series by differentiating using a d < 1 instead of d = 1 (i.e. good old returns). There's a table in the chapter that illustrates this fact for a list of different instruments and a code sample is provided to find the smallest d for which the series is stationary.

This code sample uses statsmodel's adfuller function to test for stationary, but it uses maxlag=1, which as far as I can tell results in quite an optimistic test, i.e: series are found to be stationary when just looking at them tells you they're clearly not. I found that when I'm using the default maxlag parameter, the obtained d values are generally in the order of ~0.3 higher.

So I guess my question is: why did you choose maxlag=1 and is it still possible to use these weakly/hardly stationary series in a predictive manner? The CUSUM filter mentioned in the book might be a solution, but if I think about it, it seems like a way to introduce stationarity implicitly and doesn't really need a stationary series to begin with.

As an AI expert, I think AI is always able to beat traditional quant algorithms (if built and used properly) for two very simple reasons:
- Traditional quant algorithms are based on fixed formulas which have been developed based on human understanding of the data and correlations. AI algorithms will automatically learn the relationship between the input data and the output data, and hence will automatically learn the most optimal representation of the formula.
- A.I. neural networks with more than 2 layers have the capability to learn not only lineair relationships but also non-linear relationships. Humans cannot see these non-lineair relationships, hence the A.I. models will always have a edge compared to traditional quant algorithms.

However, A.I. technology is very complex. It is much more difficult to build an A.I. model for trading than to build a traditional quant algorithm. Hence, there is only a small subset of people capable to build these types of models. Hence, why it is not used a lot yet.


As an AI expert

Let me ask you a question then. Let us take stock indices, say the S&P 500. Imagine you have 20 factors you believe influence the direction of the index. You run a PCA : which factors do you find most useful?

Marcos, somewhere above, says that prediction of price movement need not be the object of a machine learning algorithm:

there are plenty of alternative uses of ML in finance, from portfolio construction, to regime switch detection, bet sizing, strategy selection, etc

I feel this is disingenuous since the sole purpose eventually is to predict the price performance if not of a given financial series, then certainly of your account equity.

And I wonder whether ML is of much use in portfolio construction anyway. Or regime switching, or strategy selection.

All of these require "forecasting" and "prediction" in a system which is very far from "closed". Unless markets are deterministic closed systems I wonder whether ML will prove any better than simple heuristics in providing superior portfolio returns.

Personally I doubt it but would love to be shown to be wrong.

Ultimately with designing A.I. models it is always a matter of the accuracy level that you want to achieve. For any A.I. model you need a lot of trainingsdata. If you want to predict a stock price (a floating number) accurately you would need much more trainingsdata than if you want to predict whether the stock will rise or drop tomorrow (less training data). If you divide the amount the stock will rise or drop tomorrow into buckets (bucket 1 is between 0 and 1%, bucket 2 between 1 and 2%) you would need less trainingsdata to get a higher accuracy then to predict a floating number. So all of these uses are in the terrain of price prediction right?

If you have a long/short portfolio, you could also use A.I. to determine the weights for each of the assets that want to go long or short. I have also build an A.I. model already that learns in what type of market regime the stock currently is (based on history). For example, you could ask the A.I. model to divide all historic prices into 4 different market regimes and based on that predict the current market regime. Based on the predicted market regime, you can then use different models.

You could run multiple strategies in parallel and use A.I. to predict which strategy should be used at any given point in time. Which strategy will give the best return for the next week for example?

So basically it would be possible to construct a sort of Mega A.I. model that uses A.I. for a lot of different purposes but that would be unbeatable. This would be complex by the way, compare it to building a self driving car which also has about 7 to 8 different A.I. models interacting with eachother.

compare it to building a self driving car

But might I be right in thinking that the software for a self driving car is largely constructed using known factors or rules? Like chess? Physics determines the likelihood of skidding depending on the road surface heat or moisture for instance and this is used to determine optimum speed and distancing from the next car.

Vehicles have easily describable characteristics: a rage of fairly standard heights and widths and lengths and so forth.

Winds speed, road camber, road curves, lengths - all sorts of variables which are presumably not impossible to list or to describe digitally.

Driving may not be a closed system in the same way as chess, but it is presumably a great deal simpler to map out than markets. Easier to "predict" successful driving maneuvers than stock performance?

No, self driving cars is actually much harder than stock performance. A self driving car needs to be trained on all potential scenarios that can happen during a car ride. That is why these cars need to drive so much kilometers. What happens when a self driving car drives straight into a tornado? If not trained on this circumstance, it would just drive ahead.

Check out this university research paper. AI models outperform traditional quant algo's.

@Roy, Zen,

I think the endgame question is, when the time comes that all information is readily accessible and processable by a very powerful supercomputer and predictive AI software, are we going to be able to peek into the future?

To me, Renaissance Technologies is living proof that AI techniques combined with other statistical and quantitative methods can be quite profitable as reflected by their consistent track record:

Renaissance's flagship Medallion fund, which is run mostly for fund employees,[8] "is famed for one of the best records in investing history, returning more than 35 percent annualized over a 20-year span".[5] From 1994 through mid-2014 it averaged a 71.8% annual return.

Rentec has over 200 talented mathematicians working in an environment perhaps pretty much like Dr. Marcos describes in his book.

James Villa

"are we going to be able to peek into the future"
Precisely the point.

Re Rentec I'm not so sure. Their past record is fact but what is it based on? We have read much about HFT: it is said by some that it is all about front running and obtaining information that others do not have access to.
I gather HFT has declined in profitability in recent years with new entrants. Again, I have absolutely no idea.
Thanks for the paper. I will read it with interest.

Roy Lenders
re self driving cars surely we know, more or less, what circumstances it will face and what it will be subjected to. Extreme weather conditions are one example: but a test for wind speed is surely simple enough and not restricted to the tornado?

Take roads and maps: its all there. Its all already in digitized form.

Take the rules of the road: again its all set out in digitalised form.

Yes, I realise the unexpected has to be programmed in: the child stepping into the street, an on coming car swerving into your lane but I suspect these are all reasonably foreseeable.

I would have thought markets are far more complex. We really do not know what drives day to day price movement. And in the long term, for a market as a whole, all we can really say is that it depends on the success of the economy as a whole.

In any event, time will tell! Perhaps Ray Kurzweil is right after all. Perhaps w are all gods now.

Well, based on my A.I. experience, I can say that A.I. models will always be able to outperform humans and traditional quant algorithms (with fixed rule-sets). I wonder how much A.I. experts these firms like Renaissance Technologies and Rentec would actually have since A.I. experts are really scarce. On the other hand, you would probably only need 2 or 3 very good A.I. experts to build something unbeatable. But the whole world is still on a big quest to where and how A.I. technology can be be applied and we are just at the early beginnings of this. So I am pretty sure that in the next 5 to 20 years, we will see these A.I. models dominate a big part of the Trading industry.

Incidentally I note with interest that this is Mr De Prado's only post on the forum and that it is unaccompanied by any code or back test.
It will be interesting to see if he maintains his presence here or whether this post is a one off.

Have you looked at Genotick at all? Unfortunately it is written in Java which I have never looked at and there is no manual so I'm not sure I can be bothered to take it too far. But I very much like the approach and am contemplating re-producing something similar in Python with DEAP or some similar library
Its a genetic algo approach.

Re that paper you posted: EXACTLY what I had in mind. Using a broad range of other index data to forecast say the S&P. Perhaps adding in interest rates and commodity prices to see what predictive effect they may have on different markets.

I'm not a sceptic at all. I'm just wary and cautious and I believe traditional quant methods other than simple indexing have run their course.

Quickly reading the paper I have to conclude it tells me absolutely nothing about the actual performance of the NNs, just that they perform comparably across markets. They just state the MAE which tells you exactly nothing. No performance figures at all, this is something I can do in an afternoon.

@ Marcos -

This is the closest thing Q has to an open repository of published ideas (mostly links to papers in the open literature):

If you have anything to add, you could put it there. Please note the theme of the thread:

Please keep it to concrete strategy ideas, the more explicit the better, and preferably those that could be implemented in Quantopian!


My suspicion would be that this is more publicity and advertising that any attempt to become part of the community. I hope I am proved wrong and that Mr de Prado will post some systems.

We will see.

Boosting Alpha B.V.
Can you tell us more about your company? And are you yourself a programmer or are you on the marketing and promotion side of things?

@ Zenothestoic -

Well, one way to promote the book would be to apply parts of it on Quantopian, where feasible, to show that it has practical application.

Boosting Alpha is new startup. Founders are myself, an ex-banker of one of the big banks here in the Netherlands and one of my other employees (I have two other startups as well). Currently a team of 5 people working on this and obtaining subsidies for the start-up phase. Basically the idea is to build "new style quant algorithms". New style means (1) using A.I. technologies, (2) use of non-financial data (apart from only financial related data) and (3) use of the fanciest new technologies. Regarding 2, for example think of scraping weather data from websites and building an A.I. algorithm that predicts future stock moves for stocks that are weather-related (like AB Inbev, Heineken, Coca Cola, building companies etcetera). We have many of these trading hypotheses with non-financial data that we are exploring right now. I am also associated to one of the biggest universities here in the Netherlands (as a professor) so we are planning to do a lot of research with these students looking into some of these hypotheses. Anyway, our revenue model is based on selling subscriptions to our algorithms and also licensing our algorithms to hedge funds.

My own background is university level in ICT and Supply Chain (in my teenage years I used to be part of the biggest European hacking group). I used to be partner at the big consulting firms for about 25 years. But since 5 years working on building my own empire of startups with this initiative being our newest startup. So I think I have a quite unique mix of heavy core technology skills, business knowledge and communication/marketing expertise. Most people who know me, would never have thought that I actually am an extreme programmer as well. Which is actually quite good I guess......

Grant, question for you. I noticed you have been very active here on Quantopian for the last few years (at least reading through the forum messages).

Running and testing of some of our algorithms, I noticed that upward and downward behaviour can be quite different for stocks, ETF's. So I thought that measures like Beta and Alpha could actually be decomposed somehow into Upward Beta, Downward Beta, Upward Alpha and Downward Alpha. And that it should be able to somehow build an algorithm that would profit from these discrepancies, for example in Long Short portfolios. When searching the Quantopian forums, I could not find anything close to this. Have you heard of anyone trying this before?

Many are called but few are chosen. I wish you well in your endeavours.


@Professor Roy,

Impressive qualifications!

Running and testing of some of our algorithms, I noticed that upward and downward behaviour can be quite different for stocks, ETF's. So I thought that measures like Beta and Alpha could actually be decomposed somehow into Upward Beta, Downward Beta, Upward Alpha and Downward Alpha. And that it should be able to somehow build an algorithm that would profit from these discrepancies, for example in Long Short portfolios.

Maybe you can post a notebook of this proposed decomposition algo within the Q frameworks even if it is very basic and within available open source libraries in Q to see how it works. I posted my best ML algo above, a combination of alpha factors processed by a Support Vector Classifier. Not perfect but has a 53% profitable trade accuracy and passes all Q contest thresholds. I think it could be improved further if Q allocates more compute time and resources. It would also be nice if some better python programmer than me, translate some of Dr. Marcos' tools available on his website in Q format such as Probability of Backtest Overfitting.

Yes, I had planned to do this within the next couple of weeks. Need to figure out the right formulas to calculate these separate Upward and Downward factors and then put it into a Long Short portfolio and test it. We do not need AI functionality for this as well. Just traditional stuff.

Another cool idea I had was the following. Big tech have a higher P/E ratio than other stocks. Sometimes traditional companies might become more of a Big Tech company like Walmart is growing to an Amazon type of stock. This generates Alpha I would guess. So how would we measure it and identify these stocks? By calculating their Beta with respect to the S&P500 and also their beta with respect to a Big Tech ETF. If the Beta compared to S&P500 is declining and the beta towards Big Tech is growing, there could be a trend that this stock is moving to become Big Tech valuated.


Interesting hypothesis, this should be easily tested with use of vectorized Simple Beta in pipeline. Will wait for outcome...

Great post


I have read the first chapter of your book and I imagine that compartmentalization by specialization as articulated by your Structure by Production Chain is most likely the set up of most successful and well funded ML based and/or quantitative Hedge Funds. I am trying to conceptualize this structure within Q which claims to have over 60,000 community members, each with different levels of skills and understanding of AI/ML and the financial markets. I believe the assignment of specialized groups along the assembly line can be organized but this still leaves us with the problem of limitations in computational resources, lack of adaptation of more powerful and updated open source AI/ML libraries like Keras, Tensorflow, Theano, etc., and poor collaborative platform. More importantly, Q's primary focus is to first satisfy their investors' objective which is to create a hedge fund that is a low risk/volatility market neutral long/short US equities fund under a meta multi strategy scheme using data and available computational resources / tools they provide, while very much appreciated still limited for AI/ML algos. When Q starts allocating more resources towards this end, the possibility is there.

Great thread.
I would pay money for a service/platform that combines:
-Paperspace(for cloud IDE, Jupyter notebooks, storage, GPU rental)
-ability to load libraries like PyTorch and FastAI(to make ML a bit more manageble getting started)
-Zipline/Quantopian(for backtesting and research)
-And the option to connect to a brokerage would be nice.

Hi everybody, thought I would share my two cents on this subject, I'm "Jade Horse" in the contest by the way.
This is my first post so be kind :)

There are some serious issues with applying standard machine learning techniques to financial data, and especially returns. The first one that comes to mind is that returns are not really log normal distributed, they're log normal with fat tails which already takes a lot of machine learning algorithms that depend on mean and standard deviation out of the picture.
A second issue is that while we would like there to be stationarity in the markets, there really isn't: One factor might work extraordinarily for a while for thereafter become numb, or worse, change direction. Even if you can find some autocorrelation in a return series, it's highly likely that it's gonna go away soon, or that trading costs and slippage will make it impossible to profit from it. Neural networks and other ML techniques that don't use mean and SD will be great at over fitting to a specific time period. NN have been shown great in image recognition due to the stationarity of how , e.g., a cat looks across time and space: markets are very different. Even--on the surface--stationary items such as sector/industry categorization will be highly flawed as companies change a lot over time, but are kept in certain categories out of convenience or of historic reasons. Another example could be P/E (and other) that will be highly 'vulnerable' to both levels and changes in interest rates and changing accounting practices/laws.

Some people here say that the medallion fund is an example that machine learning works in finance. First of all that's impossible to know due to its secretive nature, second of all from what I've gathered from reading and watching interviews with Simons is that they mainly use more statistical techniques (I guess some of them could be characterized as machine learning) and that they have a "pipeline approach". By that I mean that they find something that works, then they transfer that signal through again from other angles AND they use adequate financial tools to exploit those signals, whether it being futures or options in any combination. A problem here on Q is those approaches seems quite hard to do in practice. I also remember an interview where Simons said that their main advantage was that they were faster than their competitors (in my understanding meaning that they need less data to feel confident about a specific trade).

All that being said, I think you can build algorithms, also using machine learning, to beat the market. I just think you should be a bit more creative (as I guess OP suggests) than just using them to predict returns and be very aware of the current macro economic environment.


You say:

Some people here say that the medallion fund is an example that machine learning works in finance. First of all that's impossible to know due to its secretive nature, second of all from what I've gathered from reading and watching interviews with Simons is that they mainly use more statistical techniques

I guess you are referring to me. My source is a mathematician friend who used to work at Rentec and direct from the horse's mouth, he specifically disclosed to me that they used AI in combination with other statistical techniques. So for me, the better take away here is quantitative techniques including statistical, AI/ML or other mathematical techniques must be used properly and creatively in combination to get optimal results.

Bjarke, you are referring to A.I. /. Machine Learning on financial data (historic returns). I would agree that since the data is not stochastic, machine learning could have issues there. However, if no external news is impacting a specific price, than behaviour would be more stochastic and machine learning would perform better. But the biggest benefit would be applying machine learning to non-financial data, for example the impact of weather condition on the stock price of beer companies. There are lots of use cases if you think about it. Those relationships would be more stochastic.

James Villa
My suggestion would be that you ask your chum what market inefficiencies Rentec is chasing on the Medallion Fund. Their equities fund is different and last time I looked not particularly exciting (but that was a few years ago).

My supposition is that Medallion has traditionally made money in ways not applicable to anybody on this website. They have made money from super fast dealing so to beat others as a market maker. They have made money out of dark pools where they can use their algos to sniff out big orders and use that information to their advantage. I would suspect that they have not made money by forecasting trends or mean reversion. I would suspect that their ML or other methods are chasing advantages not available to the rest of us.

People on this website and Quantopian are trying to do something entirely different and more in line with traditional fund managers not high frequency traders.

@Marcos Lopez de Prado. " I have managed up to $13 billion using machine learning methods."Presumably, this was in the past.If the ML was so successful, how much are you managing now?Also, what sort of PL figures did you [email protected] seems to have it right in my opinion.

Hi Marcos,

Here's a post that may be of interest to you:


I would agree that since the data is not stochastic, machine learning could have issues there. However, if no external news is impacting a specific price, than behaviour would be more stochastic and machine learning would perform better.

I wonder if I may make a few suggestions here? I am no expert in machine learning, or statistics, or mathematics but do have a little experience in financial markets.

I think you may be confusing the meaning of the words stochastic and stationary. Which takes me back to my various arguments above about machine learning and its application to fixed systems.

Chess and go are fixed systems. All the rules are known in advance. There is nothing stochastic about such rules but of course there is something stochastic about a players application of those rules. Nonetheless the rules themselves are not stochastic and hence you have a good chance, as a supercomputer, of "predicting" your opponents strategy and outwitting him.

In the same way the rules of driving are fixed. A self driving systems knows therefore that if it sees a car coming at him on the wrong side of the road it must take avoiding action. Yes, of course there are random elements to driving but these have a certain predictability. Or at least you know the rules. You know that a car may indeed encounter high winds, storms, rain.

Stock markets may be almost purely stochastic and that is NOT a good thing for somebody trying to predict stock market prices, or volatility, or correlation between positions in a portfolio.

If markets were stationary then it would be somewhat easier to predict tomorrow's price since market patterns would repeat and be predictable. But markets are instead largely Random (stochastic) and hence largely unpredictable.

You may have been more used to using ML in image or voice recognition. This is a far cry from stock markets. You know that a human face has various characteristics that differ from those of a hippo or a cat or a can of baked beans. These rules are NOT random. They are fixed or stationary. Coupled to that you know what the rules are.

With financial markets (a) price, correlation and volatility are not fixed and do not move in particularly predictable ways and (b) we do not know the full extent of the variables which effect them.

All of this is to say that whatever your experience with ML and coding, you are likely to find financial markets a greater challenge than many challenges you have faced to date,

Again, for the record, my understanding of people like DE Shaw and Rentec is that they are using market inefficiencies not available to us mere mortals. Coupled to which competition has (I believe?) greatly eroded HFT profits over the past few years.

I have not seen recent Medallion figure however so maybe I am wrong and they have maintained their huge return on capital despite greatly increased competition in their arena.

Perhaps James Villa could ask his chum about this?

Well, we already build quite a few A.I. models for stock markets and a couple of them seems to be working very well. Regime prediction was working very well, a A.I. model that is able to predict Heineken stock price based on factors such as weather, hop pricing etcetera was working well. But we also recently build a machine learning model that tried to predict pricing based on historic pricing and more than 300 different technical analysis indicators. Those models tend to achieve an accurracy in the range of 55-60% which is not high. So it appears A.I. might work very well in some areas, but maybe not all. But I also have to say we did not put a lot of time yet in the tuning and tailoring of this last Technical Analysis model so if we put some more effort in it, we might get it to a much higher level of accuracy as well.

Those models tend to achieve an accuracy in the range of 55-60% which is not high.

CTA trend following models have in the past tended to have win loss ratios as low as 40% but they have made their money by running winners and cutting losers. So if you models are predicting whether a stock or market will be higher or lower that yesterday's close in (say) 1 month's time and you use the same techniques as the CTAs then a 55 to 60% win loss ratio might make you good money.

The problem with trend following in recent years seems to be over crowding. Trends still exist but timing them seems to have become more difficult. Perhaps your methods will overcome this.

But again, randomness (stochasticity) is not the friend of the trend follower.

To be honest, things like trend following and technical analysis are too easy. Because it is too easy, everybody uses it and hence it becomes less profitable. Same for fundamental information. If you really want to make good Algorithms I think you need to use either non-financial data or use some pretty clever financial engineering hypotheses.

@Zeno, I would have asked my compadre all your interesting questions but unfortunately, he has since passed. As far as I know from what very little he disclosed to me, they didn't do HFT but more of an ensemble of short term trading strategies that are adaptive to different market regimes across different types of financial instruments processed by very powerful computers. The cummulative talent and skills of their mathematicians / scientists, their research setup which is probably close to how Dr. Marcos describes it, enormous computational resources and accessibility to large pool of traditional and non traditional financial data and probably other things are what is not available to us mere mortals and perhaps their comparative advantage. I don't think they benefitted from front running high frequency trading systems.

I have been an early adopter and practitioner of AI in finance for 20+ years, and I will agree with you that financial prediction is a very hard problem to crack, some of the reasons have been articulated above by you and other posters. AI technology has made some leaps and bounds over the years specially with apps on image and speech recognition, beating board games, self driving cars, etc. but financial time series prediction has been very elusive. Unlike image recognition for example, where data in form of pixelization is bounded and stationary, therefore, easier to predict, financial time series is non linear and non stationary. The key for me is to use the right tools for the given set of data and problem. Financial modeling is basically an abstract simplification of reality and reality in the financial markets is close to infinity and ever changing. So why use linear systems to solve a non linear problem? Why assume gaussian/normal distribution when empirically financial time series are not? Why try to make the time series stationary when its not? And this is where I think AI tools has an advantage because it throws away all these apriori assumptions and processes data in a non stationary and non linear way.

Let me briefly share with you my first AI based trading system I did back in the mid 1990s. Basically it was a market timing model on SPY and QQQ, predicting next day returns using a hybrid neuro/genetic algorithm, a one layer neural network. Data input is OHLC transformed in Takens embedding theorem (aka Chaos Theory) trained, tested and validated for 15 years data before going live. First year trading was phenomenal, peaking at more 100% annual returns only to degrade to around 55% when I pulled out and reviewed what happened. One significant finding in this experience was the model may have been overfitted and were not responsive enough to regime changes. This experience has led me to shift my focus on predicting regime change and market conditions. If regime changes are something that are recurring under same market conditions, this should be picked up by AI techniques but the elusive part is when regime change is caused by something that hasn't happened before! This for now is the limitation of AI techniques, it can only learn from what it has already seen and recur in the past but cannot predict with a certain significant amount of accuracy something that has not happened yet in the past.

James, that is actually a good summary. My experience with AI so far is that a human can actually see it in a price chart, we are capable to build an A.I. model that "sees" the same. If a human cannot see it in the price chart, then sometimes A.I. would be able to see it (if non-linear for example) but sometimes also it is unsolvable for an A.I. model. So a regime change, a human would be able to see on a price chart right? So A.I. should be pretty accurate to see this as well. I have seen this also in the AI model we build for this purpose. Price prediction is definitely more difficult it seems for AI models because individual stock prices are usually primary impacted by external news or events, that is why their are random (if you are only considering stock price history). However, if you managed to include data about that external news, external parameters or external events, you might make the overall model less random and more predictable. But this required a lot of testing until you find the right datasets and approached to use. Just like trying to find a needle in a big haystack.

@Roy, it might be more than just a huge haystack. Try the following for a rough and limited estimate of the size of the problem.

@James Villa

Inputs for "predicting regime change and market conditions".

  1. What do you use?
  2. Have you moved away from OHLCv?

How do you define "regime change and market conditions"?

Let's assume for the moment you are talking of the stock market. In many ways, predicting prices is very similar to assessing "regime change and market conditions".

Let us assume a stock is at $10.

By the end of the month let us assume it has gone :

  1. Up to $20;or
  2. Down to $5;or
  3. Remained the same, fluctuating
    somewhat between $8 and $12.

At the beginning of the month your system judges that we are in an up trending market. Is this not much the same as saying the PRICE will go UP from $10?
At the beginning of the month your system judges that we are in a down trending market. Is this not much the same as saying the PRICE will go DOWN from $10?
At the beginning of the month your system judges that we are in a mean reverting market. Since your holding period is a month you remain out of the market. Is this not the same as saying that the PRICE will go nowhere?

For a profit to be made the price must trend up or trend down for the period you hold it. It is necessary therefor to forecast both price and market condition surely?

For a profit in a mean reversion environment the PRICE must TREND up in accordance with a short term trend AGAINST the direction of the long term trend?

I think this is more than semantics. Or at least I assume it is since you draw a distinction between predicting:

  1. Price
  2. Market Regime

@James Villa

I should lay my cards on the table. I am coding a genetic algorithm for stock trading. Using initial random instructions to manipulate inputs (rather than traditional technical analysis indicators).

My interest in your experience is therefore genuine and enquiring rather than nosy or critical.

For regime prediction, I used this model that used a Guassian mixture model. See this URL:

I basically used it on historic stock price information, asked the model to divide the history into X buckets. Then you can calculate the average return for each bucket. So if you use two buckets, I will predict Bear and Bull but you might want to predict in more than 2 buckets to get a better granularity.

I applied it to Bitcoin pricing, very accurate in predicting to stay away from Bitcoin mid december and for the later periods not to move in again.


Inputs for "predicting regime change and market conditions"? I still stick to OHLC data transformations, not the normalization or standardization kind but more of the "denoising the noisy time series" type. It helps the AI engine extract more meaningful signals/patterns. If you can peek into tomorrow's price and traded on perfect knowledge you would find that volatility is probably the main factor, among many, that is directly attributable to returns. So one of my focus in regime change modeling is forecasting volatility. It is empirically known that change in volatility specially when sudden signals an impending regime change and they do come in clusters. Makes sense if you equate volatility to uncertainty and risks. For market conditions, Roy just gave us a good example above.

You mentioned that you are currently coding a genetic algorithm for stock trading. Genetic algorithm is a subset of the more general AI field of Evolutionary Algorithms. I have implemented a related algo which is more along the lines of Particle Swarm Optimization in a multi-agent, multi-strategy framework. It would be too long to articulate here, so I will link you to my old blog and corporate website ( FYI: site has not been updated since mid 2016)

Corporate website: here
Blogs: About
Trading System
IRA Trading

Thanks to both of you. In my case, frankly, it is more out of intellectual curiosity than in any expectation of above market profit. I'm just a natural geek and have been fooling around with Python for a few years now.

I have been in markets for a lot longer than that and my own experience has been that exceptional profit has only come with exceptional circumstances - basically where I had discovered a particular highly profitable niche and milked it for all it was worth while the game was still there.

@ Marcos -

It would be interesting to hear your take on the Quantopian risk model (see To me, it seems kinda ad hoc, and potentially based on a kind of industry group-think. I'm wondering if ML techniques could do a better job, than arbitrarily controlling sector and style risks. Any thoughts?

By the way, if you are not intending to participate in discussions, you might just say so. You went "lights out" after your original post. Note that Quantopian has flagged your post as "Interesting" and there has been good engagement, but you are not participating. Vacation?

@Grant -

His website states that he will be presenting his book 06/22/2018 at Risk & Trading Conference. Perhaps this is the reason he is no longer active.