Skip to content

hiaochuan/BotViewer

Repository files navigation

Fusion Alpha Manager - Electron Desktop Application

A modern, feature-rich desktop application for managing the Fusion Alpha Trading Bot system. Built with Electron, React, TypeScript, and Tailwind CSS.

🎯 Features

User Management

  • βœ… Add/remove trading bot users
  • βœ… Configure Gate.io API credentials
  • βœ… Toggle between REAL and SIMULATED trading modes
  • βœ… Start/stop individual users
  • βœ… Balance monitoring with configurable thresholds
  • βœ… Close all positions with one click
  • βœ… Export functionality

KOL Management

  • βœ… Add/remove Key Opinion Leaders
  • βœ… Support for NORMAL and WWG KOL types
  • βœ… Configure Discord channel monitoring
  • βœ… Filter by specific Discord author IDs
  • βœ… Visual status indicators

Track Configuration

  • βœ… Link users to KOLs for automated trading
  • βœ… Multiple amount modes:
    • Loss Fixed: Set maximum loss threshold
    • Fixed: Specify exact amounts per symbol
    • Percentage: Use percentage-based amounts
  • βœ… Reverse trading option
  • βœ… Future symbols filtering
  • βœ… Start/stop/restart track control
  • βœ… Real-time status monitoring

Dashboard & Monitoring

  • βœ… Overview statistics
  • βœ… Real-time data updates (configurable interval)
  • βœ… Quick action buttons
  • βœ… Activity logging

Modern UI/UX

  • 🎨 Dark mode optimized interface
  • πŸš€ Smooth animations and transitions
  • πŸ“± Responsive design
  • πŸ’Ύ Persistent settings
  • ⚑ Fast and lightweight

πŸš€ Getting Started

Prerequisites

Installation

# Navigate to BotViewer directory
cd BotViewer

# Install dependencies
npm install

# Start in development mode
npm run dev

The application will open automatically with:

Building for Production

# Build the application
npm run build

# Or use the build script
chmod +x build.sh
./build.sh

# Package for distribution
npm run build:electron

Built applications will be in the release/ directory.

πŸ“ Project Structure

BotViewer/
β”œβ”€β”€ electron/              # Electron main process
β”‚   β”œβ”€β”€ main.ts           # Main process entry
β”‚   β”œβ”€β”€ preload.ts        # Preload script
β”‚   └── tsconfig.json     # TypeScript config for Electron
β”œβ”€β”€ src/                   # React application
β”‚   β”œβ”€β”€ components/       # React components
β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx
β”‚   β”‚   β”œβ”€β”€ UserManagement.tsx
β”‚   β”‚   β”œβ”€β”€ KOLManagement.tsx
β”‚   β”‚   β”œβ”€β”€ TrackManagement.tsx
β”‚   β”‚   └── SettingsPanel.tsx
β”‚   β”œβ”€β”€ services/         # API services
β”‚   β”‚   └── api.ts        # API client
β”‚   β”œβ”€β”€ store/            # State management
β”‚   β”‚   └── settings.ts   # Settings store (Zustand)
β”‚   β”œβ”€β”€ types/            # TypeScript types
β”‚   β”‚   └── index.ts
β”‚   β”œβ”€β”€ App.tsx           # Main app component
β”‚   β”œβ”€β”€ main.tsx          # React entry point
β”‚   └── index.css         # Global styles
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.ts
β”œβ”€β”€ tailwind.config.js
└── tsconfig.json

🎨 Technology Stack

  • Electron: Desktop application framework
  • React 18: UI library
  • TypeScript: Type-safe development
  • Vite: Fast build tool and dev server
  • Tailwind CSS: Utility-first CSS framework
  • TanStack Query: Data fetching and caching
  • Zustand: Lightweight state management
  • Axios: HTTP client
  • Lucide React: Beautiful icon library

βš™οΈ Configuration

Configure the application in the Settings tab:

  • API Base URL: Set your Fusion Alpha API server URL
  • Refresh Interval: Control how often data is refreshed (minimum 1000ms)

Settings are automatically persisted to local storage.

πŸ”§ API Integration

The application communicates with the Fusion Alpha API server. All API endpoints from the original client.py are implemented:

User Endpoints

  • POST /user/add - Add new user
  • GET /user/get - Get users
  • POST /user/update - Update user
  • DELETE /user/remove - Remove user
  • POST /user/run - Start user
  • POST /user/stop - Stop user
  • POST /user/monitor/run - Start balance monitor
  • POST /user/monitor/stop - Stop balance monitor
  • POST /user/close_all - Close all positions
  • POST /user/exporter/start - Start exporter
  • POST /user/exporter/stop - Stop exporter

KOL Endpoints

  • POST /kol/add - Add new KOL
  • GET /kol/get - Get KOLs
  • DELETE /kol/remove - Remove KOL

Track Endpoints

  • POST /kol/track/add - Add track config
  • GET /kol/track/get - Get track configs
  • DELETE /kol/track/remove - Remove track config
  • POST /kol/track/start - Start tracking
  • POST /kol/track/stop - Stop tracking
  • POST /kol/track/restart - Restart tracking

🎯 Usage Examples

Adding a User

  1. Click "Add User" in the Users tab
  2. Fill in:
    • Username
    • Gate.io API Key
    • Gate.io Secret Key
    • Trade Mode (REAL/SIMULATED)
  3. Optionally enable balance monitoring with thresholds
  4. Click "Add User"

Creating a Track Configuration

  1. Ensure you have at least one User and one KOL created
  2. Go to the Tracks tab
  3. Click "Add Track Config"
  4. Select user and KOL
  5. Choose amount mode and configure parameters
  6. Optionally add specific futures to track
  7. Enable reverse trading if needed
  8. Click "Add Track Config"
  9. Start the track with the "Start" button

πŸ› Troubleshooting

Application won't connect to API

  • Verify API server is running
  • Check the API Base URL in Settings
  • Ensure no firewall is blocking the connection

Data not refreshing

  • Check refresh interval in Settings
  • Verify API server is responding
  • Check browser console for errors

Build errors

  • Delete node_modules and package-lock.json
  • Run npm install again
  • Ensure Node.js version is 18+

πŸ“ Development

Adding New Features

  1. Create types in src/types/index.ts
  2. Add API methods in src/services/api.ts
  3. Create/update components in src/components/
  4. Use TanStack Query for data fetching
  5. Follow existing patterns for consistency

Code Style

  • Use TypeScript strict mode
  • Follow React best practices
  • Use Tailwind utility classes
  • Keep components focused and reusable
  • Add proper error handling

πŸ“„ License

MIT License - See LICENSE file for details

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“§ Support

For issues and questions:

  • Create an issue on GitHub
  • Check existing documentation
  • Review API server logs

πŸŽ‰ Acknowledgments

Built as a modern replacement for the Python CLI client with enhanced visualization and user experience.


Fusion Alpha Manager - Professional trading bot management made easy.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors