@imbingox/acex 0.1.0-beta.1 → 0.1.0-beta.3
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 +664 -7
- package/package.json +26 -2
- package/src/adapters/binance/market-catalog.ts +16 -9
- package/src/adapters/binance/private-adapter.ts +833 -0
- package/src/adapters/types.ts +145 -1
- package/src/client/context.ts +63 -0
- package/src/client/private-subscription-coordinator.ts +512 -0
- package/src/client/runtime.ts +129 -2
- package/src/errors.ts +7 -1
- package/src/index.ts +1 -0
- package/src/internal/filters.ts +12 -14
- package/src/internal/managed-websocket.ts +24 -2
- package/src/managers/account-manager.ts +346 -52
- package/src/managers/market-manager.ts +21 -10
- package/src/managers/order-manager.ts +427 -46
- package/src/types/account.ts +16 -19
- package/src/types/market.ts +16 -14
- package/src/types/order.ts +47 -12
- package/src/types/shared.ts +15 -0
package/package.json
CHANGED
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imbingox/acex",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
4
|
"description": "Multi-exchange trading SDK for market data, account, and order management",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/imbingox/acex"
|
|
8
|
+
},
|
|
5
9
|
"module": "index.ts",
|
|
6
10
|
"type": "module",
|
|
7
11
|
"exports": {
|
|
8
12
|
".": "./index.ts"
|
|
9
13
|
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
10
17
|
"files": [
|
|
11
18
|
"index.ts",
|
|
12
19
|
"src/"
|
|
13
20
|
],
|
|
14
21
|
"scripts": {
|
|
22
|
+
"changeset": "changeset",
|
|
15
23
|
"lint": "biome check .",
|
|
16
24
|
"lint:fix": "biome check --write .",
|
|
25
|
+
"release": "changeset publish",
|
|
17
26
|
"type-check": "tsc --noEmit",
|
|
18
|
-
"test": "bun test"
|
|
27
|
+
"test": "bun test --max-concurrency=1",
|
|
28
|
+
"test:live:account": "bun run scripts/live-account-smoke.ts",
|
|
29
|
+
"test:live:account:smoke": "bun run scripts/live-account-smoke.ts --duration 10",
|
|
30
|
+
"test:live:account:soak": "bun run scripts/live-account-smoke.ts --duration 60 --disconnect-after 5",
|
|
31
|
+
"test:live:market": "bun run scripts/live-market-smoke.ts",
|
|
32
|
+
"test:live:market:smoke": "bun run scripts/live-market-smoke.ts --duration 10",
|
|
33
|
+
"test:live:market:soak": "bun run scripts/live-market-smoke.ts --duration 60 --disconnect-after 5 --disconnect-target perp",
|
|
34
|
+
"test:live:order": "bun run scripts/live-order-smoke.ts",
|
|
35
|
+
"test:live:order:smoke": "bun run scripts/live-order-smoke.ts --duration 10",
|
|
36
|
+
"test:live:order:soak": "bun run scripts/live-order-smoke.ts --duration 60 --disconnect-after 5",
|
|
37
|
+
"version-packages": "changeset version"
|
|
19
38
|
},
|
|
20
39
|
"devDependencies": {
|
|
21
40
|
"@biomejs/biome": "^2.4.10",
|
|
41
|
+
"@changesets/cli": "^2.31.0",
|
|
22
42
|
"@types/bun": "latest",
|
|
23
43
|
"typescript": "^6.0.2"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@mindfoldhq/trellis": "^0.4.0",
|
|
47
|
+
"bignumber.js": "^11.0.0"
|
|
24
48
|
}
|
|
25
49
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
1
2
|
import type { MarketDefinition, MarketType } from "../../types/index.ts";
|
|
2
3
|
|
|
3
4
|
type FetchLike = typeof fetch;
|
|
@@ -131,6 +132,7 @@ function normalizeSpotSymbol(
|
|
|
131
132
|
getFilter(symbol.filters, "MIN_NOTIONAL");
|
|
132
133
|
const priceStep = normalizeStep(priceFilter?.tickSize);
|
|
133
134
|
const amountStep = normalizeStep(lotSizeFilter?.stepSize);
|
|
135
|
+
const notionalValue = notionalFilter?.minNotional ?? notionalFilter?.notional;
|
|
134
136
|
|
|
135
137
|
return {
|
|
136
138
|
exchange: "binance",
|
|
@@ -144,10 +146,12 @@ function normalizeSpotSymbol(
|
|
|
144
146
|
contract: false,
|
|
145
147
|
pricePrecision: precisionFromStep(priceStep),
|
|
146
148
|
amountPrecision: precisionFromStep(amountStep),
|
|
147
|
-
priceStep,
|
|
148
|
-
amountStep,
|
|
149
|
-
minAmount: lotSizeFilter?.minQty
|
|
150
|
-
|
|
149
|
+
priceStep: new BigNumber(priceStep),
|
|
150
|
+
amountStep: new BigNumber(amountStep),
|
|
151
|
+
minAmount: lotSizeFilter?.minQty
|
|
152
|
+
? new BigNumber(lotSizeFilter.minQty)
|
|
153
|
+
: undefined,
|
|
154
|
+
minNotional: notionalValue ? new BigNumber(notionalValue) : undefined,
|
|
151
155
|
raw: toRecord(symbol),
|
|
152
156
|
};
|
|
153
157
|
}
|
|
@@ -173,6 +177,7 @@ function normalizeDerivativesSymbol(
|
|
|
173
177
|
: family === "usdm"
|
|
174
178
|
? "1"
|
|
175
179
|
: undefined;
|
|
180
|
+
const notionalValue = notionalFilter?.minNotional ?? notionalFilter?.notional;
|
|
176
181
|
|
|
177
182
|
return {
|
|
178
183
|
exchange: "binance",
|
|
@@ -193,13 +198,15 @@ function normalizeDerivativesSymbol(
|
|
|
193
198
|
contract: true,
|
|
194
199
|
linear: family === "usdm",
|
|
195
200
|
inverse: family === "coinm",
|
|
196
|
-
contractSize,
|
|
201
|
+
contractSize: contractSize ? new BigNumber(contractSize) : undefined,
|
|
197
202
|
pricePrecision: precisionFromStep(priceStep),
|
|
198
203
|
amountPrecision: precisionFromStep(amountStep),
|
|
199
|
-
priceStep,
|
|
200
|
-
amountStep,
|
|
201
|
-
minAmount: lotSizeFilter?.minQty
|
|
202
|
-
|
|
204
|
+
priceStep: new BigNumber(priceStep),
|
|
205
|
+
amountStep: new BigNumber(amountStep),
|
|
206
|
+
minAmount: lotSizeFilter?.minQty
|
|
207
|
+
? new BigNumber(lotSizeFilter.minQty)
|
|
208
|
+
: undefined,
|
|
209
|
+
minNotional: notionalValue ? new BigNumber(notionalValue) : undefined,
|
|
203
210
|
expiry: type === "future" ? symbol.deliveryDate : undefined,
|
|
204
211
|
raw: toRecord(symbol),
|
|
205
212
|
};
|