openpondai/agents/polymarket-market-watcher

OpenTool app

1Branch0Tags
OP
OpenPond Syncsync: merge local template master into production
typescript
import { describe, expect, test } from "bun:test"; import type { PolymarketMarketWatcherConfig } from "./config"; import { resolvePolymarketWatcherDecision } from "./signal-bot"; const BASE_CONFIG: PolymarketMarketWatcherConfig = { configVersion: 2, platform: "hyperliquid", marketSlug: "us-x-iran-ceasefire-by-march-31", watchedOutcome: "no", minProbability: 0.8, minLiquidity: 100_000, action: "buy", onNoMatch: "hold", asset: "BTC", allocationMode: "fixed", amountUsd: 200, percentOfEquity: 2, maxPercentOfEquity: 10, resolution: "60", countBack: 240, historyFidelitySeconds: 3600, schedule: { cron: "0 * * * *", enabled: false, notifyEmail: false, }, execution: { enabled: false, environment: "mainnet", mode: "long-only", slippageBps: 50, }, }; describe("resolvePolymarketWatcherDecision", () => { test("returns action when threshold passes", () => { const decision = resolvePolymarketWatcherDecision({ config: BASE_CONFIG, market: { title: "US x Iran ceasefire by March 31?", watchedOutcome: "no", probability: 0.865, liquidity: 631_570.63, volume: 23_924_603.69, }, }); expect(decision.signal).toBe("buy"); expect(decision.reason).toContain("0.8650"); }); test("returns hold when threshold misses", () => { const decision = resolvePolymarketWatcherDecision({ config: { ...BASE_CONFIG, minProbability: 0.95, }, market: { title: "US x Iran ceasefire by March 31?", watchedOutcome: "no", probability: 0.865, liquidity: 631_570.63, volume: 23_924_603.69, }, }); expect(decision.signal).toBe("hold"); expect(decision.reason).toContain("below 0.9500"); }); });