Vibe Water Associates - AWS Edition
Inspiration
We want to build an app which basically allows users to invest just purely through prompts. The traditional barrier to algorithmic trading is steep: you need coding skills, knowledge of financial markets, backtesting frameworks, and data infrastructure. We asked ourselves: "What if anyone could create a sophisticated trading strategy just by chatting?" Inspired by platforms like Renora.io and the democratization of finance through crypto, we set out to build an AI-first trading platform where natural conversation transforms into executable, backtested strategies.
What it does
Vibe Water Associates is a conversational AI trading platform that turns plain English into validated, backtested cryptocurrency strategies. Here's the complete workflow:
Natural Conversation: Users describe their investment goals in chat (e.g., "I have $1000 and want a 7% monthly return with moderate risk")
AI Strategy Generation: Claude 3.5 Haiku analyzes the request and generates:
- A friendly chat response explaining the strategy
- A complete strategy schema (JSON) with entry/exit conditions, risk parameters, and guardrails
Visual Strategy Builder: The AI-generated strategy appears as an interactive flowchart where users can:
- Drag-and-drop nodes (Crypto Category, Entry Conditions, Stop Loss, Take Profit)
- Adjust parameters visually
- See real-time guardrails (safety warnings for high-risk configurations)
- View impact metrics (estimated returns, capital requirements)
Multi-Agent Code Generation: When ready to backtest, our CrewAI agent system kicks in:
- Strategy Analyzer Agent: Parses the strategy JSON and extracts technical indicators
- Code Generator Agent: Writes production-quality VectorBT Python code
- Code Executor Agent: Validates security and executes in a sandboxed environment
Real Backtesting: The system:
- Fetches real Bitcoin/crypto price data from CoinGecko API
- Runs moving average crossover strategies with configurable parameters
- Calculates comprehensive metrics (Sharpe Ratio, CAGR, Max Drawdown, Win Rate)
- Displays interactive equity curves, trade history, and performance analytics
Continuous Learning: Using mem0, the system remembers successful strategy patterns and improves recommendations over time.
Result: Users go from "I want to invest" to seeing real backtest results without writing a single line of code.
How we built it
Frontend (Next.js 14 + TypeScript)
- Built with Next.js App Router for modern React patterns
- Implemented two WebSocket connections:
/ws/chat: Real-time AI conversation streaming/ws/backtest: Live agent execution updates
- Created custom hooks (
useWebSocketChat,useWebSocketBacktest) for connection management - Built interactive charts with Recharts (equity curves, drawdown analysis, monthly heatmaps)
- Implemented ReactFlow for the visual flowchart editor
- Designed a dark-themed UI with Tailwind CSS for a professional trading platform aesthetic
Backend (FastAPI + Python)
LLM Integration:
- Primary: Anthropic Claude 3.5 Haiku API
- Fallback: AWS Bedrock with Claude
- Custom XML parsing to separate user messages from strategy JSON
Multi-Agent System (CrewAI):
- Created 3 specialized agents with distinct roles
- Implemented LiteLLM integration with 120s timeout and 3 retries
- Built custom tools:
generate_vectorbt_code_tool,validate_python_code_tool,execute_python_code_tool
Backtesting Engine (VectorBT):
- Integrated VectorBT 0.26.2 for professional-grade backtesting
- Implemented moving average crossover strategies (10/30 day MAs)
- Built multi-source data fetching: CoinGecko (primary) → Yahoo Finance (fallback) → Mock data
Database (Supabase PostgreSQL):
- Designed schema with JSONB columns for flexible strategy storage
- Used asyncpg for high-performance async operations
- Implemented proper indexing for query optimization
Infrastructure
- Docker Compose orchestration for local development
- Environment-based configuration for easy deployment
- WebSocket architecture for real-time bidirectional communication
- Sandboxed subprocess execution for secure code running
Key Technical Achievements
- Dual-output LLM prompting (conversational + structured JSON in one response)
- Real-time agent progress streaming to frontend
- Secure Python code execution with validation
- Multi-source data resilience with automatic fallback
Challenges we ran into
LLM Response Parsing: Getting Claude to consistently output both conversational responses and valid JSON was tricky. We solved this with XML-style tags (
<user_message>and<backend>) in the system prompt, which proved more reliable than JSON-only approaches.CrewAI Timeout Issues: Initial CrewAI executions were timing out due to telemetry. We fixed this by:
- Setting
OTEL_SDK_DISABLED=true - Configuring LiteLLM timeouts to 120 seconds
- Adding retry logic (max 3 retries)
- Disabling telemetry:
LITELLM_TELEMETRY=False
- Setting
Data Source Reliability: Yahoo Finance API was unreliable for crypto data. We built a multi-source fallback system:
- CoinGecko API (free tier, reliable, crypto-focused)
- Yahoo Finance (backup)
- Generated mock data (last resort for demos)
WebSocket State Management: Managing two concurrent WebSocket connections (chat + backtest) while preserving state across navigation was complex. We implemented:
- SessionStorage for state persistence
- Breadcrumb navigation flags to distinguish user intent
- Custom hooks with automatic reconnection logic
Code Generation Accuracy: Getting agents to generate valid, executable VectorBT code consistently required:
- Detailed system prompts with code examples
- Multi-step validation (syntax → security → execution)
- Iterative feedback loops (if validation fails, agent fixes and retries)
Secure Code Execution: Running user-generated (AI-generated) code safely required:
- Subprocess sandboxing with 300s timeout
- Validation to block dangerous functions (eval, exec, os.system)
- Result extraction via special markers (
===RESULTS_START===)
Accomplishments that we're proud of
✨ AI-to-Code Pipeline: We built a complete pipeline from natural language → structured strategy → Python code → executed backtest results, all automated with AI agents.
🎯 Real Data, Real Results: Unlike many trading platforms, we use actual Bitcoin price data and calculate real metrics (Sharpe Ratio, CAGR, drawdown) using industry-standard VectorBT.
🤖 Multi-Agent Orchestration: Successfully implemented a 3-agent CrewAI workflow that collaborates to analyze, generate, and execute trading strategies with real-time progress updates.
🔐 Production-Grade Security: Built secure code execution with proper validation, sandboxing, and error handling—no shortcuts.
💬 Seamless UX: Users can chat naturally, see visual flowcharts update in real-time, and get backtested results without understanding the complexity underneath.
📊 Professional Analytics: Built a comprehensive analytics dashboard with interactive charts, trade blotters, and 6 key performance metrics that rivals commercial platforms.
🔄 Resilient Architecture: Multi-source data fetching, automatic fallbacks, WebSocket reconnection—the system degrades gracefully.
What we learned
AI Prompt Engineering is an Art: Crafting prompts that reliably produce both natural conversation and structured data required iteration. We learned that XML-style tags work better than asking for JSON directly.
Agent Reliability Requires Tuning: CrewAI agents need proper timeout configurations, retry logic, and telemetry management. Default settings often aren't production-ready.
WebSocket != Simple: Real-time bidirectional communication is powerful but complex. Managing connection lifecycle, reconnection, and state synchronization taught us a lot about event-driven architectures.
Financial Data APIs Have Limitations: Free tiers have rate limits, crypto data quality varies, and reliability isn't guaranteed. Building fallback chains is essential.
Code Generation is Feasible: With proper guardrails, LLMs can generate production-quality code. The key is validation, iteration, and good examples in prompts.
TypeScript + Python Integration: Bridging strongly-typed TypeScript frontend with Python backend via WebSocket JSON taught us about type safety, serialization, and API contracts.
Backtesting is Hard: VectorBT is powerful but has a learning curve. Understanding portfolio mechanics, drawdown calculations, and metric definitions required deep diving into quantitative finance.
What's next for Vibewater Associates - AWS Edition
🚀 Deploy to AWS:
- Backend on AWS Lambda + API Gateway
- Frontend on Vercel/Amplify
- RDS PostgreSQL for production database
- S3 for code execution artifacts
👥 User Authentication & Multi-tenancy:
- Implement JWT-based authentication
- User profiles and strategy isolation
- Subscription tiers (Basic, Pro, Enterprise)
📈 Advanced Strategies:
- Support RSI, MACD, Bollinger Bands indicators
- Multi-asset portfolio strategies
- Options and futures trading
- Machine learning-based signals
🤝 Strategy Marketplace:
- Users can publish and sell strategies
- Community ratings and reviews
- Backtested performance leaderboards
🧠 Enhanced AI Features:
- Strategy optimization agent (auto-tune parameters)
- Risk assessment AI (predict probability of outcomes)
- Market sentiment analysis from news/social media
- Natural language explanations of why trades were made
📱 Mobile App:
- React Native app for iOS/Android
- Push notifications for trade signals
- Portfolio tracking on the go
🔗 Live Trading Integration:
- Paper trading mode with real-time data
- Integration with Binance, Coinbase Pro APIs
- Automated execution with risk controls
- Real-time P&L tracking
📊 Advanced Analytics:
- Monte Carlo simulation
- Walk-forward analysis
- Correlation matrices
- Factor analysis
🌐 DeFi Integration:
- Support for Ethereum DeFi protocols
- Yield farming strategies
- Liquidity pool analysis
- Gas fee optimization
Technologies:
- Frontend: Next.js 14, TypeScript, Tailwind CSS, ReactFlow, Recharts
- Backend: FastAPI, Python 3.10+, asyncpg
- AI/ML: Anthropic Claude 3.5 Haiku, AWS Bedrock, CrewAI, mem0ai
- Backtesting: VectorBT 0.26.2, pandas, numpy
- Data: CoinGecko API, Yahoo Finance (yfinance)
- Database: Supabase PostgreSQL
- Infrastructure: Docker, WebSockets, Supabase
Built With
- antrophic
- bedrock
- claude
- coingecko
- crewai
- fastapi
- javascript
- next.js
- postgresql
- react
- typescript
- vectorbt
Log in or sign up for Devpost to join the conversation.