Live Site: TradeSim Pro on Heroku
Repository: GitHub
- Project Overview
- UX Design
- Features
- Database Design
- Technologies Used
- Agile Methodology
- Testing
- Deployment
- Credits
TradeSim Pro is a comprehensive prop trading simulator designed for beginner traders who want to practice trading cryptocurrencies, stocks, and forex pairs in a completely risk-free environment. The platform provides real-time market data, portfolio tracking, and performance analytics to help users develop their trading skills without risking real money.
- Beginner Traders: Individuals new to trading who want to learn market dynamics
- Finance Students: Students studying finance, economics, or trading
- Strategy Testers: Traders wanting to test new strategies without financial risk
- Educational Institutions: Schools and courses teaching financial markets
- Practice trading with virtual $10,000 starting balance
- Real-time prices from Binance (crypto) and Alpha Vantage (stocks/forex)
- Track performance with detailed statistics and charts
- Learn from mistakes without losing real money
The flowchart above shows the main user journey through the application, from registration to trading operations.
| Goal | Description |
|---|---|
| Educational | Provide a safe environment for learning trading |
| Practical | Simulate real market conditions with live prices |
| Analytical | Offer insights through performance statistics |
| Accessible | Easy to use for complete beginners |
| User Type | Goal |
|---|---|
| New Trader | Learn how to execute trades safely |
| Student | Understand market dynamics practically |
| Hobbyist | Test trading ideas without risk |
| ID | As a... | I want to... | So that I can... | Priority |
|---|---|---|---|---|
| 1.1 | New User | Register an account | Start trading with virtual money | Must Have |
| 1.2 | Registered User | Log in to my account | Access my portfolio and trades | Must Have |
| 1.3 | Logged-in User | Log out securely | Protect my account | Must Have |
| 1.4 | User | See my login status | Know if I'm logged in | Must Have |
| ID | As a... | I want to... | So that I can... | Priority |
|---|---|---|---|---|
| 2.1 | Trader | See real-time crypto prices | Make informed trading decisions | Must Have |
| 2.2 | Trader | See stock prices | Trade popular stocks | Must Have |
| 2.3 | Trader | See forex rates | Trade currency pairs | Must Have |
| 2.4 | Trader | See prices update automatically | Have current market data | Should Have |
| ID | As a... | I want to... | So that I can... | Priority |
|---|---|---|---|---|
| 3.1 | Trader | Open a BUY position | Enter the market | Must Have |
| 3.2 | Trader | Close my position (SELL) | Exit and realize profit/loss | Must Have |
| 3.3 | Trader | View my open positions | Monitor current trades | Must Have |
| 3.4 | Trader | View trade history | Analyze past performance | Must Have |
| 3.5 | Trader | Set Stop-Loss | Limit potential losses | Should Have |
| 3.6 | Trader | Set Take-Profit | Secure profits automatically | Should Have |
| ID | As a... | I want to... | So that I can... | Priority |
|---|---|---|---|---|
| 4.1 | Trader | See my account balance | Know available capital | Must Have |
| 4.2 | Trader | See total PnL | Track overall performance | Must Have |
| 4.3 | Trader | See win rate | Evaluate trading success | Should Have |
| 4.4 | Trader | See performance chart | Visualize progress | Should Have |
| ID | As a... | I want to... | So that I can... | Priority |
|---|---|---|---|---|
| 5.1 | Trader | Add assets to watchlist | Track interesting assets | Should Have |
| 5.2 | Trader | Remove from watchlist | Keep list relevant | Should Have |
| Color | Hex | Usage |
|---|---|---|
| Accent Teal | #00d4aa |
Primary buttons, success states |
| Success Green | #00d4aa |
Profit indicators, buy buttons |
| Danger Red | #ff6b6b |
Loss indicators, sell buttons |
| Warning Yellow | #ffd93d |
Forex badges, warnings |
| Dark Background | #0a0a0f |
Page background |
| Card Background | #1a1a2e |
Cards, containers |
| Text Primary | #ffffff |
Main text |
| Text Secondary | #b8b8d3 |
Secondary text |
| Element | Font | Weight |
|---|---|---|
| Headings | Inter | 600-700 |
| Body | Inter | 400 |
| Numbers/Data | JetBrains Mono | 500 |
- Clean Interface: Trading requires focus, so minimal distractions
- Color-Coded Data: Green/red for instant profit/loss recognition
- Monospace Numbers: Easier to read and compare financial data
- Responsive Layout: Trading on any device
- Video Backgrounds: Immersive, professional FinTech aesthetic
- Secure registration with email validation
- Login with JWT token authentication
- Password hashing with Django
- Session management
- Video background for immersive experience
- Live cryptocurrency prices (BTC, ETH) from Binance
- Stock quotes (TSLA, META, AAPL) from Alpha Vantage
- Forex rates (GBPUSD, EURUSD, USDJPY) from Alpha Vantage
- TradingView mini charts for each asset
- Full TradingView chart modal on click
- Auto-refresh every 30 seconds
- Open BUY/SELL positions with one click
- Real-time price display
- Quick amount buttons ($100, $500, $1000, $5000)
- Trade summary before execution
- Live prices sidebar
- Video background for immersive experience
- Real-time account balance
- Total unrealized PnL calculation
- Open positions count
- Trading tier display
- Reset Balance button to restart with $10,000
- Quick action buttons with professional icons
- View all open positions
- Real-time PnL updates
- Close positions with one click
- Position details (entry price, current price, quantity)
- Total unrealized PnL summary
- Add/remove favorite assets
- Quick access to watched prices
- One-click trade from watchlist
- Asset type badges (Crypto, Stock, Forex)
- Fully responsive on all devices
- Hamburger menu for mobile navigation
- Touch-friendly interface
- Optimized layouts for small screens
- Dynamic video backgrounds on key pages:
- Home page - Trading animation
- Login/Register - Chart visualization
- Trade page - Market data animation
- Positions/Watchlist - Trading theme
- Feather/Lucide icons throughout the app
- Clean, modern FinTech aesthetic
- TradingView-inspired design
- Consistent visual language
- Success notifications on actions
- Error messages for validation
- Confirmation dialogs for critical actions
- Loading indicators
| Feature | Description | Priority |
|---|---|---|
| Trade Journal | Notes and emotions per trade | Medium |
| Paper Trading Leagues | Compete with other users | Low |
| Advanced Charts | More TradingView features | Medium |
| Mobile App | Native iOS/Android app | Low |
| Email Alerts | Price alert notifications | Medium |
| Field | Type | Description |
|---|---|---|
| id | AutoField | Primary key |
| username | CharField | Unique username |
| EmailField | Unique email (used for login) | |
| password | CharField | Hashed password |
| account_balance | DecimalField | Virtual balance (default: $10,000) |
| trading_tier | CharField | BASIC, PRO, MASTER |
| bio | TextField | Optional user bio |
| date_joined | DateTimeField | Registration date |
| Field | Type | Description |
|---|---|---|
| id | AutoField | Primary key |
| symbol | CharField | Trading symbol (BTC, TSLA, EURUSD) |
| name | CharField | Full name |
| asset_type | CharField | CRYPTO, STOCK, FOREX |
| api_source | CharField | BINANCE, ALPHAVANTAGE |
| is_active | BooleanField | Available for trading |
| Field | Type | Description |
|---|---|---|
| id | AutoField | Primary key |
| user | ForeignKey | Link to CustomUser |
| asset | ForeignKey | Link to Asset |
| trade_type | CharField | BUY or SELL |
| quantity | DecimalField | Amount traded |
| entry_price | DecimalField | Price at open |
| exit_price | DecimalField | Price at close (nullable) |
| stop_loss | DecimalField | Stop-loss price (nullable) |
| take_profit | DecimalField | Take-profit price (nullable) |
| pnl | DecimalField | Profit/Loss (nullable) |
| pnl_percent | DecimalField | PnL percentage |
| status | CharField | OPEN or CLOSED |
| opened_at | DateTimeField | Trade open time |
| closed_at | DateTimeField | Trade close time (nullable) |
| Field | Type | Description |
|---|---|---|
| id | AutoField | Primary key |
| user | OneToOneField | Link to CustomUser |
| total_pnl | DecimalField | All-time realized PnL |
| total_pnl_percent | DecimalField | PnL percentage |
| win_rate | DecimalField | Winning trade percentage |
| total_trades | IntegerField | Total closed trades |
| winning_trades | IntegerField | Winning trades count |
| losing_trades | IntegerField | Losing trades count |
| updated_at | DateTimeField | Last update |
| Field | Type | Description |
|---|---|---|
| id | AutoField | Primary key |
| user | ForeignKey | Link to CustomUser |
| asset | ForeignKey | Link to Asset |
| added_at | DateTimeField | Date added |
- Python 3.12
- JavaScript (ES6+)
- HTML5
- CSS3
| Technology | Version | Purpose |
|---|---|---|
| Django | 5.0.1 | Backend framework |
| Django REST Framework | 3.14.0 | API development |
| Simple JWT | 5.3.1 | JWT authentication |
| django-cors-headers | 4.3.1 | CORS handling |
| django-allauth | 0.60.1 | User authentication |
| dj-rest-auth | 5.0.2 | REST authentication |
| psycopg2-binary | 2.9.9 | PostgreSQL adapter |
| dj-database-url | 2.1.0 | Database configuration |
| gunicorn | 21.2.0 | WSGI server |
| whitenoise | 6.6.0 | Static files |
| requests | 2.31.0 | HTTP requests |
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2.0 | UI framework |
| React Router DOM | 6.21.0 | Client-side routing |
| Axios | 1.6.2 | HTTP client |
| React Toastify | 9.1.3 | Toast notifications |
| React Icons | 5.0.1 | Professional icons (Feather/Lucide) |
| Vite | 5.0.10 | Build tool & dev server |
| Service | Purpose |
|---|---|
| TradingView Widgets | Interactive charts |
| Binance API | Cryptocurrency prices |
| Alpha Vantage API | Stock & forex prices |
| Database | Usage |
|---|---|
| SQLite | Local development |
| PostgreSQL | Production (Heroku) |
| Tool | Purpose |
|---|---|
| Git | Version control |
| GitHub | Repository hosting |
| GitHub Projects | Agile project management |
| Heroku | Cloud deployment |
| Postman | API testing |
| VS Code | Code editor |
| Draw.io | Flowcharts & ERD diagrams |
This project was developed using Agile methodology with GitHub Projects as the management tool.
Board Link: TradeSim Pro Project Board
| Sprint | Focus |
|---|---|
| Sprint 1 | Setup, Auth, Models |
| Sprint 2 | Trading, Prices, API |
| Sprint 3 | Frontend, Testing, Deploy |
All user stories were created as GitHub Issues with:
- Acceptance Criteria
- Tasks checklist
- Labels (Must Have, Should Have, Could Have)
- Linked to Epics
All Python files were validated using Flake8 with --max-line-length=120.
All React components and JavaScript files were validated using ESLint.
All CSS files were validated using the W3C CSS Validation Service.
--
| Page | Performance | Accessibility | Best Practices | SEO | Screenshot |
|---|---|---|---|---|---|
| Home (Desktop) | π’ 100 | π’ 96 | π’ 100 | π 92 | ![]() |
| Home (Mobile) | π’ 99 | π 85 | π’ 100 | π 92 | ![]() |
# Run all tests
python manage.py test
# Run with coverage
coverage run manage.py test
coverage reportTest Results: 29 tests passing β
Issue: AUTH_USER_MODEL refers to model 'accounts.CustomUser' that has not been installed
Cause: Custom User Model was defined after initial Django migrations were created
Fix: Deleted all migration files and database, created CustomUser before first migration:
rm -rf accounts/migrations/0*.py
rm db.sqlite3
python manage.py makemigrations accounts
python manage.py migrateStatus: β Resolved
Issue: Browser blocking API requests with No 'Access-Control-Allow-Origin' header present
Cause: Django backend rejecting requests from React frontend running on different port (3000)
Fix: Installed and configured django-cors-headers in settings.py:
INSTALLED_APPS = [
'corsheaders',
]
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
]
CORS_ALLOWED_ORIGINS = [
'http://localhost:3000',
'http://127.0.0.1:3000',
]Status: β Resolved
Issue: API returning 401 Unauthorized even with valid JWT token
Cause: Missing "Bearer " prefix when sending token in Authorization header
Fix: Updated frontend to use correct header format:
headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
}Status: β Resolved
Issue: RelatedObjectDoesNotExist: User has no portfolio when accessing portfolio endpoint
Cause: Portfolio instance not automatically created when new user registers
Fix: Added Django signal to create Portfolio on user creation:
@receiver(post_save, sender=User)
def create_user_portfolio(sender, instance, created, **kwargs):
if created:
Portfolio.objects.create(user=instance)Status: β Resolved
Issue: Prices showing incorrect decimals (e.g., BTC: 97000.12345678901234)
Cause: Using FloatField for monetary values
Fix: Changed all monetary fields to DecimalField:
entry_price = models.DecimalField(max_digits=18, decimal_places=8)Status: β Resolved
Issue: Stock and forex prices returning None
Cause: Free tier API rate limit (5 calls/minute) exceeded
Fix: Implemented 30-second price caching:
cache_key = f'price_{symbol}'
cached = cache.get(cache_key)
if cached:
return Decimal(str(cached))Status: β Resolved
Issue: React app showing white screen, 404 for CSS and JS files
Cause: backend/static/assets/ folder was in .gitignore
Fix: Force-added static files to git:
git add -f backend/static/assets/Status: β Resolved
Issue: Direct URL access to /dashboard returning Django 404
Cause: Django not configured to serve React app for client-side routes
Fix: Added catch-all URL pattern:
re_path(r'^(?!api|admin|static).*$',
TemplateView.as_view(template_name='index.html'))Status: β Resolved
Issue: Refused to apply style... MIME type ('text/html')
Cause: Static files returning HTML error page
Fix: Properly configured WhiteNoise and ran collectstatic:
cd backend && python manage.py collectstatic --noinputStatus: β Resolved
| Issue | Description | Impact | Workaround |
|---|---|---|---|
| API Rate Limiting | Alpha Vantage limited to 5 calls/minute | Medium | 30-second caching |
| Price Delay | First price fetch takes 1-2 seconds | Low | Prices cached after first load |
| UTC Timezone | Timestamps displayed in UTC | Low | None currently |
The application is deployed on Heroku using GitHub integration.
Live URL: https://tradesim-pro-stiven-62203fadbb77.herokuapp.com
-
Create Heroku App
- Log in to Heroku Dashboard
- Click "New" β "Create new app"
- Enter app name and select region (Europe)
-
Connect GitHub Repository
- Go to "Deploy" tab
- Select "GitHub" as deployment method
- Connect your repository
-
Add PostgreSQL Database
- Go to "Resources" tab
- Search for "Heroku Postgres"
- Select "Essential 0" plan
-
Configure Environment Variables
- Go to Settings β "Reveal Config Vars"
- Add:
Key Value SECRET_KEYYour Django secret key DEBUGFalseALPHA_VANTAGE_KEYYour API key -
Deploy
- Go to Deploy tab
- Click "Deploy Branch"
-
Run Migrations
- Click "More" β "Run console"
- Enter:
cd backend && python manage.py migrate
-
Collect Static Files
- Enter:
cd backend && python manage.py collectstatic --noinput
- Enter:
- Python 3.12+
- Node.js 18+
- Git
- Clone Repository
git clone https://github.com/SteveDok22/TradeSim-Pro.git
cd TradeSim-Pro/backend- Create Virtual Environment
python -m venv venv
venv\Scripts\activate # Windows- Install Dependencies
pip install -r requirements.txt- Run Migrations
python manage.py migrate- Run Server
python manage.py runservercd frontend
npm install
npm run dev- Go to GitHub Repository
- Click "Fork" button
- Clone your forked repository
git clone https://github.com/YOUR-USERNAME/tradesim-pro.git
cd tradesim-proFor detailed code attribution, see CODE_ATTRIBUTION.md
| Category | Source |
|---|---|
| Backend Framework | Django 5.0 |
| API Framework | Django REST Framework |
| Authentication | SimpleJWT |
| Charts | TradingView Widgets |
| Icons | React Icons |
| Crypto Prices | Binance API |
| Stock/Forex Prices | Alpha Vantage |
- Code Institute - For the learning materials and project guidelines
- My Mentor - For guidance and feedback throughout the project
- Slack Community - For support and troubleshooting help
Developed by Stiven | GitHub | 2025



























































.png)
.png)

