A full-stack stock market analytics and prediction platform built with Python and Streamlit.
Combines real-time market data, technical analysis, and ensemble machine learning to forecast next-day price trends.
MarketMantra web app - https://marketmantra-hckhdps.gamma.site/
Scan the QR code inside the app or visit the deployed link.
MarketMantra lets you pick any stock (NSE, BSE, NYSE, NASDAQ, crypto — anything on Yahoo Finance), set a date range, and instantly get:
- Historical price charts with interactive technical indicators
- ML-powered next-day trend prediction (Up / Down) with probability scores
- Portfolio & watchlist management across sessions
- ROI calculator — enter an investment amount and see what it's worth today (including dividends)
| Indicator | What It Tells You |
|---|---|
| 50-Day SMA | Short-term trend direction |
| 200-Day SMA | Long-term trend direction |
| MACD | Momentum & trend reversals |
| Stochastic Oscillator | Overbought / oversold signal |
| Bollinger Bands | Volatility & breakout zones |
| RSI | Relative strength (buy/sell signal) |
| Volume Chart | Buying vs. selling pressure |
MarketMantra trains four models in parallel and averages their predictions for a more robust signal:
- Random Forest
- Gradient Boosting
- XGBoost
- Decision Tree
Features used: previous close price, daily return percentage. Output: probability of an upward or downward move the next trading day.
Add any ticker to your portfolio or watchlist, track multiple positions, and remove them with one click — all persisted in your Streamlit session.
Input a start date and investment amount for any ticker. MarketMantra calculates final value, total return, return percentage, and cumulative dividends earned.
| Category | Tools |
|---|---|
| Language | Python 3.9+ |
| Web app | Streamlit |
| ML | scikit-learn, XGBoost |
| Data | Pandas, NumPy |
| Market data | yfinance, Requests |
| Visualization | Matplotlib, Plotly |
| Image | Pillow |
git clone https://github.com/Homosapien9/MarketMantra.git
cd MarketMantrapip install -r requirements.txtstreamlit run marketmantra.pyThe app opens in your browser at http://localhost:8501.
numpy
pandas
xgboost
yfinance
Pillow
streamlit
matplotlib
scikit-learn
plotly
requests
Install all at once:
pip install -r requirements.txtMarketMantra/
├── marketmantra.py # Main Streamlit application
├── requirements.txt # Python dependencies
├── Website qr.png # QR code for deployed web app
├── app QR.png # QR code for mobile app
└── README.md
- Select a stock — Enter any valid Yahoo Finance ticker (e.g.
^BSESNfor Sensex,AAPLfor Apple,BTC-USDfor Bitcoin) - Set a date range — Minimum 5 days of data required for the model to run
- Choose indicators — Select any combination of the 7 technical indicators to display
- View prediction — Head to the Predictions tab for next-day forecast with confidence percentages
- Manage your portfolio — Use the Portfolio and Watchlist tabs to track stocks
- Calculate ROI — Enter a start date and investment amount under the ROI tab
The ML pipeline:
- Pulls OHLCV data using
yfinance - Engineers two features:
Previous CloseandDaily Return - Creates a binary label: 1 if next day's close > today's close, else 0
- Normalises features with
StandardScaler - Splits 90/10 train/test
- Trains all four classifiers in parallel
- Averages predicted probabilities across models for the final signal
- Displays a confusion matrix and per-model accuracy selector
MarketMantra is an educational project. Nothing in this app constitutes financial advice. Past performance and model predictions do not guarantee future results. Always do your own research before making investment decisions.
Jeff (Homosapien9)
GitHub: @Homosapien9
If you found this useful, consider starring the repo — it helps others discover the project!