A modern platform for automated derivatives trading with visual bot building, real-time analytics, and comprehensive tutorials.
- Getting Started
 - Project Overview
 - Development Workflow
 - Project Structure
 - Technologies Used
 - Configuration
 - Testing
 - Troubleshooting
 - Contributing
 
Before working with this repository, ensure you have the following installed:
- Node.js 20.x - Required for running the application
 - npm 9.x - Package manager
 - git - For version control
 
- 
Clone the repository
git clone <repository-url> cd derivatives-bot
 - 
Install dependencies
npm install
 - 
Build the application
npm run build
 - 
Start the development server
npm start
 
The application will be available at https://localhost:8443/ (or the port specified by RSBuild).
Derivatives Bot is a comprehensive platform for automated derivatives trading that provides users with powerful tools to create, test, and deploy trading bots without requiring programming knowledge.
- π― Visual Bot Builder: Drag-and-drop interface using Blockly for creating trading strategies
 - π Real-time Dashboard: Monitor active bots, trading performance, and account statistics
 - π Integrated Charts: SmartCharts integration for advanced market analysis
 - π Interactive Tutorials: Step-by-step guides for learning bot building and trading strategies
 - π± Responsive Design: Optimized for both desktop and mobile devices
 - π Analytics Integration: Comprehensive tracking with RudderStack and GTM
 - β‘ Real-time Updates: WebSocket connections for live market data and bot status
 
The application follows a modular, component-based architecture:
- Frontend: React 18 with TypeScript for type safety
 - State Management: MobX for reactive state management
 - Build System: RSBuild for fast development and optimized production builds
 - Styling: Sass with component-scoped styles
 - Testing: Jest with React Testing Library
 - Code Quality: ESLint, Prettier, and Husky for consistent code standards
 
| Command | Description | 
|---|---|
npm start | 
Start development server with hot reload | 
npm run build | 
Create production build | 
npm run watch | 
Build in watch mode for development | 
npm run serve | 
Serve production build locally | 
npm test | 
Run Jest tests | 
npm run coverage | 
Generate test coverage report | 
npm run test:lint | 
Run linting and formatting | 
npm run test:fix | 
Fix linting issues automatically | 
npm run build:analyze | 
Analyze bundle size with detailed report | 
For local development:
# Start the development server
npm start
# Alternative: Start with webpack (if needed)
npm run start:webpackThe development server includes:
- Hot module replacement
 - Source maps
 - Live reloading
 - Error overlay
 
# Create optimized production build
npm run build
# Analyze bundle size
npm run build:analyze
# Serve production build locally for testing
npm run servesrc/
βββ components/           # Reusable UI components
β   βββ button-link/     # Custom button components
β   βββ error-component/ # Error boundary handling
β   βββ trading-view-chart/ # Chart integration
βββ pages/               # Main application pages
β   βββ dashboard/       # Bot management dashboard
β   βββ bot-builder/     # Visual bot building interface
β   βββ chart/           # Trading charts and analysis
β   βββ tutorials/       # Interactive learning modules
β   βββ main/            # Main application wrapper
βββ hooks/               # Custom React hooks
βββ analytics/           # Analytics and tracking utilities
βββ external/            # External integrations
β   βββ bot-skeleton/    # Core bot functionality
βββ styles/              # Global styles and theme
βββ xml/                 # Pre-built bot strategy templates
- Dashboard: Central hub for managing bots, viewing performance, and accessing quick actions
 - Bot Builder: Visual programming interface using Blockly for creating trading strategies
 - Charts: Integrated TradingView charts with market analysis tools
 - Tutorials: Interactive guides and educational content
 
- React 18 - Modern React with Hooks and Concurrent Features
 - TypeScript - Static type checking and enhanced developer experience
 - MobX - Reactive state management
 - React Router - Client-side routing
 
- RSBuild - Fast build tool with optimized defaults
 - Sass - Advanced CSS with variables and mixins
 - Jest - Testing framework
 - ESLint + Prettier - Code quality and formatting
 
- Blockly - Visual programming blocks for bot building
 - TradingView - Advanced charting and market analysis
 - Framer Motion - Smooth animations and transitions
 - @deriv-com/ui - Deriv's design system components
 
- @deriv-com/analytics - Analytics and user tracking
 - @deriv/deriv-api - Trading API integration
 - @datadog/browser-rum - Real user monitoring
 
For deploying to Cloudflare Pages, configure the following secrets in GitHub Actions:
CLOUDFLARE_ACCOUNT_ID=your_account_id
CLOUDFLARE_API_TOKEN=your_api_token
CLOUDFLARE_PROJECT_NAME=your_project_nameThe project uses Jest and React Testing Library for testing:
# Run all tests
npm test
# Run tests with coverage
npm run coverage
# Run tests in watch mode
npm test -- --watch
# Run specific test file
npm test -- dashboard.spec.tsx- Unit Tests: Individual component and utility function tests
 - Integration Tests: Testing component interactions
 - End-to-End: Testing complete user workflows
 
- 
Development server won't start
# Clear npm cache and reinstall npm cache clean --force rm -rf node_modules package-lock.json npm install - 
Build failures
# Check Node.js version node --version # Should be 20.x # Clear RSBuild cache rm -rf dist npm run build
 - 
Blockly workspace issues
- Ensure browser supports Web Workers
 - Check console for JavaScript errors
 - Try refreshing the page to reinitialize workspace
 
 - 
WebSocket connection problems
- Verify network connectivity
 - Check if firewall is blocking WebSocket connections
 - Ensure correct API endpoints in environment variables
 
 
- Use 
npm run build:analyzeto identify bundle size issues - Lazy load components using React.lazy() where appropriate
 - Monitor memory usage in browser DevTools
 - Use React DevTools Profiler to identify rendering bottlenecks
 
- Fork the repository
 - Create a feature branch: 
git checkout -b feature/amazing-feature - Make your changes
 - Run tests: 
npm test - Run linting: 
npm run test:lint - Commit your changes: 
git commit -m 'Add amazing feature' - Push to the branch: 
git push origin feature/amazing-feature - Open a Pull Request
 
- Follow TypeScript best practices
 - Use functional components with hooks
 - Write comprehensive tests for new features
 - Follow existing naming conventions
 - Update documentation for significant changes
 
- Use conventional commits: 
feat:,fix:,docs:,style:,refactor:,test: - Keep commits atomic and focused
 - Write descriptive commit messages
 - Rebase feature branches before merging
 
For additional support or questions, please refer to the project's issue tracker or contact the development team.