
Updated resource link inside
2024 Update:
Pandas data reader may no longer work for you. If this is the case, replace the below code in the stratmanager.py file:
...
# # Extract data (OLD)
# def _extract_data(self, symbol, start_date, end_date):
# from pandas_datareader.data import DataReader
# data = DataReader(name=symbol, data_source='yahoo', start=start_date, end=end_date)
# data = data[["Open", "High", "Low", "Close", "Volume"]]
# data = self._structure_df(data)
# return data
# Extract data (New)
# !pip install yfinance==0.2.36
def _extract_data(self, symbol, start_date, end_date):
tickerData = yf.Ticker(symbol)
data = tickerData.history(period='1d', start=start_date, end=end_date)
data = data[["Open", "High", "Low", "Close", "Volume"]]
data = self._structure_df(data)
return data
...
Notice that we are using finance version 0.2.36 as shown in the comment above.
Explore how machine learning, a branch of AI, uses data and algorithms to imitate learning, covering unsupervised, supervised, and reinforcement learning, clustering and dimensionality reduction for trading.
Begin with data ingestion and feature engineering, then select and train models using supervised or unsupervised methods. Assess performance, guard against overfitting, and prepare models for future predictions.
Use Google Colab as an out-of-the-box coding environment with notebooks and code cells, install packages with pip, and compare Colab with Jupyter notebooks when local setups fail.
Fetch stock data in Google Colab using Yahoo Finance as a pandas data reader fallback, install yfinance, and download data with start and end dates, including adjusted close.
Create and activate a conda environment for ml trading, install packages via conda or pip using provided requirements files, and prepare a code directory with notebooks.
Where to get data
Master Python basics by learning variables (integers, floats, strings, booleans), operators, and lists or arrays, then work with NumPy and PyTorch tensors in Jupyter notebooks.
Master Pandas data frame manipulation for stock data by copying frames, dropping columns, selecting rows with iloc, and creating conditional targets from a future shift while iterating over rows.
Extract close prices from a dataframe, convert to array or list, modify them (divide by two), and save or load the updated dataframe with to_csv and read_csv.
Learn to backtest in pandas, using moving averages and signals to compare returns with a buy-and-hold benchmark, and understand data extraction, feature adjustments, and price assumptions to avoid look-ahead bias.
Learn practical feature engineering and data preprocessing for regression models predicting house prices. Encode numeric data with label and one hot encoding, handle nulls, and prepare Sydney prices for modeling.
Explore unsupervised learning in finance, using hidden Markov models with Gaussian emissions, K means clustering, and principal component analysis to detect regimes and cluster assets for trading strategies.
Explore unsupervised learning with hidden Markov models to identify market regimes using returns and range data in Python, via Jupyter notebooks or Colab, with real stock data.
Train a four-state hidden Markov model on SPI data from 2017 to 2022 to reveal hidden market regimes, then visualize states and analyze means and covariances.
Visualize market regimes with hidden states by coloring price charts according to four states, then align data arrays, plot overlays, and discuss rule-based or supervised learning strategies.
Apply hidden Markov models to stock data by structuring a dataset with returns, range, and moving averages. Split dataset into training and test sets to validate unsupervised learning in trading.
Train hidden Markov models on stock data, generate predictions for train and test sets, and embed the results in a dataframe with open, adjusted close, returns, and moving averages.
Develop a backtest with moving average signals (ma12 vs ma21) and hidden Markov model states to generate trade signals and evaluate against a benchmark.
Engineer features from ETF returns and volatility using percent-change means and std-based volatility, scale with StandardScaler, and apply K-means clustering to group similar assets.
Visualize co-integrated assets with a tsne plot to reveal their relationships in a 2d space. Filter assets by co-integration and interpret the resulting clusters for insights.
Select pairs via k-means clustering and co-integration, then compute the spread with a hedge ratio and monitor the z-score to signal mean-reverting trades.
Reduce dimensionality by transforming many features into principal components, retaining about 80% of information. Use about eight components to reveal correlations and support supervised learning, though interpretation remains limited.
Import and setup unsupervised learning tools, perform data extraction from the VIX via Yahoo Finance, and apply feature engineering with TA indicators to prepare for principal component analysis.
Apply PCA-inspired data preprocessing to stock and crypto data by turning non stationary features into stationary using percentage change, detected via p-values and t-tests.
Learn how to preprocess stock and crypto data, set a supervised learning target, apply scaling, and perform a train-test split before applying PCA for dimensionality reduction.
Apply principal component analysis to reduce 80 features to a few components, preserve about 80% of the information, and visualize the results to gauge predictability for stock and crypto trading.
Leverage unsupervised learning with hidden Markov models, K means clustering, and principal component analysis to uncover hidden regimes and identify co-integrated assets for statistical arbitrage or pairs trading.
Explore the theory behind random forests and XGBoost, including bagging versus boosting, bootstrapping, feature selection, performance evaluation, and strategies to prevent overfitting for stock and crypto trading data.
Set up a supervised machine learning workflow for Bitcoin volatility trading, ingest btc usd data, compute returns and range, perform data preprocessing, and begin feature engineering for move-based strategies.
Learn feature expansion for stock and crypto data using RSI, 12- and 21-day moving averages, day of week, rolling returns and range, plus time-step features for XGBoost preprocessing.
Apply XGBoost to perform feature selection and data preprocessing for predicting bitcoin's price move, using train-test split, cross-validation, and hyperparameter tuning.
Train a classification model with xgb, set and tune hyperparameters, and fit on the training data while evaluating using cross-validation to assess accuracy and precision, and explore feature importance.
Explore evaluating an XGBoost model for stock and crypto trading by visualizing feature importance and the decision tree, tuning hyperparameters, and assessing precision and ROC performance for informed predictions.
Explore how a neural network uses input features, weights, biases, and activation functions to produce predictions through hidden and output layers, with loss and backpropagation tuning weights.
Learn how to build a PyTorch neural network for stock and crypto trading, focusing on data extraction, feature engineering, preprocessing, and training to predict the one-day-ahead spread direction.
Split the data into X and y, apply a standard scaler to features, and prepare the neural network inputs by using log returns while noting asset prices and returns.
Set up and train a neural network with hyperparameters, use binary cross-entropy loss and AdamW optimizer, then run a forward loop to monitor accuracy and loss.
Gain an edge in financial trading through deploying Machine Learning techniques to financial data using Python. In this course, you will:
Discover hidden market states and regimes using Hidden Markov Models.
Objectively group like-for-like ETF's for pairs trading using K-Means Clustering and understand how to capitalise on this using statistical methods like Cointegration and Zscore.
Make predictions on the VIX by including a vast amount of technical indicators and distilling just the useful information via Principle Component Analysis (PCA).
Use one of the most advanced Machine Learning algorithms, XGBOOST, to make predictions on Bitcoin price data regarding the future.
Evaluate performance of models to gain confidence in the predictions being made.
Quantify objectively the accuracy, precision, recall and F1 score on test data to infer your likely percentage edge.
Develop an AI model to trade a simple sine wave and then move on to learning to trade the Apple stock completely by itself without any prompt for selection positions whatsoever.
Build a Deep Learning neural network for both Classification and receive the code for using an LSTM neural network to make predictions on sequential data.
Use Python libraries such as Pandas, PyTorch (for deep learning), sklearn and more.
This course does not cover much in-depth theory. It is purely a hands-on course, with theory at a high level made for anyone to easily grasp the basic concepts, but more importantly, to understand the application and put this to use immediately.
If you are looking for a course with a lot of math, this is not the course for you.
If you are looking for a course to experience what machine learning is like using financial data in a fun, exciting and potentially profitable way, then you will likely very much enjoy this course.