mod wallet;
mod holders;
mod patterns;
mod pnl;
pub use wallet::*;
pub use holders::*;
pub use patterns::*;
pub use pnl::*;
use solana_client::rpc_client::RpcClient;
use solana_sdk::pubkey::Pubkey;
use crate::Result;
pub struct Analytics {
client: RpcClient,
config: AnalyticsConfig,
}
#[derive(Debug, Clone)]
pub struct AnalyticsConfig {
pub whale_threshold_sol: f64,
pub major_holder_threshold_pct: f64,
pub pattern_lookback: usize,
pub track_smart_money: bool,
}
impl Default for AnalyticsConfig {
fn default() -> Self {
Self {
whale_threshold_sol: 1000.0,
major_holder_threshold_pct: 1.0,
pattern_lookback: 100,
track_smart_money: true,
}
}
}
impl Analytics {
pub fn new(client: RpcClient) -> Self {
Self {
client,
config: AnalyticsConfig::default(),
}
}
pub fn with_config(client: RpcClient, config: AnalyticsConfig) -> Self {
Self { client, config }
}
pub async fn profile_wallet(&self, wallet: &Pubkey) -> Result<WalletProfile> {
let profiler = WalletProfiler::new(&self.client, self.config.clone());
profiler.analyze(wallet).await
}
pub async fn analyze_holders(&self, mint: &Pubkey) -> Result<HolderAnalysis> {
let analyzer = HolderAnalyzer::new(&self.client);
analyzer.analyze(mint).await
}
pub async fn detect_patterns(&self, wallet: &Pubkey) -> Result<Vec<TradingPattern>> {
let detector = PatternDetector::new(&self.client, self.config.pattern_lookback);
detector.analyze(wallet).await
}
pub async fn calculate_pnl(&self, wallet: &Pubkey) -> Result<PnlReport> {
let tracker = PnlTracker::new(&self.client);
tracker.calculate(wallet).await
}
}