Hello everyone and welcome to the CavalRe! ๐ค
In this article, we examine the concept of self financing. What it is and why it is important in the design and analysis of DeFi protocols.
Self Financing in TradFiโ
So... what is self financing anyway?
Self financing is a lot like a conservation law of physics. Just as energy cannot be created or destroyed and can only be transformed, a transaction is self financing if no value is created or destroyed during the transaction and value is only transferred.
In the quant literature, e.g. the derivation of the Black-Scholes equation, self financing is such a natural and obvious constraint it is often mentioned in passing (if mentioned at all) by noting that the change in value of a portfolio consisting of units of security with price is given by
To distill this a bit, step back and write the value of the portfolio as
Taking the differential of this and applying the product rule gives
We see the change in value of the portfolio can be decomposed into a change that is due to trading activity, i.e.
and a change that is due to market movements, i.e.
Comparing this with the previous expression, we see that another way of saying a portfolio is self financing is to say that the change in value due to trading activity is zero, i.e.
Although requiring transactions to be self financing might seem intuitively obvious (because it is!), the unfortunate fact is that most DeFi protocols out there today are not self financing and this has implications.
Self Financing in DeFiโ
Self financing in DeFi is essentially the same an in TradFi except, as mentioned in our previous article, when analyzing DeFi protocols, the inherent discreteness of the blockchain becomes important. We need to use analogous tools from discrete calculus to define what self financing means in the context of discrete blockchains.
The quantities and prices of tokens in a portfolio can be expressed as node functions
where the components represent the number and price, respectively, of token in the state The total value of a portfolio is then given by
The change in value can then be expressed using the discrete product rule as
recalling that
and
In complete analogy to the continuum TradFi case, the discrete change in value can be decomposed into
which is the change in value due to trading activity and
which is the change in value due to market movements.
We can now state that a portfolio is self financing on a blockchain if the change in value due to trading activity is zero, i.e. if
or, equivalently,
Effective Pricesโ
Examining the expression for the change in value due to trading activity, we can interpret the term
as the effective price used for determining the value paid for / received from exchanging tokens. This means that
corresponds to transactions occurring at the initial (stale) price determined in the previous block with no price slippage. Similarly,
corresponds to transactions occurring at the terminal price only known in the next block, which depends on the size of the transaction and includes maximum price slippage. Finally,
corresponds to transactions occurring at the exact midpoint between the initial and terminal prices.
So, what started as a purely mathematical consequence of the inherent discreteness of blockchain provides an intuitive financial interpretation of self financing with implications for the design, analysis and implementation of DeFi protocols.