WickedFinancial / Wicked

Dapp for creating, redeeming and settling synthetic tokens based on UMA LSP (Long Short Pair) contracts
https://wickedfinancial.netlify.app/
2 stars 0 forks source link

Pricing tokens created via the UMA CFD contract #5

Closed snake-poison closed 3 years ago

snake-poison commented 3 years ago

Pricing of these synthetics is tricky and while it may be outside the scope of the competition, if we want to just improve on the EMP call options design. It's not intuitive and it is not a show stopper, but if the participants don't clearly understand the risks they take on when buying a Short or Long pair than they might be reluctant to try it. Let me illustrate the issue through the example UMA gave here for their LSP example : https://docs.umaproject.org/synthetic-tokens/long-short-pair#lsp-example

Again please refer and read the story of Alice, Troy and Rachel in the link above.

To summarize: Alice in the story seems to be taking the role of a market maker who is long term ETH bullish. She is looking to generate yield on her idle ETH. She gives up gas to set up this position. She set the strike at 3,000 when the price is currently at 2,5000. She sells long tokens to Troy and short tokens to Rachel.

Note that in the story, UMA did not present the pricing of these sales! Let's analyze the position posed here and how Alice might have priced these transactions to make a profit ( which she must as she spent gas to setup the position).

Let's extend the story to include how Alice would price her LONG and SHORT tokens.

How Alice should price the SHORT:

Rachel's story based on his actions( Short Token Buyer):

How Alice should price her LONG tokens:

Troy's story based on his actions (Long Token Buyer):

Results according to the fictitious story if we take this story as canon:

Let me know if this makes sense. If it does, how can generalize the formula for pricing these contracts?

markoinether commented 3 years ago

That would mean before expiry 1 short token is worth .5 WETH and 1 long token is worth .5 WETH to the CFD contract (that anyone can redeem from)

I think this assertion is wrong, I believe that before expiry you you can only "reduce" position, meaning you would have to provide 1 long + 1 short token to the contract to get 1 ETH back (could be fractions of the tokens too, but always in 1:1 ratio), this makes logically sense (and they explain it in the video like this) since this is how you reduce the position in a neutral way.

Counterexample: Since contract has no inherent pricing for short / long tokens before expiry you could theoritacally redeem 1 short token for 0.5 before expiry when there is 99% that the position will expire out of money... making the system unusable.

ckoopmann commented 3 years ago

She needs to approach someone that is bearish on the price of WETH, but wants to acquire WETH. The buyer of the short tokens she is selling must receive the short tokens at discount, as there would be no upside to buying the tokens that are in the money.

This is only due to the fact that we are using WETH as a collateral in this case though right ? If we would use a USD stable coin as collateral this is not the case, I would think.

markoinether commented 3 years ago

Alice is motivated by the opportunity of making yield. That means that she must receive more than 1 WETH plus the cost of gas for her position to be economical.

This assertion does really hold in practice, look at the picture below (binance option market) https://voptions.binance.com/en , you can see short option + long option at the same strike do not add up the price of underlying, there is in fact no reason they should, everyone would be an option market maker then :).

image

ckoopmann commented 3 years ago

Alice knows the minimum she could take for the 1 short token in the money is a little more than .5 WETH

Why would you say that, if a token is just barely in the money and almost guaranteed to get not more than say 0.1 collateral tokens at expiry, why would anyone pay 0.5 weth for it ?

ckoopmann commented 3 years ago

That would mean before expiry 1 short token is worth .5 WETH and 1 long token is worth .5 WETH to the CFD contract (that anyone can redeem from)

I think this assertion is wrong, I believe that before expiry you you can only "reduce" position, meaning you would have to provide 1 long + 1 short token to the contract to get 1 ETH back (could be fractions of the tokens too, but always in 1:1 ratio), this makes logically sense (and they explain it in the video like this) since this is how you reduce the position in a neutral way.

Counterexample: Since contract has no inherent pricing for short / long tokens before expiry you could theoritacally redeem 1 short token for 0.5 before expiry when there is 99% that the position will expire out of money... making the system unusable.

I agree with Marko. While 1 long + 1 short token are together worth 1 WETH I don't think you can assume that the value is distributed 50 / 50 on them, since you cannot redeem them individually prior to expiry.

markoinether commented 3 years ago

She needs to approach someone that is bearish on the price of WETH, but wants to acquire WETH. The buyer of the short tokens she is selling must receive the short tokens at discount, as there would be no upside to buying the tokens that are in the money.

This is only due to the fact that we are using WETH as a collateral in this case though right ? If we would use a USD stable coin as collateral this is not the case, I would think.

In this case it does not really matter what is the collateral, you are basically "splitting" 1 ETH into a shortETH and LongETH side that together always give you the same exposure as 1 ETH. think about it like this if the strike is 10 000 USD and expiry in 3 months, there is no inherent way how to say, what is the probability that ETH will be in the money (hitting the strike). Basically market decides, if I think chance is 10% I will be willing to pay 0.1 ETH(in fact less than that but lets keep it simple) and bob is ETH bear and thinks the chance is 1% he is willing to sell me the option for 0.05. He will be willing to sell me long option I will be willing to buy it.
Only after expiry the contract knows how to split rewards between short tokens and long tokens based on the price oracle, it does not matter if we are talking about options, range bonds or whatever else. Contract only allocates between these, but it always holds that at the expiry, if you hold both 1 Long token and 1 short token you will back 1 (collateral token, could be anything) back, no matter what is the distribution of ETH between short / long. Could be 50/50 could be 100/0 or anything in between. Since this condition is always met, you can redeem 1short + 1long for 1 underlying at any time during contract's lifetime, not just aftery expiry

ckoopmann commented 3 years ago

In this case it does not really matter what is the collateral, you are basically "splitting" 1 ETH into a shortETH and LongETH side that together always give you the same exposure as 1 ETH.

I don't think that is quite right, the way I understand it the two tokens (long / short) always redeem to one token of whatever you choose as collateral. If you choose USDC as collateral then the two tokens would always equal 1 USDC together. So they would give you no ETH exposure whatsorever if you don't choose WETH as collateral no ?

markoinether commented 3 years ago

In this case it does not really matter what is the collateral, you are basically "splitting" 1 ETH into a shortETH and LongETH side that together always give you the same exposure as 1 ETH.

I don't think that is quite right, the way I understand it the two tokens (long / short) always redeem to one token of whatever you choose as collateral. If you choose USDC as collateral then the two tokens would always equal 1 USDC together.

Correct, incorrect wording on my part, 1 long + 1 short always give you 1 collateral, no matter what is the collateral.

markoinether commented 3 years ago

In this case it does not really matter what is the collateral, you are basically "splitting" 1 ETH into a shortETH and LongETH side that together always give you the same exposure as 1 ETH.

I don't think that is quite right, the way I understand it the two tokens (long / short) always redeem to one token of whatever you choose as collateral. If you choose USDC as collateral then the two tokens would always equal 1 USDC together. So they would give you no ETH exposure whatsorever if you don't choose WETH as collateral no ?

I believe the way the mechanism is currently designed, is that the price oracle always need to be a Token/USD pair and collateral in Token, could be wrong here.

To your question, you would get price exposure if collateral is in USDC, what you might not get, is the actuall delivery ;), in practice contract would be liquidated before expiry because if price of eth goes up at a certain point collateral would not be able to fullfill the obligation of the contract. e.g. Collateral is 140% of the opened ETH/USDC position in USDC. That means if at the expiry eth rises by 20%, you would get 120% of the USDC in collateral, therefore you had price exposure to eth, the same one as the collateral was in eth actually only paid in USDC instead of Eth. If at any point of the contract's life eth rises to 40% or more, contract would have to be immediately liquidated, to prevent the case that at the expiry you should have received 180% from the contract(eth rose 80%) but there is actually only 140% in the contract.

I think about it like this: Every derivative has two aspects.

  1. Price exposure / Obligation => only dependent on the oracle price which is quoted and payoff function defined in contract logic. Stablecoins track price of usd, options have assymetric payoff. Whatever contract you can think of it has a payoff function(y axis == your payout, x axis == price of underlying), basically what it is worh at any price point of the underlying (in the video he is showing different payoff functions for different derivative products)
  2. Delivery => this is basically the ability for the payoff function to be realized. You could do delivery without underlying if these are trusted parties, you promise your girlfriend you will "deliver" basically whatever she asks for :D. In traditional finance usually contracts are not fully backed and it is based on trust. In defi, there is no hope to get you an anonymous party on the internet to pay you your profit from your call option, therefore delivery is always depended on some bags of money, or eth or whatever else that is locked in the contract as a collateral to honor the agreement and guarantee payout. Any time the collateral is unable to cover the Obligation, the position is liquidated.

These two principles hold for all derivatives DAI, Call options, Range Bonds, ETc. Basically all derivatives are structurally the same in the essence and differ only in payout function.

ckoopmann commented 3 years ago

I believe the way the mechanism is currently designed, is that the price oracle always need to be a Token/USD pair and collateral in Token, could be wrong here.

I would expect that you can use any of the approved Price Feeds of UMA. Or is there a reason why it should be limited to Token/USD pairs ? | https://docs.umaproject.org/uma-tokenholders/approved-price-identifiers

ckoopmann commented 3 years ago

To your question, you would get price exposure if collateral is in USDC, what you might not get, is the actuall delivery ;), in practice contract would be liquidated before expiry because if price of eth goes up at a certain point collateral would not be able to fullfill the obligation of the contract.

Which contract would be liquidated ? The LSP / CFD contracts of UMA have no concept of liquidation as far as I understand. (Thats the main point what is so great about them, and the reason why the payouts have to be capped to the total collateral)

markoinether commented 3 years ago

I am talking specifically about CFD contract in the video. Price feed could be anything, but the collateral needs to be the Token from the price feed e.g. if UMA/USD collateral in UMA, if price feed x/USD collateral in x

markoinether commented 3 years ago

To your question, you would get price exposure if collateral is in USDC, what you might not get, is the actuall delivery ;), in practice contract would be liquidated before expiry because if price of eth goes up at a certain point collateral would not be able to fullfill the obligation of the contract.

Which contract would be liquidated ? The LSP / CFD contracts of UMA have no concept of liquidation as far as I understand. (Thats the main point what is so great about them, and the reason why the payouts have to be capped to the total collateral)

I think you are right that is basically why they keep collateral == to Token from the price feed, this allows you to always honor call option side of the contract. If UMA moons, collaterall moons too so it is always enough :)

markoinether commented 3 years ago

If there is no liquidation system here and you buy short tokens, your upside is limited, since the maximum amount you get is the full collateral, so if the price of token drops more than 50% you will not get the full upside you are entitled to

ckoopmann commented 3 years ago

If there is no liquidation system here and you buy short tokens, your upside is limited, since the maximum amount you get is the full collateral, so if the price of token drops more than 50% you will not get the full upside you are entitled to

Yes your upside on the LSP tokens is always limited to 1*collateralPerPair (a configuration parameter) tokens of the underlying collateral. That's part of the contract definition / payout function though, so I don't see why people would be "entitled" to more.

ckoopmann commented 3 years ago

I am talking specifically about CFD contract in the video. Price feed could be anything, but the collateral needs to be the Token from the price feed e.g. if UMA/USD collateral in UMA, if price feed x/USD collateral in x

Did they state that somewhere in the docs that the collateral has to be a token from the price feed ? Maybe that is true if you want to build this specific use case but generally I would expect you to be able to use any of the whitelisted collaterals.

Some price feeds are not token / blockchain related (like USD/GBP ) or not even actual "prices" at all. (Like SpaceX Launch Success Rate).

markoinether commented 3 years ago

that is basically a nomenclature, normally if you talk about put option it gives you the right to sell at certain price and the other side is obligated to buy at this price. here this is limited to the collateral, but think we have an understanding here... :)

markoinether commented 3 years ago

I am talking specifically about CFD contract in the video. Price feed could be anything, but the collateral needs to be the Token from the price feed e.g. if UMA/USD collateral in UMA, if price feed x/USD collateral in x

Did they state that somewhere in the docs that the collateral has to be a token from the price feed ? Maybe that is true if you want to build this specific use case but generally I would expect you to be able to use any of the whitelisted collaterals.

Some price feeds are not token / blockchain related (like USD/GBP ) or not even actual "prices" at all. (Like SpaceX Launch Success Rate).

I think it is in the video where he talks about CFDs specifically, but yes you are right collateral could be anything in general

markoinether commented 3 years ago

Technically it gets more complicated though, if you have heterogenius assets, you need two price oracles one to track the value of your position, the other the value of collateral.

markoinether commented 3 years ago

or you just get the full collateral in the end..

markoinether commented 3 years ago

I general to summarize my take on the examle:

  1. Alice under normal conditions would get strictly less than 1 collateral for 1 long + 1 short if she is selling them on the market.
  2. Given the first assertion holds, she would not be able to do the strategy described in your example, it's premise is, that she can get more than 1 from selling both positions.
  3. This would make her necessarily opinionated, meaning she needs to decide what is her judgment of ETH price movement and sell only short token if she thinks the price will go up, higher than the strike so that her 1 long token will be worth 1collateral and she will make some extra money on the side from selling short tokens or vice versa.

That being said, I do not think we should be the Market maker (if we cannot be market neutral), but rather try to create a market place where there are both buyers and sellers that are motivated to trade with each other. I see markets as basically places where both sides can express their opposite opinions, for every buyer there is a seller, buyer thinks that eth is worth more than 2500 if he buys it for such amount and seller believes it is worth less if he is willing to sell it.

Also, with the contracts on ethereum in general, there is a problem of a gas cost, you do not want to open a position if you are not sure that there will be other party that will take you up on the offer because of the gass cost. Thinking that perhaps, people could just signal their intention to buy / sell by signing messages and token.approve and the position would be created only if there are two parties that match. Not sure if it is feasable, just an idea...

snake-poison commented 3 years ago

That would mean before expiry 1 short token is worth .5 WETH and 1 long token is worth .5 WETH to the CFD contract (that anyone can redeem from)

I think this assertion is wrong, I believe that before expiry you you can only "reduce" position, meaning you would have to provide 1 long + 1 short token to the contract to get 1 ETH back (could be fractions of the tokens too, but always in 1:1 ratio), this makes logically sense (and they explain it in the video like this) since this is how you reduce the position in a neutral way.

Counterexample: Since contract has no inherent pricing for short / long tokens before expiry you could theoritacally redeem 1 short token for 0.5 before expiry when there is 99% that the position will expire out of money... making the system unusable.

Thanks this was indeed a bad take by me. I agree. I don't think it impacts my line of thinking on pricing.

snake-poison commented 3 years ago

Alice knows the minimum she could take for the 1 short token in the money is a little more than .5 WETH

Why would you say that, if a token is just barely in the money and almost guaranteed to get not more than say 0.1 collateral tokens at expiry, why would anyone pay 0.5 weth for it ?

You are absolutely right. I will modify the post.

snake-poison commented 3 years ago

She needs to approach someone that is bearish on the price of WETH, but wants to acquire WETH. The buyer of the short tokens she is selling must receive the short tokens at discount, as there would be no upside to buying the tokens that are in the money.

This is only due to the fact that we are using WETH as a collateral in this case though right ? If we would use a USD stable coin as collateral this is not the case, I would think.

That's correct. I believe a way to lose that property on the short side but keep everything else the same would be to set the collateral per pair to be the current price of ETH with the collateral being a stable coin. What's cool with that setup (cash settlement) is that Troy and Rachel wouldn't be exposed to movements in price between expiry and the dispute period on the proposed price. If there is a dispute there could be a delay of up to 2 days. The dispute period even with no disputes is 2 hours I believe.