Skip to content

Markov Model for Stocks in Python. Clustering in Time Series data | Model Development | Stochastic Models

Notifications You must be signed in to change notification settings

s1dewalker/Markov-Model-for-Stocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

Markov Model for Stocks

Description


Building Markov Model for Stocks after applying Clustering to Time Series data in Python


1. Applying k-means clustering to identify market states

  1. Data Preparation
  2. Feature Preparation
  3. Check for Multicollinearity
  4. Normalize (as some features might dominate due to larger scale) w/ MinMaxScaler
  5. Finding Optimal k w/ WCSS or elbow method
  6. Perform Silhouette analysis for different k
  7. Fit the model and identify the clusters
  8. Analyzing clusters
  9. Analyzing each cluster

Finding Optimal k with elbow method

Description


Pairwise Feature Relationships by Cluster

Description



Python libraries used: pandas, yfinance, sklearn, matplotlib, seaborn


2. Building Markov Model to create a Transition matrix

  1. Get previous state
  2. Create Transition State by combining previous and present states
  3. Grouping by Transition state and Counting their occurrences
  4. Separate the transition state
  5. Create Markov transition matrix
  6. Convert to row-wise percentages (%)

Description



Python libraries used: pandas

About

Markov Model for Stocks in Python. Clustering in Time Series data | Model Development | Stochastic Models

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published