dex-skills v0.1.0

getTradeHistory()

Retrieve the trade history for a specific token on a supported platform. Returns a list of recent buy and sell transactions with amounts, prices, and timestamps. This is a read-only operation that does not require a private key.

Signature

const skill = getSkill(skills, "pumpfun");
const trades: TradeHistoryItem[] = await skill.getTradeHistory("TokenMintAddress...", {
  limit: 50,
});

Parameters

Parameter Type Description
tokenAddress * string The address of the token to query trade history for.
limit number Maximum number of trades to return. Default: 50

Return Value

Returns a Promise<TradeHistoryItem[]>. See the Types reference for the full TradeHistoryItem definition.

Platform Support

Platform Supported
Pump.fun Yes
LetsBonk No
Moonshot Yes
Zora Yes
Clanker No
Four.meme No
SunPump No

Example

get-trade-history.ts
import { createSkills, getSkill } from "dex-skills";

const skills = createSkills({
  wallets: {
    solana: {
      privateKey: "your-base58-private-key",
      rpcUrl: "https://api.mainnet-beta.solana.com",
    },
  },
});

// Get recent trades for a Pump.fun token
const pumpfun = getSkill(skills, "pumpfun");
const trades = await pumpfun.getTradeHistory("TokenMintAddress...", {
  limit: 20,
});

for (const trade of trades) {
  console.log(`[${trade.action}] ${trade.tokenAmount} tokens`);
  console.log(`  Tx: ${trade.txHash}`);
  console.log(`  Price: $${trade.priceUsd}`);
  console.log(`  Time: ${new Date(trade.timestamp * 1000).toISOString()}`);
}
Optional method
getTradeHistory() is an optional method on the PlatformSkill interface. Not all platforms support it. Check the platform support table above before calling this method.