Try โ€‚โ€‰HackMD

Overlay: OI vs OI + PnL

It seems that for the reisk estimation purposes, the Overlay protocol should use OI+PnL as a metrica of market exposure, rather than just OI. The rationale is described below.

Long Position

At the time moment t0 a long position is opened with the collateral amount N, the leverage L, the open interest OI=NL, and the debt D=OIโˆ’N=N(Lโˆ’1). The underlying asset price at this moment is P(t0).

After a while, at the time moment t, the PnL for this positions is:

PnL(t0,t)=OIโ‹…(P(t)P(t0)โˆ’1)

Now, an additional time period ฯ„ passes. The additional PnL is:

PnL(t,t+ฯ„)=PnL(t0,t+ฯ„)โˆ’PnL(t0,t)==OIโ‹…(P(t+ฯ„)P(t0)โˆ’1)โˆ’OIโ‹…(P(t)P(t0)โˆ’1)==OIโ‹…(P(t+ฯ„)โˆ’P(t)P(t0))==OIโ‹…P(t)P(t0)โ‹…(P(t+ฯ„)P(t)โˆ’1)

Note, than:

OIโ‹…P(t)P(t0)=OI+OIโ‹…(P(t)P(t0)โˆ’1)=OI+PnL(t0,t)

So, from the future PnL perspective, a long position opened in the past is equivalent to a position opened just now, whose open interest is the past position's open interst plus past position's unrealized PnL.

Thus, it would be reasonable for the protocol to treat long positions opened in the past as positions opened just now but with unrealized PnL added to the open interest.

Short Position

At the time moment t0 a short position is opened with the collateral amount N, the leverage L, the (negative) open interest OI=โˆ’NL, and the (negative) debt D=OIโˆ’N=โˆ’N(L+1). The underlying asset price at this moment is P(t0).

After a while, at the time moment t, the PnL for the position is:

PnL(t0,t)=โˆ’OIโ‹…(1โˆ’P(t)P(t0))=

Now, an additional time period ฯ„ passes. The ** additional$$ PnL is:

PnL(t,t+ฯ„)=PnL(t0,t+ฯ„)โˆ’PnL(t0,t)==โˆ’OIโ‹…(1โˆ’P(t+ฯ„)P(t0))โˆ’(โˆ’OIโ‹…(1โˆ’P(t)P(t0)))==โˆ’OIโ‹…(P(t)โˆ’P(t+ฯ„)P(t0))==โˆ’OIโ‹…P(t)P(t0)โ‹…(1โˆ’P(t+ฯ„)P(t))

Note, that:

OIโ‹…P(t)P(t0)=OI+(โˆ’OIโ‹…(1โˆ’P(t)P(t0)))=OI+PnL(t0,t)

So, from the future PnL, a short position opened in the past is equivalent to a short position opened just now, whose (negative) open interest is the past positions's (negative) open interest plus the past positions's unrealized PnL.

Conclusion

Taking above into account, it would be reasonable for the protocol to treat positions open in the past as if these positions were opened just now and their unrealized PnL values were added to their open interest values.