You know that feeling when you want to learn stock trading but don't want to risk actual money? Or when you want to test a trading strategy without losing your savings? That's exactly what inspired me to build NSE Live Terminal—a full-featured paper trading simulator for Indian stocks, and I'm making it open-source for everyone.
What is NSE Live Terminal?
NSE Live Terminal is a real-time stock market simulation dashboard where you can:
- 🛒 Execute market buy/sell orders on 12 major Indian stocks
- 📊 Watch live intraday charts powered by Plotly
- 💼 Track your portfolio with real-time P&L calculations
- 🏆 Compete on a live leaderboard with other traders
- ⚡ Get data refreshed every 15 seconds automatically
The best part? You start with ₹1 Crore (10 million rupees) in virtual cash—plenty to experiment!
Why I Built This
Paper trading is criminally underrated. Most people dive into real stock trading without practicing first. But there's a disconnect:
- Traditional paper trading apps are boring or behind paywalls
- You don't get real-time data for Indian stocks
- Building your own means you actually understand how markets work
So I decided to build one that's modern, interactive, and free.
The Tech Stack (It's Simpler Than You Think)
Frontend: Streamlit (Python UI framework)
Database: SQLite3 (Local file-based DB)
Data Source: Yahoo Finance (yfinance SDK)
Charting: Plotly
Deployment: Railway (Docker containerized)
Why these choices?
- Streamlit: Zero frontend knowledge required. Deploy in 5 minutes.
- SQLite: No backend server. Perfect for projects that don't need scaling.
- yfinance: Free real-time stock data for NSE instruments.
- Plotly: Beautiful, responsive charts with minimal code.
- Railway: Dead simple Docker deployment with a free tier.
Core Features Breakdown
1️⃣ Authentication (Clean & Simple)
# User enters nickname + 4-digit PIN
# Auto-creates account on first login
# All data stored locally in SQLite
No email verification nonsense. Just pick a username and PIN. Instant access.
2️⃣ Live Trading Engine
# Real-time price from yfinance
# Buy/Sell execution with balance validation
# Auto-calculates average buy price
# Instant P&L computation
When you buy stocks, the app automatically calculates your average cost basis. When you sell, it updates your portfolio and shows you profit/loss instantly.
3️⃣ The 12-Stock Universe
We track these major Indian blue-chips:
- Tech: TCS, Infosys
- Banking: HDFC Bank, ICICI Bank, SBI
- Energy/Infra: Reliance Industries, Adani Ports, NTPC
- Auto: Maruti Suzuki, M&M
- Consumer: ITC, Hindustan Unilever
Why just 12? Focus > chaos. These are the most liquid, most traded stocks on NSE—perfect for learning.
4️⃣ Real-Time Charts
# 5-minute interval data over last 5 days
# Plotly automatically crops to tight boundaries
# No flat lines, no empty space
# Updates every 15 seconds
The charts use tight autoscaling so you actually see the volatility. No boring flat lines that waste screen space.
5️⃣ Portfolio Dashboard
- Quantity held
- Average buy price (weighted)
- Current market price
- Current value
- Unrealized P&L (green if profit, red if loss)
At a glance, you know exactly how your portfolio is doing.
6️⃣ Live Leaderboard
# Net Worth = Cash + Value of Stock Holdings
# Rankings update in real-time
# Compete with friends / colleagues
Everyone starts with ₹1 Crore. Who can grow it the most? Create a friendly competition!
Getting Started (3 Steps)
Step 1: Clone & Install
git clone https://github.com/kosmoscpp/paper-trading.git
cd paper-trading
pip install -r requirements.txt
Step 2: Run Locally
streamlit run app.py
Visit http://localhost:8501 and start trading.
Step 3: Deploy (Optional)
Want to share it with friends? Deploy to Railway in 2 minutes:
- Push your repo to GitHub
- Connect Railway to your GitHub account
- Add
Dockerfileconfig - Deploy
(Or use my live version: https://paper-trader-kosmos.up.railway.app/)
Under the Hood: How It Works
Database Schema
-- Users table
CREATE TABLE users (
username TEXT PRIMARY KEY,
pin TEXT,
balance REAL
);
-- Portfolio table
CREATE TABLE portfolio (
username TEXT,
ticker TEXT,
quantity INTEGER,
avg_price REAL,
PRIMARY KEY (username, ticker)
);
Super simple. Two tables. That's it.
The Trading Engine
# When you BUY:
1. Validate you have enough cash
2. Deduct from balance
3. Add to portfolio (or update if you already own it)
4. Recalculate weighted average price
# When you SELL:
1. Check if you own enough shares
2. Add cash back to balance
3. Reduce quantity in portfolio
4. P&L is calculated on the fly
Background Data Sync
# Every 15 seconds:
while True:
for each_stock in STOCK_DICT:
fetch_live_price_from_yfinance()
cache_in_session_memory()
sleep(15)
This background loop keeps your charts fresh without hammering Yahoo Finance's API.
What I Learned Building This
Streamlit is ridiculously fast for MVPs. Went from zero to deployed in a weekend.
SQLite scales further than you think. For paper trading with 50+ users? Totally fine.
Real-time charting matters. When charts update live, trading feels real. Psychological engagement is everything.
Cache strategically. Don't hit the API every second. Cache + periodic refresh is the sweet spot.
UX > Features. A clean authentication screen and readable tables beat 50 features nobody uses.
Next Steps / Roadmap
- 📈 Advanced charts: Candlestick patterns, technical indicators (RSI, MACD)
- 🏅 Achievements: Badges for milestones (first 1M profit, etc.)
- 💬 Social features: Comment on trades, share portfolio
- 📱 Mobile app: React Native wrapper
- 🤖 Strategy backtester: Upload your strategy, backtest it historically
The Bigger Picture
This project isn't just about paper trading. It's about making financial literacy accessible. Stock market knowledge shouldn't be behind paywalls or require intimidating setup.
With an open-source simulator:
- Students learn how markets actually work
- Traders practice strategies risk-free
- Developers see a real full-stack example
- Communities (like Indian Dev communities) get a shared learning tool
Try It
Live App: https://paper-trader-kosmos.up.railway.app/
GitHub: https://github.com/kosmoscpp/paper-trading
No signup. No BS. Just pick a username, set a PIN, and start trading with ₹1 Crore.
Have feedback? Found a bug? PRs welcome! This is open-source—contributions make it better for everyone.
Questions?
- How do you build a Streamlit app? Check the
app.py—it's heavily commented - How does the database work? Two simple tables—look at the schema
- How do you deploy? Docker config is included
- Why this stack? See my "Tech Stack" section above
Drop a comment below or open an issue on GitHub. Let's build this together! 🚀
Happy trading, and may your P&L be green! 📈










