Project Documentation: TradeMemory
Exploring Memory-Augmented AI for Trading Journaling
Tech Stack: MERN + Groq (Qwen-3) + Hindsight Cloud Vector SDK
Overview
While working on AI systems and full-stack development, we explored how Large Language Models (LLMs) can be combined with vector databases to create applications with persistent context.
TradeMemory is a learning project focused on building an intelligent trading journal that stores not only trade details but also the reasoning and emotions behind trading decisions.
The goal was to experiment with how AI memory can improve the way users review past experiences.
The Problem
Many retail traders maintain their trading records using spreadsheets or basic notes.
While these methods store information, they often lack:
1. Easy Retrieval
A normal spreadsheet cannot understand questions like:
"What was my mindset when I made my previous loss on Zomato?"
2. Consistent Logging
Manual journaling often becomes difficult to maintain because entering multiple fields after every trade creates friction.
3. Learning From History
Stored data usually remains static and does not provide context from previous decisions.
TradeMemory explores a different approach by allowing users to log trades naturally through conversation and storing those interactions as searchable memories.
System Architecture
The application follows a simple flow:
Recall → Process → Store
1. Semantic Recall (Hindsight SDK)
Before generating a response, the system searches previous stored memories using vector similarity.
Relevant past experiences are retrieved and provided as context.
2. Context Processing (Groq / Qwen)
The retrieved information is passed to the LLM so the response can consider previous interactions.
3. Memory Storage
After the interaction, important trade-related information is identified, tagged with metadata, and stored for future retrieval.
AI Processing Approach
The project uses Qwen-3 through the Groq API.
A custom agent layer manages:
- Conversation history
- Prompt structure
- Response formatting
- Memory extraction
Regex-based filtering is used to keep responses clean and focused for the user.
Features Implemented
1. Natural Language Trade Logging
Instead of filling multiple fields manually, users can write:
"Booked 20k profit on Tata Motors, felt disciplined today."
The system identifies the intent and stores it as a structured trade memory.
2. Trading Statistics Dashboard
The dashboard displays:
- Total trades
- Wins
- Losses
- Win rate
The statistics are generated from stored memory metadata.
3. Trader Reflection Model
The system can analyze previous trade memories and generate a summary of observed patterns.
Example:
"User performs better with large-cap stocks and struggles during volatile setups."
Security Implementation
API keys are handled only on the backend.
The frontend communicates through a Node.js middleware layer, preventing direct exposure of sensitive credentials.
Technical Details
Frontend
Built using React.js.
The interface uses:
- Dark terminal-style UI
- Monospace typography
- Quick action prompts
React hooks are used to refresh statistics after new memories are stored.
Backend
Built using:
- Node.js
- Express.js
The backend manages:
- LLM communication
- Memory retrieval
- Data processing
The official Hindsight SDK is used for vector operations.
Vector Database Concept
Instead of storing only text, each trade memory is converted into an embedding.
This allows similarity-based searching.
For example:
Searching "Reliance trade" can also retrieve memories containing:
- RIL
- Blue chip investment
- Previous similar setups
because they have similar meaning.
Challenges During Development
Metadata Handling
Initially, dashboard values were not updating correctly.
This was improved by adding structured metadata tags during memory creation.
Response Speed
Using Groq inference improved response time significantly compared to traditional LLM API calls.
AI Boundaries
Prompt constraints were added to keep the system focused on journaling and analysis rather than providing financial advice.
Future Improvements
Possible extensions:
Automated Trade Import
Connecting with broker APIs to import trade history.
Voice Logging
Allowing users to record trade thoughts through voice.
Market-Specific Memory
Separate memory contexts for:
- NSE
- US Markets
- Crypto
Conclusion
TradeMemory was built as an experiment to understand how persistent AI memory can be used in real applications.
The project combines:
- Full-stack development
- LLM integration
- Vector databases
- Prompt engineering
to explore a more contextual way of interacting with AI systems.
Top comments (0)