A blog about data analysis and modelling, quantitative finance, programming and trading.

Seeing the world through the lens of data


  • Python Trading Toolbox: A gentle introduction to backtesting

    We started this series by introducing some indicators based on price. Our goal is to use indicators, along with price and volume, to make investment decisions: to choose when to buy or sell a financial asset. There are different ways we can incorporate price, volume, and indicators in our investment decision process. The first, the most traditional, is to interpret their patterns in a discretional way, as followers of Technical Analysis do. Indicators can also be employed in a more quantitative approach as building blocks of a trading system that removes human discretion from the investment process. Algorithmic Trading, in particular, is an approach based on trading strategies that take positions in financial instruments on their own without human intervention. We can also use price, volume, and indicators as part of a more complex machine learning model for our investment decisions.

  • Python Trading Toolbox: step up your charts with indicator subplots

    After a several months-long hiatus, I can finally resume posting to the Trading Toolbox Series. We started this series by learning how to plot indicators (specifically: moving averages) on the top of a price chart. Moving averages belong to a wide group of indicators, called overlay indicators, that share the same scale as the price and can, therefore, be plotted on the same chart. Other technical indicators, however, do not have this advantage and we need to plot them on a separate area, sometimes called a subplot.

  • Python Trading Toolbox: introducing OHLC charts with Matplotlib

    In the first two posts of the Financial Trading Toolbox Series, we started exploring how to compute some basic indicators based on price (simple moving averages and other moving averages) and how to plot them on a chart together with the price. In those examples, we considered daily price data and used the closing price to represent each day of trading. Quite obviously, financial instruments trade throughout the whole day generating more than one price. The closing price is one of the most relevant prices but does not tell the whole story of what happened during the trading day.

  • Pandas Comes of Age

    Pandas 1.0 has been released. The popular data analysis and manipulation library for Python has become, since its first release in 2008, an industry standard adopted by data scientist as one of their main tools. It has undoubtedly contributed to elevate Python as the mainstream language for data science and analysis. However, its first official major version was released only yesterday, 12 years after its first minor version, and the documentation was made available on a newly redesigned website.

  • Matplotlib OHLC and Candlestick Charts Get a Revamp

    Matplotlib enables Python users to create beautiful and publication quality data visualizations. However, the capability to create OHLC and candlestick charts has so far been limited. The mpl-finance library, the Matplotlib component that takes care of drawing those charts, had been deprecated and relegated to a separate and, until recently, neglected package.

  • Python Trading Toolbox: Weighted and Exponential Moving Averages

    In the first article of the Financial Trading Toolbox series (Building a Financial Trading Toolbox in Python: Simple Moving Average), we discussed how to calculate a simple moving average, add it to a price series chart, and use it for investment and trading decisions. The Simple Moving Average is only one of several moving averages available that can be applied to price series to build trading systems or investment decision frameworks. Among those, two other moving averages are commonly used among financial market analysts:

  • Building a Financial Trading Toolbox in Python: Simple Moving Average

    Python, with its powerful data analysis package pandas, has taken the financial markets analysis world by storm. It enables researchers to perform sophisticated analysis that once required dedicated and expensive packages.

subscribe via RSS