Python For Finance
  • Home
  • Resources
  • Home
  • Resources
Python For Finance

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

    Data AnalysisPortfolio Optimisation

    Black-Litterman Portfolio Allocation Model in Python

    by s666 27 November 2020

    A while ago I posted an article titled “INVESTMENT PORTFOLIO OPTIMISATION WITH PYTHON – REVISITED” which dealt with the process of calculating the optimal asset weightings for a portfolio according to the classic Markowitz “mean-variance” approach. With this method we aim to maximise our level of return for any given level of risk, in doing so we develop the concept of an “efficient frontier” and usually seek to identify the point/portfolio on that frontier which represents the best trade-off between risk and return (i.e. the portfolio with the highest Sharpe Ratio).

    As nicely as the model allows us to identify our supposed “optimal asset weightings”, there are several, rather severe problems we face when using mean-variance optimisation.

    1. The model assumes asset returns are normally distributed.
    2. It can generate unintuitive, highly-concentrated portfolios.
    3. The inputs to the model include each individual asset’s predicted/expected return and volatility, but we of course can never know those values for certain. Common practice is to calculate the assets’ historic returns and standard deviations and use them as proxies – this makes the massive presumption that all the assets will continue to behave and perform just as they have done in the past. Not only does it assume the returns and volatility will remain the same, it also assumes that correlations between all the assets in question will remain stable through time. We know these assumptions are just not realistic.
    4. To make matters worse, not only do we use inputs that are reliant on our own “best guess” or forecasts, the model happens to be extremely sensitive to variations in these input values (especially to the return inputs, less so the volatility inputs). If the input values are changed, even by relatively small amounts, the optimal portfolio weightings created by the model can swing and vary wildly. Ideally we would like our model to be as “robust” as possible in this regard and generate stable/slowly changing suggested asset weightings when faced with changing input values.

    In this post I am going to take a look at the Black-Litterman model, which is an adaptation of the classic mean-variance framework which enables investors to combine their unique views regarding the performance of various assets with the market equilibrium in a manner that results in intuitive, diversified portfolios.

    Continue Reading
    27 November 2020 1 comment
    1 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Data AnalysisData Wrangling

    Build a Financial Data Database with Python

    by s666 24 October 2020
    by s666 24 October 2020

    Hi all, and welcome back to the site – I appreciate it has been an unexpectedly long time since I last posted…in fact my last post was around this time last year. Hopefully I can get back on the “treadmill” and churn out some articles at a somewhat faster rate than 1 a year over the next couple of months!…

    Read more
    1 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Data AnalysisTrading Strategy Backtest

    Equities Market Intraday Momentum Strategy in Python – Part 1

    by s666 23 October 2019
    by s666 23 October 2019

    For this post, I want to take a look at the concept of intra-day momentum and investigate whether we are able to identify any positive signs of such a phenomenon occurring across (quite a large) universe of NYSE stocks. It has been suggested that, for the wider market in general at least, there is a statistically significant intra-day momentum effect…

    Read more
    1 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Trading Strategy Backtest

    Modelling Bid/Offer Spread In Equities Trading Strategy Backtest

    by s666 13 October 2019
    by s666 13 October 2019

    In this blog post I wanted to run a couple of quick experiments to see how clearly I was able to highlight the importance of incorporating various elements and components into a backtest that I admittedly often overlook in most of my posts – that is I make the assumption that they will be dealt with by the reader at…

    Read more
    4 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Basic Data Analysis

    Time Series Decomposition & Prediction in Python

    by s666 22 July 2019
    by s666 22 July 2019

    In this article I wanted to concentrate on some basic time series analysis, and on efforts to see if there is any simple way we can improve our prediction skills and abilities in order to produce more accurate results. When considering most financial asset price time series you would be forgiven for concluding that, at various time frames (some longer,…

    Read more
    2 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Beginners ResourcesUncategorized

    Jupyter Notebook Python Extensions, Themes and Addons

    by s666 7 July 2019
    by s666 7 July 2019

    I thought today I would whip up a quick post regarding Jupyter Notebooks and how to download, install and use various “addons” that I like using and find more than just a little bit useful. Among other things I’ll show how to use the “jupyter-themes” module to change and manipulate the basic theme and styling of the overall notebook, I’ll…

    Read more
    1 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Basic Data Analysis

    Investment Portfolio Optimisation with Python – Revisited

    by s666 2 July 2019
    by s666 2 July 2019

    In this post I am going to be looking at portfolio optimisation methods, touching on both the use of Monte Carlo, “brute force” style optimisation and then the use of Scipy’s “optimize” function for “minimizing (or maximizing) objective functions, possibly subject to constraints”, as it states in the official docs (https://docs.scipy.org/doc/scipy/reference/optimize.html). I have to apologise at this point for my…

    Read more
    13 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Trading Strategy Backtest

    Ichimoku Trading Strategy With Python – Part 2

    by s666 27 June 2019
    by s666 27 June 2019

    This is part 2 of the Ichimoku Strategy creation and backtest – with part 1 having dealt with the calculation and creation of the individual Ichimoku elements (which can be found here), we now move onto creating the actual trading strategy logic and subsequent backtest. The Ichimoku approach concerns itself with two major elements – firstly the signals and insights…

    Read more
    3 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Trading Strategy Backtest

    Ichimoku Trading Strategy With Python

    by s666 26 June 2019
    by s666 26 June 2019

    I thought it was about time for another blog post, and this time I have decided to take a look at the “Ichimoku Kinko Hyo” trading strategy, or just “Ichimoku” strategy for short. The Ichimoku system is a Japanese charting and technical analysis method and was published in 1969 by a reporter in Japan. I thought I would spend this…

    Read more
    2 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Basic Data Analysis

    Python Monte Carlo vs Bootstrapping

    by s666 30 May 2019
    by s666 30 May 2019

    In this article I thought I would take a look at and compare the concepts of “Monte Carlo analysis” and “Bootstrapping” in relation to simulating returns series and generating corresponding confidence intervals as to a portfolio’s potential risks and rewards. Both methods are used to generate simulated price paths for a given asset, or portfolio of assets but they use…

    Read more
    2 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • 1
  • 2
  • 3
  • …
  • 5

Categories

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

About Me

About Me

I am a current PhD Computer Science candidate, a CFA Charterholder (CFAI) and Certified Financial Risk Manager (GARP) with over 16 years experience as a financial derivatives trader in London. I also hold an MSc in Data Science and a BA in Economics. 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

  • November 2020 (1)
  • October 2020 (1)
  • 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