Expand description
§CabalSpy
Official Rust client for the CabalSpy API: a realtime multichain data layer for labeled wallets, covering Solana, Base, BNB Chain, Ethereum and Robinhood Chain.
Track what Key Opinion Leaders, smart money wallets and whales are actually buying, with PnL, holder data, cluster signals and bundle detection.
use cabalspy::{CabalSpy, Chain, Period, SignalMode, SignalOpts, WalletType, LeaderboardOpts};
#[tokio::main]
async fn main() -> Result<(), cabalspy::Error> {
let client = CabalSpy::from_env()?;
// Who is this wallet? Searches every chain and wallet type.
let wallet = client.wallets().lookup("As7HjL7dzzvbRbaD3WCun47robib2kmAKRXMvjHkSMB5").await?;
println!("{:?}", wallet.data);
// Best KOL wallets on Solana over 7 days.
let board = client
.wallets()
.leaderboard(Chain::Solana, LeaderboardOpts {
wallet_type: Some(WalletType::Kol),
period: Some(Period::D7),
limit: Some(25),
..Default::default()
})
.await?;
println!("{}", board.pagination.map(|p| p.total).unwrap_or(0));
// Live cluster signals: five or more KOLs buying the same token within an hour.
let signals = client
.signals()
.list(Chain::Solana, WalletType::Kol, SignalMode::Cluster, SignalOpts {
min_wallets: Some(5),
hours: Some(1),
..Default::default()
})
.await?;
for signal in &signals.data.signals {
println!("{:?} {:?}", signal.token.token_name, signal.window.wallet_count);
}
Ok(())
}§Try it without signing up
CabalSpy::demo uses the public demo key, DEMO_API_KEY. Every response
then carries Envelope::demo with the remaining daily budget.
use cabalspy::{CabalSpy, Chain, WalletType};
let client = CabalSpy::demo()?;
let kols = client.wallets().list(Chain::Solana, WalletType::Kol, None, None).await?;
println!("{} left today", kols.demo.and_then(|d| d.remaining_today).unwrap_or(0));20 requests per IP per UTC day shared with the websocket, data delayed by
15 minutes, at most 5 rows per list. Once spent, requests fail with
Error::DemoLimit. A free test key with 1,000 realtime requests per month
is at https://apidashboard.cabalspy.xyz/.
§Chain coverage
| Chain | Identifier | Currency | Wallet types |
|---|---|---|---|
| Solana | Chain::Solana | SOL | Kol, Smart, Whale |
| BNB Chain | Chain::Bnb | BNB | Kol, Smart |
| Base | Chain::Base | ETH | Kol, Smart |
| Ethereum | Chain::Eth | ETH | Kol |
| Robinhood Chain | Chain::Rh | ETH | Kol, Smart |
Impossible combinations are rejected before a request goes out, so a mistake costs no credits:
let result = client.wallets().list(Chain::Eth, WalletType::Whale, None, None).await;
assert!(matches!(result, Err(Error::InvalidRequest { .. })));§Market cap availability
On REST, market_cap, price, unrealized_pnl_* and remaining_* are
populated for Solana only; on the other chains they are None. Realized PnL,
invested amounts, holdings and counters work everywhere. See
Chain::has_rest_marketcap.
The websocket gateway populates those fields on every chain, and unlike REST it does not zero the unrealized values once a position is fully sold.
§Timestamps
Timestamps inside data arrive as "YYYY-MM-DD HH:MM:SS" with no offset and
are UTC. Only meta.timestamp carries a Z. Use parse_api_timestamp rather
than assuming a format, and note that treating them as local time shifts every
value by the machine’s offset.
Re-exports§
pub use client::Analytics;pub use client::Bundle;pub use client::CabalSpy;pub use client::CabalSpyBuilder;pub use client::Calls;pub use client::CallsOpts;pub use client::FeedOpts;pub use client::LeaderboardOpts;pub use client::Signals;pub use client::SignalOpts;pub use client::System;pub use client::TokenOpts;pub use client::Tokens;pub use client::Transactions;pub use client::Wallets;pub use client::BATCH_MAX_ADDRESSES;pub use client::BATCH_MAX_MINTS;pub use client::DEFAULT_BASE_URL;pub use client::DEFAULT_WS_URL;pub use client::DEMO_API_KEY;pub use error::ApiErrorBody;pub use error::Error;pub use error::RateLimit;pub use error::Result;pub use models::ActiveTokensSummary;pub use models::AnalyticsMode;pub use models::BestCall;pub use models::BundleEntry;pub use models::BundlePosition;pub use models::BundleResponse;pub use models::BundleWallet;pub use models::Call;pub use models::CallPerformance;pub use models::CallStatsBlock;pub use models::CallStatsPeriod;pub use models::CallStatsResponse;pub use models::CallTier;pub use models::CallToken;pub use models::CallTrigger;pub use models::CallWallet;pub use models::Chain;pub use models::CountResponse;pub use models::DemoInfo;pub use models::DemoUpgrade;pub use models::Envelope;pub use models::FeedTransaction;pub use models::HealthResponse;pub use models::HoldingsAfter;pub use models::MetaResponse;pub use models::Pagination;pub use models::Period;pub use models::PeriodStats;pub use models::ResponseMeta;pub use models::Signal;pub use models::SignalMode;pub use models::SignalTokenBlock;pub use models::SignalWallet;pub use models::SignalWindow;pub use models::SignalsResponse;pub use models::TokenBlock;pub use models::TokenStats;pub use models::TokenTrader;pub use models::TotalHolders;pub use models::TotalHoldings;pub use models::TraderHoldings;pub use models::TraderStats;pub use models::TransactionsList;pub use models::VolumeResponse;pub use models::WalletProfile;pub use models::WalletTracker;pub use models::WalletType;pub use models::WinRateDistribution;pub use models::CHAINS;
Modules§
- client
- The HTTP client and its resource groups.
- error
- Error types.
- models
- Chains, wallet types and response models.
Functions§
- parse_
api_ timestamp - Parses a timestamp from a response body into Unix seconds, always as UTC.