Binance Top Traders Future Positions
DeprecatedView all Actors
This Actor is unavailable because the developer has decided to deprecate it. Would you like to try a similar Actor instead?
See alternative ActorsBinance Top Traders Future Positions
selcukitmis/binance-top-traders-positions
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.
.editorconfig
1root = true
2
3[*]
4indent_style = space
5indent_size = 4
6charset = utf-8
7trim_trailing_whitespace = true
8insert_final_newline = true
9end_of_line = lf
.eslintrc
1{
2 "extends": "@apify"
3}
.gitignore
1# This file tells Git which files shouldn't be added to source control
2
3.idea
4node_modules
Dockerfile
1# First, specify the base Docker image. You can read more about
2# the available images at https://sdk.apify.com/docs/guides/docker-images
3# You can also use any other image from Docker Hub.
4FROM apify/actor-node:16
5
6# Second, copy just package.json and package-lock.json since it should be
7# the only file that affects "npm install" in the next step, to speed up the build
8COPY package*.json ./
9
10# Install NPM packages, skip optional and development dependencies to
11# keep the image small. Avoid logging too much and print the dependency
12# tree for debugging
13RUN npm --quiet set progress=false \
14 && npm install --only=prod --no-optional \
15 && echo "Installed NPM packages:" \
16 && (npm list --only=prod --no-optional --all || true) \
17 && echo "Node.js version:" \
18 && node --version \
19 && echo "NPM version:" \
20 && npm --version
21
22# Next, copy the remaining files and directories with the source code.
23# Since we do this after NPM install, quick build will be really fast
24# for most source file changes.
25COPY . ./
26
27# Optionally, specify how to launch the source code of your actor.
28# By default, Apify's base Docker images define the CMD instruction
29# that runs the Node.js source code using the command specified
30# in the "scripts.start" section of the package.json file.
31# In short, the instruction looks something like this:
32#
33# CMD npm start
INPUT_SCHEMA.json
1{
2 "title": "Input schema for the apify_project actor.",
3 "type": "object",
4 "schemaVersion": 1,
5 "properties": {
6
7 },
8 "required": []
9}
apify.json
1{
2 "env": { "npm_config_loglevel": "silent" }
3}
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
1{
2 "name": "project-empty",
3 "version": "0.0.1",
4 "description": "This is a boilerplate of an Apify actor.",
5 "dependencies": {
6 "apify": "^2.0.7",
7 "axios": "^0.26.1",
8 "lodash": "^4.17.21",
9 "moment": "^2.29.3"
10 },
11 "devDependencies": {
12 "@apify/eslint-config": "^0.1.3",
13 "eslint": "^7.0.0"
14 },
15 "scripts": {
16 "start": "node main.js",
17 "lint": "./node_modules/.bin/eslint ./src --ext .js,.jsx",
18 "lint:fix": "./node_modules/.bin/eslint ./src --ext .js,.jsx --fix",
19 "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
20 },
21 "author": "It's not you it's me",
22 "license": "ISC"
23}
Developer
Maintained by Community