- Add British Pound (GBP) support to all database schemas and constraints - Update API validation to accept EUR, USD, and GBP currencies - Implement centralized currency symbol mapping with getCurrencySymbol() - Replace all hardcoded currency mappings throughout frontend code - Add GBP options to all currency dropdown menus in UI forms - Update README with enhanced feature descriptions and changelog - Document multi-currency support and historical price tracking features - Improve project documentation with comprehensive feature overview 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
7.2 KiB
ETF Trade Tracker
A web-based application for tracking ETF trades with multi-user authentication, portfolio management, and performance analysis.
Features
- 🔐 Multi-user Authentication - Secure login system with admin and regular user roles
- 💼 Portfolio Management - Track your ETF positions, shares, and investments
- 📊 Trade History - Complete record of all buy/sell transactions
- 📈 Gains/Losses Analysis - Calculate performance with current market prices
- 📉 Historical Price Tracking - Store and view price update history with timestamps
- 💰 Multi-Currency Support - Full support for EUR, USD, and GBP currencies
- 🏦 Cash Account Management - Track savings accounts and cash transfers
- 📊 Capital Gains Tax (CGT) - Automatic CGT calculations with long-term rates
- 🎯 Dashboard - Overview of portfolio metrics and performance
- 👥 Admin Panel - User management for administrators
- 📱 Responsive Design - Works on desktop and mobile devices
- 💾 SQLite Database - Local database storage with user data isolation
Screenshots
Dashboard
Clean overview of your portfolio with key metrics and ETF breakdown.
Trade Entry
Simple form to add new ETF trades with date/time and currency support (EUR/USD/GBP).
Gains/Losses
Update current market prices to see real-time portfolio performance.
Installation
Option 1: Direct Installation
Prerequisites
- Node.js (v14 or higher)
- npm
Setup
- Clone the repository:
git clone git@teapot.hm.keyb.ie:kris/etf-trade-tracker.git
cd etf-trade-tracker
- Install dependencies:
npm install
- Start the server:
npm start
- Open your browser and navigate to:
http://localhost:3000
Option 2: Container Installation (Podman/Docker)
Prerequisites
- Podman or Docker installed on your system
Using Podman
- Clone the repository:
git clone git@teapot.hm.keyb.ie:kris/etf-trade-tracker.git
cd etf-trade-tracker
- Build the container image:
podman build -t etf-tracker .
- Run the container:
podman run -d \
--name etf-tracker \
-p 3000:3000 \
-v etf_data:/app/data \
etf-tracker
- Open your browser and navigate to:
http://localhost:3000
Using Docker Compose
- Clone the repository:
git clone git@teapot.hm.keyb.ie:kris/etf-trade-tracker.git
cd etf-trade-tracker
- Start with docker-compose:
docker-compose up -d
- Open your browser and navigate to:
http://localhost:3000
Container Management
View logs:
podman logs etf-tracker
# or
docker-compose logs
Stop the container:
podman stop etf-tracker
# or
docker-compose down
Start the container:
podman start etf-tracker
# or
docker-compose up -d
Remove container and data:
podman rm etf-tracker
podman volume rm etf_data
# or
docker-compose down -v
Default Credentials
When you first run the application, a default admin user is created:
- Username:
admin - Password:
admin123
⚠️ Important: Change the admin password after first login for security.
Usage
For Regular Users
- Login - Use credentials provided by your administrator
- Add Trades - Navigate to "Add Trade" to record buy/sell transactions
- View Portfolio - Check your holdings and allocation in the Portfolio section
- Track Performance - Update current prices in Gains/Losses to see real-time performance
- Export Data - Export your trade history as JSON from Trade History
For Administrators
- User Management - Access Admin Panel from the sidebar to create/delete users
- Create Users - Add new users with regular or admin privileges
- Monitor System - View all users and their last login times
API Endpoints
Authentication
POST /api/login- User loginPOST /api/logout- User logoutGET /api/me- Get current user info
Trades
GET /api/trades- Get user's tradesPOST /api/trades- Add new tradeDELETE /api/trades/:id- Delete specific tradeDELETE /api/trades- Clear all user trades
Portfolio
GET /api/portfolio-summary- Get portfolio summary
Admin (Admin Only)
GET /api/admin/users- List all usersPOST /api/admin/users- Create new userDELETE /api/admin/users/:id- Delete user
Database Schema
Users Table
id- Primary keyusername- Unique usernamepassword_hash- Bcrypt hashed passwordemail- Optional email addressis_admin- Boolean admin flagcreated_at- Account creation timestamplast_login- Last login timestamp
Trades Table
id- Primary keyuser_id- Foreign key to users tableetf_symbol- ETF ticker symboltrade_type- 'buy' or 'sell'shares- Number of sharesprice- Price per sharecurrency- 'EUR', 'USD', or 'GBP'trade_datetime- Date and time of tradefees- Optional trading feesnotes- Optional trade notestotal_value- Calculated total valuecreated_at- Record creation timestamp
Configuration
Environment Variables
PORT- Server port (default: 3000)
Session Configuration
The application uses express-session with the following settings:
- Session secret:
etf-tracker-secret-key(change in production) - Session duration: 24 hours
- Secure cookies: disabled (enable for HTTPS)
Security Features
- Password hashing using bcrypt
- Session-based authentication
- User data isolation
- Admin-only endpoints protection
- SQL injection prevention with parameterized queries
Development
Project Structure
├── server.js # Express server and API routes
├── index.html # Main HTML template
├── script.js # Frontend JavaScript
├── styles.css # CSS styles
├── package.json # Dependencies and scripts
├── .gitignore # Git ignore rules
└── README.md # This file
Running in Development Mode
npm run dev
This uses nodemon for automatic server restart on file changes.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
License
MIT License - see the code for details.
Support
For issues or questions:
- Check existing issues in the repository
- Create a new issue with detailed description
- Include steps to reproduce any bugs
Changelog
v1.2.0 (Latest)
- Historical Price Tracking: Store and view price update history for all ETFs
- Price History Modal: View timeline of price updates with timestamps
- Persistent Pricing: Automatically load latest prices on app startup
- Multi-Currency Support: Added British Pound (GBP) alongside EUR/USD
- Enhanced UX: Improved price update notifications and database persistence
v1.1.0
- Comprehensive cash savings and transfers system
- Capital Gains Tax (CGT) calculations with 8+ year long-term rates
- Total holdings tracking across ETFs and cash accounts
- Enhanced portfolio analytics and reporting
v1.0.0 (Initial Release)
- Multi-user authentication system
- ETF trade tracking
- Portfolio management
- Gains/losses calculation
- Admin panel
- Responsive design
- SQLite database integration