Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Backtest strategy on the market

Hi!
I've just come to the algo-trading world, and am currently learning matlab.
My questing'd be that how can I backtest my algo on the whole stock marke?
E.g. I'd like to get all the symbols and their daily closing price during a period of time. Where/how can I download such a data?
I know that I can get stocks' symbols and prices but just symbol by symbol.

Thank you

2 responses

The Quantopian platform has price and volume data available for pretty much all US equities from 01 Jan 2002 - current ( https://www.quantopian.com/data/quantopian/us_equity_pricing ). One can "get all the symbols and their daily closing price during a period of time" . One can work with all this data (ie the whole stock market) or one can filter for certain sub-sets (eg common stock and not ETFs). One can easily get daily close prices by using either the 'pipeline' or 'get_pricing' or 'data.history' methods. Check out the documentation (https://www.quantopian.com/help#important-concepts) or the tutorials (https://www.quantopian.com/tutorials/getting-started#lesson1)

This data is free and available to use as long as one uses the online Quantopian platform (either the algorithm IDE or the research notebooks). However, this data cannot be exported for use offline in matlab or other tools. This is pretty much the case for any sources on the web. The data providers don't want their data easily accessible to copy and re-post.

So, the data is available within Quantopian and all the excellent resources it offers, but if you want to work with it using matlab you are out of luck. I'd very much suggest going through the tutorials and the extensive set of lectures available here on Quantopian rather than investing time learning matlab. The iPython notebook environment here is very similar to matlab.

Unless Matlab is necessary (e.g. required for a course, project, or by an employer), I'd recommend checking out Python. At a basic level, Python does everything that Matlab can do (see https://docs.scipy.org/doc/numpy-dev/user/numpy-for-matlab-users.html), and it is free. The main thing is to get into the habit of taking full advantage of vectorization, if you haven't written code in this fashion before (see https://en.wikipedia.org/wiki/Array_programming).