Skip to main content

scope/market/
mod.rs

1//! # Market Module
2//!
3//! Provides peg and order book health analysis for stablecoin markets.
4//! Fetches level-2 order book data from exchange APIs (e.g., Biconomy) and
5//! runs configurable health checks: peg deviation, spread, bid/ask balance,
6//! and minimum depth thresholds.
7//!
8//! ## Supported Exchanges
9//!
10//! - **Binance**: Spot REST depth API (public, no auth)
11//! - **Biconomy**: CEX-style REST depth API
12//! - **Ethereum DEX**: Synthesized from DexScreener liquidity
13//! - **Solana DEX**: Synthesized from DexScreener liquidity
14//!
15//! ## Usage
16//!
17//! ```rust,no_run
18//! use scope::market::{OrderBookClient, MarketSummary, HealthThresholds};
19//!
20//! #[tokio::main]
21//! async fn main() -> scope::Result<()> {
22//!     let client = scope::market::BiconomyClient::new("https://api.biconomy.com");
23//!     let book = client.fetch_order_book("PUSD_USDT").await?;
24//!     let summary = MarketSummary::from_order_book(&book, 1.0, &HealthThresholds::default(), None);
25//!     print!("{}", summary.format_text(Some("biconomy")));
26//!     Ok(())
27//! }
28//! ```
29
30mod orderbook;
31
32pub use orderbook::{
33    BiconomyClient, BinanceClient, ExecutionEstimate, ExecutionSide, HealthCheck, HealthThresholds,
34    MarketSummary, MarketVenue, OrderBook, OrderBookClient, OrderBookLevel,
35    order_book_from_analytics,
36};