Skip to main content
Copy trading endpoints are split between public methods (no auth, lead trader discovery) and private methods (auth required, managing your copy or lead-trader account).

Method reference

Public — lead trader discovery

MethodHTTPEndpointDescription
getCopytradingConfig(params?)GET/api/v5/copytrading/public-configCopy trading platform configuration
getCopytradingLeadRanks(params?)GET/api/v5/copytrading/public-lead-tradersPublic lead trader rankings
getCopytradingLeadWeeklyPnl(params)GET/api/v5/copytrading/public-weekly-pnlLead trader weekly PnL
getCopytradingLeadDailyPnl(params)GET/api/v5/copytrading/public-pnlLead trader daily PnL
getCopytradingLeadStats(params)GET/api/v5/copytrading/public-statsLead trader statistics
getCopytradingLeadPreferences(params)GET/api/v5/copytrading/public-preference-currencyLead trader currency preferences
getCopytradingLeadOpenPositions(params)GET/api/v5/copytrading/public-current-subpositionsLead trader open positions
getCopytradingLeadPositionHistory(params)GET/api/v5/copytrading/public-subpositions-historyLead trader position history
getCopyTraders(params)GET/api/v5/copytrading/public-copy-tradersList copiers for a lead trader

Private — copy trading (follower)

MethodHTTPEndpointDescription
getCopytradingSubpositions(params?)GET/api/v5/copytrading/current-subpositionsYour current copy positions
getCopytradingSubpositionsHistory(params?)GET/api/v5/copytrading/subpositions-historyYour copy position history
submitCopytradingAlgoOrder(params)POST/api/v5/copytrading/algo-orderPlace an algo order on a copy position
closeCopytradingSubposition(params)POST/api/v5/copytrading/close-subpositionClose a copy position
getCopytradingInstruments(params?)GET/api/v5/copytrading/instrumentsInstruments you are copying
setCopytradingInstruments(params)POST/api/v5/copytrading/set-instrumentsSet instruments to copy
getCopytradingAccount()GET/api/v5/copytrading/configYour copy trading account config
setCopytradingFirstCopy(params)POST/api/v5/copytrading/first-copy-settingsStart copying a lead trader
updateCopytradingCopySettings(params)POST/api/v5/copytrading/amend-copy-settingsUpdate copy settings for a lead trader
stopCopytradingCopy(params)POST/api/v5/copytrading/stop-copy-tradingStop copying a lead trader
getCopytradingCopySettings(params)GET/api/v5/copytrading/copy-settingsCurrent copy settings for a lead trader
getCopytradingBatchLeverageInfo(params)GET/api/v5/copytrading/batch-leverage-infoLeverage info for copied instruments
setCopytradingBatchLeverage(params)POST/api/v5/copytrading/batch-set-leverageSet leverage for copied instruments
getCopytradingMyLeadTraders(params?)GET/api/v5/copytrading/current-lead-tradersLead traders you are following
getCopytradingLeadTradersHistory(params?)GET/api/v5/copytrading/lead-traders-historyHistorical lead traders you followed

Private — lead trader

MethodHTTPEndpointDescription
getCopytradingProfitDetails(params?)GET/api/v5/copytrading/profit-sharing-detailsProfit-sharing details
getCopytradingTotalProfit(params?)GET/api/v5/copytrading/total-profit-sharingTotal profit sharing earned
getCopytradingUnrealizedProfit(params?)GET/api/v5/copytrading/unrealized-profit-sharing-detailsUnrealized profit sharing
applyCopytradingLeadTrading(params)POST/api/v5/copytrading/apply-lead-tradingApply to become a lead trader
stopCopytradingLeadTrading(params?)POST/api/v5/copytrading/stop-lead-tradingStop lead trading
updateCopytradingProfitSharing(params)POST/api/v5/copytrading/amend-profit-sharing-ratioUpdate profit sharing ratio
getCopytradingLeadPrivateRanks(params?)GET/api/v5/copytrading/lead-tradersYour private lead trader ranking
geCopytradingLeadPrivateStats(params)GET/api/v5/copytrading/statsYour lead trader statistics
getCopytradingLeadPrivateOpenPositions(params)GET/api/v5/copytrading/performance-current-subpositionsYour current lead positions
getCopyTradersPrivate(params)GET/api/v5/copytrading/copy-tradersYour current copiers

Examples

Discover lead traders

import { RestClient } from 'okx-api';

const client = new RestClient(); // no auth needed

// Get top lead traders
const ranks = await client.getCopytradingLeadRanks({
  instType: 'SWAP',
  sortType: '1',  // sort by PnL
});

for (const trader of ranks.slice(0, 5)) {
  console.log(`Trader: ${trader.uniqueCode}`);
  console.log(`  Win rate: ${trader.winRatio}`);
  console.log(`  Copiers: ${trader.copyTraderNum}`);
}

Start copying a lead trader

import { RestClient } from 'okx-api';

const client = new RestClient({
  apiKey: process.env.API_KEY!,
  apiSecret: process.env.API_SECRET!,
  apiPass: process.env.API_PASS!,
});

await client.setCopytradingFirstCopy({
  instType: 'SWAP',
  uniqueCode: 'LEAD_TRADER_CODE',
  copyMode: 'fixed_amount',
  fixedAmt: '100',          // copy 100 USDT per trade
  copyMgnMode: 'cross',
  copyInstIdType: 'custom', // specify instruments
  instIds: ['BTC-USDT-SWAP', 'ETH-USDT-SWAP'],
});

console.log('Now copying trader!');

View your current copy positions

const positions = await client.getCopytradingSubpositions();
for (const pos of positions) {
  console.log(`${pos.instId}: size=${pos.copyAmt}, PnL=${pos.pnl}`);
}

Close a copy position

const [result] = await client.closeCopytradingSubposition({
  subPosId: 'your-subposition-id',
  instId: 'BTC-USDT-SWAP',
  mgnMode: 'cross',
});
console.log('Closed subposition:', result.subPosId);

Stop copying

await client.stopCopytradingCopy({
  instType: 'SWAP',
  uniqueCode: 'LEAD_TRADER_CODE',
  subPosCloseType: 'market_close', // market_close, copy_close, or manual_close
});

Build docs developers (and LLMs) love