Metadata-Version: 2.4
Name: ponk
Version: 0.18.0
Summary: Python client for the ponk API: liquidity agents on Solana, Ethereum, Arbitrum, Base, BNB Chain and Robinhood Chain, and webhook verification.
License: Apache-2.0
Project-URL: Homepage, https://ponk.exchange
Project-URL: Documentation, https://ponk.exchange/docs/developers/agents-api
Project-URL: Source, https://github.com/ponkexchange/ponk-sdk
Project-URL: Issues, https://github.com/ponkexchange/ponk-sdk/issues
Keywords: solana,ethereum,arbitrum,base,bnb-chain,dlmm,liquidity,meteora,orca,raydium,uniswap,pancakeswap,aerodrome,ponk,webhooks,jupiter,limit-orders,dca
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: Developers
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# ponk (Python)

A thin client for the ponk public API: create and drive liquidity agents on
Solana, Ethereum, Arbitrum, Base, BNB Chain and Robinhood Chain, read their
live positions, PnL and fees, and move funds home.

Standard library only. No dependencies, no code generation, one method per
endpoint. It never computes a number the server did not send.

## Install

```bash
pip install ponk
```

0.17.0 adds collect all (`claim_agents`), one position shape on every
chain (`agent_positions`), one route for every owner action
(`agent_action`), the public venue registry (`registry`), any wallet's LP
value line (`wallet_history`), farming rewards on Solana agents and
PancakeSwap Infinity Bin (see [Changes in 0.17.0](#changes-in-0170)).
0.16.0 puts every chain on the boards and trackers (see
[Chains on the boards and trackers](#chains-on-the-boards-and-trackers)),
adds liquidity shapes to EVM agents (see [Shapes](#shapes-on-evm-agents)) and
states the exit fee.
0.15.0 adds the five EVM chains (see [Agents on EVM chains](#agents-on-evm-chains)).
0.7.0 brings everything the site does to a key: Jupiter limit, trailing,
TP/SL and DCA orders (a sign link, or self-sign with your own signer
callback), copy and live follow, Copy LP, the self-custody prepare and mark
loop, calls, push, card looks, referral codes, privacy, and preset ranking in
one call (see [Changes in 0.7.0](#changes-in-070)). To install
from this repository
instead:

```bash
git clone https://github.com/ponkexchange/ponk-sdk
pip install ./ponk-sdk/python
```

or put the `python` directory on `PYTHONPATH` and `import ponk`.

Python 3.8 or newer.

## Webhooks

ponk POSTs a signed JSON body to a URL you register. Verify it before you
act on it:

```python
from ponk import verify, InvalidSignature

@app.post("/ponk")
def receive(request):
    try:
        event = verify(
            raw_body=request.get_data(),               # BYTES, as received
            signature_header=request.headers["X-Ponk-Signature"],
            secret=MY_WEBHOOK_SECRET,
        )
    except InvalidSignature:
        return "", 400
    if event.event == "agent_out_of_range":
        page_someone(event.agent_id)
    return "", 200        # anything but 2xx is a failure, and ponk retries
```

Verify the **raw bytes you received**. The signature covers the exact body on
the wire, and `json.dumps(json.loads(body))` is not guaranteed to reproduce
it, so verifying a re-serialized dict fails for reasons that look like a ponk
bug and are not.

`verify` checks the HMAC and the age of the delivery, and raises
`InvalidSignature` with a message saying which of the two failed. The
timestamp is inside the MAC, so a captured delivery cannot be aged forward.

Registering endpoints is not in this client, and that is deliberate: the API
scopes it to a signed-in session rather than to an API key, exactly as it does
for minting keys. Register them in the app, under Settings, then verify here.

## Get a key

Open [Settings, API keys](https://ponk.exchange/settings) in the app with your
wallet. Name the key, pick **Read only** (`read`) or **Read and act**
(`trade`), and copy the secret. It is shown once: the server stores only a hash
of it, so it genuinely cannot be shown again. Lost keys get revoked and
replaced, not recovered.

A key carries exactly the authority of the wallet that minted it. It can never
see or touch another account, and it cannot mint or revoke keys, so a leaked
key cannot extend or outlive its own revocation.

## Quickstart

```python
import os
from ponk import PonkClient

ponk = PonkClient(api_key=os.environ["PONK_API_KEY"])

me = ponk.whoami()
print("acting as", me.wallet_address, "with scope", me.scope)

for agent in ponk.list_agents():
    print(agent.name, agent.status, agent.strategy, "dry_run" if agent.dry_run else "live")

    perf = ponk.agent_performance(agent.id)
    # Every USD field is a string or None. None means "could not be priced",
    # never zero, so print a dash rather than a number you do not have.
    print("  value", perf.current_value_usd or "-", "pnl", perf.pnl_usd or "-")

    pos = ponk.agent_position(agent.id)
    if pos.position_address:
        print("  range", pos.lower_price or "-", "to", pos.upper_price or "-",
              "in range" if pos.in_range else "OUT OF RANGE")

for log in ponk.list_logs(limit=20):
    print(log.created_at, log.action_type, log.status, log.tx_signature or "")
```

Create an agent, watch it think, then let it trade:

```python
agent = ponk.create_agent(
    name="sol-usdc runner",
    wallet_address=me.wallet_address,   # must be the key's own wallet
    dex="meteora_dlmm",                 # meteora_dlmm | meteora_damm_v2 | orca | raydium
    pool_address="POOL_ADDRESS",
    strategy="bin_rebalancer",
    config={"kind": "bin_rebalancer", "bin_range_width": 20, "rebalance_threshold_bins": 5},
    dry_run=True,                       # required: True simulates, False is live
)

# A dry-run agent runs its whole strategy loop and logs every decision to
# list_logs without sending a transaction. Read those logs before going live.
ponk.set_dry_run(agent.id, False)
```

`dry_run` is required by this client even though the server accepts it
omitted, because on `POST /v1/agents` an omitted `dry_run` creates a **live**
agent, the opposite of the app's default. A non-boolean raises `TypeError`
before anything is sent. A live agent created here is still non-custodial: it
recommends, and cannot sign for funds until a mandate signed in the app makes
it autonomous.

For Degen Mode, `strategy="entry_agent"`: the agent starts with no pool, so
`pool_address` and `position_address` are ignored, and its config's `venues`
must include one where ponk can discover pools, which today is only
`meteora_dlmm`.

Price a wide Meteora range before you ask for one. The quote separates the
rent you get back from the rent you do not:

```python
q = ponk.range_cost("meteora_dlmm", "POOL_ADDRESS", bins=400)   # TOTAL bins
print(q.total_bins, "bins,", q.down_pct, "% to", q.up_pct, "%")
print("hold", q.total_upfront_lamports, "lamports;",
      q.non_refundable_lamports, "of it does not come back")
if q.clamped:
    print("the venue caps a position at", q.max_total_bins, "bins")
```

Move funds home:

```python
wallet = ponk.agent_wallet(agent.id)
print(wallet.pubkey, wallet.lamports, "lamports")

ponk.withdraw(agent.id, lamports=500_000_000)   # 0.5 SOL, or omit to sweep
result = ponk.exit_agent(agent.id)              # stop, close, sweep everything
print("swept to", result.destination, "sig", result.signature)
```

## Agents on EVM chains

Agents run on Solana and on Ethereum, Arbitrum, Base, BNB Chain and Robinhood
Chain. The chain words are `solana`, `ethereum`, `arbitrum`, `base`, `bsc` and
`robinhood`; the EVM venues are `uniswap_v2`, `uniswap_v3`, `uniswap_v4`
(Ethereum, Arbitrum, Robinhood Chain), `pancakeswap_v2`, `pancakeswap_v3`,
`pancakeswap_infinity_cl`, `pancakeswap_infinity_bin` (BNB Chain) and
`aerodrome_slipstream`,
`aerodrome_classic` (Base). `ponk.evm` holds those tables and the id helpers.

```python
from ponk import PonkClient, evm, fund_link

ponk = PonkClient(api_key="ponk_live_...")

# 1. Pools on BNB Chain. No key needed for this read.
board = ponk.evm_pools("bsc", venue="pancakeswap_v3")
pools = [p for p in board.pools if p.fees.h24 and not p.flags()]
pool = max(pools, key=lambda p: p.fees.h24)
print(pool.pair, pool.fee_pct, pool.tvl, pool.farm)   # farm: CAKE, live, apr_pct

# 2. What the first open costs, and the rates this key's agents pay.
cost = ponk.evm_open_cost("bsc", pool.dex, pool=pool.address)
print(evm.wei_to_native(cost.min_open_wei), cost.native_symbol)

# 3. Create. The range is fractions: 0.05 is 5% either side of the price.
agent = ponk.create_evm_agent(
    name="bnb " + pool.pair,
    wallet_address=ponk.whoami().wallet_address,   # your Solana login wallet
    chain="bsc", dex=pool.dex, pool_address=pool.address,
    down_pct=0.05, up_pct=0.05,
    stake=True,                                    # farm CAKE
    dry_run=False,
)

# 4. Fund it and sign for it, with your own wallets.
print("send BNB to", ponk.create_agent_wallet(agent.id).address)
print("then sign:", fund_link(agent.id, chain="bsc"))
```

`examples/evm.py` is that flow, creating nothing unless `PONK_CREATE=1`.

### Shapes on EVM agents

An agent on a range venue takes a liquidity shape: `spot` (one even range,
the default), `curve` (heaviest at the price), `bid_ask` (heaviest at the
edges) or `spot_bid_ask` (half of each). On Uniswap v3 on Arbitrum, Ethereum
and Robinhood Chain, Uniswap v4 on Arbitrum and Ethereum, PancakeSwap v3 and
Infinity CL on BNB Chain and Aerodrome Slipstream on Base
(`evm.SHAPE_VENUES`) a shape other than Spot opens as several ranges managed
as one position; `shape_ranges` is `"auto"` (chosen from live gas so opening
and later closing stays within 3% of the deposit) or 1 to 7. On any other
range venue the agent keeps the shape and opens one range. A one-sided range
is one side at 0.

```python
# What a Curve position of $1,000 opens as on Arbitrum right now.
cost = ponk.evm_open_cost("arbitrum", "uniswap_v3", pool=POOL, shape="curve", amount_usd=1000)
print(cost.shape["ranges"], cost.shape["entry_cost"], cost.shape["note"])

agent = ponk.create_evm_agent(
    name="weth usdc curve", wallet_address=ME, chain="arbitrum",
    dex="uniswap_v3", pool_address=POOL,
    down_pct=0.05, up_pct=0,                       # one sided, below the price
    shape="curve", shape_ranges="auto", dry_run=False,
)

plan = ponk.copilot_evm_plan("$1000 in an arbitrum pool", shape="bid_ask", one_sided="below")
print(plan.legs[0].shape.sentence)
```

`evm.with_shape(config, shape, shape_ranges=...)` writes the same keys into a
config of your own (`knobs.liquidity_shape`, or the top-level
`liquidity_shape` on `adaptive_range_recovery`, and `evm.shape_ranges`).
Per-side shapes are the config keys `shape_below`, `shape_above` and
`ratio_below_pct`.

| Method | Route | What it does |
|---|---|---|
| `evm_chains()` | `GET /public/evm/chains` | Every chain, its gas coin and its venues. |
| `evm_pools(chain, venue=None)` | `GET /public/evm/{chain}/board` | The pool board: fee tier, `dynamic_fee`, TVL, volume and LP fees per window, `farm`, `flags()`. |
| `evm_pool(pool_id)` | `GET /public/evm/pools/{id}` | One pool by its CAIP id. |
| `evm_token(token_id)` | `GET /public/evm/tokens/{id}` | One token; the zero address is the gas coin with its price. |
| `evm_open_cost(chain, dex, pool=, stake=, shape=, ...)` | `GET /v1/evm/{chain}/open-cost` | Gas of the first open, the exit reserve, the least to hold, the fee rates, and with `shape` the ranges it opens as. |
| `create_evm_agent(...)` | `POST /v1/agents` | An agent on an EVM chain: `down_pct`, `up_pct`, `stake`, `withdrawal_address`, `shape`, `shape_ranges`. |
| `set_stake_rewards(id, stake)` | `PATCH /v1/agents/{id}/config` | Stake for CAKE or AERO from the next open. |
| `copilot_evm_plan(text, shape=, one_sided=)` | `POST /copilot/evm/plans` | Plan one sentence in dollars: `"$200 in the top 5 bnb pools"`. |
| `copilot_evm_get_plan(id)` | `GET /copilot/evm/plans/{id}` | The plan again. |
| `copilot_evm_start(id)` | `POST /copilot/evm/plans/{id}/start` | One agent per pool, plus `sign_urls` and `fleet_id`. Moves no money. |
| `evm_fleet()` | `GET /agents/evm/fleet` | Every EVM agent and what it still needs from you. |

Pass `public=False` to the four pool reads for their `/v1` twins, on the key's
budget instead of the per-IP limit.

An EVM agent is read and driven by id with the methods every agent uses:
`get_agent` (`chain`), `agent_wallet` (`address`, `native_symbol`,
`balance_wei`, `min_open_wei`, `withdrawable_wei`, `balance_usd`,
`withdrawal_address`, `mandate_status`), `agent_position` (ticks, `bin_step`,
`staked`), `agent_performance` (`farm_rewards` with `apr_basis`, `pnl_note`,
`figures_unavailable`), `agent_decisions`, `agent_value_history`,
`agent_mandate`, `list_positions`, `pause_agent`, `resume_agent`,
`update_config`, `withdraw` and `exit_agent`, which return `tx_hashes`,
`amount_wei`, `received`, `status` and `sentence`.

Units: wei amounts are decimal strings and `evm.wei_to_native` reads one
exactly; USD amounts are decimal strings; `pnl_pct` and `drawdown_pct` on
`agent_performance` are fractions on every chain (0.05 is 5%); a figure the
server could not read is `None`, never 0.

The mandate of an EVM agent takes two signatures, your Solana login wallet and
the EVM wallet that will receive withdrawals, and both are made on
ponk.exchange. `fund_link(agent_id, chain=...)` and `fund_links([...])` build
that page's link, 40 agents to a link; this client reads the mandate's status
and never signs. Revoking a mandate and the exit card are on ponk.exchange too.

An agent created with a key pays the API rates: a one-time activation fee on
its first open, a performance fee on the fees it earns, and an exit fee on what
it sends you once it has opened a position, each lower for a wallet holding
$PONK. The exact figures are shown at the confirm step;
`agent.activation_fee_bps`, `agent.managed_fee_bps`, `agent.exit_fee_bps` and
`evm_open_cost` state the rates for you; `withdraw` and `exit_agent` list what
the exit fee took in `exit_fees`.

## Perpetuals on Hyperliquid

A Perpetuals agent is one typed trade. The server builds the ticket from
Hyperliquid's live prices and refuses one its gates refuse, as a
`PonkUnprocessableError` carrying the sentence. Money and percents may be
strings, to keep them exact.

```python
from ponk import PonkClient, perpetuals

ponk = PonkClient(api_key="ponk_live_...")

# 1. The board, no key needed. Funding is a fraction; positive means longs pay.
board = ponk.perp_markets(sort="volume", limit=10)

# 2. The ticket on live prices, creating nothing.
p = ponk.preview_perp_agent(coin="ETH", direction="short", leverage=2,
                            capital_usd="300", stop_loss_pct="4", take_profit_pct="8")
if not p.ok:
    print(p.sentence)
for w in p.warnings:        # a crowded side, a thin market, above 10x, little stop room
    print("Warning:", w)

# 3. Create. When p.needs_confirmation (above 10x, or a stop with little room
#    before liquidation), show p.confirmation_warnings, have the user type
#    the agent's name and send it as confirmation_text.
agent = ponk.create_perp_agent(coin="ETH", direction="short", leverage=2,
                               capital_usd="300", stop_loss_pct="4", take_profit_pct="8")

# 4. Authorize and fund it in the app with your wallet. Then read it.
now = ponk.perp_agent(agent.id)
print(now.account.position, now.decision.sentences if now.decision else None)

# Owner actions, carried out on the agent's next ticks.
ponk.tighten_perp_stop(agent.id, "2")           # closer only
ponk.close_perp_agent(agent.id, confirm=True)   # the funds stay on its account
ponk.exit_perp_agent(agent.id, confirm=True)    # close, settle, withdraw
```

Leverage goes up to the market's own maximum on Hyperliquid (`max_leverage`
on the board). Two warnings need the user to acknowledge them: leverage above
10x, and the stop-room warning, when the stop is inside the liquidation
price but liquidation is closer than twice the stop's distance (a fast move
can pass liquidation before the stop fills, and Liquidation Guard may cut
part of the position before the stop does). One acknowledgement covers both:
the agent's name as the user typed it, in `confirmation_text`. Only the
server knows the stop-room warning, because it reads the live price, so the
preview is the authority: `perpetuals.needs_confirmation(preview)` reads its
`needs_confirmation`, and `preview.confirmation_warnings` is what to show.
`perpetuals.needs_confirmation(n)` with a whole number answers only the
leverage half (above 10x).

```python
args = dict(coin="BTC", direction="long", leverage=5, capital_usd="200",
            stop_loss_pct="4", name="BTC 5x")
p = ponk.preview_perp_agent(**args)
if p.ok and perpetuals.needs_confirmation(p):
    for w in p.confirmation_warnings:
        print(w)
    typed = input("Type the agent's name to confirm: ")
    agent = ponk.create_perp_agent(**args, confirmation_text=typed)
```

Without it the server answers 422 with the warnings and "To go ahead, type
the agent's name (NAME) to confirm." The name compares exactly after
trimming, except its market ticker, which compares in any case (`btc`
matches the default name `BTC`; `KPEPE Long 20x` matches `kPEPE Long 20x`).
A stop at or past the liquidation price (with the safety margin Liquidation
Guard keeps) is refused, with a sentence naming a stop that would work.
The user's stop is never loosened and Liquidation Guard never moves it. Once the trade is in profit the agent moves it to break-even and then trails it, only ever toward profit. Liquidation Guard judges the user's stop against the real liquidation price, places a stop of its own only when the user's would fire too close to liquidation or past it (or none rests), keeps one, moves only its own if it must re-place it, and cancels it once the user's stop fires first with room again. With two stops resting, the one that fires first is the position's stop. The ticket (`p.ticket`,
`agent.ticket_figures`) carries `needs_confirmation`, `stop_room_warning`
and `atr_warning`, and `perp_agent(id).config.warnings` is what the agent
was warned about when it was created.
`warnings` on the preview and on the new agent is what the confirm step warns
about (a crowded side, a thin market, unknown funding or volume, above 10x,
a liquidation price inside three days of the market's normal daily range),
never a refusal. `pause_agent` and `resume_agent` work on a
Perpetuals agent: paused, it opens nothing new and its resting stop and
Liquidation Guard keep running. `perp_say("long btc 3x 500 stop 3")` is the
same one-sentence answer as the app, Telegram and the MCP; an open that needs
an acknowledgement (above 10x, or a 5x line whose stop leaves too little
room) answers 422 with the warnings and creates nothing, and
`perp_say(text, confirmation_text="BTC")`, the agent's name (its market)
typed by the user, acknowledges them. `confirmation_text` is sent at any
leverage. `confirm=True` is for a close and never acknowledges a warning.
Preview first is how a client shows the user the warnings: never send a
`confirmation_text` the user typed without having shown them the preview's
`confirmation_warnings`. The typed name acknowledges only the warnings that
ticket raised.

Prices move. When an agent's decision feed says `perp_entry_needs_acknowledgement` ("Not opened yet: ..."), its trade now raises a warning (liquidation less than twice the stop away) that was not acknowledged when it was set up, and nothing opens until it is. Call `perp_acknowledge(agent_id)` without a name: its `confirmation_warnings` are what to show the user and `name` what they type; nothing changes. Then call it again with the name exactly as the user typed it (`confirmation_text`, `--confirm-name`), never filled in for them. The agent then opens on its next check with the stop the user chose. `perp_agent(id).config.acknowledged` lists the kinds acknowledged (`high_leverage`, `stop_room`).

```python
ask = ponk.perp_acknowledge(agent.id)
if ask.needs_confirmation:
    for w in ask.confirmation_warnings:
        print(w)
    typed = input("Type the agent's name ({0}) to acknowledge: ".format(ask.name))
    print(ponk.perp_acknowledge(agent.id, confirmation_text=typed).sentence)
```

A fleet from one sentence: `copilot_perp_plan("put $2,000 across 4 Perpetuals
agents, long BTC and ETH, short SOL and HYPE, 3x")`, then
`copilot_perp_start(plan.id)`, which moves no money and returns `sign_url`,
the page where each agent is authorized and funded. A leg with
`needs_confirmation` (above 10x, or the stop-room warning) starts only with
its agent's name typed by the user after its `confirmation_warnings`, in
`confirmations={leg_index: name}`, the leg's `name` as the plan prints it,
like `{0: "BTC Long 20x"}`. Funding an agent waits for its
authorization, which sets the address its withdrawals go to. `copilot_fleet(id).perp`
reads every agent live; `copilot_tighten_agent_stops`, `copilot_pause_fleet`,
`copilot_resume_fleet` and `copilot_stop_fleet` act on all of them.

What has no method here: authorizing the agent and funding its Hyperliquid
account, both wallet signatures in the app.

## Chains on the boards and trackers

The agents leaderboard, Calls, the X Tracker and the Wallet Tracker cover
Solana, BNB Chain, Base, Ethereum, Arbitrum and Robinhood Chain. `chains` on
`leaderboard`, `calls_feed`, `top_calls`, `callers_board`, `x_feed`,
`x_trending`, `x_callers`, `wallets_feed` and `wallet_activity` is a list of
chain ids or `"all"`; left out, a public read covers every chain and a
signed-in read your saved filter. Every answer carries `chains`, the ids it
covers. A token is a Solana mint or an EVM token id
(`evm.token_id("bsc", "0x...")`), a wallet a Solana or an EVM address.

```python
board = ponk.leaderboard("7d", chains=["bsc"])          # ranks from 1 on BNB Chain
for row in board.ranked:
    print(row.rank, row.chain, row.dex, row.pnl_usd)

cake = evm.token_id("bsc", "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82")
t = ponk.x_token(cake)                                   # chain, price_source
for call in ponk.calls_feed(mint=cake).calls:
    print(call.chain, call.price_source, call.multiple_now)

ponk.set_feed_prefs("all")                               # the saved filter, trade key
print(ponk.feed_prefs().chains)
```

## What a key cannot do

Three limits are structural. They are properties of how custody works in ponk,
not settings that can be turned off.

* **It cannot sign with your connected wallet.** Non-custodial actions still
  need your signature in the app. This client can read their state, not produce
  the signature.
* **It cannot create a custody mandate.** A mandate is a signature from your
  wallet, so it is granted in the app with your wallet connected. Once an
  agent has one, a `trade` key can use it: `set_autonomous(id, True)` turns
  autonomous signing on under that existing, unexpired mandate, and
  `set_autonomous(id, False)` turns it off, which is always allowed. This
  client never sends a `grant`, and the server refuses a key request that
  carries one.
* **It cannot act on an agent that holds no wallet of its own.** `compound`,
  `withdraw`, `exit` and `agent_wallet` operate on the isolated wallet an
  autonomous agent owns. A self-custody agent has no such wallet, so those four
  do not apply to it. Reads, pause, resume, dry-run and mode do.

`withdraw` and `exit` have no destination parameter and cannot be given one.
The server locks the destination to the wallet that owns the agent. A stolen
key can move your funds home. It cannot move them anywhere else.

## The mandate expires

A mandate carries a hard expiry, 365 days by default in the app (30, 90 or
180 when you pick them). Lapsing is a
clock fact with nothing on chain to mark it: the agent keeps running and every
signature it asks for is denied, so it quietly stops compounding, claiming and
recentering with its funds still deployed. Read the expiry instead of waiting
for the silence:

```python
from ponk import PonkNotFoundError

try:
    m = ponk.agent_mandate(agent.id)
except PonkNotFoundError:
    m = None            # no mandate: this agent is not autonomous

if m is not None:
    # seconds_remaining is computed by the server and goes negative once the
    # mandate has lapsed, so it does not depend on your clock.
    if m.status == "expired":
        print("expired", m.expires_at, "- renew it in the app")
    elif m.seconds_remaining < 3 * 86400:
        print("expires", m.expires_at, "- renew it in the app soon")
```

* `max_action_value_usd` is `None` when there is no per-action ceiling. That
  means unlimited, not zero.
* `set_autonomous(id, False)` does not revoke the mandate. A later
  `set_autonomous(id, True)` re-arms the agent while the mandate is unexpired.
  Enabling also sets the agent live, but it does not restart an agent a
  previous exit left `stopped`: read `status` on the result and call
  `resume_agent` if you need the loop running.
* `set_autonomous(id, True)` needs the agent's own managed wallet with an
  active, unexpired mandate that still pays out to this account's wallet.
  Otherwise it raises `PonkUnprocessableError` with a sentence saying which.
* `compound` can return a receipt and still have done nothing. A mandate
  denial is recorded on the action, not raised, so read `signature is None`
  as "nothing reached the chain" and `error_message` for why.
* A lapsed mandate never traps funds. `withdraw` and `exit` deliberately
  bypass it and keep working after expiry.
* `mandates()` reads every autonomous agent's mandate at once, the most
  urgent first, with `renew_all_url`: one page where your wallet signs every
  renewal in turn.
* ponk also reminds at 7 days, 2 days and on expiry (`mandate_expiring` and
  `mandate_expired` notifications). A webhook registered from a signed-in
  session receives them; see [Webhooks](#webhooks).

## Methods

| Method | Endpoint | Needs |
| --- | --- | --- |
| `health()` | `GET /health` | nothing |
| `pool(dex, address)` | `GET /pools/{dex}/{address}` | nothing |
| `range_cost(dex, address, bins)` | `GET /pools/{dex}/{address}/range-cost?bins=N` | nothing |
| `ponk_perks(wallet_address)` | `GET /public/ponk/perks/{address}` | nothing |
| `leaderboard(window=None, chains=None)` | `GET /public/agents-leaderboard?window=24h\|7d\|30d\|all&chains=` | nothing |
| `public_agent(slug)` | `GET /public/agents/{slug}` | nothing |
| `public_agent_value_history(slug, range=None)` | `GET /public/agents/{slug}/value-history` | nothing |
| `public_points_leaderboard(limit, offset)` | `GET /public/points/leaderboard` | nothing |
| `resolve_referral(code)` | `GET /public/referral/{code}` | nothing |
| `agents_activity()` | `GET /public/agents-activity` | nothing |
| `ponkillionaires_week()` | `GET /public/ponkillionaires/week` | nothing |
| `x_feed(before=, since=, limit=, category=, ca_only=, min_followers=, account=, q=, first_calls=, chains=)` | `GET /public/x/feed` | nothing |
| `x_trending(window=None, limit=None, chains=None)` | `GET /public/x/trending?window=1h\|24h` | nothing |
| `x_callers(days=None, chains=None)` | `GET /public/x/callers` | nothing |
| `x_token(mint)` (a Solana mint or an EVM token id) | `GET /public/x/token/{mint}` | nothing |
| `x_accounts()` | `GET /public/x/accounts` | nothing |
| `x_status()` | `GET /public/x/status` | nothing |
| `wallets_feed(before=, limit=, kind=, min_usd=, token=, wallet=, chains=)` | `GET /public/wallets/feed` | nothing |
| `wallets_defaults()` | `GET /public/wallets/defaults` | nothing |
| `wallets_status()` | `GET /public/wallets/status` | nothing |
| `wallet_activity(address, before=, limit=, kind=, min_usd=, token=, chains=)` | `GET /public/wallets/{address}/activity` | nothing |
| `feed_prefs()` | `GET /v1/feed-prefs` | `read` |
| `set_feed_prefs(chains)` | `PATCH /v1/feed-prefs` | `trade` |
| `whoami()` | `GET /v1/me` | `read` |
| `perp_markets(q=None, sort=, limit=)` | `GET /public/perp/markets` | nothing |
| `perp_market(market)` | `GET /public/perp/markets/{id}` | nothing |
| `perp_candles(market, interval=None, bars=None)` | `GET /public/perp/markets/{id}/candles` | nothing |
| `perp_funding_history(market, days=None)` | `GET /public/perp/markets/{id}/funding` | nothing |
| `perp_wallet(address)` / `perp_wallet_pnl(address)` | `GET /public/wallets/{address}/perp`, `/perp/pnl` | nothing |
| `perp_book(market=None)` | `GET /public/wallets/perp/book` | nothing |
| `perp_parse(text)` | `POST /public/perp/parse` | nothing |
| `perp_agents()` / `perp_agent(id)` | `GET /v1/perp-agents`, `/{id}` | `read` |
| `perp_agent_balances(id)` / `perp_agent_ledger(id)` / `perp_agent_decisions(id)` / `perp_agent_exit_card(id)` | `GET /v1/perp-agents/{id}/balances`, `/ledger`, `/decisions`, `/exit-card` | `read` |
| `preview_perp_agent(...)` | `POST /v1/perp-agents/preview` | `read` |
| `create_perp_agent(...)` | `POST /v1/perp-agents` | `trade` |
| `perp_say(text, confirm=False, confirmation_text=None)` | `POST /v1/perp-agents/say` | `trade` |
| `close_perp_agent(id, confirm=True)` / `tighten_perp_stop(id, stop_pct)` / `exit_perp_agent(id, confirm=True)` | `POST /v1/perp-agents/{id}/close`, `/stop`, `/exit` | `trade` |
| `perp_acknowledge(id, confirmation_text=None)` | `POST /v1/perp-agents/{id}/acknowledge` | `trade` |
| `copilot_perp_plan(text, practice=False)` / `copilot_perp_get_plan(id)` | `POST /copilot/perp/plans`, `GET /copilot/perp/plans/{id}` | nothing (a key to start it later) |
| `copilot_perp_start(id)` | `POST /copilot/perp/plans/{id}/start` | `trade` |
| `copilot_tighten_agent_stops(fleet_id, stop_pct)` | `POST /copilot/fleets/{id}/stop-rule` | `trade` |
| `copilot_pause_fleet(fleet_id)` / `copilot_resume_fleet(fleet_id)` | `POST /copilot/fleets/{id}/pause`, `/resume` | `trade` |
| `list_agents()` | `GET /v1/agents` | `read` |
| `get_agent(id)` | `GET /v1/agents/{id}` | `read` |
| `agent_performance(id)` | `GET /v1/agents/{id}/performance` | `read` |
| `agent_position(id)` | `GET /v1/agents/{id}/position` | `read` |
| `agent_value_history(id, range=None)` | `GET /v1/agents/{id}/value-history` | `read` |
| `agent_decisions(id, hours=None, limit=None)` | `GET /v1/agents/{id}/decisions`, raw JSON | `read` |
| `agent_wallet(id)` | `GET /v1/agents/{id}/wallet` | `read` |
| `agent_mandate(id)` | `GET /v1/agents/{id}/mandate` | `read` |
| `mandates()` | `GET /v1/agents/mandates` | `read` |
| `list_positions()` | `GET /v1/positions` | `read` |
| `list_logs(limit)` | `GET /v1/logs` (limit 1 to 500, default 100) | `read` |
| `get_public_link(id)` | `GET /v1/agents/{id}/public-link` | `read` |
| `list_follows()` | `GET /v1/follows` | `read` |
| `points()` | `GET /v1/points` | `read` |
| `points_leaderboard(limit, offset)` | `GET /v1/points/leaderboard` | `read` |
| `referral()` | `GET /v1/referral` | `read` |
| `creator_dashboard(days=None)` | `GET /v1/referral/creator` | `read` |
| `check_handle(handle)` | `GET /v1/referral/handle/check` | `read` |
| `get_json(path, params)` | any `GET`, raw JSON | depends on the route |
| `create_agent(...)` | `POST /v1/agents` | `trade` |
| `copy_agent(source, name=, wallet_address=, dry_run=)` | `public_agent` then `POST /v1/agents` from its `copy` block | `trade` |
| `optimize_draft(draft)` | `POST /v1/agents/optimize-draft`, raw JSON | `trade` |
| `pause_agent(id)` | `POST /v1/agents/{id}/pause` | `trade` |
| `resume_agent(id)` | `POST /v1/agents/{id}/resume` | `trade` |
| `set_autonomous(id, enabled)` | `POST /v1/agents/{id}/autonomous` | `trade` |
| `set_dry_run(id, dry_run)` | `POST /v1/agents/{id}/dry-run` | `trade` |
| `set_mode(id, mode)` | `POST /v1/agents/{id}/mode` | `trade` |
| `update_config(id, patch)` | `PATCH /v1/agents/{id}/config` | `trade` |
| `update_exits(id, tp_sl=None, automation=None)` | `POST /v1/agents/{id}/exits` | `trade` |
| `set_auto_compound(id, auto_compound, min_claimable_base_units=None, min_claimable_usd=None)` | `POST /v1/agents/{id}/auto-compound` | `trade` |
| `share_agent(id, hide_usd=False, show_onchain=None)` | `POST /v1/agents/{id}/public-link` | `trade` |
| `unshare_agent(id)` | `DELETE /v1/agents/{id}/public-link` | `trade` |
| `follow(slug)` / `unfollow(slug)` | `POST` / `DELETE /v1/follows/{slug}` | `trade` |
| `claim_handle(handle)` | `POST /v1/referral/handle` | `trade` |
| `compound(id)` | `POST /v1/agents/{id}/compound` | `trade` |
| `withdraw(id, lamports)` | `POST /v1/agents/{id}/withdraw` | `trade` |
| `exit_agent(id)` | `POST /v1/agents/{id}/exit` | `trade` |
| `create_agents(agents, create_wallets=True)` | `POST /v1/agents/batch` | `trade` |
| `fund_prepare(transfers)` | `POST /v1/agents/fund/prepare`, unsigned transactions | `trade` |
| `exit_agents(agent_ids, all_agents=False)` | `POST /v1/agents/batch/exit` | `trade` |
| `withdraw_agents(agent_ids, all_agents=False)` | `POST /v1/agents/batch/withdraw` | `trade` |
| `claim_agents(agent_ids, all_agents=False, destination=None)` | `POST /v1/agents/batch/claim` | `trade` |
| `agent_positions(id)` | `GET /v1/agents/{id}/positions` | `read` |
| `agent_action(id, action, body=None)` | `POST /v1/agents/{id}/actions/{action}` | `trade` |
| `registry()` | `GET /public/registry` | nothing |
| `wallet_history(address, range=None)` | `GET /public/wallet/{address}/history` | nothing |
| `get_batch(batch_id)` | `GET /v1/agents/batch/{batch_id}` | `read` |
| `fleet(offset=None, limit=None)` / `iter_fleet(limit)` / `fleet_all(limit)` | `GET /v1/agents/fleet` | `read` |
| `create_agent_wallet(id)` | `POST /v1/agents/{id}/wallet` | `trade` |
| `rebalance(id, new_lower_bin_id=, new_upper_bin_id=, strategy=, max_slippage_bps=None)` | `POST /v1/agents/{id}/rebalance` | `trade` |
| `collect_fees(id, destination=None)` | `POST /v1/agents/{id}/collect-fees` | `trade` |
| `rename_agent(id, name)` | `PATCH /v1/agents/{id}` | `trade` |
| `delete_agent(id)` | `DELETE /v1/agents/{id}` | `trade` |
| `agent_proof(id, hours=None)` | `GET /v1/agents/{id}/proof` | `read` |
| `agent_range_history(id, range=None)` | `GET /v1/agents/{id}/range-history` | `read` |
| `custody_withdraw(lamports=None)` | `POST /v1/custody/withdraw` | `trade` |
| `custody_exit()` | `POST /v1/custody/exit` | `trade` |
| `portfolio()` | `GET /v1/portfolio` | `read` |
| `portfolio_history(range=None)` | `GET /v1/portfolio/history` | `read` |
| `list_transactions(limit)` | `GET /v1/transactions` | `read` |
| `list_risk_events(limit)` | `GET /v1/risk-events` | `read` |
| `list_fees(limit)` / `fee_summary()` | `GET /v1/fees`, `GET /v1/fees/summary` | `read` |
| `list_notifications(status, limit)` / `unread_notifications()` | `GET /v1/notifications`, `/unread-count` | `read` |
| `mark_all_notifications_read()` / `mark_notification_read(id)` / `dismiss_notification(id)` | `POST /v1/notifications/read-all`, `/{id}/read`, `/{id}/dismiss` | `trade` |
| `list_recommendations(status, limit)` / `get_recommendation(id)` | `GET /v1/recommendations`, `/{id}` | `read` |
| `review_recommendation` / `approve_recommendation` / `dismiss_recommendation` / `snooze_recommendation(id, minutes)` | `POST /v1/recommendations/{id}/{review,approve,dismiss,snooze}` | `trade` |
| `notify_settings()` / `update_notify_settings(...)` | `GET` / `PUT /v1/notify-settings` | `read` / `trade` |
| `list_presets()` / `create_preset` / `update_preset` / `delete_preset` | `GET` / `POST /v1/presets`, `PUT` / `DELETE /v1/presets/{id}` | `read` / `trade` |

Receiver-side, needing no key and no network:

| Function | Purpose |
| --- | --- |
| `verify(raw_body, signature_header, secret)` | Check a webhook delivery and parse it |
| `parse_signature_header(header)` | Split `t=`/`v1=` out of the header |
| `EVENT_KINDS` | Every kind ponk sends, for recognition, never for rejection |

The first four need no key at all. `PonkClient()` with no `api_key` reaches
them and nothing else. `pool` and `range_cost` are rate limited per IP. `health()` returns its report even when the API answers
503, because which component is down is the whole point of that call.

This client covers the key-authenticated `/v1` API plus those four public
reads. The rest of the server's surface, the session-authenticated app routes
and the wallet-signed Meteora transaction builders under `/public/meteora`,
needs a wallet signature rather than a key, so it is out of scope here.

## Errors

Every error carries the same envelope, and this client maps it by status:

```json
{"error": {"code": "conflict", "message": "exit already running", "request_id": "..."}}
```

| Status | Exception | What to do |
| --- | --- | --- |
| 400 | `PonkBadRequestError` | Fix the request. `code` is `invalid_strategy_config` when the config did not match the strategy, and `message` names the field. |
| 401 | `PonkAuthError` | Missing, malformed, unknown or revoked key. The last two are deliberately indistinguishable. Do not retry. |
| 403 | `PonkForbiddenError` | The key is valid but read-only. Mint a `trade` key. Do not retry. |
| 404 | `PonkNotFoundError` | No such object, or it belongs to another account. Also deliberately indistinguishable. |
| 409 | `PonkConflictError` | Conflicts with in-flight work, for example an exit already running. Retry after a pause. |
| 422 | `PonkUnprocessableError` | Understood but cannot apply, for example compounding an agent with no open position. `code` carries the risk code when there is one. |
| 429 | `PonkRateLimitedError` | Back off and retry. Only the public per-IP routes (`pool`, `range_cost`, `ponk_perks`) are rate limited; `/v1` is not. |
| 5xx | `PonkServerError` | Quote `request_id` to support. |
| no response | `PonkTransportError` | DNS, connection, TLS or timeout. |

All of them subclass `PonkError`. `PonkAPIError` carries `status`, `code`,
`message`, `request_id` and the decoded `body`.

```python
from ponk import PonkAPIError, PonkConflictError, PonkTransportError

try:
    ponk.exit_agent(agent_id)
except PonkConflictError:
    pass                      # an exit is already running; it will finish
except PonkTransportError:
    # A fund call that times out has NOT necessarily failed: the work keeps
    # running on the server. Exit is idempotent, so call it again and it
    # continues rather than double-sending.
    ponk.exit_agent(agent_id)
except PonkAPIError as e:
    print(e.status, e.code, e.message, e.request_id)
```

`compound`, `withdraw` and `exit` send several transactions and wait for each
confirmation, so they can take a minute. They get their own timeout,
`fund_timeout` (180s), separate from `timeout` (30s) for everything else.

## Reading the numbers

* **A null USD figure means unknown, not zero.** An unpriceable pool returns
  `null` rather than a fabricated 0. Render it as a dash. Treating it as zero
  silently understates a position.
* **USD amounts on the agent and position endpoints are strings.** Feed them to
  `decimal.Decimal` before doing arithmetic. They are strings precisely so a
  float cannot round them.
* **`claimable_fees_usd` and `fee_pnl_usd` are different numbers.** The first is
  the unclaimed fees sitting on the position right now, the second is lifetime
  fees earned, claimed plus unclaimed. Do not add them.
* **PnL decomposes as Total = Price + Fee**: `pnl_usd`, `price_pnl_usd`,
  `fee_pnl_usd`. `pnl_source` says whether the figures are Meteora's own
  (`meteora_datapi`) or ponk's on-chain valuation (`oracle_estimate`).
* **`cost_basis_estimated`** marks a position ponk did not open. The basis is
  then a first-observation stamp, so lifetime PnL stays `None` instead of
  asserting a gain that contradicts your real numbers.
* **Every object keeps `raw_json`**, the exact decoded payload, so a field added
  to the API after this client was written is still reachable.

## Fees

Autonomous agents charge a performance fee on realized yield, and a one-time
activation fee on the capital of an agent's first open (lower for a wallet
holding $PONK), paid inside the transaction that opens it: a failed open pays
nothing, and recenters, re-opens, compounds and top-ups never pay it again. A
referrer earns a share of it out of the fee. A withdrawal or an exit from an
agent that has opened a position pays an exit fee on what leaves (lower for a
wallet holding $PONK), taken in kind in the same run, on every chain, for agents created in the app and through the API
alike; an agent that never opened a position pays none
(`ponk.EXIT_FEE_BPS`, `ponk.EXIT_FEE_HOLDER_BPS`, `agent.exit_fee_bps`,
`perks.exit_fee`). There is no charge for a key, for a call or for
depositing. The exact rates are shown at the confirm step and returned by the
fields above; read them there rather than from this page.

**An agent created through this API pays the API rate, not the app rate.** The
rate is fixed when the agent is created and follows that agent for its whole
life, including after you enable autonomous mode for it in the app. Read both
rates live rather than hardcoding them:

```python
perks = ponk.ponk_perks(me.wallet_address)
print("app agents", perks.managed_agent_fee.effective_percent, "%")
print("api agents", perks.api_agent_fee.effective_percent, "%")
print("holding $PONK would make that", perks.api_agent_fee.holder_percent, "%")
```

`agent.managed_fee_bps` is the rate that specific agent's skim actually
charges, before any $PONK holder discount.

The activation rate is on the same perks read, and `ponk.ACTIVATION_FEE_BPS`,
`ACTIVATION_FEE_HOLDER_BPS` and `ACTIVATION_REFERRER_BPS` name the published
rates. A fee event charged on an activation carries `source == "activation"`:

```python
print("activation", perks.activation_fee.effective_percent, "%")
for e in ponk.list_fees():
    if e.source == "activation":
        print(e.fee_token_mint, e.platform_fee_amount)
```

## People: profiles, follows and the Following feed

Every claimed @handle and every /r/ code opens a public profile. Follow a
person and their agent, LP, call and (when they share them) swap activity
lands in your Following feed, with a Copy action on each row. Every account
is public.

```python
p = ponk.profile("@kader")                     # no key needed
print(p.label, p.social)
for pos in ponk.person_positions("kader").positions:
    print(pos.venue, pos.pool, pos.pnl_pct, pos.copy.mode)

ponk.follow_person("kader")                    # trade key
for row in ponk.following_feed(kinds="agents").rows:
    print(row.actor.name, row.verb, row.pool, row.size_usd, row.copy.mode)

for r in ponk.people_board(window="7d").rows:  # the people board, no key
    print(r.rank, r.person.name, r.pnl_usd, r.roi_pct, r.vs_hodl_pct)

page = ponk.people_search("ch")                # @handle, /r/ code or name, from
while page.people:                             # the first letter, 20 a page
    for hit in page.people:
        print(hit.display_name, hit.handle, hit.followers)
    if not page.next_cursor:
        break
    page = ponk.people_search("ch", cursor=page.next_cursor)

for r in ponk.recommended_people(limit=5).people:   # who to follow, no key
    print(r.name, r.reason)
for r in ponk.similar_people("kader").people:       # traders like this one
    print(r.name, r.reason)
for r in ponk.my_recommended().people:              # for your account
    print(r.name, r.reasons)
ponk.dismiss_recommended(r.key)                     # never suggest again
```

## Privacy

Every Ponk account is public since 0.11.0's server release (2026-10-29).
`privacy`, `set_privacy` and `answer_privacy_prompt` still answer, with the
public state, so older code keeps running; writes are accepted and ignored.

## Wallet Tracker P&L, tracked LPs, X caller cards and Top calls

```python
pnl = ponk.wallet_pnl(WALLET)                  # trading P&L per token, no key
for row in ponk.tracked_lps().rows:            # curated wallets' open LPs
    print(row.wallet["label"], row.position["pool_address"], row.position["pnl_usd"])
card = ponk.x_account("solana", days=30)
print(card.hit_rate, card.x2_rate, card.first_calls)
print(ponk.x_feed(first_calls=True).raw_json["items"][:1])
for call in ponk.top_calls(days=7, source="all").calls:
    print(call)
```

## The copilot (unreleased)

One sentence to a fleet plan, read by ponk's own closed grammar (no language
model anywhere). The copilot routes take a WALLET SESSION ONLY and refuse an
API key, so these methods need `session_token=` and never send `api_key`:

```python
ponk = PonkClient(session_token="...")       # from POST /auth/nonce + /auth/verify
plan = ponk.copilot_plan("put 2 sol into 4 agents on sol pools, stop all if down 10%")
plan = ponk.copilot_wait(plan.plan_id)          # builds, then replays 30 days
totals = plan.replay.result["totals"]
print(totals["net_pnl_usd"], totals["hold_pnl_usd"], totals["net_vs_hold_usd"])
if plan.can_start:
    start = ponk.copilot_start(plan.plan_id)    # agents in dry run, UNSIGNED funding
    print(start.sign_url)                       # your wallet signs there; nothing moves before
fleet = ponk.copilot_fleet(start.fleet_id)
ponk.copilot_stop_fleet(start.fleet_id)         # managed exit of this fleet's agents only
```

`copilot_parse`, `copilot_plan`, `copilot_get_plan`, `copilot_replay`,
`copilot_wait`, `copilot_start`, `copilot_fleets`, `copilot_fleet`,
`copilot_stop_fleet` and `copilot_tighten_stop` (tighter only).

Amounts are SOL, exactly as typed: "$500", "half my sol" or "20% of my wallet"
are refused, never converted. A fleet is 1 to 8 agents on Meteora DLMM pools
only. Name a token by symbol ("jup pools") or by its mint; a symbol is
resolved to a mint. An ambiguous or unverified symbol is refused with
`refusal["suggestions"]`, the tokens carrying it with their mints, most liquid
first, so you can put the one you mean into the sentence. `plan.can_start` turns true once the replay is done, and
`plan.plan["totals"]["ponk_fee_bps"]` is the Ponk fee on fees earned for this
wallet. After a start, `copilot_fleet(...).funding` lists what is left to fund
or approve with a fresh `sign_url`, and `.exit` names any agent whose exit
failed; `copilot_stop_fleet` on a stopping fleet retries only those. The replay is
one past window beside holding, not a forecast.

## Changes in 0.18.0

* **Perpetuals on Hyperliquid.** The markets board, candles, funding history,
  any 0x wallet's positions and 30 day PnL, the curated long and short book
  and the sentence parser, with no key; a key's Perpetuals agents: create
  and preview a typed trade (up to the market's own maximum leverage; above
  10x, or with the stop-room warning, the warnings acknowledged by the
  agent's typed name, `confirmation_text`, one name for every warning;
  `needs_confirmation(preview)` and `confirmation_warnings` from the
  preview, the authority; `warnings` on the preview, the new agent and the
  agent's config; the ticket's `needs_confirmation`, `stop_room_warning`
  and `atr_warning`), one sentence (`perp_say`, `confirmation_text` at any
  leverage), close, tighten the stop, exit,
  the agent's account, ledger, decision feed and closing card; Perpetuals
  fleets from one sentence (`copilot_perp_plan`, `copilot_perp_start` with
  `confirmations` for each leg with `needs_confirmation`, whose
  `confirmation_warnings` say why),
  `copilot_tighten_agent_stops`, `copilot_pause_fleet` and
  `copilot_resume_fleet`. `CopilotFleet.kind` and `CopilotFleet.perp`.


* **Collect all.** `claim_agents(ids)` or `claim_agents(all_agents=True)`
  (`POST /v1/agents/batch/claim`) collects every agent's fees through its own
  mandate-checked claim, to your own wallet by default
  (`destination="agent"` keeps them in each agent's wallet). An agent that
  cannot claim is a `skipped` item with the reason; one sent and not
  confirmed is `unknown` with its signature: read its state before claiming
  again. `FleetBatch` gains `unknown` and `skipped`.
* **One position shape.** `agent_positions(id)` returns `PositionEnvelope`s:
  venue, chain, the chain's own id, and value, cost basis, PnL and yield as
  `Observed` figures (known, or absent with the reason).
* **One action route.** `agent_action(id, "claim" | "compound" |
  "rebalance")` refuses what the venue cannot do before anything is read
  from chain.
* **The registry.** `registry()` is every chain and venue with its support
  matrix; `registry().supports_on(venue, chain, capability)`.
* **Any wallet's value line.** `wallet_history(address, range)`.
* **Farming rewards on Solana agents.** `AgentPerformance.rewards`,
  `rewards_claimable_usd` and the Solana `farm_rewards` block (pending,
  claimed and the fee booked, per mint: `FarmRewardMint`).
  `FARM_REWARD_FEE_BPS` states the farming reward fee.
* **PancakeSwap Infinity Bin** (`pancakeswap_infinity_bin`, BNB Chain) in
  `ponk.evm.EVM_VENUES`: a range venue whose fees compound inside the bins.
* **Smaller additions.** `Agent.kind`; `next_check_at` on `agent_decisions`;
  the take-profit ladder on `update_exits` for EVM agents; `token_x` and
  `token_y` labels on feed rows and the agents activity strip, plus
  `AgentsActivity.checks`; `XDirectoryEntry.read_state`;
  `FollowState.following_count` and `viewer`; `LeaderboardRow.spark_from`
  and `spark_until`; the copilot's risk words (`steady`, `balanced`,
  `aggressive`) and the `skipped` pools on a refusal;
  `Referral.share_bps`.

## Changes in 0.11.0

* **People search.** `people_search(q, cursor=None)` (`PeopleSearch`,
  `SearchHit`), no key.
* **Who to follow.** `recommended_people`, `similar_people` (no key),
  `my_recommended`, `dismiss_recommended` (`Recommendations`,
  `RecommendedPerson`).
* **Mandates.** `mandates()` (`Mandates`, `MandateRow`) with `renew_all_url`.
* **Pool checks are advice.** `create_agent(..., accept_pool_risk=True)`.
* **Copilot.** Leg `warnings` and refusal `suggestions` for new tokens.
* Every account is public: the privacy methods answer the public state.

## Changes in 0.10.0

* **People.** `profile`, `followers`, `following`, `person_activity`,
  `person_positions`, `people_board` and `live_feed` (no key);
  `follow_person`, `unfollow_person`, `my_following` and `following_feed`
  (API key). Models `Person`, `Profile`, `PeopleList`, `FollowState`,
  `MyFollowing`, `SocialFeed`, `ActivityRow`, `CopyAction`, `OpenPosition`,
  `PersonPositions`, `PeopleBoard`.
* **Privacy.** `privacy`, `set_privacy` and `answer_privacy_prompt` over
  `/v1/me/privacy` (`Privacy`, `PrivacySettings`); the leaderboard-privacy
  names stay as aliases.
* **Activation fee.** `PonkPerks.activation_fee`, `FeeEvent.source`
  (`activation`), and the constants `ACTIVATION_FEE_BPS`,
  `ACTIVATION_FEE_HOLDER_BPS` and `ACTIVATION_REFERRER_BPS`.
* **Trackers and calls.** `wallet_pnl`, `tracked_lps`, `x_account`,
  `top_calls`, and `x_feed(first_calls=True)`.

## Changes in 0.7.0

* **Swap orders.** `plan_orders([limit_order(...), tp_sl_order(...),
  dca_order(...)])` validates up to ten orders and returns one link
  (`plan.sign_url`) where your wallet signs them. For a program that holds its
  own key: `orders_sign_in(sign_message)`, then `place_order(token, family,
  body, sign_transaction)`, or the single steps `craft_order_deposit`,
  `create_price_order`, `create_dca_order`, `cancel_order`,
  `confirm_order_cancel`, `list_orders`, `cancel_orders(token,
  all_orders=True)` and `confirm_order_cancels`. The Jupiter token is a
  per-call argument (`X-Jupiter-Session`), never stored. A 504
  `outcome_unknown` on a create or confirm is never retried.
* **Copy and follow.** `copy_source`, `follow_status`, `follow_leader`,
  `update_follow`, `unfollow_leader`, `answer_follow_offer`,
  `list_copy_follows`, `follow_leaders` and `follow_many` (batches), and Copy
  LP: `wallet_follow`, `unfollow_wallet`, `answer_wallet_offer`, `copy_log`,
  `copy_referral`, `attach_copy_referral`.
* **Self-custody loop.** Every prepare returns a `Prepared` (an UNSIGNED
  build for your own wallet) and every mark a `MarkedTx`: the agent
  rebalance (prepare, prepare-split, prepare-open, mark), the fee claim
  (prepare, mark, confirm), the position builders, `lp_withdraw_prepare`, wSOL reclaim, stranded positions and
  cleanup, `positions_sync`.
* **Account.** Calls, Web Push, card looks, referral codes, the Creator
  application, leaderboard privacy and per-agent visibility, `clear_logs`,
  `weekly_recap`, `my_ponkillionaires`, `telegram_status`,
  `share_position_telegram`, and `rank_presets`.

Still app only: minting a custody mandate, API keys, webhooks and linking
Telegram.

## Changes in 0.6.0

* **Agent fleets.** `create_agents([...])` creates many agents in one call,
  each with its own wallet. `fund_prepare(agent_ids)` returns the UNSIGNED
  transfers that fund them all from your wallet, packed into as few
  transactions as fit: ten agents, one signature. `iter_fleet()` reads every
  agent with its wallet balance, mandate expiry and value, page by page.
  `exit_agents(ids)` and `withdraw_agents(ids)` (or `all_agents=True`) close
  them all at once. A batch keeps running on the server after the response;
  `get_batch(batch_id)` collects what was still `running`.
* **The client never signs.** Your wallet signs the funding transfers, on
  ponk.exchange (`plan.sign_urls`, which also queues each custody mandate an
  agent still needs) or in wallet software you control
  (`plan.transactions[i].unsigned_tx_b64`). The SDK holds no key and asks for
  none.
* **`/v1` parity with the app:** `rebalance`, `collect_fees`, `rename_agent`,
  `delete_agent`, `create_agent_wallet`, `agent_proof`, `agent_range_history`,
  `custody_withdraw`, `custody_exit`, `portfolio`, `portfolio_history`,
  `list_transactions`, `list_risk_events`, `list_fees`, `fee_summary`, the
  notifications, the recommendations, `notify_settings` and the saved presets.
* `AgentWallet` gained `withdrawable_lamports` and `token_accounts_with_value`
  (`None` means the token read failed, never zero tokens).

```python
batch = ponk.create_agents([
    {"name": "fleet %d" % i, "dex": "meteora_dlmm", "pool_address": POOL,
     "strategy": "bin_rebalancer", "dry_run": True,
     "config": {"kind": "bin_rebalancer", "bin_range_width": 20, "rebalance_threshold_bins": 5}}
    for i in range(10)
])
ids = [it.agent_id for it in batch.items if it.ok]
plan = ponk.fund_prepare(ids)            # unsigned; sign at plan.sign_urls
for row in ponk.iter_fleet():
    print(row.agent.name, row.wallet and row.wallet.lamports, row.mandate and row.mandate.status)
ponk.exit_agents(ids)
```

The whole flow, with polling, is [`examples/fleet.py`](examples/fleet.py).

Still app only: minting a custody mandate, API keys and webhooks. A key
cannot produce a wallet signature, so these stay behind a wallet sign-in.

## Changes in 0.5.0

* **Live agents activity, no key:** `agents_activity()` returns the board
  agents' confirmed actions of the last 24 hours and every live hold, with no
  identity on any event.
* **Weekly Ponkillionaires, no key:** `ponkillionaires_week()` returns this
  week's standings, the prizes (next week's agent fee rate plus points) and
  last week's winners.
* **X Tracker, no key:** `x_feed`, `x_trending`, `x_callers`, `x_token`,
  `x_accounts`, `x_status`.
* **Wallet Tracker, no key:** `wallets_feed`, `wallets_defaults`,
  `wallets_status`, and `wallet_activity(address)` for any wallet.
* **Referral tiers:** `referral()` now carries `tier` (`current`,
  `share_bps`, `referred_fees_usd`, `window_days`, `next`) and `programme`
  (`ladder`, `window_days`). One level only: the share steps up with the
  referred platform fees over 30 days, and `programme.ladder` states each
  step.
* The tracker and weekly race responses are camelCase on the wire; the models
  expose snake_case attributes (`accounts_1h` reads `accounts1h`).
* `PublicLink.path` is documented as `/ponkillionaires/<slug>`, the path the
  server sends.

Not in the client, by design: following X accounts, tracked wallets, live copy
follow, mandate reminder settings and the PnL and referral card settings are
app session routes (`/me/*`, `/agents/{id}/follow`) that need a wallet
sign-in, not an API key.

```python
ponk = PonkClient()
hot = ponk.x_trending(window="24h", limit=10)
week = ponk.ponkillionaires_week()
tier = PonkClient(api_key=KEY).referral().tier
print(tier.current, tier.share_bps / 100, "%", tier.next.min_fees_usd if tier.next else "top")
```

## Changes in 0.4.0

* **Top Ponkillionaires, no key:** `leaderboard(window)`, `public_agent(slug)`,
  `public_agent_value_history(slug, range)`.
* **Copy an agent:** `copy_agent(slug_or_row, name=, wallet_address=,
  dry_run=, config_overrides=None)` creates an agent on your wallet from a
  shared agent's `copy` block.
* **Share and follow:** `share_agent`, `unshare_agent`, `get_public_link`,
  `follow`, `unfollow`, `list_follows`.
* **Points and referrals:** `points`, `points_leaderboard`,
  `public_points_leaderboard`, `referral`, `creator_dashboard`,
  `check_handle`, `claim_handle`, `resolve_referral`.
* **Agent reads:** `agent_value_history` and `agent_decisions`.
* **Settings edits:** `update_config`, `update_exits`, `set_auto_compound`,
  and `optimize_draft`. The docstrings list the new keys: keep side, reshape,
  cooldown and daily cap, the market cap, value and value plus fees take
  profits, and the Degen Mode bin step filter.

```python
board = ponk.leaderboard(window="7d")
row = board.ranked[0]
mine = ponk.copy_agent(row, name="copy", wallet_address=me.wallet_address, dry_run=True)

standing = ponk.points()
print(standing.season.name if standing.season else "off-season", standing.total_points, standing.rank)
r = ponk.referral()
print("earned", r.total_earned_usd, "owed", r.owed_usd, "unproven", r.unproven_usd)  # never add these
```

## Changes in 0.3.0

* **Breaking: `create_agent` requires `dry_run`.** 0.2.0 documented an
  omitted `dry_run` as a dry run. On `/v1` it is the opposite: an omitted
  `dry_run` creates a live agent. Code that relied on the old wording was
  creating live agents, so 0.3.0 makes the choice explicit and raises
  `TypeError` if it is missing or not a `bool`.
* `agent_mandate(id)` reads the live custody mandate, including its expiry.
* `set_autonomous(id, enabled)` turns autonomous signing on under an existing
  mandate, or off. It never creates a mandate.
* `range_cost(dex, address, bins)` quotes what a Meteora range costs to open.
* `get_json(path, params)` reaches any GET this client does not name.
* The User-Agent now carries the real package version (it said 0.1.0).

## Tests

Offline, no network, no fixtures to refresh:

```bash
cd python && python3 -m pytest
```

`python3 -m unittest discover -s tests -v` runs the same suite without
pytest.
