1Branch0Tags
typescript
import { store } from "opentool/store";
import type { ToolProfile } from "opentool";
import {
readConfig,
resolveProfileAssets,
resolveScheduleConfig,
SIGNAL_BOT_TEMPLATE_CONFIG,
runSignalBot,
} from "../src/dca-agent";
const config = readConfig();
export const profile: ToolProfile = {
description: "Hyperliquid DCA agent.",
category: "strategy",
templatePreview: {
subtitle: "Automated fixed-amount DCA into selected Hyperliquid assets.",
description: `Runs on a recurring schedule and buys with a fixed USD amount per cycle.
Supports multiple configured assets with shared budget and allocation controls.
Uses standardized order sizing and execution utilities from OpenTool.
Tracks decision outcomes and execution status through structured strategy events.
Built for steady accumulation without needing manual order placement.`,
},
schedule: resolveScheduleConfig(config),
assets: resolveProfileAssets(config),
templateConfig: SIGNAL_BOT_TEMPLATE_CONFIG,
};
export async function GET(_req: Request) {
const snapshot = readConfig();
try {
const result = await runSignalBot(snapshot);
await store({
source: "dca-agent",
ref: `dca-agent-${Date.now()}`,
status: result.ok ? "info" : "failed",
action: "dca",
metadata: result,
});
return Response.json(result);
} catch (error) {
const message = error instanceof Error ? error.message : "unknown";
await store({
source: "dca-agent",
ref: `dca-agent-${Date.now()}`,
status: "failed",
action: "dca",
metadata: { ok: false, error: message },
});
return new Response(JSON.stringify({ ok: false, error: message }), {
status: 400,
headers: { "content-type": "application/json" },
});
}
}