# Copy trading and the trade feed

> Copy this trade on trade cards, the feed and top wallets opens the same route with your own amount and credits the trader's referral. The public trade feed only shows wallets that opted in with a signed message.

Source: https://docs.layerhop.com/guides/copy-trading

Every filled LayerHop swap has a public [trade card](/guides/trade-history) at `app.layerhop.com/card/<quoteId>`. A card, the [trade feed](https://app.layerhop.com/feed) and the [top wallets](https://app.layerhop.com/wallets) page have a **Copy this trade** button. It opens the swap with the same chains and tokens, and **your own amount**: you pick a size once ($25 until you do) and it is remembered in your browser. The original trade's size is never copied. You review the live quote and sign in your own wallet, as with any swap.

## How does copying credit the trader?

The swap link carries `copy=<quoteId>` (a trade card) or `copy=<wallet>` (a top wallet). The app sends it with every quote as `copyOf`, and the API makes the trade's owner the [referrer](/guides/referrals) of that quote, ahead of a stored `?r=` referral:

- **A trade card**: the owner is the order's sender. The API never returns that address, so a card stays address-free. It only counts when your quote buys the same token on the same destination chain as the card.
- **A wallet**: only when that wallet uses LayerHop (it has a filled swap, or it opted in to the feed).

Attribution only: it never changes your price or fee. Invalid values, unknown cards and copying yourself are ignored, never an error.

```bash
curl "https://api.layerhop.com/v1/quote?srcChain=base&srcToken=USDC&amount=25000000&dstChain=solana&dstToken=SOL\
&sender=0xYourWallet&recipient=YourSolanaWallet&copyOf=q_3f1c2a9e-7b4d-4e0a-9c55-2d8e6f1a0b7c"
```

With the TypeScript SDK, pass `copyOf` in `QuoteParams`. A deep link that copies a trade:

```text
https://app.layerhop.com/swap?srcChain=8453&srcToken=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913&dstChain=7565164&dstToken=So11111111111111111111111111111111111111112&amount=25&copy=q_3f1c2a9e-7b4d-4e0a-9c55-2d8e6f1a0b7c
```

## What is the trade feed?

[app.layerhop.com/feed](https://app.layerhop.com/feed) lists recent notable swaps (worth at least $25 at fill, both tokens on LayerHop's token list; tips, split shares and payouts are left out) by wallets that **chose** to share them, with their address. Nobody appears without opting in. `GET /v1/trade-feed?limit=20&before=<ISO time>` returns the same list:

```json
{
  "minUsd": 25,
  "trades": [
    { "quoteId": "q_…", "trader": "0x1111…", "srcSymbol": "USDC", "srcAmount": "250000000", "srcAmountUsd": 250, "dstSymbol": "SOL", "dstAmount": "1530000000", "filledAt": "2026-10-29T09:00:00.000Z" }
  ]
}
```

Each entry is a [trade card](/api-reference#get-a-verified-trade-card) plus `trader`.

## How does a wallet opt in or out?

On the feed page, **Share my trades** asks the connected wallet to sign a plain text message (free; it moves nothing and isn't a sign-in). From your own code, sign `buildShareTradesMessage` from `@layerhop/shared` and post it:

```ts
import { buildShareTradesMessage } from "@layerhop/shared";

const fields = { vm: "evm" as const, wallet: address.toLowerCase(), enabled: true, issuedAt: new Date().toISOString() };
const signature = await walletClient.signMessage({ account: address, message: buildShareTradesMessage(fields) });
await fetch("https://api.layerhop.com/v1/trade-feed/opt-in", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ ...fields, signature }),
});
```

- Only swaps filled **after** the opt-in are shown. Opting out (`enabled: false`) removes all of them at once.
- The API rebuilds the message from the fields, so the signature covers the wallet, the choice and the time. `issuedAt` must be within 10 minutes and newer than the wallet's last recorded choice (`CONFLICT` otherwise): an old "share" signature can't be replayed after an opt-out.
- `GET /v1/trade-feed/opt-in/{wallet}` returns `{ wallet, enabled, since }`.

Copying is not advice: a trade that worked for someone else can lose you money.
