Skip to main content

Learn how to code with Python - Lesson 5 - Basics wrapup

Basic code wrapup
Basic code?
In this lesson I bring together the few basics discussed in the previous videos and this video. To do this I will discuss one more important principle in programming and that is:


I have already introduced some datatypes like strings, integers and floats. But there are more types you need to know about before we can continue.


A built-in Python sequence. Despite its name it is more akin to an array in other languages than to a linked list since access to elements are O(1).


An associative array, where arbitrary keys are mapped to values. The keys can be any object with __hash__() function and __eq__() methods. Called a hash in Perl.


tuple is an immutable sequence type, as documented in Sequence Types — str, bytes, bytearray, list, tuple, range.

Popular posts from this blog

How to install Google Drive Sync on Ubuntu 16.04 and higher

Google drive is one of the many handy tools Google offers. It is a file synchronization tool that allows you to backup, store and share and access files in the cloud. I use it to collaborate on files with others or to sync movies that I can then easily publish on Youtube.

Unfortunately there is no native Google drive software for Linux Desktops. Luckily there is a way to have a proper sync setup on Ubuntu 16.04 and higher that uses the Google drive API and some Gui tools. Let me show you how I have this installed on my Ubuntu Desktop.

First I install the Grive2 commandline tool:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive

No need to set it up right now. Instead let's first install grive-tools. This is a package that is only available up to Ununtu Vivid, but I have found that is works just the same on Ubuntu 16.04
Run the following from a terminal:

sudo su -c "nano /etc/apt/sources.list.d/thefanclub*.list"
deb http://ppa.lau…

Exploring pair trading opportunities with yahoo, python and LibreOffice

I have been reading two books about quantative and algorithmic trading by Ernie Chan:
Quantitative Trading: How to Build Your Own...Algorithmic Trading: Winning Strategies and... See the books page for my reading recommendations.

One of the main take aways of this reading is the insight that it is possible to create stationary pairs by shorting and longing two, or more equities that usually move in tandem. The idea is to arbitrage the oscillating differences in moves between the equities in the pairs. Mr Chan explains all the mathematics behind mean reversion and provides Matlab code do the necessary calculus.

How to back test a manually traded strategy using TradingView

Trading is hard. It takes a lot of practice. One way to practice and build skill and confidence is to back test a system over and over again. In this video I show you how I do this using online charts at Tradingview.