1Branch0Tags
GL
glucryptouse HIP-4 series key identity
e149f868 days ago3Commits
typescript
import { store } from "opentool/store"; import type { ToolProfile } from "opentool"; import { HyperliquidApiError } from "opentool/adapters/hyperliquid"; import { z } from "zod"; import { HIP4_EDGE_BOT_TEMPLATE_CONFIG, readConfig, resolveProfileAssets, resolveScheduleConfig, } from "../src/config"; import { runHip4EdgeBot } from "../src/hip4-edge-bot"; const config = readConfig(); export const schema = z.object({}).partial(); export const profile: ToolProfile = { description: "Hyperliquid HIP-4 BTC fair value edge bot.", category: "strategy", templatePreview: { subtitle: "Trades underpriced HIP-4 YES or NO outcome legs from the BTC edge feed.", description: `Reads the OpenPond HIP-4 edge endpoint on a schedule. Filters underpriced YES and NO outcome asks by fair value edge, ROI, ask price, and liquidity. Can run as a monitor with execution disabled or submit live Hyperliquid outcome buys through the customer lambda operating wallet.`, }, schedule: resolveScheduleConfig(config), assets: resolveProfileAssets(config), templateConfig: HIP4_EDGE_BOT_TEMPLATE_CONFIG, }; function buildFailureMetadata(error: unknown) { const message = error instanceof Error ? error.message : "unknown"; return { ok: false, error: message, errorType: error instanceof Error ? error.name : typeof error, ...(error instanceof HyperliquidApiError ? { errorResponse: error.response } : {}), }; } export async function POST() { const snapshot = readConfig(); try { return Response.json(await runHip4EdgeBot(snapshot)); } catch (error) { const metadata = buildFailureMetadata(error); await store({ source: "hip4-edge-bot", ref: `hip4-edge-bot-${Date.now()}`, status: "failed", action: "signal", metadata, }); return new Response(JSON.stringify(metadata), { status: 400, headers: { "content-type": "application/json" }, }); } }