@usherlabs/cex-broker 0.1.4 → 0.1.6

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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usherlabs/cex-broker",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
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/",
@@ -28,7 +28,7 @@
28
28
  "scripts": {
29
29
  "proto-gen": "./proto-gen.sh",
30
30
  "start": "bun run ./src/index.ts",
31
- "build": "bun run ./build.ts && bun run build:ts && bun run copy:dts",
31
+ "build": "bun run ./build.ts && bun run build:ts && bun run copy:dts && bun run copy:proto",
32
32
  "build:ts": "bunx tsc",
33
33
  "test": "bun test",
34
34
  "format": "bunx biome format --write",
@@ -36,7 +36,8 @@
36
36
  "lint:fix": "bunx biome lint --write",
37
37
  "check": "bunx biome check",
38
38
  "check:fix": "bunx biome check --write",
39
- "copy:dts": "cpx \"build/src/*.d.ts\" ./dist/",
39
+ "copy:dts": "cpx \"build/*.d.ts\" ./dist/",
40
+ "copy:proto": "cpx \"src/proto/*.proto\" ./dist/proto",
40
41
  "prepare": "bunx husky",
41
42
  "postinstall": "./proto-gen.sh"
42
43
  },