Selling & Buying Existing Calls
Owners may sell their existing calls into the market, and Writers may buy back their positions to absolve their obligation and short position
For Long positions, they may sell their existing open calls into the market. They do so by making them intentionally tradeable (bool set to true) and then offering them for a price.
This is done with the setPrice method. Owners may reset the price anytime they wish for open options, and can also use this method to cancel their trade (but still maintain ownership of the call), by simply setting the tradeable bool to false.
This function itself does not actually sell the option, it merely makes it available for sale. As such there is a separate function for people to purchase an Open call that is in the market - buyOpenOption.
This method runs through a few checks, but similar to the buy / sell new options, it checks that the details of the call that is intended to be purchased actually match what is stored on the smart contract. Once complete the new buyer delivers cash to the former call long, and then the new buyer is assigned their position as call.long.
The buyOpenOption has a unique function whereby it checks if the buyer is actually the short position of the call already. In this case, they current call short can be released of their obligation and position - and the tokens held in escrow are returned back to the short. In this case the call is closed out because there is no more long or short position, and no more tokens held in escrow.
There are two other nuanced functions used to transfer ownership of calls in the market.
Suppose that you are a call short position, and you would like to get out of your short position. If the call owner puts the call up for sale, then you can buy it back with the above buyOpenOption function, but what if they want to keep their option? If there is another call (either newAsk or secondary sale "open ask") that matches all of the parameters of your current short position, then you can buy that option and safely exit your short position.
The function is called buyOptionFromAsk
When executing this method, it will require that the options parameters match up exactly, with the exception of the price (as you will pay whatever the current ask wants to charge). Calling this method will effectively switch positions such that the ask short is assigned your short position, and then their ask is closed out. You will pay the ask.long the premium price to close out this position, and then get your tokens out of escrow.
Conversely lets suppose you are a call owner of an open position, and you see on the order book a new bid (in this case must be a new bid). You can sell your current long position to this new bidder, and they will switch spots with you. You would no longer own the call, but you would receive the premium for selling the call to the new bidder.
This method is called sellOpenOptionToNewBid
Copy link