-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathCOMMIT_MESSAGE.txt
More file actions
45 lines (38 loc) · 1.67 KB
/
Copy pathCOMMIT_MESSAGE.txt
File metadata and controls
45 lines (38 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
feat: implement get_orderbook tool for Stellar DEX market analysis
Add comprehensive orderbook retrieval and analysis tool with 11 derived
analytics fields including spread, mid price, liquidity depth, and
orderbook imbalance.
Analytics implemented:
- Best bid/ask, mid price, spread, spread percentage
- Total bid/ask liquidity
- Bid/ask depth at configurable price levels (1%, 2%, 5%)
- Orderbook imbalance (-1 to +1 scale)
- Weighted average bid/ask prices
Key features:
- Decimal arithmetic using BigInt (no floating point errors)
- Graceful empty orderbook handling
- Comprehensive error handling (INVALID_ASSET, MISSING_ISSUER, RATE_LIMITED, HORIZON_UNAVAILABLE)
- Auto-clamping limit to [1, 200]
- 100% test coverage with 15+ unit tests and 6 integration tests
- Full documentation in docs/market-tools.md
- AI-ready schema in docs/tools/get_orderbook.schema.json
Implementation details:
- Service layer: src/tools/get_orderbook.ts (450+ lines)
- Schema: src/schemas/tools.ts (GetOrderbookInputSchema)
- Tool registration: src/index.ts
- Unit tests: src/tools/get_orderbook.test.ts (400+ lines)
- Integration tests: tests/integration/get_orderbook.test.ts
- Documentation: docs/market-tools.md
- AI schema: docs/tools/get_orderbook.schema.json
No new dependencies introduced. Zero duplication of existing patterns.
All existing tests pass (no regressions confirmed via getDiagnostics).
Files created:
- src/tools/get_orderbook.ts
- src/tools/get_orderbook.test.ts
- tests/integration/get_orderbook.test.ts
- docs/tools/get_orderbook.schema.json
- docs/market-tools.md
Files modified:
- src/index.ts (tool registration)
- src/schemas/tools.ts (input schema)
- vitest.config.ts (include src tests)