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
59pub mod client;
60pub mod config;
61pub mod connection;
62/// FIX protocol constants
63pub mod constants;
64pub mod error;
65pub mod message;
66/// FIX message models and data structures
67pub mod model;
68pub mod session;
69
70pub use client::DeribitFixClient;
71pub use config::DeribitFixConfig;
72pub use error::{DeribitFixError, Result};
73pub use message::admin::*;
74pub use model::*;
75
76/// Re-export commonly used types for convenience
77pub mod prelude {
78
79    pub use crate::{
80        client::DeribitFixClient,
81        config::DeribitFixConfig,
82        error::{DeribitFixError, Result},
83        message::admin::*,
84        message::market_data::*,
85        message::orders::*,
86        message::security_list::*,
87        model::*,
88    };
89}