deribit_fix/lib.rs
1//! # Deribit FIX Framework
2//!
3//! A comprehensive FIX protocol client framework for Deribit cryptocurrency exchange.
4//! This library provides a reusable foundation for building trading applications
5//! that connect to Deribit using the FIX protocol.
6//!
7//! ## Overview
8//!
9//! Deribit FIX API is based on FIX version 4.4 with some tags from version 5.0 and custom tags.
10//! This framework implements the complete Deribit FIX specification, providing a robust
11//! and type-safe interface for cryptocurrency derivatives trading.
12//!
13//! ### Supported Environments
14//! - **Production**: `www.deribit.com:9880` (raw TCP) / `www.deribit.com:9883` (SSL)
15//! - **Test**: `test.deribit.com:9881` (raw TCP) / `test.deribit.com:9883` (SSL)
16//!
17//! ## Key Features
18//!
19//! ### Core FIX Protocol Support
20//! - **Session Management**: Logon(A), Logout(5), Heartbeat(0), Test Request(1)
21//! - **Message Sequencing**: Resend Request(2), Sequence Reset(4)
22//! - **Error Handling**: Reject(3) messages with proper error codes
23//!
24//! ### Trading Operations
25//! - **Order Management**: New Order Single(D), Order Cancel Request(F), Order Cancel/Replace Request(G)
26//! - **Mass Operations**: Order Mass Cancel Request(q), Order Mass Status Request(AF)
27//! - **Execution Reports**: Real-time order status updates and fill notifications
28//! - **Position Management**: Request For Positions(AN), Position Report(AP)
29//!
30//! ### Market Data
31//! - **Real-time Data**: Market Data Request(V), Market Data Snapshot/Full Refresh(W)
32//! - **Incremental Updates**: Market Data Incremental Refresh(X)
33//! - **Security Information**: Security List Request(x), Security Definition Request(c)
34//! - **Instrument Status**: Security Status Request(e), Security Status(f)
35//!
36//! ### Advanced Features
37//! - **Market Making**: Mass Quote(i), Quote Request(R), Quote Cancel(Z)
38//! - **RFQ System**: RFQ Request(AH), Quote Status Report(AI)
39//! - **Risk Management**: MMProtection Limits(MM), MMProtection Reset(MZ)
40//! - **Trade Reporting**: TradeCaptureReportRequest(AD), TradeCaptureReport(AE)
41//!
42//! ### Authentication & Security
43//! - **Secure Authentication**: SHA256-based authentication with nonce
44//! - **Application Registration**: Support for registered applications with DeribitAppSig
45//! - **Cancel on Disconnect**: Automatic order cancellation on connection loss
46//! - **User Management**: User Request(BE), User Response(BF)
47//!
48//! ## Technical Features
49//!
50//! - **Async/Await**: Full async support with Tokio runtime
51//! - **Connection Management**: Automatic reconnection with configurable backoff
52//! - **Message Validation**: Comprehensive FIX message parsing and validation
53//! - **Type Safety**: Strongly typed message structures and enums
54//! - **Error Handling**: Detailed error types with context
55//! - **Logging**: Configurable logging with tracing support
56//! - **Testing**: Comprehensive test suite with mock server support
57//!
58
59
60pub mod client;
61pub mod config;
62pub mod connection;
63pub mod error;
64pub mod message;
65pub mod session;
66pub mod types;
67pub mod utils;
68
69pub use client::DeribitFixClient;
70pub use config::Config;
71pub use error::{DeribitFixError, Result};
72pub use types::*;
73
74/// Re-export commonly used types for convenience
75pub mod prelude {
76 pub use crate::{
77 client::DeribitFixClient,
78 config::Config,
79 error::{DeribitFixError, Result},
80 types::*,
81 utils::logger::setup_logger,
82 };
83}