Downloads
Download the starter code and challenge specification.
Overview
Build an agentic stock analysis workflow in Go. Your program accepts a stock ticker symbol, uses the DeepSeek Chat LLM to autonomously call tools (get price, fetch news, analyze sentiment), and produces a structured Buy / Sell / Hold recommendation as JSON.
High-level flow:
CLI args (symbol) → LLM ⇔ Tools → Final AnalysisReport (JSON)
What’s Provided vs. What You Implement
| Component | Status | File |
|---|---|---|
| Data types | Provided | internal/models/types.go |
| Mock tools (GetStockPrice, GetNews, AnalyzeSentiment) | Provided | internal/tools/tools.go |
| LLM client (HTTP call) | Provided | internal/llm/client.go |
| CLI entry point | Provided | cmd/analyzer/main.go |
| Test suite (22 tests) | Provided | *_test.go |
Tool-call parsing (ParseToolCall) | You Implement | internal/llm/client.go |
| Agent loop verification | You Implement | internal/agent/agent.go |
| System prompt design | You Implement | internal/agent/agent.go |
Project Structure
├── Makefile
├── go.mod
├── cmd/analyzer/main.go
├── internal/
│ ├── agent/agent.go, agent_test.go
│ ├── llm/client.go, client_test.go
│ ├── models/types.go
│ └── tools/tools.go, tools_test.go
├── configs/config.example.yaml
├── testdata/sample_response.json
└── docs/challenge.tex, challenge.pdf
Getting Started
-
Download and extract the starter code:
tar xzf agentic-trading-challenge.tar.gz cd stock-analyzer -
Verify it compiles:
make build -
Run the tests to see your starting point (14 pass, 8 fail):
make test -
Set your API key:
export DEEPSEEK_API_KEY="your-key-here"Get a key at platform.deepseek.com.
-
Implement
ParseToolCallininternal/llm/client.goand refine the agent loop. -
Run:
./bin/analyzer AAPL
Available Tools
The mock tools return deterministic data so you can focus on the agent logic.
GetStockPrice(symbol)
{
"name": "GetStockPrice",
"arguments": { "symbol": "AAPL" }
}
Returns: symbol, price, change, change_pct, volume, high, low.
GetNews(symbol)
{
"name": "GetNews",
"arguments": { "symbol": "AAPL" }
}
Returns: array of news items with title, source, summary.
AnalyzeSentiment(text)
{
"name": "AnalyzeSentiment",
"arguments": { "text": "Apple Reports Record Q4 Revenue..." }
}
Returns: sentiment (positive/negative/neutral), confidence.
Mock Data Reference
Stock Prices
| Symbol | Price | Change | Change% | Volume |
|---|---|---|---|---|
| AAPL | 178.72 | +2.35 | +1.33% | 52.3M |
| GOOGL | 141.80 | −0.95 | −0.67% | 23.1M |
| TSLA | 248.50 | +8.20 | +3.41% | 98.8M |
| Other | 100.00 | +0.50 | +0.50% | 10.0M |
News Headlines
- Apple Reports Record Q4 Revenue (Reuters)
- Apple Announces New AI Features (Bloomberg)
- Analysts Raise Apple Price Target (CNBC)
- Google Cloud Revenue Surges 28% (Reuters)
- DOJ Antitrust Case Update (WSJ)
TSLA (2 articles)
- Tesla Deliveries Beat Expectations (Bloomberg)
- Tesla Expands Charging Network (Electrek)
Sentiment Analysis
Keyword-based: positive words (record, beat, surge, growth, strong, ...) vs negative words (decline, drop, fall, antitrust, lawsuit, ...). Tie → neutral.
Expected Output
{
"symbol": "AAPL",
"recommendation": "Buy",
"confidence": 0.85,
"reasoning": "Strong Q4 earnings, positive analyst sentiment, and upward price momentum.",
"price": { "symbol": "AAPL", "price": 178.72, ... },
"news": [ ... ],
"sentiment": { "sentiment": "positive", "confidence": 0.85 }
}
Acceptance Criteria
Automated (must all pass)
make build— compiles without errorsmake test— all 22 tests pass./bin/analyzer AAPL— produces valid JSON to stdout
Manual Review
- Agent makes ≥ 2 tool calls before producing a final answer (not hardcoded)
recommendationis one ofBuy,Sell, orHoldconfidenceis in [0.0, 1.0]reasoningis a non-empty string
Scoring Rubric
| Criterion | Weight | Description |
|---|---|---|
| Agent Loop | 30% | LLM drives tool selection, multi-turn conversation, clean termination |
| Function Calling | 25% | Robust parsing (raw JSON, code fences, surrounding text), correct dispatch |
| Code Quality | 20% | Idiomatic Go, proper error handling, clear naming |
| Output | 15% | Valid JSON, reasonable recommendation with supporting data |
| Edge Cases | 10% | Unknown symbols, malformed responses, API errors |
DeepSeek API Reference
Full docs: api-docs.deepseek.com · Chat completions: create-chat-completion
POST https://api.deepseek.com/chat/completions
Content-Type: application/json
Authorization: Bearer <DEEPSEEK_API_KEY>
| Model ID | Description |
|---|---|
deepseek-chat | DeepSeek-V3 — use this for the challenge |
deepseek-reasoner | DeepSeek-V3 with chain-of-thought reasoning |
Bonus (Optional)
- Streaming — SSE streaming with real-time partial output
- Retries with backoff — exponential backoff for 429/500/503
- Multi-turn memory — remember previous analyses across runs
- Concurrent tool calls — use goroutines to execute independent tools in parallel
- Additional tests — extend the suite with your own edge-case tests