Inspiration

90% of retail traders lose money because they let emotion override risk management. I realized traders don't need another crypto chatbot—they need an objective system to physically intercept their bad decisions. I was inspired to build a tool that mathematically protects wallets from "hopium."

What it does

YuJiDi is an AI-driven Chief Risk Officer. You ask the Copilot for a trade setup, and before it answers, the backend calculates your exact Risk-to-Reward (R:R) and checks live market momentum. If the math fails, or the order book liquidity isn't there, the AI actively VETOES your trade and explains exactly why you shouldn't take it.

How I built it

The Engine: Node.js backend with a custom Pub/Sub WebSocket manager streaming live Binance Order Book and Cumulative Volume Delta (CVD) momentum in milliseconds.The Math: Deterministic Fixed Fractional Position Sizing calculated in O(1) time before the AI sees the prompt: $$PositionSize = \frac{WalletBalance \times (\frac{RiskPercentage}{100})}{|Entry - StopLoss|}$$ The AI Brain: Groq + Llama-3 acting strictly as an Intent Router to approve or veto trades based on the backend data.The Frontend: React via the MeDo visual builder, styled as a premium, institutional macOS-terminal dashboard.

Challenges we ran into

The MeDo frontend uses stateless HTTP polling for live prices, but our backend required WebSocket client connections to trigger the Binance streams. This caused a "silent failure" where the engine ran against $0.00 values. I solved this by engineering an authenticated "Ignition Switch" middleware—when a logged-in user hits the HTTP route, the backend secretly lazy-loads the persistent WebSocket stream in the background.

Accomplishments that we're proud of

We successfully bridged deterministic quantitative math with probabilistic AI reasoning. Seeing the AI actively render a red "TRADE VETOED" card on a mathematically flawed, over-leveraged setup was the ultimate validation of our architecture.

What we learned

We mastered advanced state management—specifically, how to sync stateless HTTP REST calls with a stateful WebSocket singleton pattern without memory leaks. We also learned how to constrain LLMs using Zod schemas to act as strict logic routers rather than math generators.

What's next for YuDiJi / AI Crypto Risk Agent

The next logical step is moving from purely vetoing trades to Auto-Execution. We plan to integrate user exchange API keys so that when the Chief Risk Officer approves a highly optimized trade, it automatically fires the limit orders directly into the Binance matching engine.

Share this project:

Updates

Submission history