# The Hidden Technical Challenge Behind Senpi Mirror Trading on Hyperliquid

*How we engineered real-time, lossless replication of the world’s best Hyperliquid traders.*

By [0xeaf5](https://paragraph.com/@0xeaf55242a90bb3289db8184772b0b98562053559) · 2025-12-11

hyperliquid, perps, trading

---

When you tap “Mirror” in [Senpi](https://senpi.ai), it looks simple.

Behind the scenes, it’s one of the hardest engineering problems in all of crypto.

[Hyperliquid](https://app.hyperliquid.xyz/trade) processes up to **200,000 on-chain order-events per second** and supports **tens of thousands of traders** opening, closing, flipping, scaling, and adjusting complex derivative positions in real time.

HL traders can:

*   Open long/short positions with leverage
    
*   Add to or reduce positions
    
*   Change leverage mid-flight
    
*   Flip long → short or short → long
    
*   Use market, limit, post-only, IOC, and **TWAP** (firing dozens/hundreds of micro-fills)
    
*   Close positions through fragmented fills
    
*   Execute multi-asset strategies across dozens of tickers
    

**The good news:** All of this is onchain, with fee incentives that discourage wallet rotation.

**The challenge:** Replicating all of this _exactly_, _deterministically_, and _in real time_ for thousands of users.

Senpi set out to build the most precise mirror trading system in the Hyperliquid ecosystem.

* * *

**Senpi’s Four-Engine Architecture**
====================================

**1\. Discovery Engine**
------------------------

Real-time, lossless indexing of the entire Hyperliquid ecosystem.

**Responsibilities:**

*   Track _every HL trader_ and _every trade_ in real time
    
*   Reconstruct true positions from raw fills (including TWAP slice fills)
    
*   Calculate size, leverage, notional, PnL, direction changes, and liquidation risk
    
*   Maintain complete state for each tracked trader
    
*   Run on Senpi-owned HL nodes + internal high-throughput databases
    
*   Enrich data with streams from **Allium** and **Hydromancer**
    

**Purpose:**

Ensure Senpi always knows the _exact_ and _current_ state of every OG trader.

* * *

**2\. Mirroring Engine**
------------------------

Deterministic, moment-accurate execution.

**Responsibilities:**

*   Mirror every open, close, scale-in/out, flip, and leverage adjustment
    
*   Translate each trader’s action into proportional execution for each Senpi user
    
*   Send transactions directly to Hyperliquid with optimized writers
    
*   Handle edge cases: micro-fills, fragmented exits, partials, rapid-fire deltas
    
*   Preserve state synchronization across volatile markets
    

**Purpose:**

If the OG trader moves, Senpi moves — instantly and precisely.

* * *

**3\. Reconciliation Engine**
-----------------------------

Continuous correction and realignment.

**Responsibilities:**

*   Detect any drift between a user’s position and the OG trader
    
*   Recalculate true deltas when divergence occurs
    
*   Issue corrective trades to restore perfect alignment
    
*   Validate execution integrity across all mirrored users
    
*   Ensure long-term consistency across complex multi-step trade sequences
    

**Purpose:**

A self-healing system that always brings positions back into perfect sync.

* * *

**4\. Intelligence Engine (WIP)**
---------------------------------

The next evolution of automated trading: _understanding_ and _optimizing_ strategies.

**Analyzes:**

*   Every trader
    
*   Every trade
    
*   Every position
    
*   Every strategy
    
*   Every PnL pattern
    
*   Every behavior shift
    
*   Every risk flag
    
*   Every long-term trend
    

**WIP capabilities:**

*   Recommend the best HL traders for each Senpi user
    
*   Evaluate trader quality, consistency, volatility, and regime shifts
    
*   Assess user performance and suggest better portfolio mixes
    
*   Detect overexposure or declining strategy performance
    
*   Recommend reshuffling or rotating into stronger strategies
    
*   Maintain memory of **every trade and strategy** a user has ever run
    
*   Build cross-user intelligence models for broad pattern detection
    

**Purpose:**

Evolve Senpi from a mirroring tool into a personalized trading intelligence system.

* * *

**Why This Matters**
====================

Mirror trading isn’t “copy what they do.”

It’s **perfect state replication** across high-frequency, leverage-driven markets.

Hyperliquid is the fastest and most technically advanced perps environment in crypto.

To build Senpi, we had to engineer systems that match — and in some places exceed — HL’s precision.

  

**Result:**

Senpi now mirrors the world’s top 1% traders with unprecedented fidelity.

Soon, with the Intelligence Engine, it will help users _choose better_, _trade better_, and _perform better_.

This is the future of trading.

And we’re just getting started.

---

*Originally published on [0xeaf5](https://paragraph.com/@0xeaf55242a90bb3289db8184772b0b98562053559/the-hidden-technical-challenge-behind-senpi-mirror-trading-on-hyperliquid)*
