Using Python to Analyse Financial Markets

Abstract: We begin by exploring the open source Python ecosystem for data analysis. We give a summary of the major libraries for time series analysis, machine learning, visualisation, natural language processing and market data. We discuss both commonly and less commonly known libraries. We discuss the links between solving data science problems and developing trading strategies. We present an open source Python based ecosystem for analysing financial markets, introducing the open source Python libraries chartpy (for visualisation with multiple backends including plotly, matplotlib and bokeh), findatapy (for accessing market data from many sources including Quandl and Bloomberg) and finmarketpy (for market analysis and backtesting of trading strategies). We discuss how abstraction has been used in these libraries to enable users to focus on solving the problem (finding profitable trading strategies) rather than grappling with low level APIs for visualisation and accessing market data. In the last section of the talk, we do several live Python demos and tutorial examples. We show how to quickly download market data using findatapy, in an interactive example, as well as plotting market data in multiple libraries like plotly, bokeh and matplotlib, by changing a single keyword. We also show how to visualise market data quickly with GPU acceleration with just a few lines of code and create animations of FX vol surfaces over major data events (such as Brexit). We present code to show how to do backtest of a trading strategy using finmarketpy. We also show how redis can be used to cache market data to significantly speed up analysis of market data.

Bio: Saeed Amen is the founder of Cuemacro. Over the past decade, Saeed Amen has developed systematic trading strategies at major investment banks including Lehman Brothers and Nomura. Independently, he is also a systematic FX trader, running a proprietary trading book trading liquid G10 FX, since 2013. He is also the author of Trading Thalesians: What the ancient world can teach us about trading today (Palgrave Macmillan). Through Cuemacro, he now consults and publishes research for clients in the area of systematic trading. His clients have included major quant funds and data companies such as RavenPack and TIM Group. He is also a co-founder of the Thalesians.