Lesson 1: Basic Stock Price Analysis on Jollibee Food Corp. (JFC)
Introducing fastquant, a tool for easy access and analysis of stock data
- fastquant lesson 1
- Introduction to fastquant
- Objectives and strategies
- Top down approach to lectures and package design
- Expect 1 - 2 lessons per month
- Course Outline (Part 1) - Backtesting Classic Technical Analysis Indicators
- Course Outline (Part 2) [TBD] - Building Advanced Indicators w/ Statistics & Machine Learning based Approaches + other financial indicators
- Setup
- Installation
- Get stock data from stock in 2 lines of code!
- Plot daily closing prices
- Analyze with a simple moving average crossover (SMAC) trading strategy
fastquant lesson 1
Introduction to fastquant
fastquant is a python package that allows you easily access stock data with as few as 2 lines of python code.
Its goal is to promote data driven investments by making quantitative analysis in finance accessible to everyone.
Objectives and strategies
1) Raise awareness, and guide beginners to get a sufficient foundation by teaching the basics of quant analysis with lectures presented via blog posts & online lectures
2) Make quant analysis simple and easy w/ a high level python API that allows for lower level configuration for more advanced users - development of an easy to use python package to facilitate data driven investments
Top down approach to lectures and package design
We start w/ immediate usefulness and then work towards “deep” understanding later as more experience is gained. This approach will be reflected in the design of the blog posts, lectures, and the fastquant package.
Expect 1 - 2 lessons per month
medium article + notebook -> webinar
Medium article + notebook takes 1-2 weeks, while webinar will take 1-2 weeks. So the pace will generally be 1-2 webinars per month.
Webinars will be recorded and posted as content on facebook/youtube.
Course Outline (Part 1) - Backtesting Classic Technical Analysis Indicators
1. Lecture 1: Accessing PSE data in 3 lines of code
1. Accessing PSE data in 3 lines of code
2. Plotting a basic SMAC strategy
3. The idea of backtesting
2. Lecture 2: Backtest your trading strategy with 5 lines of code
3. Lecture 3: Relative Strength Index (Intro + backtesting)
4. Lecture 4: Bollinger Bands (Intro + backtesting)
5. Lecture 5: Moving Average Convergence Divergence (Intro + backtesting)
6. Lecture 6: Backtesting multiple strategies at the same time
Course Outline (Part 2) [TBD] - Building Advanced Indicators w/ Statistics & Machine Learning based Approaches + other financial indicators
Setup
1. Let's make sure everyone gets Google Colab working
2. Show github and encourage people to make an account (if they want to contribute to fastquant).
3. Please star the repo if you find it useful! :)
!pip3 install fastquant
Get stock data from stock in 2 lines of code!
Here I demonstrate how to get the stock data of Jollibee (JFC is the stock symbol) from January 1, 2018 to January 1, 2019.
Please ensure that your date strings are in the format YYYY-MM-DD.
You can find a list of company names and PSE stock symbols here, and Yahoo Finance symbols here
from fastquant import get_stock_data
df = get_stock_data('JFC', '2018-01-01', '2019-01-01')
df.head()
help(get_stock_data)
from matplotlib import pyplot as plt
df.close.plot(figsize=(10, 6))
plt.title("Daily Closing Prices of JFC\nfrom 2018-01-01 to 2019-01-01", fontsize=20)
First, let's import the pandas library (general purpose library for handling tabular data).
import pandas as pd
Next, we calculate the 30 day moving average of Jollibee's closing price and combine it with the original closing price data.
ma30 = df.close.rolling(30).mean()
close_ma30 = pd.concat([df.close, ma30], axis=1).dropna()
close_ma30.columns = ['Closing Price', 'Simple Moving Average (30 day)']
ma30.dropna()
ma30.dropna().plot(figsize=(10, 6))
Lastly, we plot the trends for the daily closing prices and the 30 day SMA together
close_ma30.plot(figsize=(10, 6))
plt.title("Daily Closing Prices vs 30 day SMA of JFC\nfrom 2018-01-01 to 2019-01-01", fontsize=20)