Binance Top Traders Future Positions avatar
Binance Top Traders Future Positions

Deprecated

Pricing

Pay per usage

Go to Store
Binance Top Traders Future Positions

Binance Top Traders Future Positions

Deprecated

Developed by

Selçuk İtmiş

Selçuk İtmiş

Maintained by Community

Binance is the world's largest crypto exchange. On Binance Leaderboard, you can see the current future positions of the traders with the highest monthly earnings and the most followers.

0.0 (0)

Pricing

Pay per usage

1

Total users

319

Monthly users

2

Runs succeeded

>99%

Last modified

3 years ago

.editorconfig

root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

.eslintrc

{
"extends": "@apify"
}

.gitignore

# This file tells Git which files shouldn't be added to source control
.idea
node_modules

Dockerfile

# First, specify the base Docker image. You can read more about
# the available images at https://sdk.apify.com/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:16
# Second, copy just package.json and package-lock.json since it should be
# the only file that affects "npm install" in the next step, to speed up the build
COPY package*.json ./
# Install NPM packages, skip optional and development dependencies to
# keep the image small. Avoid logging too much and print the dependency
# tree for debugging
RUN npm --quiet set progress=false \
&& npm install --only=prod --no-optional \
&& echo "Installed NPM packages:" \
&& (npm list --only=prod --no-optional --all || true) \
&& echo "Node.js version:" \
&& node --version \
&& echo "NPM version:" \
&& npm --version
# Next, copy the remaining files and directories with the source code.
# Since we do this after NPM install, quick build will be really fast
# for most source file changes.
COPY . ./
# Optionally, specify how to launch the source code of your actor.
# By default, Apify's base Docker images define the CMD instruction
# that runs the Node.js source code using the command specified
# in the "scripts.start" section of the package.json file.
# In short, the instruction looks something like this:
#
# CMD npm start

INPUT_SCHEMA.json

{
"title": "Input schema for the apify_project actor.",
"type": "object",
"schemaVersion": 1,
"properties": {
},
"required": []
}

apify.json

{
"env": { "npm_config_loglevel": "silent" }
}

main.js

1const Apify = require('apify');
2const axios = require('axios');
3const moment = require('moment');
4const lodash = require('lodash');
5Apify.main(async () => {
6 let positions = [];
7 try {
8 var config = {
9 method: 'post',
10 url: 'https://www.binance.com/bapi/futures/v1/public/future/leaderboard/getOtherPosition',
11 headers: {
12 'authority': 'www.binance.com',
13 'accept': '*/*',
14 'accept-language': 'tr,en;q=0.9,tr-TR;q=0.8',
15 'clienttype': 'web',
16 'content-type': 'application/json',
17 'lang': 'en',
18 'origin': 'https://www.binance.com',
19 'referer': 'https://www.binance.com/en/futures-activity/leaderboard?type=myProfile&encryptedUid=EE0CE3F95107DE82428E8744053E85D3',
20 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"',
21 'sec-ch-ua-mobile': '?0',
22 'sec-ch-ua-platform': '"Windows"',
23 'sec-fetch-dest': 'empty',
24 'sec-fetch-mode': 'cors',
25 'sec-fetch-site': 'same-origin',
26 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36',
27 'Cookie': 'cid=4C4kmgsb'
28 },
29 data: "{}"
30 };
31 const tradersConfig = config;
32 tradersConfig.data = {
33 "limit": 50,
34 "sortType": "ROI",
35 "isShared": true,
36 "periodType": "MONTHLY",
37 "pnlGainType": null,
38 "roiGainType": null,
39 "symbol": "",
40 "tradeType": "PERPETUAL"
41 };
42 tradersConfig.url = "https://www.binance.com/bapi/futures/v1/public/future/leaderboard/searchLeaderboard";
43 const tradersData = await axios(config);
44
45 const allRequests = [];
46 const traders = [];
47 if (tradersData && tradersData.data && tradersData.data.data && tradersData.data.data.length > 0) {
48 tradersData.data.data.forEach(async (trader) => {
49 const roi = trader.roiValue * 100;
50 if (trader.followerCount > 20 && roi > 100) {
51 var data = JSON.stringify({
52 "encryptedUid": trader.encryptedUid,
53 "tradeType": "PERPETUAL"
54 });
55 config.data = data;
56 config.url = "https://www.binance.com/bapi/futures/v1/public/future/leaderboard/getOtherPosition";
57 allRequests.push(axios(config));
58 traders.push(trader);
59 }
60 });
61 const response = await axios.all(allRequests);
62 response.forEach((res, index) => {
63 if (res && res.data && res.data.data && res.data.data.otherPositionRetList && res.data.data.otherPositionRetList.length > 0) {
64 var otherPositionRetList = res.data.data.otherPositionRetList;
65 var trader = traders[index];
66 otherPositionRetList.forEach(otherPositionRet => {
67 let positionType = "--";
68 const { symbol, amount, entryPrice, markPrice, pnl, roe, updateTimeStamp } = otherPositionRet;
69 var _roe = roe * 100;
70
71 if (markPrice > entryPrice && pnl > 0) {
72 positionType = "LONG";
73 }
74 else if (entryPrice > markPrice && pnl > 0) {
75 positionType = "SHORT";
76 }
77 else if (entryPrice > markPrice && pnl < 0) {
78 positionType = "LONG";
79 }
80 else if (entryPrice < markPrice && pnl < 0) {
81 positionType = "SHORT";
82 }
83 _roe = _roe.toFixed(2);
84 if (pnl && pnl !== 0) {
85 positions.push({
86 traderName: trader.nickName,
87 traderWebPage: "https://www.binance.com/en/futures-activity/leaderboard?type=myProfile&encryptedUid=" + trader.encryptedUid,
88 symbol: symbol,
89 positionType,
90 entryPrice: entryPrice,
91 markPrice: markPrice,
92 roe: _roe + "%",
93 enteringTime: moment(updateTimeStamp).format('YYYY-DD-MM HH:mm:ss')
94 });
95 }
96
97 });
98 }
99 });
100 }
101 } catch (error) {
102 console.log("error", error.message);
103 }
104 if (positions && positions.length > 0) {
105 positions = lodash.orderBy(positions, ['symbol', 'positionType'],
106 ['asc', 'asc']);
107 }
108 await Apify.pushData(positions);
109});

package.json

{
"name": "project-empty",
"version": "0.0.1",
"description": "This is a boilerplate of an Apify actor.",
"dependencies": {
"apify": "^2.0.7",
"axios": "^0.26.1",
"lodash": "^4.17.21",
"moment": "^2.29.3"
},
"devDependencies": {
"@apify/eslint-config": "^0.1.3",
"eslint": "^7.0.0"
},
"scripts": {
"start": "node main.js",
"lint": "./node_modules/.bin/eslint ./src --ext .js,.jsx",
"lint:fix": "./node_modules/.bin/eslint ./src --ext .js,.jsx --fix",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "It's not you it's me",
"license": "ISC"
}