♾️1.2 Limit Orders

There are 2 types of limit orders

  • Lending Limit Orders (credit buy limit orders), representing an intent to lend money, in a certain time range and a certain rates range

  • Borrowing Limit Orders (credit sell limit orders), representing an intent to borrow money, in a certain time range and a certain rate range

In terms of liquidity

  • Lending Limit Orders are associated with an amount of token that can be lent out, USDC in this case and

  • Borrowing Limit Orders are associated with the borrower's collateral, to back the loan if the order is matched

The collateral backing a loan is automatically calculated and assigned pro rata so there is no direct collateral to loan assignment or collateralized debt position.

1.2.1 Limit Order Structure - Yield Curve

Makers place limit orders by specifying a yield curve ρ(t):RR+\rho(t) : \mathbb{R} \rightarrow \mathbb{R}^{+} which is a curve that associates with each term a non-negative rate

The yield curve consists of a set of (ti,ri)i=1,...,n{(t_{i}, r_{i})}_{i=1,...,n} points specified by the lender-associated

  • to a given tit_{i} term

  • a certain riRr_{i} \in \mathbb{R} rate (they can be negative because of the price hooks explained later)

This effectively defines a piece-wise function in the (t0,tn1)(t_{0}, t_{n-1}) temporal range on-chain and the taker submitting a market order can pick any t(t0,tn1)t \in (t_{0}, t_{n-1}) and the result is computed by interpolating linearly.

1.2.2 Filling limit orders

1.2.2.1 Filling Lending Limit Orders (credit buy limit orders)

In filling a Lending Limit Order, the lender expects

  • some cash gets out of his account, since it is sent to the borrower and

  • to acquire some credit in exchange

This mechanism can be used for 2 purposes

  • standard lending and

  • selling existing credit

In fact, if the borrower is also a lender, he can use this mechanism to sell some of his credit to another lender in exchange for some cash.

This leads to a broader and more general terminology where

  • the lender is a "credit buyer" and

  • the borrower is a "credit seller" as he can sell both

    • a new credit he emits in the form of overcollateralized debt and

    • a credit he already owns, since he can also be a lender

The pricing of the credit is implicitly present in the Lending Limit Order as the rate associated with the due date chosen by the borrower, aka credit seller.

The way a Lending Limit Order is filled is

  1. the credit seller/buyer chooses:

  • an amount AA to borrow

  • a lender LL and

  • a tenor ΔT\Delta T

This allows to compute the corresponding rate to that lender yield curve as follows

r=ρL(ΔT)r = \rho_{L}(\Delta T)

Of course, it is required that ΔT(t0,tn1)\Delta T \in (t_{0}, t_{n-1}) since outside of that interval, the lender does not want to lend.

Observation: in the current implementation, the rate is not a function of the amount borrowed so there is no "slippage" in borrowing from a single lender, although there can be "slippage" if a large amount is borrowed since it would require borrowing from multiple lenders at different rates.

This is exactly what happens in a standard 2D order book when a large order consumes the liquidity of a bucket and the buckets at different prices close the initial one.

  1. the borrower emits a bond in favor of the lender for V=A(1+r)V = A (1 + r) face value that matures at TT time

  2. the amount AA is withdrawn from the Lender L reserves and sent to the borrower

  3. finally, before finalizing the operation, a collateral check is performed to check that the borrower's collateral ratio is above the opening threshold

1.2.2.2 Filling Borrowing Limit Orders

The filling of Borrowing Limit Orders is symmetric to the filling of Lending Limit Orders.

Last updated