<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Headless Oracle</title>
    <description>The latest articles on Forem by Headless Oracle (@lembagang).</description>
    <link>https://forem.com/lembagang</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3817102%2F8eb37f92-1f64-40ed-9680-4fb8ac219a5a.png</url>
      <title>Forem: Headless Oracle</title>
      <link>https://forem.com/lembagang</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/lembagang"/>
    <language>en</language>
    <item>
      <title>I Built an MCP Server That Signs Market Data for 28 Exchanges</title>
      <dc:creator>Headless Oracle</dc:creator>
      <pubDate>Wed, 08 Apr 2026 14:56:01 +0000</pubDate>
      <link>https://forem.com/lembagang/i-built-an-mcp-server-that-signs-market-data-for-28-exchanges-i8a</link>
      <guid>https://forem.com/lembagang/i-built-an-mcp-server-that-signs-market-data-for-28-exchanges-i8a</guid>
      <description>&lt;p&gt;41 days ago I started building something I wasn't sure anyone needed. A cryptographically signed oracle for market hours. For AI agents. Not a dashboard. Not a webhook. An Ed25519-signed receipt that says "yes, this exchange is open right now" with a 60-second TTL and a fail-closed guarantee. Here's what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem No One Talks About
&lt;/h2&gt;

&lt;p&gt;AI agents are trading stocks, managing portfolios, and executing DeFi strategies. Most of them check market hours the same way: &lt;code&gt;datetime.now()&lt;/code&gt; plus some hardcoded UTC offsets.&lt;/p&gt;

&lt;p&gt;This breaks in ways that cost real money:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DST transitions:&lt;/strong&gt; The US springs forward in March. Europe springs forward two weeks later. For those two weeks, the offset between NYSE and London is wrong. An agent using &lt;code&gt;America/New_York = UTC-5&lt;/code&gt; submits orders to a market that closed an hour ago.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exchange holidays:&lt;/strong&gt; Martin Luther King Day, Golden Week, Diwali. Your timezone library doesn't know about these. Your agent submits orders to a closed exchange and gets rejected fills — or worse, queued orders that execute at unpredictable prices at the next open.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Circuit breakers:&lt;/strong&gt; NYSE Level 1 halt. Your agent has no idea. It keeps submitting orders into a halted market.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lunch breaks:&lt;/strong&gt; Tokyo and Shanghai close for lunch. Hong Kong too. Your "market is open from 9 to 3" check is wrong for half the trading day.&lt;/p&gt;

&lt;p&gt;The root cause is the same every time: agents use boolean &lt;code&gt;is_open()&lt;/code&gt; checks that don't account for the full complexity of real market schedules.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;Headless Oracle returns cryptographically signed receipts for 28 global exchanges. Each receipt includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ed25519 signature&lt;/strong&gt; — verifiable without trusting the server&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;60-second TTL&lt;/strong&gt; — &lt;code&gt;expires_at&lt;/code&gt; forces re-fetch, prevents stale OPEN acting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fail-closed guarantee&lt;/strong&gt; — UNKNOWN always means CLOSED, halt all execution&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Receipt mode&lt;/strong&gt; — &lt;code&gt;demo&lt;/code&gt; vs &lt;code&gt;live&lt;/code&gt; so agents know what they're working with&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's available as an &lt;strong&gt;MCP server&lt;/strong&gt; that works with Claude Desktop, Cursor, and Windsurf:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"headless-oracle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"headless-oracle-mcp"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or as a &lt;strong&gt;REST API&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;curl https://headlessoracle.com/v5/demo?mic&lt;span class="o"&gt;=&lt;/span&gt;XNYS
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"receipt"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"mic"&lt;/span&gt;: &lt;span class="s2"&gt;"XNYS"&lt;/span&gt;,
    &lt;span class="s2"&gt;"status"&lt;/span&gt;: &lt;span class="s2"&gt;"OPEN"&lt;/span&gt;,
    &lt;span class="s2"&gt;"issued_at"&lt;/span&gt;: &lt;span class="s2"&gt;"2026-04-07T15:30:00.000Z"&lt;/span&gt;,
    &lt;span class="s2"&gt;"expires_at"&lt;/span&gt;: &lt;span class="s2"&gt;"2026-04-07T15:31:00.000Z"&lt;/span&gt;,
    &lt;span class="s2"&gt;"issuer"&lt;/span&gt;: &lt;span class="s2"&gt;"headlessoracle.com"&lt;/span&gt;,
    &lt;span class="s2"&gt;"source"&lt;/span&gt;: &lt;span class="s2"&gt;"SCHEDULE"&lt;/span&gt;,
    &lt;span class="s2"&gt;"schema_version"&lt;/span&gt;: &lt;span class="s2"&gt;"v5.0"&lt;/span&gt;,
    &lt;span class="s2"&gt;"receipt_mode"&lt;/span&gt;: &lt;span class="s2"&gt;"demo"&lt;/span&gt;,
    &lt;span class="s2"&gt;"signature"&lt;/span&gt;: &lt;span class="s2"&gt;"a3f8c1d2..."&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent
  │
  ├─ MCP ──→ Headless Oracle Worker (Cloudflare)
  │              │
  │              ├─ Schedule Engine (28 exchanges, IANA timezones)
  │              ├─ KV Override Check (circuit breakers)
  │              ├─ Ed25519 Sign (canonical payload, alphabetical sort)
  │              └─ Return signed receipt
  │
  └─ Agent verifies signature + TTL + status
       │
       └─ OPEN? → proceed
          NOT OPEN? → halt execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The worker runs on Cloudflare's edge network — 42+ data centers globally. Schedule computation uses &lt;code&gt;Intl.DateTimeFormat&lt;/code&gt; with IANA timezone names. No hardcoded UTC offsets anywhere. DST transitions are handled automatically by the runtime.&lt;/p&gt;

&lt;p&gt;Signing uses &lt;code&gt;@noble/ed25519&lt;/code&gt; — a pure JavaScript implementation with no native dependencies. The canonical payload is built by sorting keys alphabetically and JSON-stringifying with no whitespace. Any consumer in any language can independently verify.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;x402 micropayments&lt;/strong&gt; are live on Base mainnet. Agents can pay $0.001 USDC per call with no API key, no signup, no human in the loop. The agent sends a USDC transaction, includes the proof in the &lt;code&gt;X-Payment&lt;/code&gt; header, and gets a signed receipt back. Self-sovereign agent commerce.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;714 tests&lt;/strong&gt; passing (Vitest + Cloudflare Workers runtime)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;28 exchanges&lt;/strong&gt; across Americas, Europe, Middle East, Africa, Asia, Pacific&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;4 MCP tools:&lt;/strong&gt; &lt;code&gt;get_market_status&lt;/code&gt;, &lt;code&gt;get_market_schedule&lt;/code&gt;, &lt;code&gt;list_exchanges&lt;/code&gt;, &lt;code&gt;verify_receipt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;42+ Cloudflare edge locations&lt;/strong&gt; serving requests&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;6 AI platforms&lt;/strong&gt; already crawling our &lt;code&gt;llms.txt&lt;/code&gt; (ClaudeBot, GPTBot, Applebot, Bytespider, PerplexityBot, AhrefsBot)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$0.001/call&lt;/strong&gt; via x402 on Base mainnet — first autonomous agent payment processed on Day 41&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1,319 schedule edge cases&lt;/strong&gt; per year computed from the exchange configs (holidays, DST, lunch breaks, weekends)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Surprised Me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;x402 changed everything.&lt;/strong&gt; The x402 protocol lets agents pay for API calls with USDC on Base — no API key, no signup form, no OAuth dance. An agent that hits a 402 response can read the payment details, sign a USDC transfer, and retry with the proof. Zero human interaction.&lt;/p&gt;

&lt;p&gt;This isn't theoretical. We have a live 402 response with full x402 payment details. The first real payment was processed on Day 41. An agent paid for its own oracle call.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The compliance angle was unexpected.&lt;/strong&gt; ESMA (Europe), NIST (US), and Singapore's MAS are all publishing requirements that map directly to what we built — pre-trade transparency, reliable AI systems, fail-closed risk management. The Ed25519 signatures and 60-second TTL aren't just engineering choices. They're regulatory compliance features.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Free trial:&lt;/strong&gt; 3 signed receipts per day on &lt;code&gt;/v5/status&lt;/code&gt; — no API key needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo endpoint:&lt;/strong&gt; Always free, unlimited:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://headlessoracle.com/v5/demo?mic&lt;span class="o"&gt;=&lt;/span&gt;XNYS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;MCP server:&lt;/strong&gt; Install in 30 seconds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx headless-oracle-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Python SDK:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;headless-oracle
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JavaScript verification:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @headlessoracle/verify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;More exchanges:&lt;/strong&gt; 28 → 50 → 100. Architecture scales — each exchange is a config object.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-party attestation (MPAS):&lt;/strong&gt; Two or more independent operators verify before an agent acts. Ed25519 was chosen to compose cleanly into threshold signing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Framework integrations:&lt;/strong&gt; PRs submitted to TradingAgents and ai-hedge-fund. More coming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LangChain + CrewAI:&lt;/strong&gt; First-party PyPI packages already live (&lt;code&gt;headless-oracle-langchain&lt;/code&gt;, &lt;code&gt;headless-oracle-crewai&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Star us on GitHub if this is useful: &lt;a href="https://github.com/LembaGang/headless-oracle-v5" rel="noopener noreferrer"&gt;github.com/LembaGang/headless-oracle-v5&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What pre-trade checks do your agents run? I'd love to hear in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>fintech</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Market Hours APIs Are Not Enough for Autonomous Agents</title>
      <dc:creator>Headless Oracle</dc:creator>
      <pubDate>Sun, 05 Apr 2026 13:59:42 +0000</pubDate>
      <link>https://forem.com/lembagang/market-hours-apis-are-not-enough-for-autonomous-agents-bfl</link>
      <guid>https://forem.com/lembagang/market-hours-apis-are-not-enough-for-autonomous-agents-bfl</guid>
      <description>&lt;p&gt;Every developer building a trading agent checks market hours. Almost none check them correctly.&lt;/p&gt;

&lt;p&gt;The standard approach: call an API, parse the response, check if a flag says &lt;code&gt;is_open: true&lt;/code&gt;. Then proceed.&lt;/p&gt;

&lt;p&gt;This works when a human is in the loop. It fails silently when an autonomous agent is running at 3am.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the standard approach misses
&lt;/h2&gt;

&lt;p&gt;A market data API tells you what the market data provider believes is true. It doesn't prove it.&lt;/p&gt;

&lt;p&gt;Four things can go wrong:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Stale data.&lt;/strong&gt; A cached response from 45 minutes ago says the market is open. The market closed 40 minutes ago. The cache TTL was set to 1 hour. Your agent executes into a closed book.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. No authentication on the market state.&lt;/strong&gt; Anyone — including a compromised service or a man-in-the-middle — can return &lt;code&gt;is_open: true&lt;/code&gt;. The response has no signature. Your agent cannot tell the difference between a live authoritative response and a forged or stale one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Ambiguous failure modes.&lt;/strong&gt; The API call fails with a 503. What does your agent do? Most implementations default open ("I couldn't check, so I'll proceed"). That's the wrong default. The safe assumption when you can't verify state is: don't proceed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. DST transitions.&lt;/strong&gt; Your API uses UTC offsets. The exchange observes daylight saving time. On March 8, the US springs forward. For 21 days, the US/UK DST offset compresses from 5 hours to 4 hours. If your API uses hardcoded UTC offsets, it's wrong for three weeks every spring and fall.&lt;/p&gt;




&lt;h2&gt;
  
  
  What autonomous agents actually need
&lt;/h2&gt;

&lt;p&gt;An agent that executes trades without human oversight needs three things a standard market hours API cannot provide:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cryptographic proof.&lt;/strong&gt; The response must be signed so the agent can verify it wasn't forged, intercepted, or replayed from a previous session. Ed25519 is the right primitive here — compact signatures, deterministic, composable into multi-party schemes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A TTL.&lt;/strong&gt; The agent needs to know when the attestation expires. A receipt that says "NYSE is OPEN" is only meaningful for the next 60 seconds. After that, the agent must re-fetch. A receipt without an expiry is a receipt that can be used indefinitely — including after the market has moved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fail-closed semantics.&lt;/strong&gt; If the agent can't reach the oracle, or if the oracle returns an ambiguous state, the safe default is CLOSED. Not open. Not "retry." Halt execution until the state can be verified.&lt;/p&gt;

&lt;p&gt;A boolean &lt;code&gt;is_open&lt;/code&gt; flag satisfies none of these requirements.&lt;/p&gt;




&lt;h2&gt;
  
  
  The signed attestation model
&lt;/h2&gt;

&lt;p&gt;A signed market receipt looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mic"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"XNYS"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"OPEN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"issued_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-04-04T14:30:00.000Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"expires_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-04-04T14:31:00.000Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"issuer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"headlessoracle.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"schema_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"v5.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SCHEDULE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"receipt_mode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"live"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"signature"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"a7f3b2...c9d4"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent does four things with this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verify the Ed25519 signature against the oracle's public key&lt;/li&gt;
&lt;li&gt;Check that &lt;code&gt;expires_at&lt;/code&gt; is in the future&lt;/li&gt;
&lt;li&gt;Check that &lt;code&gt;status === "OPEN"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If any step fails — halt&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The practical difference
&lt;/h2&gt;

&lt;p&gt;Here's the naive version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_market_open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://some-api.com/market-hours/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;symbol&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;is_open&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this returns &lt;code&gt;True&lt;/code&gt;, your agent proceeds. If the API is down, it returns &lt;code&gt;False&lt;/code&gt; and your agent doesn't proceed — which is actually safe. But if the API returns stale data, if the response is cached at an intermediate layer, or if the TTL logic is wrong, you're trading blind.&lt;/p&gt;

&lt;p&gt;Here's the safe version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;headless_oracle&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OracleClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verify&lt;/span&gt;

&lt;span class="n"&gt;oracle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OracleClient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;safe_to_trade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;receipt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;oracle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mic&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Step 1: Verify cryptographic signature
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;  &lt;span class="c1"&gt;# Signature invalid — fail closed
&lt;/span&gt;
    &lt;span class="c1"&gt;# Step 2: Check TTL
&lt;/span&gt;    &lt;span class="c1"&gt;# (verify() already checks expires_at — if expired, returns False)
&lt;/span&gt;
    &lt;span class="c1"&gt;# Step 3: Check status
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;status&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OPEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="c1"&gt;# UNKNOWN and HALTED both return False — fail closed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference is 4 lines. The second version is provably correct. The first version is probably correct, most of the time.&lt;/p&gt;

&lt;p&gt;"Probably correct, most of the time" is fine when a human can catch the exception at 3am. It's not fine when no human is watching.&lt;/p&gt;




&lt;h2&gt;
  
  
  When this matters more than you think
&lt;/h2&gt;

&lt;p&gt;The cost of getting market state wrong isn't just a bad fill. It's:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Executing a trade that can't settle (T+1/T+2 windows)&lt;/li&gt;
&lt;li&gt;Triggering a circuit breaker with an order at a halted price&lt;/li&gt;
&lt;li&gt;Trading into a pre-market session with 1/100th the liquidity&lt;/li&gt;
&lt;li&gt;Executing through a DST transition window where the market is technically open but the clearing systems are running on reduced staffing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren't theoretical. They're the exact scenarios that the signed receipt model was designed to handle.&lt;/p&gt;




&lt;h2&gt;
  
  
  The three-line integration
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;headless_oracle&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OracleClient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verify&lt;/span&gt;

&lt;span class="n"&gt;oracle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OracleClient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Auto-provisions a free sandbox key
&lt;/span&gt;&lt;span class="n"&gt;receipt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;oracle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;XNYS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;receipt&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;status&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OPEN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Market not verified open — trade blocked&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Free sandbox key at &lt;a href="https://headlessoracle.com/v5/sandbox" rel="noopener noreferrer"&gt;headlessoracle.com/v5/sandbox&lt;/a&gt;. No signup required.&lt;/p&gt;




&lt;p&gt;The oracle covers 28 exchanges across 6 regions. Ed25519 signatures. 60-second TTL. MCP server for Claude Desktop, Cursor, and any MCP-compatible agent.&lt;/p&gt;

&lt;p&gt;Full documentation: &lt;a href="https://headlessoracle.com/docs" rel="noopener noreferrer"&gt;headlessoracle.com/docs&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I'm building Headless Oracle — &lt;a href="https://headlessoracle.com" rel="noopener noreferrer"&gt;headlessoracle.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>fintech</category>
    </item>
    <item>
      <title>Why Your Trading Agent Needs a Pre-Trade Gate</title>
      <dc:creator>Headless Oracle</dc:creator>
      <pubDate>Sun, 05 Apr 2026 13:49:11 +0000</pubDate>
      <link>https://forem.com/lembagang/why-your-trading-agent-needs-a-pre-trade-gate-590k</link>
      <guid>https://forem.com/lembagang/why-your-trading-agent-needs-a-pre-trade-gate-590k</guid>
      <description>&lt;p&gt;Your agent traded $50,000 into a halted market at 3am. Nobody was watching.&lt;br&gt;
This isn't a hypothetical. It's the failure mode that autonomous trading agents are quietly running toward — and almost nobody has a circuit breaker in place.&lt;/p&gt;

&lt;p&gt;The Blind Spot in Autonomous Execution&lt;br&gt;
Agents that execute trades check a lot of things. Price feeds. Order book depth. Portfolio constraints. Risk limits. Slippage estimates.&lt;br&gt;
What they almost never check: is the exchange actually open right now?&lt;br&gt;
Price feeds don't tell you the exchange is closed. They serve you the last known price — which may be hours old — and they do it silently. A market data feed returning a stale quote and a market data feed returning a live quote look identical to an agent reading the response.&lt;br&gt;
An agent that sees a valid price and a filled order book and a cleared risk check will execute. It has no reason not to.&lt;br&gt;
Unless someone told it to check market state first.&lt;/p&gt;

&lt;p&gt;The DST Bug Nobody Saw Coming&lt;br&gt;
March 8, 2026. US clocks spring forward. European clocks don't change for another three weeks.&lt;br&gt;
For exactly one hour, agents using hardcoded UTC-offset schedules believed European markets were open. Their local-time arithmetic said "09:30 Paris time" but their UTC math was wrong by an hour. The clocks disagreed.&lt;br&gt;
Trades executed into closed markets. The positions sat there, unhedged, until European markets actually opened — 60 minutes and several volatility points later.&lt;br&gt;
No error was thrown. No alert fired. The trades looked syntactically correct.&lt;br&gt;
This is the class of bug that kills accounts: not a crash, not a panic, but a silent wrong answer that looks like a right answer.&lt;/p&gt;

&lt;p&gt;What a Pre-Trade Gate Actually Does&lt;br&gt;
A pre-trade gate is a check you run before any trade, payment, or capital commitment. It asks one question: is this exchange open right now, with cryptographic proof?&lt;br&gt;
The answer comes back as a signed receipt:&lt;br&gt;
json{&lt;br&gt;
  "mic": "XNYS",&lt;br&gt;
  "status": "OPEN",&lt;br&gt;
  "issued_at": "2026-04-03T14:32:10.000Z",&lt;br&gt;
  "expires_at": "2026-04-03T14:33:10.000Z",&lt;br&gt;
  "receipt_mode": "live",&lt;br&gt;
  "signature": "a3f9..."&lt;br&gt;
}&lt;br&gt;
The signature is Ed25519. The TTL is 60 seconds. If either check fails, you don't trade.&lt;/p&gt;

&lt;p&gt;The Fail-Closed Contract&lt;br&gt;
This is the design decision that separates a verification gate from a rubber stamp:&lt;br&gt;
StatusActionOPENProceedCLOSEDHaltHALTEDHalt (circuit breaker active)UNKNOWNHalt (treat as CLOSED)&lt;br&gt;
UNKNOWN is the critical case. It's what you get when the oracle can't determine the answer — network partition, data gap, signing infrastructure problem. An oracle that returns UNKNOWN is telling you it cannot confirm the safe state.&lt;br&gt;
The fail-closed contract says: if you can't verify, don't trade. An agent that proceeds on UNKNOWN is choosing to skip the gate, not to pass it.&lt;/p&gt;

&lt;p&gt;The Gate in 5 Lines of Python&lt;br&gt;
pythonfrom headless_oracle import OracleClient, verify&lt;/p&gt;

&lt;p&gt;client = OracleClient()&lt;/p&gt;

&lt;p&gt;def safe_to_execute(mic: str = 'XNYS') -&amp;gt; bool:&lt;br&gt;
    receipt = client.get_status(mic)&lt;br&gt;
    return verify(receipt) and receipt['status'] == 'OPEN'&lt;br&gt;
Call safe_to_execute() before any trade. If it returns False — for any reason — halt.&lt;br&gt;
That's it. Five lines between your agent and a $50K mistake at 3am.&lt;/p&gt;

&lt;p&gt;Why Cryptographic Signing Matters&lt;br&gt;
A signed receipt isn't just a JSON response. It's a tamper-proof attestation you can pass between agents.&lt;br&gt;
If your execution agent receives a market state receipt from a data collection agent, it doesn't have to trust the data pipeline. It verifies the Ed25519 signature against the oracle's public key. If the signature is invalid — whether from tampering, replay, or corruption — the receipt is rejected.&lt;br&gt;
This is how you build multi-agent financial workflows without a single trusted intermediary.&lt;/p&gt;

&lt;p&gt;The Question Isn't Whether Your Agent Will Encounter a Closed Market&lt;br&gt;
Markets close. Exchanges halt. Holidays happen. DST transitions land on trading days.&lt;br&gt;
In 2026 alone, there are over 5,000 schedule edge cases across 28 global exchanges — holidays, early closes, lunch breaks, circuit breakers, DST transitions, weekend rules for Middle Eastern markets that treat Friday as a non-trading day.&lt;br&gt;
Your agent will encounter these. The question is whether it will know.&lt;br&gt;
A pre-trade gate doesn't guarantee profit. It guarantees that when a market is closed, your agent knows it — and stops.&lt;/p&gt;

&lt;p&gt;Get Started&lt;/p&gt;

&lt;p&gt;MCP (Claude/Cursor/Windsurf): Add &lt;a href="https://headlessoracle.com/mcp" rel="noopener noreferrer"&gt;https://headlessoracle.com/mcp&lt;/a&gt; to your MCP config&lt;br&gt;
Python: pip install headless-oracle&lt;br&gt;
REST: GET &lt;a href="https://headlessoracle.com/v5/demo?mic=XNYS" rel="noopener noreferrer"&gt;https://headlessoracle.com/v5/demo?mic=XNYS&lt;/a&gt;&lt;br&gt;
Free sandbox key: POST &lt;a href="https://headlessoracle.com/v5/sandbox" rel="noopener noreferrer"&gt;https://headlessoracle.com/v5/sandbox&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm building Headless Oracle — signed market status for AI agents. headlessoracle.com&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>fintech</category>
    </item>
    <item>
      <title>If your trading bot uses market hours, you have a hidden liquidation bug today.</title>
      <dc:creator>Headless Oracle</dc:creator>
      <pubDate>Tue, 10 Mar 2026 14:46:36 +0000</pubDate>
      <link>https://forem.com/lembagang/if-your-trading-bot-uses-market-hours-you-have-a-hidden-liquidation-bug-today-23a3</link>
      <guid>https://forem.com/lembagang/if-your-trading-bot-uses-market-hours-you-have-a-hidden-liquidation-bug-today-23a3</guid>
      <description>&lt;p&gt;US DST shifted on Sunday. UK/EU shifts March 29. For the next 3 weeks, any AI trading agent or DeFi bot using hardcoded UTC offsets for market hours is calculating time incorrectly.&lt;/p&gt;

&lt;p&gt;If an automated liquidator tries to sell collateral while the NYSE is actually closed, the transaction fails and bad debt accrues. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Just use a timezone library."&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;pytz&lt;/code&gt; handles DST. It does not handle the 67 exchange-specific holidays in 2026, early closes, Tokyo's daily lunch break, or emergency circuit breakers. A timezone library solves 80% of the problem. The other 20% is where protocols absorb bad debt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Exploit &amp;amp; The Fix&lt;/strong&gt;&lt;br&gt;
To fix this, I built Headless Oracle. It is a defensive execution layer for AI trading agents and DeFi bots that returns the real-time OPEN/CLOSED/HALTED status for 7 global exchanges. &lt;/p&gt;

&lt;p&gt;Every response is an Ed25519 cryptographically signed receipt with a 60s expiry. The architecture is strictly fail-closed: if the signature is invalid, the receipt is expired, or the status is UNKNOWN, your bot halts. When dealing with autonomous capital, defaulting to closed is the only safe option.&lt;/p&gt;

&lt;p&gt;I've open-sourced a demo that reproduces the DST exploit and shows the Ed25519 verification fix: &lt;br&gt;
&lt;strong&gt;&lt;a href="https://github.com/LembaGang/dst-exploit-demo" rel="noopener noreferrer"&gt;View the Exploit Demo on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can also hit the live API demo (no API key needed): &lt;a href="https://headlessoracle.com/v5/demo?mic=XNYS" rel="noopener noreferrer"&gt;headlessoracle.com/v5/demo?mic=XNYS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI agents need verifiable environmental data before touching capital. We are building the verification layer for autonomous finance. Let me know if you have questions on the fail-closed logic or the crypto implementation.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>python</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
