WORK IN PROGRESS BY: H. Pandit
PROPHET-OF-WALLSTREET is a Python-based stock market analysis toolkit designed to predict stock prices and detect anomalies in financial time-series data. It integrates traditional statistical forecasting models (such as Facebook’s Prophet), deep learning architectures (like LSTM neural networks), and anomaly detection algorithms (such as Isolation Forest) into a cohesive pipeline. The goal is to empower investors, analysts, and researchers with a transparent, data-driven toolset for financial forecasting and risk assessment.
-
Time-Series Forecasting
Utilizes Facebook’s Prophet model to forecast future stock prices based on seasonal trends. Prophet handles missing data, outliers, and changepoints effectively. -
Deep Learning via LSTM
Applies Long Short-Term Memory (LSTM) neural networks to learn from historical stock price sequences and predict future trends. -
Anomaly Detection
Employs the Isolation Forest algorithm to flag data points that deviate significantly from the historical trend, helping detect potential manipulations or unusual market events. -
Data Preprocessing
Offers utilities for reading stock data, scaling numerical features, and generating training sequences for LSTM-based models. -
Visualization
Provides functions to visualize stock price trends and mark anomalies directly on the price chart for easier analysis.
Category | Tools/Frameworks |
---|---|
Language | Python 3.x |
Forecasting | Facebook Prophet |
Deep Learning | LSTM (TensorFlow/Keras or PyTorch recommended) |
ML/Anomaly Detection | Scikit-learn (Isolation Forest) |
Data Handling | Pandas, NumPy |
Visualization | Matplotlib |
Contains functions for:
load_stock_data(csv_path)
: Reads CSV file and sorts by date.scale_data(df, feature_cols)
: Normalizes selected features using MinMaxScaler.create_lstm_sequences(data, sequence_length)
: Generates input-output pairs for LSTM training from normalized sequences.
Provides anomaly detection functionality:
detect_anomalies(df, contamination=0.01)
: Applies Isolation Forest to flag anomalies.plot_anomalies(df)
: Visualizes anomalies on a line chart of closing prices.
A historical dataset containing:
date
,open
,high
,low
,close
,volume
Spans one year of daily stock prices (approx. 261 rows).
An additive time series forecasting model that handles daily, weekly, and yearly seasonality. Designed for interpretability and ease of use by business users.
A specialized form of recurrent neural network (RNN) capable of learning long-term dependencies. Ideal for sequential prediction tasks like stock price modeling.
An unsupervised learning algorithm for anomaly detection. Efficiently isolates outliers using an ensemble of randomly partitioned trees.
from preprocessing import load_stock_data, scale_data, create_lstm_sequences
df = load_stock_data("sample_stock_data.csv")
scaled_values, scaler = scale_data(df, feature_cols=["close"])
X, y = create_lstm_sequences(scaled_values, sequence_length=50)
from isolation_forest import detect_anomalies, plot_anomalies
df_with_scores = detect_anomalies(df, contamination=0.01)
plot_anomalies(df_with_scores)
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense
model = Sequential([
LSTM(64, input_shape=(50, 1)),
Dense(1)
])
model.compile(loss='mse', optimizer='adam')
model.fit(X, y, epochs=10, batch_size=32)
The tool produces:
- A time series plot of closing stock prices.
- Anomaly markers (in red) overlaid on the price trend.
- LSTM and Prophet forecasts (can be visualized separately as extensions).
- Python 3.8+
- Recommended packages:
pip install pandas numpy scikit-learn matplotlib tensorflow prophet
- Replace
sample_stock_data.csv
with your own stock data. - Call the preprocessing and modeling functions.
- Visualize anomalies or predictions using provided functions or Jupyter notebooks.
- Retail Investors: To identify abnormal price behavior and inform buy/sell decisions.
- Quant Researchers: As a base framework for algorithmic strategy development.
- Financial Advisors: To generate automated forecasts and anomaly reports.
- Risk Analysts: For detecting early warning signals of market manipulation or volatility.
- Not Financial Advice: This tool is for research and educational purposes.
- No Live Feed Integration: Requires CSV-based historical data input.
- Basic LSTM Model: Can be extended with additional features (e.g., technical indicators, macro data).
- No License Specified: Currently lacks an open-source license.
GNU GENERAL PUBLIC LICENSE Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Originally developed by H PANDIT
GitHub: MykeHaunt/PROPHET-OF-WALLSTREET