Featured

A 8-post collection

Book Recommendations

Life and Mindset The New Psycho Cybernetics by Maxwell Maltz Think and Grow Rich by Napoleon Hill The 7 Habits of Highly Effective People by Stephen Covey Principles by Ray Dalio How to Fail at Almost Everything and Still Win Big by Scott Adams The 4 Hour Work Week by Tim Ferriss Business and Startups The Art of the Start by Guy Kawasaki The Effective Executive by Peter Drucker Turn The Ship Around!
Continue Reading...

Products that I recommend

Software development Visual Studio Code for HTML/CSS/JS/Python/Markdown/Text editing. Notepad++ for quickly making any edits to a text file, or when I want to see hidden characters Visual Studio for any .NET Core, and general C# work. Beyond Compare for file diffs. Git Bash for any command line work with Git, and as a general Windows command prompt. Sourcetree as an interactive Git browser, and for when I want to stage or diff files in a Git repo.
Continue Reading...

How to scrape Yahoo Finance and extract fundamental stock market data using Python, LXML, and Pandas

In this blog post I’ll show you how to scrape Income Statement, Balance Sheet, and Cash Flow data for companies from Yahoo Finance using Python, LXML, and Pandas.

I’ll use data from Mainfreight NZ (MFT.NZ) as an example, but the code will work for any stock symbol on Yahoo Finance.

The screenshot below shows a Pandas DataFrame with MFT.NZ balance sheet data, which you can expect to get by following the steps in this blog post:

After taking you step by step on how to fetch data from the balance sheet, I’ll show you how to generalise the code to also generate a DataFrame containing data from the Income Statement, and Cash Flow statement.

After creating the Pandas DataFrames, I’ll then show you how to scrape data for multiple symbols, and finally, export everything to an Excel file, so you’ll have output that looks something like this:

This post was last updated in April, 2020.

Prior to October, 2019, Yahoo Finance conveniently had all this data in a regular HTML table, which made extracting the data super easy. Since then, they’ve updated the page with a new structure, which was a wee bit tricker to get the data from. Fortunately, it’s still possible. Read on to find out how.

Continue Reading...

Google Authentication with Python and Flask

In this blog post, you will learn how to create a Python app using Flask and the Google API which will:

  • Support Google Authentication with Python and Flask
  • Restrict access via an OAuth scope, so that the app can only view and manage Google Drive files and folders which were created by the app
  • Read and write files on the user’s Google Drive with Python.

By the time you get to the end of this blog post, you’ll have built a basic Google Drive file browser which looks something like:

OAuth Google Drive Scope

This blog post is divided up into sections which progressively build up an app which interacts with the user’s Google Drive. If you only want to find out about how to do user Authentication with Google and Python, feel free to stop there.

Continue Reading...

A Basic Stock Trading Backtesting System for F# using Ta-Lib and FSharp.Data

This article is written for the intermediate F# audience who has a basic familiarity of stock trading and technical analysis, and is intended to show the basics of implementing a backtesting system in F#.

If you’re an F# beginner it may not take too long for you to get up to speed on the concepts if you check out a few resources. In particular:

The backtesting strategy which you will implement is a simple SMA crossover where the fast line is 10 bars and the slow one 25. When the fast line crosses above the slow line, a buy signal will be triggered, and when the fast line cross below the slow line, a sell signal will be triggered. Only one long position will exist at any time, so the system will not trigger another buy order until after the long position is sold.

Continue Reading...

Wellington Spearfishing

A collection of links, with a Wellington focus, which I frequently use to work out if it’s worth going for a dive or not.

Feel free to get in touch if you have any links worth adding.

Webcams

Beacon Hill Webcam

Forecasts

MetService - 5 day forecast for Wellington

MetService - 10 day forecast for Wellington

Swellmap - Surf Forecast Conditions and Marine Weather

Windy - Interactive wind forecast maps

Tides

Tideschart - Wellington

Maps

Cawthron Eye - Satellite view

LINZ - Hydrographic raster chart

Water Quality

Shellfish Biotoxin Alerts

Wellington Water Quality

Continue Reading...