♾️3.3 Market Orders
Notation
3.3.1 Sell Credit Market Order (borrowing market order)
The FROB Borrowing Market Order can be used for different purposes.
The mechanism is always the same:
the borrower specifies, in addition to MEV-protection parameters:
a
lender
a
tenor
an
creditPositionId
to sellan
amount
to borrowexactAmountIn
whether theamount
parameter means credit or cash
as a result of this, given the
amount
and therate
, the future value of the loan related to that specific limit order is computed by applying the linear interest rate model
If the borrower wants to take multiple loans, from N different lenders, they may do so with a multicall
by submitting N borrowing market orders.
Observation: thanks to its robust API, both existing and new credit may be sold through the SellCreditMarket
function. By passing type(uint256).max
as the creditPositionId
, the system first creates a DebtPosition/CreditPosition pair assigned to the sender, in a "mint credit" internal operation, and then sells that CreditPosition to the lender. If an existing credit position is being sold, the tenor
parameter is ignored, as it can be automatically computed from the related debt position.
3.3.1.1 To take a new fixed-rate loan
This is the primary purpose of the Sell Credit Market Order; to take a new fixed-rate loan, a borrower fills a lending limit order, and a DebtPosition, CreditPosition pair is created as a result.
3.3.1.2 To exit a loan you own
Lenders can "exit" their lending position before the due date by selling their credit to other lenders
This is possible because the FROB as an order book without any further adaptation serves 2 purposes
to price the borrowing requests and
to price the credit aka future cashflow
3.3.1.3 Technical specification
In this case, the
amountIn
is creditWith
exactAmountIn=true
Formula
Preconditions
the order of magnitude of the fee we are considering is 0.5% APR so the break-even would be for a credit whose remaining lifetime is 200 years.
Fragmentation Fee
Explanation
Then fees are applied and
With
exactAmountIn=false
Formula
Preconditions
Recalling the formula for
exactAmountIn=true
let's computewhich is the maximum amount of cash possible, obtained by selling the full credit and therefore assuming no fragmentation fee
This is to say that the preconditions are
Fragmentation Fee
Explanation
Then fees are applied and
3.3.2 Buy Credit Market Order (lending market order)
There is also a FROB for borrowing bids.
The mechanism is similar to that of selling credit:
the lender specifies, in addition to MEV-protection parameters:
a
borrower
a
tenor
an
creditPositionId
to sellan
amount
to lendexactAmountIn
whether theamount
parameter means cash or credit
Observation: thanks to its robust API, here too, both existing and new credit may be bought through the BuyCreditMarket
function. By passing type(uint256).max
as the creditPositionId
, the system first creates a DebtPosition/CreditPosition pair assigned to the borrower, in a "mint credit" internal operation, and then buys that CreditPosition to the sender. If an existing credit position is being bought, both the tenor
and borrower
parameters are ignored, as these can be automatically computed from the related debt and credit positions.
The main use case has been envisioned for that is to allow borrowers to exit their positions before the due date, without forfeiting the full-term interest.
It is also possible for lenders to fill limit orders on the borrowing offer book. However, this is likely to be a less frequent arbitrage event, i.e. when borrow bids are priced higher than the market lending rate.
3.3.2.1 Technical specification
In this case, the
amountIn
is cashwith
exactAmountIn=false
Formula
We can see that
the amount of cash to send in is equal to the credit desired (exact amount out) converted into cash discounting by the rate and increased by the fragmentation fee and then
Preconditions
Fragmentation Fee
with
exactAmountIn=true
Formula
We can see that,
the amount of credit that is obtained is equal to the amount of cash sent in (exact amount in) first subtracted by the fragmentation fee and then converted into credit using the rate
Preconditions
So the conditions for the swap to happen are
Fragmentation Fee
In the case of BuyCreditMarket
, there is no swap fee in the formula since it is not paid by the credit buyer (even though he is on the active side of the trade), but by the credit seller. So the. amount of cash received by the credit seller is netCash = cash * (1 - k * \Delta T)
.
Last updated