FOR LEARNING ONLY. NOT FOR REAL TRADING.
A paper trading web application built with Python and Flask. It pulls live market data, runs ML price predictions, and lets you execute simulated trades.
https://trading-strategy-nttz.onrender.com
The app runs on Render's free tier and may take around 30 seconds to wake up on the first visit.
| Page | URL |
|---|---|
| Home | / |
| Trading Dashboard | /dashboard |
| Paper Trading | /trading |
| Performance | /performance/ |
| Symbol Manager | /symbols/ |
| System Status | /system |
| Layer | Technology |
|---|---|
| Backend | Python 3.11, Flask 2.3.3 |
| Server | Gunicorn (2 workers) |
| Database | PostgreSQL (Render Managed) |
| Market Data | yfinance |
| ML Models | scikit-learn (Random Forest), statsmodels (ARIMA) |
| Charts | Plotly.js |
| Frontend | HTML, CSS, JavaScript |
| Hosting | Render |
Trading Dashboard Real-time candlestick charts with RSI, SMA20, and SMA50 overlays. Generates BUY / SELL / HOLD signals based on RSI thresholds and moving average crossovers.
Paper Trading Execute BUY and SELL orders at live market prices against a simulated account starting at 1,00,000 INR. Positions and transaction history persist in PostgreSQL.
ML Price Predictions 5-day ahead price forecast using an ARIMA + Random Forest ensemble. Results are cached per symbol for 1 hour.
Symbol Manager Search any stock across NSE, NYSE, NASDAQ, ETFs, and Forex. Watchlist is stored in PostgreSQL and persists across restarts.
Performance Dashboard Portfolio value over time, position breakdown, P&L per position, and full transaction history.
System Status Live CPU, memory, and disk usage. Service health indicators and log viewer.
Order: ARIMA(5, 1, 0). Uses the last 5 days of closing prices, differences once to remove trend, and forecasts the next 5 trading days. Handles short-term momentum well.
100 decision trees trained on 10 engineered features: 1/3/5-day price returns, 5/10/20-day SMAs, 5/10-day rolling volatility, volume change, and 5-day volume SMA.
Final Prediction = 0.4 x ARIMA + 0.6 x Random Forest
All tables are created automatically on first boot using CREATE TABLE IF NOT EXISTS.
| Table | Purpose |
|---|---|
paper_account |
Cash balance, positions, and transaction history (JSONB) |
watchlist |
Saved symbols |
positions |
Open position tracker |
transactions |
Full trade log |
portfolio_history |
Portfolio value over time |
TP/
web_app.py Main Flask app and paper trading routes
db.py Shared PostgreSQL connection helper
apps/
symbol_manager.py Watchlist CRUD and symbol search
performance_dashboard.py Portfolio analytics
templates/ Jinja2 HTML templates
base.html
home.html
dashboard.html
trading.html
performance.html
manage_symbols.html
system.html
static/
css/
js/
src/
models/ ML model implementations
config/ JSON config files
Dockerfile
docker-compose.yml
render.yaml
requirements.txt
Requirements: Python 3.11+ and a PostgreSQL instance (local or remote).
git clone https://github.com/sreeteja2006/TP.git
cd TP
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
export DATABASE_URL="postgresql://postgres:yourpassword@localhost:5432/tradepro"
python web_app.pyThe app will be available at http://localhost:5000. All database tables are created on startup.
docker-compose up -dThe app runs as a Render web service backed by a Render managed PostgreSQL database.
- Create a PostgreSQL database on Render (free plan).
- Create a web service and connect your GitHub repository.
- Add an environment variable
DATABASE_URLusing the Internal Connection String from the database. - Set the build command to
pip install -r requirements.txt. - Set the start command to
gunicorn --workers 2 --timeout 120 web_app:app.
The included render.yaml can auto-provision both services if you use Render's Blueprint feature.
config/trading_config.json
{
"max_positions": 8,
"position_size_pct": 0.1,
"stop_loss_pct": 0.05,
"take_profit_pct": 0.15,
"daily_loss_limit": 0.02,
"max_trades_per_day": 10
}This is a paper trading simulator. No real money is involved. The signals and predictions are not financial advice. Market data is sourced from Yahoo Finance via the yfinance library.
GitHub: sreeteja2006 Email: gsreeteja25@gmail.com