Python For Finance
  • Home
  • Resources
  • Contact Us
  • Home
  • Resources
  • Contact Us
Python For Finance

Python, finance and getting them to play nicely together...

    Trading Strategy Backtest

    Mean Reversion Pairs Trading With Inclusion of a Kalman Filter

    by s666 July 4, 2018

    In this article we are going to revisit the concept of building a trading strategy backtest based on mean reverting, co-integrated pairs of stocks. So to restate the theory, stocks that are statistically co-integrated move in a way that means when their prices start to diverge by a certain amount (i.e. the spread between the 2 stocks prices increases), we would expect that divergence to
    eventually revert back to the mean. In this instance we would look to sell the outperforming stock,and buy the under performing stock in our expectance that the under performing stock would eventually “catch up” with the overpeforming stock and rise in price, or vice versa the overperforming stock would in time suffer from the same downward pressure of the underperforming stock and fall in relative value.

    Hence, pairs trading is a market neutral trading strategy enabling traders to profit from virtually any market conditions: uptrend, downtrend, or sideways movement.

    Continue Reading
    July 4, 2018 59 comments
    0 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Basic Data Analysis

    Replicating Excel Functionality in Pandas

    by s666 June 30, 2018
    by s666 June 30, 2018

    This article is aimed at showing how to replicate some common Excel tasks using Python and the Pandas library. The point and click interface of Excel means the learning curve is somewhat lesssteep than it is for using Pandas – however once a certain level of proficiency is met when using Pandas, the possibilities presented are far greater than you…

    Read more
  • Basic Data Analysis

    Trading Strategy Analysis using Python and the FFN Package – Part 2

    by s666 March 15, 2018
    by s666 March 15, 2018

    Hi all, this is the second part to the “Trading Strategy Analysis using Python and the FFN Package” post (the first part can be found here). Last time we went over the use of the “PerformanceStats” object in ffn, whereas this time I want to concentrate on the “GroupStats” object. The former is for use with single series of data,…

    Read more
  • Basic Data Analysis

    Trading Strategy Analysis using Python and the FFN Package – Part 1

    by s666 February 27, 2018
    by s666 February 27, 2018

    In this post I will be reviewing and running through examples of using the brilliant python module, “ffn – Financial Functions for Python“, which has been created by Philippe Morissette and released on the MIT license. The github page can be found here (http://pmorissette.github.io/ffn/index.html) The module helps quickly carry out analysis of trading strategies and financial asset price series/history. It…

    Read more
  • Basic Data Analysis

    Stock Clusters Using K-Means Algorithm in Python

    by s666 February 8, 2018
    by s666 February 8, 2018

    For this post, I will be creating a script to download pricing data for the S&P 500 stocks, calculate their historic returns and volatility and then proceed to use the K-Means clustering algorithm to divide the stocks into distinct groups based upon said returns and volatilities. So why would we want to do this you ask? Well dividing stocks into groups…

    Read more
  • Uncategorized

    Stock Return Heatmap using Seaborn

    by s666 February 7, 2018
    by s666 February 7, 2018

    Hi all, this post is going to be a relatively short and to the point run through of creating an annotated heatmap for the Dow 30 stock returns using the Python Seaborn package. Let’s start with what is a heatmap actually is; it’s defined as “a representation of data in the form of a map or diagram in which data…

    Read more
  • Trading Strategy Backtest

    Stochastic Oscillator Trading Strategy Backtest in Python

    by s666 October 10, 2017
    by s666 October 10, 2017

    I thought for this post I would just continue on with the theme of testing trading strategies based on signals from some of the classic “technical indicators” that many traders incorporate into their decision making; the last post dealt with Bollinger Bands and for this one I thought I’d go for a Stochastic Oscillator Trading Strategy Backtest in Python. Let’s…

    Read more
  • Trading Strategy Backtest

    Bollinger Band Trading Strategy Backtest in Python

    by s666 July 31, 2017
    by s666 July 31, 2017

    So, after a long time without posting (been super busy), I thought I’d write a quick Bollinger Band Trading Strategy Backtest in Python and then run some optimisations and analysis much like we have done in the past. It’s pretty easy and can be written in just a few lines of code, which is why I love Python so much…

    Read more
  • Trading Strategy Backtest

    Intraday Stock Mean Reversion Trading Backtest in Python With Short Selling

    by s666 February 21, 2017
    by s666 February 21, 2017

    Carrying on from the last post which outlined an intra-day mean reversion stock trading strategy, I just wanted to expand on that by adapting the backtest to allow short selling too. So as well as buying stocks that have gapped down, we will be allowing the strategy to short sell stocks that have gapped up. I was interested as to…

    Read more
  • Trading Strategy Backtest

    Intraday Stock Mean Reversion Trading Backtest in Python

    by s666 February 20, 2017
    by s666 February 20, 2017

    After completing the series on creating an inter-day mean reversion strategy, I thought it may be an idea to visit another mean reversion strategy, but one that works on an intra-day scale. That is, we will be looking for the mean reversion to take place within one trading day. Stock prices tend to follow geometric random walks, as we are…

    Read more
  • 1
  • 2
  • 3
  • 4
  • 5

Categories

  • Basic Data Analysis (20)
  • Beginners Resources (9)
  • Data Analysis (1)
  • Trading Strategy Backtest (24)
  • Uncategorized (2)

About Me

About Me

I am a CFA Charterholder (CFAI) and Certified Financial Risk Manager (GARP) with over 16 years experience as a financial derivatives trader in London. Finance / Machine Learning / Data Visualization / Data Science Consultant I am mostly interested in projects related to data science, data visualization, data engineering and machine learning, especially those related to finance.

Hire Me on People Per Hour

Python Blogs

Archives

  • October 2019 (2)
  • July 2019 (3)
  • June 2019 (2)
  • May 2019 (1)
  • April 2019 (2)
  • February 2019 (1)
  • January 2019 (5)
  • December 2018 (1)
  • September 2018 (1)
  • July 2018 (3)
  • June 2018 (1)
  • March 2018 (1)
  • February 2018 (3)
  • October 2017 (1)
  • July 2017 (1)
  • February 2017 (2)
  • January 2017 (2)
  • December 2016 (1)
  • November 2016 (1)
  • September 2016 (2)
  • July 2016 (2)
  • May 2016 (1)
  • April 2016 (4)
  • March 2016 (4)
  • Facebook
  • Twitter
  • Linkedin
  • Github
  • Stack-Overflow
  • Reddit
Footer Logo

@2019 - All Rights Reserved PythonForFinance.net

SiteLock


Back To Top