Skip to content

abraham-ny/TradeRocker-Desktop

Repository files navigation

TradeRocker crypto trading desktop client. [TradeRock(r) TraderOK(R) :: TradeRocker]

A comprehensive Java-based cryptocurrency trading simulation client with real-time market data, charting, and portfolio management.

Features

Core Features

  • 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

Trading Features

  • 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

UI Features

  • 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

Screenshots

traderocker traderocker traderocker

Prerequisites

  • Java 11 or higher
  • Maven 3.6 or higher
  • Internet connection (for API access)

Building the Application

Option 1: Using Maven (Recommended)

# Clean and build the project
mvn clean package

# Run the application
java -jar target/crypto-trading-client-1.0-SNAPSHOT-jar-with-dependencies.jar

Option 2: Manual Compilation

# 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

Usage Guide

Getting Started

  1. Launch the Application: Run the JAR file or use the Java command
  2. Default Account: A demo account with $10,000 is created automatically
  3. Browse Tokens: The left panel shows the top 100 cryptocurrencies by market cap
  4. Select a Token: Click any token to view its chart and details

Account Management

Creating a New Account

  1. Go to AccountCreate Account
  2. Enter account name and initial balance
  3. Choose Demo or Live account type
  4. Click Create

Switching Accounts

  1. Go to AccountSwitch Account
  2. Select the desired account from the list
  3. Click "Switch to Account"

Viewing All Accounts

  1. Go to AccountView All Accounts
  2. See all accounts with their balances and P&L (color-coded)
  3. Switch or delete accounts from this dialog

Trading

Buying Cryptocurrency

  1. Select a token from the list
  2. Click the green "Buy" button
  3. Enter the quantity you want to purchase
  4. View the total cost and available balance
  5. Click "Buy" to execute the trade

Selling Cryptocurrency

  1. Select a token you own from the list
  2. Click the red "Sell" button
  3. Enter the quantity to sell
  4. View your available quantity and total proceeds
  5. Click "Sell" to execute the trade

Managing Positions

  1. Go to TradingOpen Positions
  2. View all your active positions with real-time P&L
  3. Click "Refresh Prices" to update current prices
  4. Select a position and click "Close Position" to exit

Watchlist

  1. Select any cryptocurrency
  2. Click the "★ Watch" button to add to watchlist
  3. Go to TradingWatchlist to view only your starred tokens
  4. Click "★ Watching" to remove from watchlist

Deposits and Withdrawals

Deposit Funds

  1. Go to WalletDeposit
  2. Enter the amount to deposit
  3. Click "Deposit"

Withdraw Funds

  1. Go to WalletWithdraw
  2. Enter the amount to withdraw
  3. Click "Withdraw" (requires sufficient balance)

Data Storage

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

Color Coding

  • Green: Positive price changes, profits, gains
  • Red: Negative price changes, losses, declines
  • Orange: Watchlist indicator (starred items)

API Information

The application uses the free CoinGecko API:

Architecture

Key Components

  1. CryptoTradingClient: Main application frame and entry point
  2. AccountManager: Handles account persistence and management
  3. CryptoAPI: Manages all API calls with async SwingWorker pattern
  4. MainPanel: Primary UI container with three-panel layout
  5. TokenListPanel: Cryptocurrency list with search functionality
  6. ChartPanel: JFreeChart-based price visualization
  7. CryptoInfoPanel: Token details and trading buttons
  8. AccountInfoPanel: Account balance and P&L chart

Data Models

  • 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

Troubleshooting

Application won't start

  • Ensure Java 11+ is installed: java -version
  • Check that all dependencies are in the classpath
  • Verify internet connection for API access

API errors

  • Check your internet connection
  • CoinGecko API may have rate limits - wait a minute and retry
  • Some cryptocurrencies may not have complete data

Chart not displaying

  • Ensure JFreeChart library is properly included
  • Try selecting a different cryptocurrency
  • Check console for error messages

Accounts not saving

  • Verify write permissions in the application directory
  • Check that accounts/ folder exists and is writable
  • Review console output for JSON serialization errors

Future Enhancements

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

License

This is a demonstration/educational project. Use at your own risk. Cryptocurrency trading involves significant risk. This application is for simulation purposes only.

Credits

  • 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.

About

Desktop client for TradeRocker crypto trading app

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages