Read-only client for the copy.top REST API (https://copy.top/v1).
copy.top tracks what top traders buy and sell on fomo, pumpfun and Hyperliquid. No key needed:
(require '[copytop.core :as ct]) (def c (ct/client)) (:traders (ct/traders c {:window "7d" :platform "pumpfun" :limit 10}))
Every route function takes the client and an optional map of options, and returns the decoded JSON answer as a map with keyword keys. A nil option is left to the server default. Answers 429 and 5xx, and network errors, are retried with exponential backoff, honouring Retry-After. Then errors are thrown as ex-info whose ex-data :type is one of :copytop/bad-request (400), :copytop/auth (401, 403), :copytop/not-found (404), :copytop/rate-limit (429), :copytop/server (5xx), :copytop/api (another status), :copytop/network (the API could not be reached) or :copytop/decode (the answer was not a JSON object). An empty handle, address or query throws IllegalArgumentException before any call.
Read-only client for the copy.top REST API (https://copy.top/v1).
copy.top tracks what top traders buy and sell on fomo, pumpfun and
Hyperliquid. No key needed:
(require '[copytop.core :as ct])
(def c (ct/client))
(:traders (ct/traders c {:window "7d" :platform "pumpfun" :limit 10}))
Every route function takes the client and an optional map of options, and
returns the decoded JSON answer as a map with keyword keys. A nil option is
left to the server default. Answers 429 and 5xx, and network errors, are
retried with exponential backoff, honouring Retry-After. Then errors are
thrown as ex-info whose ex-data :type is one of :copytop/bad-request (400),
:copytop/auth (401, 403), :copytop/not-found (404), :copytop/rate-limit
(429), :copytop/server (5xx), :copytop/api (another status),
:copytop/network (the API could not be reached) or :copytop/decode (the
answer was not a JSON object). An empty handle, address or query throws
IllegalArgumentException before any call.(alerts c)(alerts c
{:keys [since min-top-traders min-trade-usd max-mcap-usd kinds limit]})Events since a cursor: confluence (several top traders bought the same coin recently), big_trade (one tracked trader bought or sold a large amount) and thesis (a tracked trader posted a thesis). GET /alerts.
:since the cursor of the previous answer (nil: the last 15 minutes). :min-top-traders 1 to 50 (server default 3). :min-trade-usd server default 5000. :max-mcap-usd. :kinds a collection or a comma separated string of confluence, big_trade, thesis. :limit 1 to 40. Returns {:since :cursor :thresholds :events [...]}. Pass the cursor back as :since on the next call, or use watch-alerts.
Events since a cursor: confluence (several top traders bought the same
coin recently), big_trade (one tracked trader bought or sold a large
amount) and thesis (a tracked trader posted a thesis). GET /alerts.
:since the cursor of the previous answer (nil: the last 15 minutes).
:min-top-traders 1 to 50 (server default 3). :min-trade-usd server default
5000. :max-mcap-usd. :kinds a collection or a comma separated string of
confluence, big_trade, thesis. :limit 1 to 40.
Returns {:since :cursor :thresholds :events [...]}. Pass the cursor back
as :since on the next call, or use watch-alerts.(api-get c path)(api-get c path params)GET any route of the API and return the JSON answer. Use it for routes or parameters this namespace does not model yet. params is a map or a sequence of [key value] pairs, encoded by encode-query.
(ct/api-get c "coins/hot" {:window "1h"})
GET any route of the API and return the JSON answer. Use it for routes or
parameters this namespace does not model yet. params is a map or a
sequence of [key value] pairs, encoded by encode-query.
(ct/api-get c "coins/hot" {:window "1h"})(api-key? c)True when the client sends an API key.
True when the client sends an API key.
(client)(client {:keys [api-key base-url timeout max-retries backoff user-agent key-fn
transport sleep]})A copy.top client. Every option is optional:
:api-key from https://copy.top/account#api. Default: the COPYTOP_API_KEY environment variable; "" sends no key. Sent as "Authorization: Bearer <key>". :base-url default "https://copy.top/v1". :timeout seconds per HTTP call, default 45. :max-retries retries on 429, 5xx and network errors, default 3; 0 disables them. :backoff base delay in seconds, doubled on each retry, up to 30 s. Default 1.0. :user-agent default "copytop-clojure/<version> (+https://copy.top)". :key-fn turns JSON keys into map keys, default keyword; pass identity to keep strings. :transport a function {:url :headers :timeout} -> {:status :headers :body}, see copytop.transport. Default: java.net.http. :sleep a function taking seconds; tests replace it.
The API key is kept in a closure, so printing the client never shows it.
A copy.top client. Every option is optional:
:api-key from https://copy.top/account#api. Default: the
COPYTOP_API_KEY environment variable; "" sends no key.
Sent as "Authorization: Bearer <key>".
:base-url default "https://copy.top/v1".
:timeout seconds per HTTP call, default 45.
:max-retries retries on 429, 5xx and network errors, default 3; 0
disables them.
:backoff base delay in seconds, doubled on each retry, up to 30 s.
Default 1.0.
:user-agent default "copytop-clojure/<version> (+https://copy.top)".
:key-fn turns JSON keys into map keys, default keyword; pass
identity to keep strings.
:transport a function {:url :headers :timeout} -> {:status :headers
:body}, see copytop.transport. Default: java.net.http.
:sleep a function taking seconds; tests replace it.
The API key is kept in a closure, so printing the client never shows it.(coin c chain address)One coin: price, market cap, moves, liquidity, which tracked traders hold or sold it, and theses. GET /coins/{chain}/{address}. chain: robinhood, solana, base, bnb, eth or arc.
One coin: price, market cap, moves, liquidity, which tracked traders hold
or sold it, and theses. GET /coins/{chain}/{address}. chain: robinhood,
solana, base, bnb, eth or arc.(coin-url chain address)The copy.top page of a coin: https://copy.top/token/<chain>/<address>.
The copy.top page of a coin: https://copy.top/token/<chain>/<address>.
Seconds per HTTP call. Some routes can take up to 30 seconds when their cache is cold.
Seconds per HTTP call. Some routes can take up to 30 seconds when their cache is cold.
Seconds between two polls of watch-alerts. Once a minute is plenty.
Seconds between two polls of watch-alerts. Once a minute is plenty.
(dex-paid c)(dex-paid c {:keys [limit]})Coins whose team paid for a dexscreener profile in the last 24 hours. GET /coins/dex-paid. :limit 1 to 12.
Coins whose team paid for a dexscreener profile in the last 24 hours. GET /coins/dex-paid. :limit 1 to 12.
(encode-query params)A query string from a map or a sequence of [key value] pairs. Nil and blank values are dropped, booleans become true/false, keywords their name, collections are joined with commas.
A query string from a map or a sequence of [key value] pairs. Nil and blank values are dropped, booleans become true/false, keywords their name, collections are joined with commas.
(error-type e)The :type of an error thrown by this client (:copytop/not-found...), or nil for another exception.
The :type of an error thrown by this client (:copytop/not-found...), or nil for another exception.
(escape value)Percent-encodes a query string key or value (space as %20).
Percent-encodes a query string key or value (space as %20).
(escape-segment value)Percent-encodes a path segment, keeping ":" (xyz:TSLA).
Percent-encodes a path segment, keeping ":" (xyz:TSLA).
(format-number n)A number as the API reads it: 1500000.0 -> "1500000", 250.5 -> "250.5".
A number as the API reads it: 1500000.0 -> "1500000", 250.5 -> "250.5".
(hl-calls c coin)The X analysts ranked by the track record of their calls on one Hyperliquid market, and their recent calls. GET /hyperliquid/markets/{coin}/calls.
The X analysts ranked by the track record of their calls on one
Hyperliquid market, and their recent calls.
GET /hyperliquid/markets/{coin}/calls.(hl-market c coin)copy.top's read of one Hyperliquid market (BTC, ETH, xyz:TSLA...): technicals, funding, open interest, what the top traders hold, liquidations. GET /hyperliquid/markets/{coin}.
copy.top's read of one Hyperliquid market (BTC, ETH, xyz:TSLA...):
technicals, funding, open interest, what the top traders hold,
liquidations. GET /hyperliquid/markets/{coin}.(hl-market-url coin)The copy.top page of a Hyperliquid market: https://copy.top/token/hyperliquid/<coin>.
The copy.top page of a Hyperliquid market: https://copy.top/token/hyperliquid/<coin>.
(hl-markets c)(hl-markets c {:keys [category limit]})Live Hyperliquid markets (crypto perps and hip-3 markets: stocks, indices, commodities, fx), sorted by 24 hour volume. GET /hyperliquid/markets. :category crypto, stocks, indices... :limit 1 to 50.
Live Hyperliquid markets (crypto perps and hip-3 markets: stocks, indices, commodities, fx), sorted by 24 hour volume. GET /hyperliquid/markets. :category crypto, stocks, indices... :limit 1 to 50.
(hl-trader c address)One Hyperliquid trader by address (0x and 40 hex characters): metrics, pnl per window, live positions and fills. GET /hyperliquid/traders/{address}.
One Hyperliquid trader by address (0x and 40 hex characters): metrics,
pnl per window, live positions and fills. GET /hyperliquid/traders/{address}.(hl-trader-url address)The copy.top page of a Hyperliquid trader: https://copy.top/t/hl/<address>.
The copy.top page of a Hyperliquid trader: https://copy.top/t/hl/<address>.
(hl-traders c)(hl-traders c {:keys [window sort limit]})Hyperliquid perps traders tracked by copy.top, ranked by pnl or roi. GET /hyperliquid/traders. :window 24h, 7d, 30d (default) or all. :sort pnl (default) or roi. :limit 1 to 20.
Hyperliquid perps traders tracked by copy.top, ranked by pnl or roi. GET /hyperliquid/traders. :window 24h, 7d, 30d (default) or all. :sort pnl (default) or roi. :limit 1 to 20.
(hot-coins c)(hot-coins c {:keys [window max-mcap-usd limit]})The signal feed: coins tracked traders are buying now. GET /coins/hot. :window 1h or 24h (default 24h). :max-mcap-usd leaves out coins above this market cap. :limit 1 to 15.
The signal feed: coins tracked traders are buying now. GET /coins/hot. :window 1h or 24h (default 24h). :max-mcap-usd leaves out coins above this market cap. :limit 1 to 15.
(hot-index c)(hot-index c {:keys [window chain limit]})copy.top's hot index: coins ranked 0 to 100 by attention (buyers, callers, activity on X). GET /coins/index. :window 1h, 6h or 24h. :chain optional. :limit 1 to 10.
copy.top's hot index: coins ranked 0 to 100 by attention (buyers, callers, activity on X). GET /coins/index. :window 1h, 6h or 24h. :chain optional. :limit 1 to 10.
(money-flow c)(money-flow c {:keys [side window limit]})Coins ranked by the dollars tracked traders bought (:side buy) or sold (:side sell). GET /coins/flow. :window 1h, 6h, 24h or 7d. :limit 1 to 10.
Coins ranked by the dollars tracked traders bought (:side buy) or sold (:side sell). GET /coins/flow. :window 1h, 6h, 24h or 7d. :limit 1 to 10.
(parse-retry-after value)(parse-retry-after value now)Retry-After in seconds (a number of seconds or an HTTP date), capped at two minutes, or nil when absent or unreadable.
Retry-After in seconds (a number of seconds or an HTTP date), capped at two minutes, or nil when absent or unreadable.
(search c query)Traders and coins by name, @handle, $ticker or address (2 to 80 characters). GET /search. Returns {:traders [...] :coins [...]}.
Traders and coins by name, @handle, $ticker or address (2 to 80
characters). GET /search. Returns {:traders [...] :coins [...]}.(temporary? e)True when a call that threw e may succeed later: 429, 5xx or a network error.
True when a call that threw e may succeed later: 429, 5xx or a network error.
(theses c)(theses c {:keys [sort hours limit]})Theses (a trader's written reason for holding a coin) posted by tracked traders. GET /theses. :sort new (default) or popular. :hours 1 to 24. :limit 1 to 10.
Theses (a trader's written reason for holding a coin) posted by tracked traders. GET /theses. :sort new (default) or popular. :hours 1 to 24. :limit 1 to 10.
(trader c handle)One trader's profile: pnl over 30 days, roi, win rate, fair play, open positions, latest trades and theses. GET /traders/{handle}.
handle as search or another call gave it, with or without "@"; a handle starting with pf_ is a pumpfun account. Throws :copytop/not-found when there is no such trader.
One trader's profile: pnl over 30 days, roi, win rate, fair play, open
positions, latest trades and theses. GET /traders/{handle}.
handle as search or another call gave it, with or without "@"; a handle
starting with pf_ is a pumpfun account. Throws :copytop/not-found when
there is no such trader.(trader-url handle)The copy.top page of a fomo or pumpfun trader, where anyone can copy them: https://copy.top/t/<handle>.
The copy.top page of a fomo or pumpfun trader, where anyone can copy them: https://copy.top/t/<handle>.
(traders c)(traders c {:keys [window sort chain platform fair-play limit]})Trader leaderboard (fomo and pumpfun), like https://copy.top/traders. GET /traders.
:window 1d, 7d or 30d. :sort total, realized, roi, winrate or copiers. :chain robinhood, solana, base, bnb, eth or arc. :platform fomo or pumpfun. :fair-play clean or clean_or_watch. :limit 1 to 20 (default 10). Returns {:window :sort :traders [...]}. The leaderboard is a snapshot refreshed periodically; a profile from trader is read live and is the reference.
Trader leaderboard (fomo and pumpfun), like https://copy.top/traders.
GET /traders.
:window 1d, 7d or 30d. :sort total, realized, roi, winrate or copiers.
:chain robinhood, solana, base, bnb, eth or arc. :platform fomo or
pumpfun. :fair-play clean or clean_or_watch. :limit 1 to 20 (default 10).
Returns {:window :sort :traders [...]}. The leaderboard is a snapshot
refreshed periodically; a profile from trader is read live and is the
reference.(trades c)(trades c {:keys [since side min-usd limit]})The live tape: the latest buys and sells by tracked traders, newest first. GET /trades. :since an ISO time or the cursor of a previous answer. :side buy or sell. :min-usd leaves out smaller trades. :limit 1 to 30. The tape keeps the latest 30 trades: poll at least once a minute to miss none. Returns {:cursor :trades [...]}.
The live tape: the latest buys and sells by tracked traders, newest
first. GET /trades. :since an ISO time or the cursor of a previous answer.
:side buy or sell. :min-usd leaves out smaller trades. :limit 1 to 30. The
tape keeps the latest 30 trades: poll at least once a minute to miss none.
Returns {:cursor :trades [...]}.(watch-alerts c)(watch-alerts c {:keys [interval since on-cursor on-error] :as opts})A lazy, endless sequence of new alert events, oldest first. Polls alerts every :interval seconds (default 60) and passes the cursor of each answer back as :since. Realizing the sequence blocks until the next poll.
(doseq [event (ct/watch-alerts c {:kinds ["confluence" "big_trade"]})] (println (:kind event) (:symbol event) (:url event)))
Filters are those of alerts (:min-top-traders, :min-trade-usd, :max-mcap-usd, :kinds, :limit); :since is the cursor to start from. Temporary errors (429, 5xx or network, after the client's own retries) never stop the watch: they go to :on-error and the next poll follows. Other errors, like a refused API key, are thrown. :on-cursor is called with the new cursor once all the events of a poll were consumed: save it and pass it back as :since to resume after a restart. A coin can alert again when another top trader buys it.
A lazy, endless sequence of new alert events, oldest first. Polls alerts
every :interval seconds (default 60) and passes the cursor of each answer
back as :since. Realizing the sequence blocks until the next poll.
(doseq [event (ct/watch-alerts c {:kinds ["confluence" "big_trade"]})]
(println (:kind event) (:symbol event) (:url event)))
Filters are those of alerts (:min-top-traders, :min-trade-usd,
:max-mcap-usd, :kinds, :limit); :since is the cursor to start from.
Temporary errors (429, 5xx or network, after the client's own retries)
never stop the watch: they go to :on-error and the next poll follows.
Other errors, like a refused API key, are thrown. :on-cursor is called with
the new cursor once all the events of a poll were consumed: save it and
pass it back as :since to resume after a restart. A coin can alert again
when another top trader buys it.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |