opendeviationbar_providers/lib.rs
1//! Data provider integrations
2//!
3//! Source-specific adapters for fetching and processing tick/trade data.
4//!
5//! ## Supported Providers
6//!
7//! - `binance` - Binance spot and futures markets (primary - crypto)
8//! - `exness` - Exness EURUSD Standard tick data (primary - forex)
9//!
10//! ## Provider Selection
11//!
12//! | Asset Class | Provider | Rationale |
13//! |-------------|----------|-----------|
14//! | Crypto | Binance | Official data, high volume, REST + WebSocket |
15//! | Forex | Exness | Zero rate limiting, 100% reliability, simple format |
16//!
17//! ## Adding New Providers
18//!
19//! Follow the established pattern:
20//!
21//! ```text
22//! providers/
23//! └── [provider_name]/
24//! ├── mod.rs # Public API and documentation
25//! ├── client.rs # HTTP client or WebSocket
26//! ├── types.rs # Provider-specific data structures
27//! ├── builder.rs # Open deviation bar builder (if custom logic needed)
28//! └── conversion.rs # Convert to AggTrade format
29//! ```
30//!
31//! ## Design Principles
32//!
33//! 1. **Adapter pattern**: Convert provider format → AggTrade (core format)
34//! 2. **Error propagation**: Raise immediately, no silent failures
35//! 3. **Stateless where possible**: Cache externally, not in provider
36//! 4. **Documented edge cases**: Timezone handling, decimal factors, etc.
37//! 5. **Out-of-box dependencies**: Use standard crates (zip, csv, chrono)
38//!
39//! ## Quick Start
40//!
41//! Top-level re-exports allow shorter import paths:
42//!
43//! ```rust,ignore
44//! // Top-level imports (recommended)
45//! use opendeviationbar_providers::{
46//! HistoricalDataLoader,
47//! get_tier1_symbols,
48//! ExnessFetcher,
49//! };
50//! ```
51//!
52//! Or use submodule paths directly:
53//!
54//! ```rust,ignore
55//! // Submodule imports (also supported)
56//! use opendeviationbar_providers::binance::HistoricalDataLoader;
57//! use opendeviationbar_providers::exness::ExnessFetcher;
58//! ```
59
60#[cfg(feature = "binance")]
61pub mod binance;
62
63#[cfg(feature = "exness")]
64pub mod exness;
65
66// Issue #96: Zero-allocation serde helpers shared by WS and REST deserialization
67pub mod serde_helpers;
68
69// ============================================================================
70// Public API Re-exports
71// ============================================================================
72//
73// Commonly used types re-exported at the top level for convenience.
74// Users can import from either:
75// - Top level: `use opendeviationbar_providers::HistoricalDataLoader;`
76// - Submodule: `use opendeviationbar_providers::binance::HistoricalDataLoader;`
77//
78// Both paths are supported and equivalent.
79
80// Binance provider re-exports (alphabetically sorted)
81// Includes: historical data loading, Tier-1 symbol discovery, WebSocket streaming,
82// intra-day chunking, adaptive rate limiting (Issue #162)
83#[cfg(feature = "binance")]
84pub use binance::{
85 AdaptiveRateLimiter, BinanceWebSocketStream, CsvAggTrade, HistoricalDataLoader,
86 HistoricalError, IntraDayChunkIterator, RateLimitError, TIER1_SYMBOLS, WebSocketError,
87 detect_csv_headers, fetch_aggtrades_parallel, get_tier1_symbols, get_tier1_usdt_pairs,
88 is_tier1_symbol, python_bool, shared_binance_limiter,
89};
90
91// Exness provider re-exports (alphabetically sorted)
92// Includes: client, builder, types, and errors
93#[cfg(feature = "exness")]
94pub use exness::{
95 ConversionError, ExnessError, ExnessFetcher, ExnessInstrument, ExnessOpenDeviationBar,
96 ExnessOpenDeviationBarBuilder, ExnessTick, SpreadStats, ValidationStrictness,
97};