deribit-fix 0.3.1

This crate provides a client for the Deribit Markets API using the FIX protocol.
Documentation
//! # Deribit FIX Framework
//!
//! [![Dual License](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
//! [![Crates.io](https://img.shields.io/crates/v/deribit-fix.svg)](https://crates.io/crates/deribit-fix)
//! [![Downloads](https://img.shields.io/crates/d/deribit-fix.svg)](https://crates.io/crates/deribit-fix)
//! [![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://docs.rs/deribit-fix)
//!
//! **Version: 0.3.1**  | **Status:** Production Ready | **Repository:** <https://github.com/joaquinbejar/deribit-fix>
//!
//! A comprehensive, production-ready FIX protocol client framework for Deribit cryptocurrency exchange.
//! This library provides a complete, type-safe, and async foundation for building sophisticated trading applications
//! that connect to Deribit using the FIX 4.4 protocol with custom extensions.
//!
//! ## ๐Ÿ—๏ธ Project Status
//!
//! **Current Version: 0.3.1** - Feature Complete & Production Ready
//!
//! This release represents a complete implementation of the Deribit FIX specification with:
//! - โœ… Full FIX 4.4 protocol support with Deribit extensions
//! - โœ… Complete trading operations (orders, positions, mass operations)
//! - โœ… Real-time market data streaming and snapshots
//! - โœ… Comprehensive session management and error handling
//! - โœ… Production-grade connection management with SSL support
//! - โœ… Extensive test suite with 90%+ coverage
//! - โœ… Rich examples and documentation
//!
//! ## ๐Ÿš€ Quick Start
//!
//! Add to your `Cargo.toml`:
//! ```toml
//! [dependencies]
//! deribit-fix = ""
//! ```
//!
//! Basic usage:
//! ```rust,no_run
//! use deribit_fix::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//!     let config = DeribitFixConfig::default()
//!         .with_credentials("your_key".to_string(), "your_secret".to_string())
//!         .with_heartbeat_interval(30);
//!
//!     let mut client = DeribitFixClient::new(&config).await?;
//!     client.connect().await?;
//!     
//!     // Start trading!
//!     let positions = client.get_positions().await?;
//!     println!("Current positions: {}", positions.len());
//!     
//!     client.disconnect().await?;
//!     Ok(())
//! }
//! ```
//!
//! ## ๐ŸŒ Supported Environments
//!
//! | Environment | Raw TCP | SSL |
//! |-------------|---------|-----|
//! | **Production** | `fix.deribit.com:9881` | `fix.deribit.com:9883` |
//! | **Test** | `fix-test.deribit.com:9881` | `fix-test.deribit.com:9883` |
//!
//! ## ๐ŸŽฏ Core Features
//!
//! ### ๐Ÿ“ก Session Management
//! - **Logon/Logout (A/5)**: Secure authentication with SHA256 + nonce
//! - **Heartbeat (0)**: Configurable keep-alive mechanism
//! - **Test Request (1)**: Connection health monitoring
//! - **Resend Request (2)**: Message recovery and gap filling
//! - **Sequence Reset (4)**: Sequence number management
//! - **Reject (3)**: Comprehensive error handling with detailed codes
//!
//! ### ๐Ÿ“ˆ Trading Operations
//! - **Order Management**:
//!   - New Order Single (D) - Place orders with full parameter support
//!   - Order Cancel Request (F) - Cancel individual orders
//!   - Order Cancel/Replace Request (G) - Modify existing orders
//! - **Mass Operations**:
//!   - Order Mass Cancel Request (q) - Cancel multiple orders
//!   - Order Mass Status Request (AF) - Bulk order status queries
//! - **Execution Reports**: Real-time order status updates and fill notifications
//! - **Position Management**:
//!   - Request For Positions (AN) - Query current positions
//!   - Position Report (AP) - Real-time position updates
//!
//! ### ๐Ÿ“Š Market Data
//! - **Real-time Streaming**:
//!   - Market Data Request (V) - Subscribe to live data feeds
//!   - Market Data Snapshot/Full Refresh (W) - Complete market snapshots
//!   - Market Data Incremental Refresh (X) - Efficient incremental updates
//! - **Security Information**:
//!   - Security List Request (x) - Available instruments
//!   - Security Definition Request (c) - Detailed instrument specifications
//!   - Security Status Request (e) / Security Status (f) - Instrument status updates
//!
//! ### ๐Ÿ’ผ Advanced Trading Features
//! - **Market Making**:
//!   - Mass Quote (i) - Bulk quote submission
//!   - Quote Request (R) - Request for quotes
//!   - Quote Cancel (Z) - Quote cancellation
//! - **RFQ (Request for Quote) System**:
//!   - RFQ Request (AH) - Submit RFQ requests
//!   - Quote Status Report (AI) - Quote status updates
//! - **Risk Management**:
//!   - MMProtection Limits (MM) - Market maker protection
//!   - MMProtection Reset (MZ) - Reset protection limits
//! - **Trade Reporting**:
//!   - TradeCaptureReportRequest (AD) - Request trade reports
//!   - TradeCaptureReport (AE) - Trade execution reports
//!
//! ### ๐Ÿ” Security & Authentication
//! - **SHA256 Authentication**: Secure credential-based authentication
//! - **Application Registration**: Support for registered apps with DeribitAppSig
//! - **Cancel on Disconnect**: Automatic order cancellation on connection loss
//! - **User Management**: User Request (BE) / User Response (BF)
//! - **SSL/TLS Support**: Encrypted connections for production environments
//!
//! ## โšก Technical Architecture
//!
//! ### ๐Ÿ—๏ธ Built on Modern Rust
//! - **Rust 2024 Edition**: Latest language features and performance
//! - **Async/Await**: Full async support with Tokio runtime
//! - **Type Safety**: Zero-cost abstractions with compile-time guarantees
//! - **Memory Safety**: No segfaults, buffer overflows, or memory leaks
//!
//! ### ๐Ÿ”Œ Connection Management
//! - **Automatic Reconnection**: Configurable backoff strategies
//! - **Connection Pooling**: Efficient resource utilization
//! - **Timeout Handling**: Robust timeout management
//! - **SSL/TLS Support**: Production-grade encrypted connections
//!
//! ### ๐ŸŽฏ Message Processing
//! - **FIX Protocol Compliance**: Full FIX 4.4 with Deribit extensions
//! - **Message Validation**: Comprehensive parsing and validation
//! - **Sequence Management**: Automatic sequence number handling
//! - **Gap Detection**: Automatic message gap detection and recovery
//!
//! ### ๐Ÿ›ก๏ธ Error Handling
//! - **Detailed Error Types**: Comprehensive error classification
//! - **Context Preservation**: Rich error context for debugging
//! - **Recovery Strategies**: Automatic recovery from transient errors
//! - **Logging Integration**: Structured logging with tracing support
//!
//! ## ๐Ÿ“š Examples & Documentation
//!
//! The framework includes comprehensive examples covering all major use cases:
//!
//! ### ๐Ÿ”ง Basic Examples
//! - **Basic Client** (`examples/basic/`): Simple client setup and connection
//! - **Login Test** (`examples/session/login_test.rs`): Authentication examples
//! - **Heartbeat** (`examples/session/heartbeat_example.rs`): Keep-alive handling
//!
//! ### ๐Ÿ“Š Trading Examples
//! - **Order Management** (`examples/order_management/`): Complete order lifecycle
//! - **Position Management** (`examples/position_management/`): Position tracking
//! - **Market Data** (`examples/market_data/`): Real-time data streaming
//!
//! ### ๐Ÿšจ Advanced Examples
//! - **Error Handling** (`examples/error_handling/`): Comprehensive error scenarios
//! - **Session Management** (`examples/session/session_management.rs`): Advanced session handling
//! - **Test Requests** (`examples/session/test_request_example.rs`): Connection monitoring
//! - **Resend Requests** (`examples/session/resend_request_example.rs`): Message recovery
//!
//! ## ๐Ÿงช Testing & Quality
//!
//! ### ๐Ÿ”ฌ Comprehensive Test Suite
//! - **Unit Tests**: 100+ unit tests covering all modules
//! - **Integration Tests**: End-to-end scenarios with mock servers
//! - **Coverage**: 90%+ code coverage with detailed reports
//! - **Continuous Integration**: Automated testing on multiple platforms
//!
//! ### ๐Ÿ“Š Quality Assurance
//! - **Clippy Linting**: Strict code quality enforcement
//! - **Rustfmt**: Consistent code formatting
//! - **Documentation**: 100% public API documentation
//! - **Benchmarks**: Performance regression testing
//!
//! ## ๐Ÿ“ฆ Installation & Setup
//!
//! ### Prerequisites
//! - Rust 1.75+ (specified in `rust-toolchain.toml`)
//! - Tokio async runtime
//! - Valid Deribit API credentials
//!
//! ### Build Commands
//! ```bash
//! # Standard build
//! cargo build
//!
//! # Release build (recommended for production)
//! cargo build --release
//!
//! # Run tests
//! cargo test
//!
//! # Run examples
//! cargo run --example basic_client
//! ```
//!
//! ## ๐Ÿš€ Performance
//!
//! - **Low Latency**: Optimized for high-frequency trading
//! - **Memory Efficient**: Zero-copy message parsing where possible
//! - **Async I/O**: Non-blocking network operations
//! - **Connection Pooling**: Efficient resource utilization
//!
//! ## ๐Ÿ› ๏ธ Development Tools
//!
//! The project includes comprehensive development tooling:
//! ```bash
//! # Format code
//! make fmt
//!
//! # Lint code
//! make lint
//!
//! # Run tests
//! make test
//!
//! # Generate documentation
//! make doc
//!
//! # Run benchmarks
//! make bench
//! ```
//!
//! ## โš ๏ธ Important Notes
//!
//! - **Testing Required**: Always test with demo account before live trading
//! - **Risk Management**: Implement proper risk controls in your application
//! - **Rate Limits**: Respect Deribit's API rate limits
//! - **Error Handling**: Implement robust error handling for production use
//!
//! ## ๐Ÿ“„ License & Disclaimer
//!
//! Licensed under MIT License. This software is not officially associated with Deribit.
//! Trading financial instruments carries risk - use at your own discretion.
//!

pub mod client;
pub mod config;
pub mod connection;
/// FIX protocol constants
pub mod constants;
pub mod error;
/// Utility macros for Debug and Display implementations
#[macro_use]
pub mod macros;
pub mod message;
/// FIX message models and data structures
pub mod model;
pub mod session;
/// Utility functions
pub mod utils;

pub use client::DeribitFixClient;
pub use config::DeribitFixConfig;
pub use error::{DeribitFixError, Result};
pub use message::admin::*;
pub use model::*;

/// Re-export commonly used types for convenience
pub mod prelude;