activity-monitor
Activity Monitor
Overview
Monitor and analyze trading activity on Polymarket including token merges, splits, and redemptions. Useful for tracking whale movements, detecting coordinated activity, and identifying market closing signals.
Security
This skill implements defense-in-depth measures against indirect prompt injection (Snyk W011):
- Input Sanitization: All user-generated content (activity titles, market slugs) is sanitized using
security.ts - Pattern Filtering: Known prompt injection patterns are removed (e.g., "ignore previous instructions", "system:")
- Content Validation: Suspicious content with excessive special characters is flagged
- Fail-Safe: Processing errors return original data rather than corrupting it
The skill fetches data from the trusted DOME API (api.domeapi.io) which provides structured activity data from the Polymarket protocol.
Setup
npm install
npm run build
Quick Start
import {
fetchActivity,
trackLargeTransactions,
analyzeActivityPatterns,
detectMarketClosingSignals
} from "./scripts/activityMonitor.js";
// Fetch recent activity
const result = await fetchActivity(apiKey, { limit: 100 });
// Track large transactions
const large = trackLargeTransactions(result.activities, { threshold: 10000 });
// Analyze patterns
const analysis = analyzeActivityPatterns(result.activities);
console.log(`Suspicious patterns: ${analysis.suspicious_patterns.length}`);
// Detect market closing signals
const signals = detectMarketClosingSignals(result.activities);
Core Functions
fetchActivity()
Fetch MERGE, SPLIT, REDEEM activities.
const result = await fetchActivity(apiKey, {
user: "0x...",
market_slug: "will-bitcoin-hit-100k",
start_time: 1700000000,
limit: 1000
});
trackLargeTransactions()
Identify large transactions by threshold or percentile.
// By fixed threshold
const large = trackLargeTransactions(activities, { threshold: 5000 });
// By percentile (top 10%)
const top10 = trackLargeTransactions(activities, { percentile: 90 });
analyzeActivityPatterns()
Analyze activity patterns and detect anomalies.
const analysis = analyzeActivityPatterns(activities, {
clusterWindowSeconds: 300
});
// Returns: { total_count, type_distribution, clusters, suspicious_patterns, ... }
detectMarketClosingSignals()
Detect potential market closing signals from redemption patterns.
const signals = detectMarketClosingSignals(activities);
// Returns: MarketClosingSignal[] sorted by confidence
filterMergesSplitsRedeems()
Filter activities by type, size, market, or user.
const redeems = filterMergesSplitsRedeems(activities, {
types: ["REDEEM"],
minShares: 1000,
market_slug: "specific-market"
});
Activity Types
- MERGE - Combining Yes and No tokens back into collateral
- SPLIT - Splitting collateral into Yes and No tokens
- REDEEM - Redeeming winning tokens after market resolution
Use Cases
- Whale Watching: Track large transactions above thresholds
- Market Intelligence: Detect unusual activity patterns
- Closing Signals: Identify when markets may be resolving
- Coordinated Activity: Detect potential manipulation
More from 0xweaksheep/dome_skills
market-discovery
Fetch and discover Polymarket markets from DOME API. Use this skill when the user wants to find markets, search for specific topics, filter markets by criteria (volume, status, tags), or identify backtesting candidates. Triggers include phrases like "find markets", "search for markets", "get market data", "filter markets", or "discover markets".
3backtest-planner
|
3historical-trades
Fetch and analyze historical Polymarket trade data. Use this skill when users need to retrieve trade history, analyze trading patterns, calculate volume statistics, or aggregate trades by time periods for specific markets, tokens, or users.
3candlestick-analysis
Analyze historical candlestick data for Polymarket prediction markets. Use this skill when users need to fetch OHLCV data, calculate technical indicators (SMA, EMA, volatility), detect price trends, support/resistance levels, or perform time-series analysis on market prices. Trigger for requests involving price history, chart data, technical analysis, or market trend detection.
3wallet-analytics
Analyze Polymarket wallet performance, positions, and trading activity. Use this skill when the user wants to analyze a trader's performance, get wallet positions, calculate PnL, or identify smart money wallets. Triggers include phrases like "analyze wallet", "trading performance", "wallet PnL", "positions", "smart money", or "trader analysis".
2event-discovery
Fetch and discover Polymarket events from DOME API. Use this skill when the user wants to find events (groups of related markets), search for specific event topics, filter events by criteria (volume, status, tags), or get markets within an event. Triggers include phrases like "find events", "get event markets", "discover events", "event analysis", or "events by category".
2