copy_trading/
lib.rs

1//! # Solana Copy Trading Library
2//!
3//! Live execution system for copying trades from high-performing Solana wallets.
4//!
5//! This library provides the core components for a copy trading system that:
6//! - Monitors swap transactions from tracked wallets
7//! - Automatically opens positions when tracked wallets buy tokens
8//! - Manages position lifecycle (opening, monitoring, closing)
9//! - Implements stop-loss and hold-time strategies
10//! - Executes trades via Jito bundles for fast settlement
11//!
12//! ## Architecture
13//!
14//! - **PositionManager**: Central coordinator that monitors swap transactions, market updates,
15//!   and new pool creations. Manages multiple positions simultaneously.
16//! - **Position**: Represents a single copy trading position with state management and lifecycle handling.
17//! - **PositionConfig**: Configuration for each tracked wallet defining buy amounts, hold times, stop-loss settings.
18//!
19//! ## Position Lifecycle
20//!
21//! 1. **Created**: Position created when a tracked wallet buys a token
22//! 2. **Opening**: Buy transaction sent to blockchain via Jito
23//! 3. **Open**: Position actively monitored for stop-loss triggers and hold time expiration
24//! 4. **Closing**: Sell transaction sent to blockchain
25//! 5. **Closed**: Position finalized and removed from active tracking
26//!
27//!
28//! LOTS OF FUNCTIONS UNDER IMPLEMENTATIONS OF POSITION AND POSITION MANAGER ARE DOCUMENTED IN THE CODE.
29
30mod position;
31mod position_manager;
32mod types;
33
34// Re-exports
35pub use position_manager::set_wallet_configs_from_pl_df::set_wallet_configs_from_pl_df;
36pub use types::position::Position;
37pub use types::position_close_reason::PositionCloseReason;
38pub use types::position_config::PositionConfig;
39pub use types::position_manager::PositionManager;
40pub use types::position_status::PositionStatus;