Binance Leaderboard Realtime-Positions avatar
Binance Leaderboard Realtime-Positions
Deprecated
View all Actors
This Actor is deprecated

This Actor is unavailable because the developer has decided to deprecate it. Would you like to try a similar Actor instead?

See alternative Actors
Binance Leaderboard Realtime-Positions

Binance Leaderboard Realtime-Positions

comforted_wingnut/binance-leaderboard-realtime-positions

.dockerignore

1# configurations
2.idea
3
4# crawlee and apify storage folders
5apify_storage
6crawlee_storage
7storage
8
9# installed files
10node_modules
11
12# git folder
13.git

Dockerfile

1# 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 AS builder
5
6# Copy just package.json and package-lock.json
7# to speed up the build using Docker layer cache.
8COPY package*.json ./
9
10# Install all dependencies. Don't audit to speed up the installation.
11RUN npm install --include=dev --audit=false
12
13# Next, copy the source files using the user set
14# in the base image.
15COPY . ./
16
17# Install all dependencies and build the project.
18# Don't audit to speed up the installation.
19RUN npm run build
20
21# Create final image
22FROM apify/actor-node:16
23
24# Copy only built JS files from builder image
25COPY --from=builder /usr/src/app/dist ./dist
26
27# Copy just package.json and package-lock.json
28# to speed up the build using Docker layer cache.
29COPY package*.json ./
30
31# Install NPM packages, skip optional and development dependencies to
32# keep the image small. Avoid logging too much and print the dependency
33# tree for debugging
34RUN npm --quiet set progress=false \
35    && npm install --omit=dev --omit=optional \
36    && echo "Installed NPM packages:" \
37    && (npm list --omit=dev --all || true) \
38    && echo "Node.js version:" \
39    && node --version \
40    && echo "NPM version:" \
41    && npm --version \
42    && rm -r ~/.npm
43
44# Next, copy the remaining files and directories with the source code.
45# Since we do this after NPM install, quick build will be really fast
46# for most source file changes.
47COPY . ./
48
49
50# Run the image.
51CMD npm run start:prod --silent

INPUT_SCHEMA.json

1{
2  "title": "Add two integers",
3  "type": "object",
4  "schemaVersion": 1,
5  "properties": {
6    "firstNumber": {
7      "title": "First integer",
8      "type": "integer",
9      "description": "The number you want to add to the second number.",
10      "editor": "number"
11    },
12    "secondNumber": {
13      "title": "Second integer",
14      "type": "integer",
15      "description": "The number you want to add to the first number.",
16      "editor": "number"
17    }
18  },
19  "required": ["firstNumber", "secondNumber"]
20}

package.json

1{
2    "name": "getting-started-typescript",
3    "version": "0.0.1",
4    "type": "module",
5    "description": "This is an example of an Apify actor.",
6    "dependencies": {
7        "apify": "^3.0.0"
8    },
9    "devDependencies": {
10        "@apify/tsconfig": "^0.1.0",
11        "ts-node": "^10.9.1",
12        "typescript": "4.7.4"
13    },
14    "scripts": {
15        "start": "npm run start:dev",
16        "start:prod": "node dist/main.js",
17        "start:dev": "ts-node-esm -T src/main.ts",
18        "build": "tsc",
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}

tsconfig.json

1{
2    "extends": "@apify/tsconfig",
3    "compilerOptions": {
4        "module": "ES2022",
5        "target": "ES2022",
6        "outDir": "dist",
7        "noUnusedLocals": false,
8        "lib": ["DOM"]
9    },
10    "include": [
11        "./src/**/*"
12    ]
13}

.actor/actor.json

1{
2    "actorSpecification": 1,
3    "name": "getting-started-actor",
4    "title": "Getting Started Actor",
5    "description": "Adds two integers.",
6    "version": "0.0.1",
7    "storages": {
8        "dataset": {
9            "actorSpecification": 1,
10            "title": "Numbers and their sums",
11            "views": {
12                "sums": {
13                    "title": "A sum of two numbers",
14                    "transformation": {
15                        "fields": [
16                            "sum",
17                            "firstNumber",
18                            "secondNumber"
19                        ]
20                    },
21                    "display": {
22                        "component": "table",                        
23                        "properties": {
24                            "sum": {
25                                "label": "Sum",
26                                "format": "number"
27                            },
28                            "firstNumber": {
29                                "label": "First number",
30                                "format": "number"
31                            },
32                            "secondNumber": {
33                                "label": "Second number",
34                                "format": "number"
35                            }
36                        }
37                    }
38                }
39            }
40        }
41    }
42}

src/main.ts

1// This is the main Node.js source code file of your actor.
2// An actor is a program that takes an input and produces an output.
3
4// For more information, see https://sdk.apify.com/
5import { Actor } from 'apify';
6
7interface InputSchema {
8    firstNumber: number;
9    secondNumber: number;
10}
11
12await Actor.init()
13
14console.log('Loading input');
15// Structure of input is defined in INPUT_SCHEMA.json.
16const input = await Actor.getInput<InputSchema>();
17console.log('First number: ', input?.firstNumber);
18console.log('Second number: ', input?.secondNumber);
19
20// 👉 Complete the code so that result is
21// the sum of firstNumber and secondNumber.
22// 👇👇👇👇👇👇👇👇👇👇
23const result = null;
24// 👆👆👆👆👆👆👆👆👆👆
25
26console.log('The result is: ', result);
27
28// Structure of output is defined in .actor/actor.json
29await Actor.pushData({
30    firstNumber: input?.firstNumber,
31    secondNumber: input?.secondNumber,
32    sum: result,
33});
34
35await Actor.exit();
Developer
Maintained by Community