digdigdig3/lib.rs
1//! # V5 Exchange Connectors - Traits + Utils Architecture
2//!
3//! ## Архитектура
4//!
5//! ```text
6//! ┌─────────────────────────────────────────────────────────────────────────────┐
7//! │ v5/core │
8//! ├─────────────────────────────────────────────────────────────────────────────┤
9//! │ traits/ - Core трейты (MarketData, Trading, Account, ExchangeAuth) │
10//! │ utils/ - Утилиты (crypto, encoding, time) │
11//! │ http/ - HTTP клиент │
12//! │ websocket/ - WebSocket │
13//! │ types/ - Общие типы │
14//! └─────────────────────────────────────────────────────────────────────────────┘
15//!
16//! ┌─────────────────────────────────────────────────────────────────────────────┐
17//! │ v5/exchanges │
18//! ├─────────────────────────────────────────────────────────────────────────────┤
19//! │ kucoin/ - KuCoinConnector (impl MarketData, Trading, ExchangeAuth) │
20//! │ binance/ - BinanceConnector │
21//! │ ... │
22//! └─────────────────────────────────────────────────────────────────────────────┘
23//! ```
24//!
25//! ## Core трейты
26//!
27//! | Трейт | Описание |
28//! |-------|----------|
29//! | `MarketData` | price, orderbook, klines, ticker, ping |
30//! | `Trading` | market_order, limit_order, cancel, get_order, open_orders |
31//! | `Account` | balance, account_info |
32//! | `Positions` | positions, funding_rate, set_leverage |
33//! | `ExchangeAuth` | sign_request (каждая биржа реализует свою логику) |
34//!
35//! ## Утилиты
36//!
37//! - `utils::crypto` - hmac_sha256, hmac_sha512
38//! - `utils::encoding` - encode_base64, encode_hex
39//! - `utils::time` - timestamp_millis, timestamp_iso8601
40
41pub mod core;
42pub mod l1;
43pub mod l2;
44pub mod l3;
45pub mod connector_manager;
46pub mod testing;
47
48// Re-exports для удобства
49pub use core::{
50 // Traits
51 ExchangeIdentity, MarketData, Trading, Positions, Account,
52 CoreConnector,
53 WebSocketConnector, WebSocketExt,
54 Authenticated, CredentialKind,
55 Credentials, AuthRequest, SignatureLocation, ExchangeAuth,
56 CancelAll, AmendOrder, BatchOrders,
57 AccountTransfers, CustodialFunds, SubAccounts,
58
59 // Types
60 ExchangeId, ExchangeType, AccountType, Symbol,
61 SymbolInput, OwnedSymbolInput,
62 ExchangeError, ExchangeResult,
63 Price, Quantity, Asset, Timestamp,
64 OrderSide, OrderType, OrderStatus, Order, Position, PositionSide, Balance,
65 ExchangeCredentials,
66 SymbolInfo,
67 // Capabilities
68 MarketDataCapabilities, TradingCapabilities, AccountCapabilities,
69 RateLimitCapabilities, LimitModel,
70 EndpointWeight, RestLimitPool, DecayingLimitConfig, WsLimits,
71 // Empirical validation
72 ValidationStamp, FieldValidation,
73
74 // WebSocket types
75 ConnectionStatus, StreamType, SubscriptionRequest, StreamEvent,
76 OrderUpdateEvent, BalanceUpdateEvent, PositionUpdateEvent,
77
78 // Extended market data types (source of truth for derivatives/options feeds)
79 AggTrade,
80 HistoricalVolatility, VolatilityIndex, Basis, IndexPrice, CompositeIndex,
81 InsuranceFund, SettlementEvent, BlockTrade,
82 OrderBookSide, L3Action, OrderbookL3Event,
83 RiskLimit, PredictedFunding, FundingSettlement,
84 AuctionEvent, MarketWarning, OptionGreeks,
85
86 // Utils
87 hmac_sha256, hmac_sha512, sha256, sha512,
88 encode_base64, encode_hex, encode_hex_lower,
89 timestamp_millis, timestamp_seconds, timestamp_iso8601,
90
91 // Precision utilities
92 safe_price, safe_qty, format_price, format_qty,
93 PrecisionCache, PrecisionInfo,
94
95 // Transport
96 HttpClient,
97
98 // Normalization (Phase λ.A)
99 Canonicalize, CanonicalEvent,
100 CanonicalTrade, CanonicalTicker,
101 CanonicalOrderbook, CanonicalOrderbookDelta, CanonicalKline,
102 CanonicalLevel,
103 normalize_ts_to_ms,
104};