How to Track Binance Futures Traders and Positions Using Node.js
If you're building a crypto trading dashboard, trader analytics platform, smart-money tracker, or research tool, you may want more than just Binance market data.
Sometimes you want to answer questions like:
- What is a specific Binance Futures trader doing?
- What positions does the trader currently have?
- What is the trader's PnL?
- What does the trader's performance look like over time?
- How can I display this information inside my own Node.js application?
This tutorial shows how to retrieve Binance Futures trader profile data, chart data, and positions using Node.js with the Binance Futures Smart Money API available through RapidAPI.
What we'll build
We'll create a simple Node.js application that calls three API endpoints:
- Get Trader Profile
- Get Trader Chart Data
- Get Trader Positions
The same approach can be used to build a trader dashboard, smart-money tracker, whale tracker, or crypto analytics application.
API Overview
The Binance Futures Smart Money API provides trader-level data that can be used for applications focused on Binance Futures trader analytics.
The three endpoints used in this tutorial are:
1. Get Trader Profile
GET /v1/getTraderProfile
This endpoint retrieves profile information for a Binance Futures trader.
2. Get Trader Chart Data
GET /v1/getTraderChartData
This endpoint can be used to retrieve historical trader chart data.
For example, we can request:
timeRange = 30D
chartDataType = PNL
3. Get Trader Positions
GET /v1/getTraderPositions
This endpoint retrieves the trader's Binance Futures position information.
You can specify:
- Market type
- Page
- Number of rows
- Trader ID
Getting Started
1. Create a Node.js project
Create a new directory:
mkdir binance-trader-api-example
cd binance-trader-api-example
Initialize the project:
npm init -y
Install Axios:
npm install axios
Axios will be used to make HTTP requests to the RapidAPI endpoints.
2. Add your RapidAPI key
You should never hard-code your RapidAPI key inside a public GitHub repository.
Instead, use an environment variable.
macOS / Linux
export RAPIDAPI_KEY="YOUR_RAPIDAPI_KEY"
Windows PowerShell
$env:RAPIDAPI_KEY="YOUR_RAPIDAPI_KEY"
3. Create index.js
Create a file called:
index.js
Add the following code:
const axios = require("axios");
const RAPIDAPI_KEY =
process.env.RAPIDAPI_KEY || "YOUR_RAPIDAPI_KEY";
const RAPIDAPI_HOST =
"binance-futures-smart-money-api.p.rapidapi.com";
const BASE_URL = `https://${RAPIDAPI_HOST}`;
// Change this to the trader ID you want to query.
const TRADER_ID = "4567039936116284160";
// =========================================================
// 1. Get Trader Profile
// =========================================================
async function getTraderProfile(traderId) {
const response = await axios.get(
`${BASE_URL}/v1/getTraderProfile`,
{
params: {
traderId,
},
headers: {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": RAPIDAPI_HOST,
},
}
);
return response.data;
}
// =========================================================
// 2. Get Trader Chart Data
// =========================================================
async function getTraderChartData({
traderId,
timeRange = "30D",
chartDataType = "PNL",
}) {
const response = await axios.get(
`${BASE_URL}/v1/getTraderChartData`,
{
params: {
timeRange,
chartDataType,
traderId,
},
headers: {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": RAPIDAPI_HOST,
},
}
);
return response.data;
}
// =========================================================
// 3. Get Trader Positions
// =========================================================
async function getTraderPositions({
traderId,
marketType = "UM",
page = 1,
rows = 9,
}) {
const response = await axios.get(
`${BASE_URL}/v1/getTraderPositions`,
{
params: {
marketType,
page,
rows,
traderId,
},
headers: {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"X-RapidAPI-Host": RAPIDAPI_HOST,
},
}
);
return response.data;
}
// =========================================================
// Example Usage
// =========================================================
async function main() {
if (RAPIDAPI_KEY === "YOUR_RAPIDAPI_KEY") {
console.error(
"Please set your RAPIDAPI_KEY environment variable."
);
process.exit(1);
}
try {
// 1. Trader Profile
console.log(
"\n========== TRADER PROFILE ==========\n"
);
const profile =
await getTraderProfile(TRADER_ID);
console.dir(profile, {
depth: null,
});
// 2. Trader Chart Data
console.log(
"\n========== TRADER CHART DATA ==========\n"
);
const chartData =
await getTraderChartData({
traderId: TRADER_ID,
timeRange: "30D",
chartDataType: "PNL",
});
console.dir(chartData, {
depth: null,
});
// 3. Trader Positions
console.log(
"\n========== TRADER POSITIONS ==========\n"
);
const positions =
await getTraderPositions({
traderId: TRADER_ID,
marketType: "UM",
page: 1,
rows: 9,
});
console.dir(positions, {
depth: null,
});
} catch (error) {
console.error("\nAPI request failed.");
if (error.response) {
console.error(
"Status:",
error.response.status
);
console.error(
"Response:",
error.response.data
);
} else {
console.error(
"Error:",
error.message
);
}
}
}
main();
4. Run the application
Once your RapidAPI key is configured, run:
node index.js
The application will make three requests:
Trader Profile
↓
Trader Chart Data
↓
Trader Positions
The returned JSON will be printed directly in your terminal.
Understanding the Trader ID
The API uses a trader ID to identify the trader you want to retrieve.
For example:
const TRADER_ID = "4567039936116284160";
You can replace this with another supported trader ID.
This makes the same Node.js code reusable for different traders.
Getting Trader Profile Data
The profile endpoint is:
await getTraderProfile(TRADER_ID);
The returned data can be used to populate a trader profile page in your application.
For example, you could create a UI containing:
Trader
├── Profile
├── Performance
├── PnL
├── ROI
└── Trading information
Getting Historical Chart Data
You can request chart data using:
const chartData =
await getTraderChartData({
traderId: TRADER_ID,
timeRange: "30D",
chartDataType: "PNL",
});
The timeRange and chartDataType parameters allow your application to request the chart data you need.
You could use this data to create charts using libraries such as:
- Recharts
- Chart.js
- ApexCharts
- TradingView Lightweight Charts
For example, you could build a trader performance dashboard showing historical PnL.
Getting Current Trader Positions
To retrieve trader positions:
const positions =
await getTraderPositions({
traderId: TRADER_ID,
marketType: "UM",
page: 1,
rows: 9,
});
The marketType parameter can be used to specify the futures market.
For example:
UM
can be used for USDⓈ-M Futures.
The page and rows parameters can be used when retrieving paginated position data.
What Can You Build With This?
Once you have trader profile, chart and position data, you can build much more than a simple API integration.
Smart Money Tracker
Monitor selected traders and display their current positions.
Trader Dashboard
Create a dashboard showing:
Trader Profile
↓
Performance
↓
PnL Chart
↓
Current Positions
Binance Futures Whale Tracker
Track selected high-performing or high-value traders and monitor their positions.
Crypto Trading Analytics
Combine trader information with your own market data to create analytics tools.
Research Platform
Use historical trader performance and position information for quantitative research.
Why Trader-Level Data Is Useful
Traditional cryptocurrency APIs often focus on market-level information such as:
- Price
- Volume
- Order book
- Candles
- Funding rates
Trader-level information can provide a different perspective.
Instead of asking only:
"What is Bitcoin doing?"
you can also investigate:
"What are the traders I'm monitoring doing?"
That can be useful when building research and analytics applications.
Security: Protect Your API Key
Never commit your RapidAPI key to GitHub.
Avoid doing this:
const RAPIDAPI_KEY =
"your-real-api-key";
Instead use:
const RAPIDAPI_KEY =
process.env.RAPIDAPI_KEY;
You can also use a .env file with the dotenv package for local development.
For production applications, use your hosting provider's environment-variable or secret-management system.
API Documentation
The complete API documentation, available endpoints, parameters and usage information can be found on the RapidAPI listing.
RapidAPI: https://rapidapi.com/singhmayankms123/api/binance-futures-smart-money-api
GitHub: https://github.com/mayanksingh2233/binance-futures-smart-money-api
Final Thoughts
Building a Binance Futures trader analytics application doesn't have to start with a large backend.
With a few Node.js functions and three API endpoints, you can retrieve:
- Trader profiles
- Historical chart data
- Trader positions
From there, you can build dashboards, smart-money trackers, trader monitoring tools and crypto analytics applications around the data.
If you're working on a Binance Futures analytics project, this approach provides a simple starting point for integrating trader-level data into a Node.js application.
Disclaimer: This API and tutorial are intended for software development, research and analytics purposes. Nothing in this article constitutes financial advice or a recommendation to buy or sell any financial asset.
Top comments (0)