mirror of
https://github.com/mauricioabh/arbpulse.git
synced 2026-08-08 13:07:43 +00:00
Initial commit: Arb Pulse monolith with CI and optional Fly deploy.
Real-time BTC cross-exchange arbitrage detection (Kraken, Bybit, OKX, Binance) with React dashboard, GitHub Actions CI, and documented Fly.io deploy workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { PublicConfig, ExchangeId } from "./types";
|
||||
|
||||
export interface ConfigPatch {
|
||||
minNetProfitPct?: number;
|
||||
maxTradeBtc?: number;
|
||||
flickerConfirmMs?: number;
|
||||
activeExchanges?: Partial<Record<ExchangeId, boolean>>;
|
||||
}
|
||||
|
||||
async function parseJson<T>(res: Response): Promise<T> {
|
||||
const body = (await res.json()) as { success: boolean; data?: T; error?: string };
|
||||
if (!body.success) throw new Error(body.error ?? "request failed");
|
||||
return body.data as T;
|
||||
}
|
||||
|
||||
export async function getConfig(): Promise<PublicConfig> {
|
||||
const res = await fetch("/api/config");
|
||||
return parseJson<PublicConfig>(res);
|
||||
}
|
||||
|
||||
export async function patchConfig(patch: ConfigPatch): Promise<PublicConfig> {
|
||||
const res = await fetch("/api/config", {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(patch),
|
||||
});
|
||||
return parseJson<PublicConfig>(res);
|
||||
}
|
||||
Reference in New Issue
Block a user