<?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>DEV Community: Harrier</title>
    <description>The latest articles on DEV Community by Harrier (@harrieronchain).</description>
    <link>https://dev.to/harrieronchain</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1648131%2Fe2157fcf-aca9-407f-8275-ee7cfb716d62.jpg</url>
      <title>DEV Community: Harrier</title>
      <link>https://dev.to/harrieronchain</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harrieronchain"/>
    <language>en</language>
    <item>
      <title>I built a Directional Arbitrage Bot for Polymarket crypto markets in Rust — here's the architecture</title>
      <dc:creator>Harrier</dc:creator>
      <pubDate>Wed, 24 Jun 2026 15:30:13 +0000</pubDate>
      <link>https://dev.to/harrieronchain/i-built-a-directional-arbitrage-bot-for-polymarket-crypto-markets-in-rust-heres-the-architecture-31k8</link>
      <guid>https://dev.to/harrieronchain/i-built-a-directional-arbitrage-bot-for-polymarket-crypto-markets-in-rust-heres-the-architecture-31k8</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;Sharing a new bot I've been building — it's a directional arbitrage bot for binary prediction markets (BTC/ETH/SOL Up/Down on Polymarket). Written in Rust for the latency requirements this strategy demands.&lt;/p&gt;

&lt;p&gt;The core idea&lt;/p&gt;

&lt;p&gt;Pure arbitrage on prediction markets is straightforward — if Up + Down &amp;lt; $1, you buy both and lock in the difference. Safe, but the upside is capped at the spread.&lt;/p&gt;

&lt;p&gt;This bot starts from that arbitrage structure but adds a directional tilt. If the model identifies that one side has additional edge beyond the arb, it skews the position — buying more of the stronger side and less of the hedge side. The result is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arbitrage base = structural protection&lt;/li&gt;
&lt;li&gt;Directional tilt = additional EV when the model has conviction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why this matters in short crypto markets&lt;/p&gt;

&lt;p&gt;BTC/ETH/SOL 5-15 minute markets on Polymarket are interesting because the underlying asset can move sharply while Polymarket's CLOB reprices one side with a delay. That lag is the exploitable window. By the time the order book catches up, a pure arb bot has already exited. A directional bot can hold the stronger side through the reprice and capture the full move.&lt;/p&gt;

&lt;p&gt;Architecture (Rust)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="n"&gt;rust&lt;/span&gt;&lt;span class="c1"&gt;// Core position structure&lt;/span&gt;
&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Position&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;arb_base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// guaranteed arb fill on both sides&lt;/span&gt;
    &lt;span class="n"&gt;directional_tilt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// extra exposure on favored side&lt;/span&gt;
    &lt;span class="n"&gt;hedge_ratio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;// partial hedge on weaker side&lt;/span&gt;
    &lt;span class="n"&gt;edge_threshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;f64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// minimum model edge to tilt&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key design decisions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Limit orders only — never market orders. Paying the spread kills the arb base immediately&lt;/li&gt;
&lt;li&gt;Tilt gated by edge threshold — the model has to show meaningful conviction before skewing the position. No tilt = pure arb fallback&lt;/li&gt;
&lt;li&gt;Hedge ratio is dynamic — scales down as directional confidence increases, never goes to zero&lt;/li&gt;
&lt;li&gt;Rust for execution — async order management with Tokio, minimal GC pauses, deterministic latency on the quoting loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Position logic flow&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Scan CLOB for Up + Down &amp;lt; $1 (arb opportunity exists)
2. Run edge model on both sides
3. If edge delta &amp;gt; threshold → tilt toward stronger side
4. Place limit orders: full size on strong side, hedge_ratio on weak side
5. Monitor fill state and adjust tilt if market moves before fill
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hedge means a wrong directional call doesn't blow up the position — it just reduces the arb profit. The floor is always the arb spread minus fees.&lt;/p&gt;

&lt;p&gt;Current limitations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Edge model is still rule-based — pattern recognition on price movement sequences. Not ML yet&lt;/li&gt;
&lt;li&gt;Liquidity on some markets is thin enough that the tilt size is constrained by available depth&lt;/li&gt;
&lt;li&gt;Correlated markets (BTC and ETH moving together) need net exposure tracking across both, not per-market limits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why Rust&lt;/p&gt;

&lt;p&gt;Polymarket's CLOB API has enough latency variance that the quoting loop needs to be tight. Rust gives deterministic async performance without the GC pauses you'd get in Node or JVM. The order state machine is also complex enough that Rust's ownership model catches a lot of bugs at compile time that would be runtime errors elsewhere.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits" rel="noopener noreferrer"&gt;https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy to discuss the edge model, position sizing logic, or the Rust async architecture. Also curious if anyone has solved the correlated market exposure problem cleanly.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>developers</category>
      <category>opensource</category>
      <category>rust</category>
    </item>
    <item>
      <title>I built an open-source market maker for prediction markets (Polymarket/CLOB) — here's how it works</title>
      <dc:creator>Harrier</dc:creator>
      <pubDate>Fri, 19 Jun 2026 15:16:29 +0000</pubDate>
      <link>https://dev.to/harrieronchain/i-built-an-open-source-market-maker-for-prediction-markets-polymarketclob-heres-how-it-works-5aam</link>
      <guid>https://dev.to/harrieronchain/i-built-an-open-source-market-maker-for-prediction-markets-polymarketclob-heres-how-it-works-5aam</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;I've been deep in prediction market infrastructure for a while and just open-sourced a market maker bot designed for CLOB-based prediction markets like Polymarket.&lt;/p&gt;

&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quotes both sides of a binary market automatically&lt;/li&gt;
&lt;li&gt;Adjusts spreads based on order book depth and volatility&lt;/li&gt;
&lt;li&gt;Manages inventory risk to avoid getting stuck on the wrong side of a resolved market&lt;/li&gt;
&lt;li&gt;Built on top of Polymarket's CLOB API with Gnosis Safe / EOA wallet support on Polygon&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The core challenge with prediction markets vs. regular markets:&lt;/p&gt;

&lt;p&gt;Normal market making is about capturing spread. Prediction markets add a brutal edge case — resolution risk. If you're holding YES at 0.6 and the market resolves NO, you're not just down on the spread, you're down the full position. So the bot has to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Track time-to-resolution and widen spreads as resolution approaches&lt;/li&gt;
&lt;li&gt;Reduce inventory exposure on markets with high directional momentum&lt;/li&gt;
&lt;li&gt;Use FAK orders to avoid resting limit orders too long near resolution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rust&lt;/li&gt;
&lt;li&gt;Polymarket CLOB API&lt;/li&gt;
&lt;li&gt;Polygon (USDC settlement)&lt;/li&gt;
&lt;li&gt;SQLite for order state tracking&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic spread model based on implied volatility&lt;/li&gt;
&lt;li&gt;Multi-market portfolio rebalancing&lt;/li&gt;
&lt;li&gt;Better signal integration (news feeds, oracle data)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits" rel="noopener noreferrer"&gt;https://github.com/HarrierOnChain/Prediction-Markets-Trading-Bot-Toolkits&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy to answer questions on the architecture, risk model, or anything CLOB-related. Always looking for feedback from others building in this space.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>blockchain</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
