A Python-based real-time speech-to-text system designed for trading floors. This project leverages Deepgram’s Nova-3 model for accurate, low-latency transcription and OpenAI’s GPT-4.1-mini model to detect and log trade intents as they happen.
Trading floors are loud, fast-paced, and chaotic. Capturing accurate voice logs in real time is a major challenge, yet essential for auditing and compliance.
This project demonstrates how to:
- Stream live audio from a trader’s microphone
- Transcribe it in real time using Deepgram Nova-3
- Detect trading instructions such as "Buy 100 AAPL at market" using OpenAI’s LLM
- Log valid trades automatically into a JSONL file for record keeping
The system is made up of three main components:
- Audio Input: Captures live microphone input using
PyAudio. - WebSocket Communication: Streams audio in chunks to Deepgram’s API for transcription.
- Transcription & Logging: Processes transcripts with OpenAI to detect trading intents and logs detected trades in real time.
🎙️ Microphone → WebSocket → Deepgram (Nova-3) → OpenAI LLM → Trade Log
- Real-time voice transcription
- Speaker-aware diarization
- Trading intent detection (Buy, Sell, Cancel)
- Automatic trade logging to
trades_log.jsonl - Configurable and extensible for other downstream tasks
git clone https://github.com/Neurl-LLC/deepgram-60.git
cd deepgram-60python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the project root with your API keys:
OPENAI_API_KEY=sk-your-openai-key
DEEPGRAM_API_KEY=your-deepgram-key
Start the trading transcription service:
python main.pyYou’ll see output like:
🎙️ Microphone live. Press Ctrl+C to stop.
🗣️ Speaker 0: Buy 100 AAPL at market
💹 TRADE DETECTED:
{
"trade_detected": true,
"action": "BUY",
"symbol": "AAPL",
"quantity": 100,
"price_type": "MARKET",
"price": null
}
All detected trades are stored in trades_log.jsonl with timestamps.
Each trade is stored as a structured JSON object:
{
"timestamp": "2025-10-21 15:42:03",
"trade_detected": true,
"action": "BUY",
"symbol": "TSLA",
"quantity": 200,
"price_type": "LIMIT",
"price": 250.00,
"raw_text": "Buy 200 Tesla at limit 250"
}You can modify the TRADING_INSTRUCTION system prompt in main.py to adapt the detection logic for different trading formats, markets, or internal compliance requirements.
- Integrate Deepgram Flux CSR model for conversational trade execution
- Add a web dashboard for visual trade tracking
- Include keyword-based risk detection and trade validation