📘Orderbook
Filament features a unique hybrid trading model that seamlessly integrates an off-chain order book with an on-chain liquidity pool. This system is meticulously designed to ensure efficient order fulfillment, particularly beneficial for large trading orders. Here’s how the process works:
Initial Order Placement: When a trader initiates a trade on Filament's Order Managment smart contract, their order first interacts with the off-chain order book. This is the primary stage for matching orders.
Partial Order Fulfillment and Notification: If an order cannot be completely filled by the available counterparts in the order book, the platform’s Matching Engine identifies this partial fulfillment. It then sends a notification to the Order Creation contract, indicating the partially filled status of the order.
Routing Partially Filled Orders: The Order Creation contract, upon receiving the partial fulfillment notification, relays this information to the Router. The Router evaluates the order based on a predefined percentage split between the order book and the liquidity pool. This evaluation determines how much of the order will be directed to the Trade Execution Contract for further processing.
Trade Execution and Liquidity Pool Involvement: Let’s consider an example for clarity: A trader places a $100k long order. On the ask side, there’s only a $60k order available. The $100k order matches with the $60k, leaving a $40k gap. This remaining amount is then seamlessly filled by the liquidity pool, provided 50% of the order is matched on the order book first. In this step, the Trade Execution Contract plays a pivotal role in ensuring the remaining $40k of the trade is executed via the liquidity pool.
Borrowing Mechanism and Fee Distribution: Concurrently, a borrowing mechanism is activated in the background. For the part of the order filled by the liquidity pool (in our example, $40k), the equivalent amount is borrowed under the trader’s account. The trader is then responsible for a borrowing fee on this amount. Notably, the borrowing fee paid by the trader is socialised across all traders on the platform. This creates a balanced fee distribution system, where the costs are equitably shared among the liquidity providers and other stakeholders.
Last updated