@imbingox/acex 0.3.0-beta.0 → 0.3.0-beta.2
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/README.md +73 -23
- package/package.json +9 -3
- package/src/adapters/binance/adapter.ts +1 -1
- package/src/adapters/binance/market-catalog.ts +2 -2
- package/src/adapters/binance/private-adapter.ts +14 -4
- package/src/adapters/juplend/private-adapter.ts +483 -0
- package/src/adapters/types.ts +27 -4
- package/src/client/context.ts +16 -11
- package/src/client/private-subscription-coordinator.ts +101 -47
- package/src/client/runtime.ts +43 -20
- package/src/errors.ts +1 -1
- package/src/internal/filters.ts +9 -9
- package/src/managers/account-manager.ts +95 -58
- package/src/managers/market-manager.ts +129 -44
- package/src/managers/order-manager.ts +49 -56
- package/src/types/account.ts +30 -10
- package/src/types/client.ts +2 -2
- package/src/types/market.ts +40 -16
- package/src/types/order.ts +8 -7
- package/src/types/shared.ts +43 -7
package/src/types/shared.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const SUPPORTED_VENUES = [
|
|
2
|
+
"binance",
|
|
3
|
+
"okx",
|
|
4
|
+
"bybit",
|
|
5
|
+
"gate",
|
|
6
|
+
"juplend",
|
|
7
|
+
] as const;
|
|
2
8
|
|
|
3
|
-
export type
|
|
9
|
+
export type Venue = (typeof SUPPORTED_VENUES)[number];
|
|
4
10
|
|
|
5
11
|
export type ClientStatus =
|
|
6
12
|
| "idle"
|
|
@@ -30,6 +36,9 @@ export interface AccountRuntimeOptions {
|
|
|
30
36
|
streamReconnectDelayMs?: number;
|
|
31
37
|
streamReconnectMaxDelayMs?: number;
|
|
32
38
|
listenKeyKeepAliveMs?: number;
|
|
39
|
+
juplend?: {
|
|
40
|
+
pollIntervalMs?: number;
|
|
41
|
+
};
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
export interface CreateClientOptions {
|
|
@@ -47,16 +56,41 @@ export interface AccountCredentials {
|
|
|
47
56
|
extra?: Record<string, string>;
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
export interface
|
|
59
|
+
export interface BinanceAccountOptions {
|
|
60
|
+
timestamp?: number;
|
|
61
|
+
recvWindow?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface JuplendAccountCredentials {
|
|
65
|
+
apiKey: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface JuplendAccountOptions {
|
|
69
|
+
walletAddress: string;
|
|
70
|
+
positionId?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface RegisterCexAccountInput {
|
|
51
74
|
accountId: string;
|
|
52
|
-
|
|
75
|
+
venue: Exclude<Venue, "juplend">;
|
|
53
76
|
credentials?: AccountCredentials;
|
|
54
|
-
options?:
|
|
77
|
+
options?: BinanceAccountOptions;
|
|
55
78
|
}
|
|
56
79
|
|
|
80
|
+
export interface RegisterJuplendAccountInput {
|
|
81
|
+
accountId: string;
|
|
82
|
+
venue: "juplend";
|
|
83
|
+
credentials: JuplendAccountCredentials;
|
|
84
|
+
options: JuplendAccountOptions;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type RegisterAccountInput =
|
|
88
|
+
| RegisterCexAccountInput
|
|
89
|
+
| RegisterJuplendAccountInput;
|
|
90
|
+
|
|
57
91
|
export interface RegisterAccountResult {
|
|
58
92
|
accountId: string;
|
|
59
|
-
|
|
93
|
+
venue: Venue;
|
|
60
94
|
}
|
|
61
95
|
|
|
62
96
|
export interface StopOptions {
|
|
@@ -66,7 +100,7 @@ export interface StopOptions {
|
|
|
66
100
|
|
|
67
101
|
export interface AcexInternalError {
|
|
68
102
|
source: "client" | "market" | "account" | "order" | "adapter" | "runtime";
|
|
69
|
-
|
|
103
|
+
venue?: Venue;
|
|
70
104
|
accountId?: string;
|
|
71
105
|
symbol?: string;
|
|
72
106
|
error: Error;
|
|
@@ -88,6 +122,8 @@ export type PrivateRuntimeStatus =
|
|
|
88
122
|
export type PrivateRuntimeReason =
|
|
89
123
|
| "credentials_missing"
|
|
90
124
|
| "auth_failed"
|
|
125
|
+
| "http_failed"
|
|
126
|
+
| "rate_limited"
|
|
91
127
|
| "ws_disconnected"
|
|
92
128
|
| "heartbeat_timeout"
|
|
93
129
|
| "reconciling";
|