💡 Inspiration

Algorithmic trading has traditionally been plagued by the "black box" problem. Quantitative developers build models, but when market conditions shift, understanding why a model failed requires immense manual effort. We were inspired to bridge the gap between advanced mathematical trading and the reasoning capabilities of large language models. The goal was to build DepthSight: a transparent, enterprise-grade AI trading platform where a society of agents doesn't just execute trades, but actively researches, builds, and self-optimizes strategies autonomously.

⚙️ What it does

DepthSight operates an autonomous, self-correcting Autopilot loop powered by specialized AI agents:

  • Vision Analysis: On the first pass, a vision model analyzes a chart screenshot to identify structural patterns and generate an initial hypothesis.
  • Memory Researcher: Connects via a custom TCP-based JSON-RPC server using the Model Context Protocol (MCP) to fetch universal rules, exact symbol insights, and cross-asset transfers.
  • Strategy Advisor: Engages in a two-turn LLM dialogue (first selecting semantic tags, then generating the logic) based on the researched context.

🏗️ How we built it

The backend infrastructure relies on Python, PostgreSQL, and Celery workers, containerized with Docker and deployed on Alibaba Cloud.

The core innovation is our Intelligent Agent Memory System. Instead of a flat last-N memory, we built a 3-tier hierarchy exposed via an MCP Server on port 8100. To optimize strategies across multiple iterations, we implemented a Confidence-Based Lifecycle evaluation. After each backtest, a rule's confidence ($C$) and validated count ($V$) are updated based on the resulting $PnL$:

$$ C_{new} = \begin{cases} C + 0.1, & \text{if } PnL > 0 \ C - 0.2, & \text{otherwise} \end{cases} $$

If $C \le 0.3$ or $V \le -2$, the rule is strictly deprecated and removed from the active context window. Additionally, when 3 or more successful insights share the same strategy type, the system automatically synthesizes them into a permanent universal rule.

⚠️ Challenges we ran into

  1. Context Window Bloat: Feeding entire trading logs into the LLM degraded reasoning. We solved this by strictly limiting the MCP query outputs (max 2 universal rules, 3 exact insights) and introducing cross-asset transfer logic (e.g., applying successful ETHUSDT patterns to BTCUSDT, marked as ⚡).
  2. Logical Hallucinations: LLMs occasionally generated invalid strategy parameters (e.g., inverted stop losses). We engineered a Sub-Agent Critic to validate strategy JSON for logical flaws before backtesting. We also added programmatic Block Validation that intercepts invalid block types and forces the Autopilot to retry with direct feedback.

🏆 Accomplishments that we're proud of

We successfully built a trading environment that learns across sessions and asset classes. Our memory system actually "forgets" bad rules via TTL expiry and dynamically synthesizes permanent rules from recurring successes. Furthermore, we eliminated the "black box" effect: every AI decision compiles directly into a transparent drag-and-drop visual editor where users can inspect the exact logic.

🚀 What's next for DepthSight

We plan to expand DepthSight's multi-agent society by introducing specialized "Risk Management Agents" that can negotiate portfolio allocations in real-time, and scale our deployment across a larger Alibaba Cloud Kubernetes cluster.

Built With

Share this project:

Updates