perp-cli 0.7.6 → 0.7.7
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/risk.js +13 -1
- package/package.json +1 -1
package/dist/commands/risk.js
CHANGED
|
@@ -4,10 +4,21 @@ import { loadRiskLimits, saveRiskLimits, assessRisk, getLiquidationDistances } f
|
|
|
4
4
|
import { pingPacifica, pingHyperliquid, pingLighter } from "../shared-api.js";
|
|
5
5
|
/** Run health check and return results + render. Exported for use by status --health. */
|
|
6
6
|
export async function runHealthCheck(isJson) {
|
|
7
|
-
const
|
|
7
|
+
const pingAster = async () => {
|
|
8
|
+
const start = Date.now();
|
|
9
|
+
try {
|
|
10
|
+
const res = await fetch("https://fapi.asterdex.com/fapi/v1/time");
|
|
11
|
+
return { ok: res.ok, latencyMs: Date.now() - start, status: res.status };
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return { ok: false, latencyMs: Date.now() - start, status: 0 };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const [pacPing, hlPing, ltPing, astPing] = await Promise.all([
|
|
8
18
|
pingPacifica(),
|
|
9
19
|
pingHyperliquid(),
|
|
10
20
|
pingLighter(),
|
|
21
|
+
pingAster(),
|
|
11
22
|
]);
|
|
12
23
|
const toPingResult = (name, p) => ({
|
|
13
24
|
exchange: name,
|
|
@@ -19,6 +30,7 @@ export async function runHealthCheck(isJson) {
|
|
|
19
30
|
toPingResult("pacifica", pacPing),
|
|
20
31
|
toPingResult("hyperliquid", hlPing),
|
|
21
32
|
toPingResult("lighter", ltPing),
|
|
33
|
+
toPingResult("aster", astPing),
|
|
22
34
|
];
|
|
23
35
|
const allOk = checks.every(c => c.status === "ok");
|
|
24
36
|
if (isJson()) {
|