TradeMemory An AI-Powered Persistence Layer for Disciplined Trading
Source: Dev.to
Project Documentation: TradeMemory
Exploring Memory-Augmented AI for Trading Journaling
Tech Stack: MERN + Groq (Qwen-3) + Hindsight Cloud Vector SDK 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. Many retail traders maintain their trading records using spreadsheets or basic notes. While these methods store information, they often lack: A normal spreadsheet cannot understand questions like: “What was my mindset when I made my previous loss on Zomato?” Manual journaling often becomes difficult to maintain because entering multiple fields after every trade creates friction. 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. The application follows a simple flow: Before generating a response, the system searches previous stored memories using vector similarity. Relevant past experiences are retrieved and provided as context. The retrieved information is passed to the LLM so the response can consider previous interactions. After the interaction, important trade-related information is identified, tagged with metadata, and stored for future retrieval. 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. 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. The dashboard displays: Total trades Wins Losses Win rate The statistics are generated from stored memory metadata. 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.” API keys are handled only on the backend. The frontend communicates through a Node.js middleware layer, preventing direct exposure of sensitive credentials. 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. Built using: Node.js Express.js The backend manages: LLM communication Memory retrieval Data processing The official Hindsight SDK is used for vector operations. 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. Initially, dashboard values were not updating correctly. This was improved by adding structured metadata tags during memory creation. Using Groq inference improved response time significantly compared to traditional LLM API calls. Prompt constraints were added to keep the system focused on journaling and analysis rather than providing financial advice. Possible extensions: Connecting with broker APIs to import trade history. Allowing users to record trade thoughts through voice. Separate memory contexts for: NSE US Markets Crypto 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.