A comprehensive Java-based cryptocurrency trading simulation client with real-time market data, charting, and portfolio management.
- Real-time Market Data: Fetches live cryptocurrency prices, market cap, volume, and 24h changes from CoinGecko API
- Interactive Charts: 7-day price charts with JFreeChart showing price movements with color-coded trends (green/red)
- Multiple Accounts: Create and manage multiple demo accounts with simulated trading
- Portfolio Tracking: Track open positions with real-time P&L calculations
- Watchlist: Star and track your favorite cryptocurrencies
- Account Management: Deposit/withdraw funds, switch between accounts
- Buy/Sell: Execute trades with real-time price data
- Position Management: View and close open positions
- P&L Tracking: 24-hour and total profit/loss tracking
- Account Persistence: All positions and account data saved to JSON files
- Non-blocking Operations: All API calls and data loading use SwingWorker for smooth UI
- Progress Indicators: Loading messages and progress bars for all async operations
- Color-coded Indicators: Green for gains, red for losses throughout the interface
- Responsive Design: Three-panel layout with token list, chart, and account info
- Java 11 or higher
- Maven 3.6 or higher
- Internet connection (for API access)
# Clean and build the project
mvn clean package
# Run the application
java -jar target/crypto-trading-client-1.0-SNAPSHOT-jar-with-dependencies.jar# Download dependencies manually:
# - JFreeChart 1.5.4: https://github.com/jfree/jfreechart/releases
# - Gson 2.10.1: https://github.com/google/gson/releases
# Compile all Java files
javac -cp ".:jfreechart-1.5.4.jar:gson-2.10.1.jar" *.java
# Run the application
java -cp ".:jfreechart-1.5.4.jar:gson-2.10.1.jar" CryptoTradingClient- Launch the Application: Run the JAR file or use the Java command
- Default Account: A demo account with $10,000 is created automatically
- Browse Tokens: The left panel shows the top 100 cryptocurrencies by market cap
- Select a Token: Click any token to view its chart and details
- Go to
Account→Create Account - Enter account name and initial balance
- Choose Demo or Live account type
- Click Create
- Go to
Account→Switch Account - Select the desired account from the list
- Click "Switch to Account"
- Go to
Account→View All Accounts - See all accounts with their balances and P&L (color-coded)
- Switch or delete accounts from this dialog
- Select a token from the list
- Click the green "Buy" button
- Enter the quantity you want to purchase
- View the total cost and available balance
- Click "Buy" to execute the trade
- Select a token you own from the list
- Click the red "Sell" button
- Enter the quantity to sell
- View your available quantity and total proceeds
- Click "Sell" to execute the trade
- Go to
Trading→Open Positions - View all your active positions with real-time P&L
- Click "Refresh Prices" to update current prices
- Select a position and click "Close Position" to exit
- Select any cryptocurrency
- Click the "★ Watch" button to add to watchlist
- Go to
Trading→Watchlistto view only your starred tokens - Click "★ Watching" to remove from watchlist
- Go to
Wallet→Deposit - Enter the amount to deposit
- Click "Deposit"
- Go to
Wallet→Withdraw - Enter the amount to withdraw
- Click "Withdraw" (requires sufficient balance)
All account data is stored in JSON format in the accounts/ directory:
- Each account has its own JSON file named with its unique ID
- Data includes: balance, positions, P&L history, and watchlist
- Files are automatically saved on exit and after each transaction
- Green: Positive price changes, profits, gains
- Red: Negative price changes, losses, declines
- Orange: Watchlist indicator (starred items)
The application uses the free CoinGecko API:
- Base URL: https://api.coingecko.com/api/v3
- Rate Limit: Cached for 1 minute to reduce API calls
- No API Key Required: Uses free tier endpoints
- CryptoTradingClient: Main application frame and entry point
- AccountManager: Handles account persistence and management
- CryptoAPI: Manages all API calls with async SwingWorker pattern
- MainPanel: Primary UI container with three-panel layout
- TokenListPanel: Cryptocurrency list with search functionality
- ChartPanel: JFreeChart-based price visualization
- CryptoInfoPanel: Token details and trading buttons
- AccountInfoPanel: Account balance and P&L chart
- Account: User account with balance, positions, and P&L history
- Position: Individual cryptocurrency holding
- CryptoData: Cryptocurrency market information
- PnLSnapshot: Point-in-time profit/loss record
- Ensure Java 11+ is installed:
java -version - Check that all dependencies are in the classpath
- Verify internet connection for API access
- Check your internet connection
- CoinGecko API may have rate limits - wait a minute and retry
- Some cryptocurrencies may not have complete data
- Ensure JFreeChart library is properly included
- Try selecting a different cryptocurrency
- Check console for error messages
- Verify write permissions in the application directory
- Check that
accounts/folder exists and is writable - Review console output for JSON serialization errors
Potential features for future versions:
- Real API integration with actual exchanges
- Advanced charting with multiple timeframes
- Technical indicators (RSI, MACD, etc.)
- Order types (limit, stop-loss, etc.)
- Multi-currency support
- Export trading history to CSV
- Dark mode theme
- Custom alerts and notifications
This is a demonstration/educational project. Use at your own risk. Cryptocurrency trading involves significant risk. This application is for simulation purposes only.
- JFreeChart: Chart visualization library
- Gson: JSON serialization/deserialization
- CoinGecko: Cryptocurrency market data API
Note: This is a simulation client for educational purposes. It does not connect to real exchanges or handle real money. All trades are simulated based on real market prices.


