A voice-based OTC (Over-The-Counter) trading assistant built with Next.js frontend and Go backend. The bot allows users to place simulated trading orders through voice commands using speech recognition and text-to-speech capabilities.
- Frontend: Next.js 15 with TypeScript, Tailwind CSS
- Backend: Go with Gin framework
- Speech Recognition: Web Speech API
- Text-to-Speech: Web Speech Synthesis API
- Price Data: CoinGecko API
- Voice-based trading interface
- Real-time speech recognition
- Text-to-speech responses
- Support for multiple exchanges (OKX, Bybit, Deribit, Binance)
- Real-time cryptocurrency price fetching
- Session management
- Debug console for troubleshooting
- Node.js (v18 or higher)
- Go (v1.24.1 or higher)
- Modern web browser with Web Speech API support (Chrome, Edge, Safari)
- Microphone access for voice features
Navigate to the backend directory:
cd backendInstall Go dependencies:
go mod downloadCreate a .env file in the backend directory:
touch .envAdd the following environment variables to .env:
BLAND_API_KEY=your_bland_api_key_here
PORT=8080Navigate to the frontend directory:
cd ../quantbotInstall dependencies:
npm installCreate a .env.local file in the quantbot directory:
touch .env.localAdd the following environment variable:
BACKEND_URL=http://localhost:8080In the backend directory:
go run main.goThe backend will start on http://localhost:8080
You should see:
Server starting on port 8080
In a new terminal, navigate to the quantbot directory:
cd quantbot
npm run devThe frontend will start on http://localhost:3000
Open your browser and go to http://localhost:3000
- Allow microphone access when prompted by your browser
- Test your microphone using the "Test Mic" button
- Start a call by clicking the "Start Call" button
- Choose Exchange: Say "OKX", "Bybit", "Deribit", or "Binance"
- Select Symbol: Say the trading symbol (e.g., "Bitcoin", "BTC", "Ethereum")
- Specify Order Details: Say quantity and price (e.g., "1.5 Bitcoin at 65000 dollars")
- Confirm Order: Say "yes" to confirm or "no" to modify
Bot: "Hello! Welcome to GoQuant's OTC trading service. Please choose an exchange: OKX, Bybit, Deribit, or Binance."
You: "OKX"
Bot: "Great! You've selected OKX. Which trading symbol would you like to trade?"
You: "Bitcoin"
Bot: "The current price for BITCOIN on OKX is $65,123.45. Now, what quantity and price for the order?"
You: "1.5 Bitcoin at 65000 dollars"
Bot: "Got it. To confirm, you want to trade 1.5000 BITCOIN at $65000.0000 per unit on OKX. Is that correct?"
You: "Yes"
Bot: "Excellent! Your simulated order has been recorded. Thank you for using GoQuant!"
1. Microphone Not Working
- Ensure microphone permissions are granted
- Check browser compatibility (Chrome, Edge, Safari recommended)
- Test microphone using the "Test Mic" button
2. Speech Recognition Errors
- Speak clearly and at a moderate pace
- Ensure good microphone quality
- Check for background noise
3. Backend Connection Issues
- Verify backend is running on port 8080
- Check that CORS is properly configured
- Ensure no firewall blocking the connection
4. Price Fetching Issues
- Check internet connection
- CoinGecko API might be rate-limited
- Fallback mock prices will be used if API fails
The application includes a debug console that shows:
- Speech recognition status
- Microphone permissions
- API calls and responses
- Error messages
POST /start-call- Initialize a new trading sessionPOST /bland/webhook- Process voice commandsGET /health- Health check endpoint
POST /api/start-call- Proxy to backend start-callPOST /api/process-speech- Proxy to backend webhook
├── backend/
│ ├── handlers/
│ │ └── bland.go # Main trading logic
│ ├── main.go # Server entry point
│ ├── go.mod # Go dependencies
│ └── .env # Environment variables
├── quantbot/
│ ├── app/
│ │ ├── api/ # Next.js API routes
│ │ ├── globals.css # Global styles
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Main application
│ ├── next.config.ts # Next.js configuration
│ └── .env.local # Environment variables
└── README.md
- This is a simulation/demo - no real trades are executed
- Microphone access is required for voice features
- All trading data is stored in memory (sessions are not persistent)
- No sensitive trading credentials are handled
- Set environment variables in your deployment platform
- Ensure PORT environment variable is set correctly
- Configure CORS for your frontend domain
- Update BACKEND_URL in environment variables
- Ensure your deployment platform supports Web Speech API
- Configure proper HTTPS (required for microphone access in production)