Quantification of the efficiency of trading ETH/BTC or LTC/BTC using simple moving averages
This notebook shows the process of investigating the price history of Bitcoin, Ethereum and Litecoin using Simple Moving Averages (SMAs).
I noticed that the 7 day and 30 day SMAs would cross each other occasionally, and I wondered how profitable it would be to use this as a trading strategy.
I generate a heat map to show how profitability varies across different pairs of SMAs.
For a given SMA pair I show the trading algorithms performance between two dates.
Setup and import data¶
Setup involves importing the python packages required and changing the default notebook settings. I use Plotly figures rather than a simpler method of visualising data and whilst creating the notebook I use the offline Plotly options. If I use other visualisation packages I’ll set figures to appear below the code cell that called the plot command.
The price data is downloaded from Quandl. In order to keep my Quandl and Plot.ly credentials private, I keep my account credentials in a separate .py file.
The Pickle package and get_data() functions are used to download Quandl data only once and then store it locally in a .pkl file. This is quicker than downloading it every time I (re)run the notebook.
## Setup - libraries %matplotlib inline import os import pickle import quandl import matplotlib.pyplot as plt import pandas as pd import datetime as dt import numpy as np import credentials # keep my quandl and plot.ly api keys private import plotly #import plotly.offline as py import plotly.plotly as py import plotly.graph_objs as go import plotly.figure_factory as ff #py.init_notebook_mode(connected=True) plotly.offline.init_notebook_mode() #from mpl_toolkits.mplot3d import Axes3D