• Home
  • Resources
  • Forums
  • Contact Us
Python For Finance
Python, finance and getting them to play nicely together...
    Basic Data AnalysisData Analysis

    Create a Personal Portfolio/Wealth Simulation in Python (Part 2)

    by Stuart Jamieson 18 July 2021
    written by Stuart Jamieson

    Welcome to Part 2 of the series of posts dealing with how to build your own python based personal portfolio /wealth simulation model. At the end of the first post (which can be found here), we got to the point where we had modelled some inflows, some outflows, we had applied an annual salary raise to our future income flows, along with applying various tax rates to both our active income (salary) and investment income.

    We had also factored in a stochastic element to our model for generating investment returns, using the historic mean monthly return and volatility of the S&P Total Return index as a proxy for the “market”. Finally, we had ended by adding a couple of lines of code that would record whether our wealth/asset value were reduced to (or below) zero at any point throughout the simulated time period; we will be using this later to help calculate our “risk of ruin”, i.e. attach probabilities to the likelihood of ending up with assets worth less than a threshold value (one that we deem unacceptable to fall below – which doesn’t have to be zero of course).

    The full code snippet from the end of Part 1 is shown below for convenience (I have altered some of the outflow and inflow values back to their original levels just fyi). IMPORTANT: I have also had to include the use of the yfinance package to allow the over-riding of the Pandas DataReader package as at the time of writing, Pandas DataReader is currently not stable and essentially not working. The code changes are commented below to help identify them more easily.

    Continue Reading
    18 July 2021 0 comment
    4 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Data AnalysisPortfolio OptimisationTrading Strategy Backtest

    Create a Personal Portfolio/Wealth Simulation in Python

    by Stuart Jamieson 13 June 2021
    by Stuart Jamieson 13 June 2021

    This post will introduce the first part (of multiple) where we build up a personal finance model to help simulate future time periods based on certain chosen input variables. We will input variables such as our current investable asset base, our annual salary, expected monthly inflows and outflows and a range of other relevant values. Firstly, after our necessary imports,…

    Read more
    2 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Data AnalysisPortfolio Optimisation

    Black-Litterman Portfolio Allocation Model in Python

    by Stuart Jamieson 27 November 2020
    by Stuart Jamieson 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…

    Read more
    1 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Data AnalysisData Wrangling

    Build a Financial Data Database with Python

    by Stuart Jamieson 24 October 2020
    by Stuart Jamieson 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
    6 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Data AnalysisTrading Strategy Backtest

    Equities Market Intraday Momentum Strategy in Python – Part 1

    by Stuart Jamieson 23 October 2019
    by Stuart Jamieson 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
    4 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Trading Strategy Backtest

    Modelling Bid/Offer Spread In Equities Trading Strategy Backtest

    by Stuart Jamieson 13 October 2019
    by Stuart Jamieson 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 Stuart Jamieson 22 July 2019
    by Stuart Jamieson 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
    3 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Beginners ResourcesUncategorized

    Jupyter Notebook Python Extensions, Themes and Addons

    by Stuart Jamieson 7 July 2019
    by Stuart Jamieson 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 Stuart Jamieson 2 July 2019
    by Stuart Jamieson 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
    14 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • Trading Strategy Backtest

    Ichimoku Trading Strategy With Python – Part 2

    by Stuart Jamieson 27 June 2019
    by Stuart Jamieson 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
    6 FacebookTwitterPinterestLinkedinRedditWhatsappTelegramEmail
  • 1
  • 2
  • 3
  • …
  • 6

Categories

  • Basic Data Analysis (21)
  • Beginners Resources (9)
  • Data Analysis (5)
  • Data Wrangling (1)
  • Portfolio Optimisation (2)
  • Trading Strategy Backtest (25)
  • 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

  • July 2021 (1)
  • June 2021 (1)
  • 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
  • Discord
Footer Logo

@2019 - All Rights Reserved PythonForFinance.net

SiteLock


Back To Top
Python For Finance
  • Home
  • Resources
  • Forums
  • Contact Us
 

Loading Comments...