dualdatarate/ipoFastApi
0
IPO Classifier
ML-based cluster classification for Indian Mainboard IPOs — a data-driven alternative to Gray Market Premium (GMP) speculation.
Instead of relying on GMP (which is unregulated and easily manipulated), this matches an upcoming IPO against historical cluster profiles built from 6 years of Mainboard IPO data.
How It Works
Input fields (subscription data, reservations, recommendations, issue size)
↓
Pydantic validation + computed features
↓
StandardScaler → UMAP (dimensionality reduction) → K-Means clustering
↓
Cluster profile lookup → historical outcome distribution + avg listing gainThe model was trained on 100+ scraped fields, reduced to ~30 high-correlation features, across 6+ years of Mainboard IPO history.
Cluster Profiles
Hit GET / on the running API to see the current cluster breakdown:
{
"0": { "Stonks": "61.5%", "Hmm": "23.1%", "Meh": "7.7%", "Loss": "7.7%", "Avg Gain": "34.2%", "Sample Size": 26 },
"1": { ... }
}Outcome buckets: Loss (<0%), Meh (0–10%), Hmm (10–25%), Stonks (>25% listing gain).
Project Structure
├── api.py # FastAPI app — POST /test to classify, GET / for cluster profiles
├── model.py # Pydantic input schema (EntryStruct) with computed fields
├── preprocess_data.py # StandardScaler transform → UMAP → cluster prediction
├── frontend.py # Streamlit UI for entering IPO details
├── frontHome.py # Streamlit homepage showing cluster profiles
├── get_schema.json # JSON schema used to generate model.py fields
├── models.pkl # Serialised pipeline: K-Means + UMAP + scaler (not in repo — generate below)
└── ipo_history.pkl # Training data — 6 years of scraped Mainboard IPO history (not in repo)Setup
git clone https://github.com/sunny9n9/MainboardIpoClustering
cd MainboardIpoClustering
pip install -r requirements.txtmodels.pkl and ipo_history.pkl are not committed (size). To regenerate the model, run your training notebook/script that produces these two files, then place them in the project root.
Run the API:
uvicorn api:app --reloadRun the frontend:
streamlit run frontHome.pyTech Stack
- FastAPI — REST API
- Streamlit — frontend
- scikit-learn — K-Means, StandardScaler
- umap-learn — dimensionality reduction
- Pydantic v2 — input validation and computed fields
- pandas / numpy — data handling
