mirror of
https://github.com/mauricioabh/arbpulse.git
synced 2026-08-05 11:37:44 +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,26 @@
|
||||
export function usd(n: number, digits = 2): string {
|
||||
return n.toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
||||
}
|
||||
|
||||
export function pct(fraction: number, digits = 3): string {
|
||||
return `${(fraction * 100).toFixed(digits)}%`;
|
||||
}
|
||||
|
||||
export function btc(n: number, digits = 5): string {
|
||||
return n.toFixed(digits);
|
||||
}
|
||||
|
||||
export function ago(ts: number, now: number): string {
|
||||
const s = Math.max(0, Math.round((now - ts) / 1000));
|
||||
if (s < 60) return `${s}s`;
|
||||
const m = Math.floor(s / 60);
|
||||
return `${m}m ${s % 60}s`;
|
||||
}
|
||||
|
||||
export function timeOf(ts: number): string {
|
||||
return new Date(ts).toLocaleTimeString("en-US", { hour12: false });
|
||||
}
|
||||
|
||||
export function clsx(...parts: Array<string | false | null | undefined>): string {
|
||||
return parts.filter(Boolean).join(" ");
|
||||
}
|
||||
Reference in New Issue
Block a user