@usherlabs/cex-broker 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/cli.js +452 -26
- package/dist/index.js +666 -3082
- package/dist/proto/node.proto +53 -0
- package/dist/server.d.ts +7 -0
- package/package.json +5 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package cex_broker;
|
|
3
|
+
|
|
4
|
+
message ActionRequest {
|
|
5
|
+
Action action = 1; // The CCXT method to call (e.g., "fetchBalance", "createOrder")
|
|
6
|
+
map<string, string> payload = 2; // Parameters to pass to the CCXT method
|
|
7
|
+
string cex = 3; // CEX identifier (e.g., "binance", "bybit")
|
|
8
|
+
string symbol = 4; // Optional: trading pair symbol if needed
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message ActionResponse {
|
|
12
|
+
string result = 2; // JSON string of the result data
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message SubscribeRequest {
|
|
16
|
+
string cex = 1; // CEX identifier (e.g., "binance", "bybit")
|
|
17
|
+
string symbol = 2; // Trading pair symbol (e.g., "BTC/USDT")
|
|
18
|
+
SubscriptionType type = 3; // Type of subscription (orderbook, trades, etc.)
|
|
19
|
+
map<string, string> options = 4; // Additional subscription options
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message SubscribeResponse {
|
|
23
|
+
string data = 1; // JSON string of the streaming data
|
|
24
|
+
int64 timestamp = 2; // Unix timestamp of the data
|
|
25
|
+
string symbol = 3; // Trading pair symbol
|
|
26
|
+
SubscriptionType type = 4; // Type of subscription
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
enum SubscriptionType {
|
|
30
|
+
ORDERBOOK = 0; // Order book updates
|
|
31
|
+
TRADES = 1; // Recent trades
|
|
32
|
+
TICKER = 2; // Ticker information
|
|
33
|
+
OHLCV = 3; // OHLCV candlestick data
|
|
34
|
+
BALANCE = 4; // Balance updates
|
|
35
|
+
ORDERS = 5; // Order updates
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
service cex_service {
|
|
39
|
+
rpc ExecuteAction(ActionRequest) returns (ActionResponse);
|
|
40
|
+
rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Mode enum for price direction
|
|
44
|
+
enum Action {
|
|
45
|
+
NoAction=0;
|
|
46
|
+
Deposit = 1;
|
|
47
|
+
Transfer = 2;
|
|
48
|
+
CreateOrder= 3;
|
|
49
|
+
GetOrderDetails=4;
|
|
50
|
+
CancelOrder=5;
|
|
51
|
+
FetchBalance=6;
|
|
52
|
+
FetchDepositAddresses=7;
|
|
53
|
+
}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PolicyConfig } from "./types";
|
|
2
|
+
import * as grpc from "@grpc/grpc-js";
|
|
3
|
+
import type { Exchange } from "@usherlabs/ccxt";
|
|
4
|
+
export declare function getServer(policy: PolicyConfig, brokers: Record<string, {
|
|
5
|
+
primary: Exchange;
|
|
6
|
+
secondaryBrokers: Exchange[];
|
|
7
|
+
}>, whitelistIps: string[], useVerity: boolean, verityProverUrl: string): grpc.Server;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usherlabs/cex-broker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Unified gRPC API to CEXs by Usher Labs",
|
|
5
5
|
"repository": "git@gitlab.com:usherlabs/cex-broker.git",
|
|
6
6
|
"homepage": "https://usher.so/",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"@types/bun": "latest",
|
|
16
16
|
"bun-plugin-dts": "latest",
|
|
17
17
|
"bun-types": "latest",
|
|
18
|
+
"cpx": "^1.5.0",
|
|
18
19
|
"dotenv": "^17.2.0",
|
|
19
20
|
"husky": "^9.1.7"
|
|
20
21
|
},
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"scripts": {
|
|
28
29
|
"proto-gen": "./proto-gen.sh",
|
|
29
30
|
"start": "bun run ./src/index.ts",
|
|
30
|
-
"build": "bun run ./build.ts",
|
|
31
|
+
"build": "bun run ./build.ts && bun run build:ts && bun run copy:dts && bun run copy:proto",
|
|
31
32
|
"build:ts": "bunx tsc",
|
|
32
33
|
"test": "bun test",
|
|
33
34
|
"format": "bunx biome format --write",
|
|
@@ -35,6 +36,8 @@
|
|
|
35
36
|
"lint:fix": "bunx biome lint --write",
|
|
36
37
|
"check": "bunx biome check",
|
|
37
38
|
"check:fix": "bunx biome check --write",
|
|
39
|
+
"copy:dts": "cpx \"build/src/*.d.ts\" ./dist/",
|
|
40
|
+
"copy:proto": "cpx \"proto/*.proto\" ./dist/proto",
|
|
38
41
|
"prepare": "bunx husky",
|
|
39
42
|
"postinstall": "./proto-gen.sh"
|
|
40
43
|
},
|