Skip to main content
For concepts see Copy Trading.

useCopyTrading

Returns the thirteen sdk.copyTrading methods with the same signatures. Each throws SDK not available until the provider has built the SDK. The leaderboard, getLeadTrader and listLeadTraderClosedTrades need no session; every other method needs an authenticated one.
An upsertFollow edit replaces the follow’s settings: every optional setting left out reverts to its default. See upsertFollow.

useCopyEvents

A typed subscription to the authenticated copy channel, wrapping sdk.ws.copy(). It streams to the follower only, and runs only while a user is signed in: it subscribes on login, and logout or an account switch clears the follows and skips before the next user’s snapshot arrives. On subscribe the channel delivers a snapshot of your live follows (ACTIVE or CLOSE_ONLY). Each copy_relationship_update frame then carries a follow’s full state and replaces its entry, unless its version is older than the stored one (a late frame). A follow stopped while the socket is up keeps its entry with status STOPPED. Each later snapshot (after a reconnect) replaces the whole set, so a follow that stopped while the socket was down leaves it. copy_skip frames collect in recentSkips, newest first, up to MAX_RECENT_COPY_SKIPS (50). The snapshot carries no skips; read getFollow(followId) for a follow’s persisted recent skips. cumNetRealized and hwm on each follow are its profit-share basis, not the copy account’s balance. The subscription is torn down on unmount and re-established when sdk.ws or the signed-in user changes.

Returns

CopyRelationshipEventData[]
Your follows as last reported, newest first by startedAt.
Record<string, CopyRelationshipEventData>
The same entries keyed by relationshipId (the follow id, Follow.followId over REST).
CopySkipEventData[]
Leader fills your follows did not mirror while subscribed, newest first, capped at 50.
boolean
Whether the copy subscription is registered. Not a connection indicator.
Error | null
A rejected subscription request. Connection loss and malformed frames never appear here.
() => void
Clear error.