In Part 2 , we built the "heartbeat" of our engine: PnL Calculation . We ensured that every price tick accurately updates a trader’s equity with decimal precision. But a market cannot survive on price action alone. Without an anchor, the price of a perpetual contract would drift aimlessly away from the actual value of the underlying asset. That anchor is Funding Rates . It is the regulatory mechanism that ensures the perpetual market remains fair, balanced, and tethered to reality. Here is how I implemented this "incentive engine" in Rust. 1. What are Funding Rates? (The Market’s Anchor) In perpetual futures, there is no expiration date. To prevent the contract price from deviating too far from the Spot Price , the system uses a peer-to-peer payment exchange. When Longs dominate (Bullish): Perpetual Price > Spot Price. Longs pay Shorts. When Shorts dominate (Bearish): Perpetual Price < Spot Price. Shorts pay Longs. This is a zero-sum game .…