How to set up and use the P2P Derivatives Pricing Sheet

Crypto Garage
Crypto Garage
Published in
12 min readAug 21, 2020

OVERVIEW

This article is here to guide you on how to use the P2P Derivatives pricing sheet, to generate the needed CSV output for the P2P Derivatives Beta app and to calculate the amount that both contract parties should contribute to start the Discreet Log Contracts (“DLCs”) transaction.

PURPOSE

With the aid of the P2P Derivatives pricing sheet (pricer) provided, 2 parties using the P2P Derivatives Beta app can agree on the pricing of certain financial contracts. Based on the financial contract selected, the pricer generates a CSV output needed for the P2P Derivatives Beta app and the amount that each party of the contract should contribute to start the DLCs transaction.

SCOPE

The types of financial contracts covered by the pricer are financial derivative products:

Please take a look at the reference section at the end of this article to confirm the definition of each derivative product.

PREREQUISITES

The user of this guide and the pricer should have some basic knowledge about derivative products, such as options and an understanding about DLCs). The pricer is only compatible with Google Sheets. The pricer for the P2P Derivatives Beta app is set up in such a way that the Client is the “Price Taker” of the financial contract, where the trade direction is set to “Client buys”. And if a one party wants to be the seller of the financial contract, then this party is considered to be the “Pricer Maker”.

STAKEHOLDERS

Client

The Client is the party who is the price taker for the financial contract. In the P2P Derivatives Beta app, the Client is the initiator of the DLC contract and he is the buyer of the financial contract.

Price Maker

Price Maker is the party who is providing the liquidity for the financial contract and making the price of the contract. In the P2P Derivatives Beta app, the Price Maker is the receiver of the DLC contract and he is the seller of the financial contract.

RESPONSIBILITIES

The Client and Price Maker both bear the responsibility to agree on the price of the derivative product and also the CSV output needed for the P2P Derivatives Beta app.

PROCEDURE

The pricer is broken down into 2 sections:

  • Pricing the Financial Derivative
  • Generate the output for DLCs

SETTING UP THE PRICER

This part is here to guide you on how to set-up the pricer, give the sheet’s script “OptionPricer” the authorization to get executed when using the pricer for the first time.

SET UP

By Opening the URL below:

https://docs.google.com/spreadsheets/d/1nzeD2F908BEbrh6a-CsnCHKBP3PDIDO0-Djysot3RHc/copy

You will be asked to make a copy of the pricer to his google drive as bellow:

After making a copy of the pricer to Google Drive, push the button “Import Market Data.” (This is the first step of using the pricer, as it will be explained in detail in the next section.)

After pushing the Import Market Data button, several windows will pop up for authorization requirements. and a Google account selection. Please click on the highlighted button as below and continue until the end.

With the above steps, you are ready now to use the pricer freely.

Please proceed to the next step “PRICING THE FINANCIAL DERIVATIVE” to continue your pricing.

PRICING THE FINANCIAL DERIVATIVE

Under the sheet ‘1. Pricer’, first click the ‘Import Market Data Button’

Step 2:

The cells highlighted in yellow are the parameters the Client may modify. The size of the financial contract can be modified with the number of contracts.

For any parameters, the Client may confirm its payout with the diagram as in below:

The price result of the derivative is expressed in terms of USD and Satoshi.

GENERATE THE OUTPUT FOR DLCS

OVERALL FLOW

Step 1:

Under the sheet ‘2. output-for-dlc’, click “Generate output for DLCs” in order to generate the Client’s and the Price Maker’s payout at maturity.

The P2P Derivatives Beta app requires a CSV file with all the possible settlement payout* for both the Client and the Price Maker. The steps to realize the settlement payout are:

  • At the maturity date of the financial contract, a neutral 3rd party called the Oracle broadcasts the BTCUSD exchange rate with an Oracle’s signature for this rate.
  • With this signature, the P2P Derivatives Beta app requests either the Client or the Pricer Maker to confirm the Oracle’s price and its signature and signs off the transaction for settlement.

*The price range of BTCUSD values for the possible settlement is mentioned in the Advanced Feature section of this documentation.

Some time is required to generate the output. The computation is done when the Status is shown as below.

Otherwise, the Status will be flagged in red as follows:

One possible explanation where the cell is red is that the generation of payouts is not finished yet. If the cell remains red for some time even after payouts are generated, this could mean that some error has occurred. In this case, we recommend you to double check the previous steps of the procedure and re-start the procedure from the beginning.

Step 2:

Once the output for DLCs is generated, the Client and the Pricer Maker can confirm the payout in the sheet ‘output-details’ If you would like further details on this sheet, please refer to the Advanced Features section below of this documentation.

INITIAL FUND CONTRIBUTION

The Client and the Pricer Maker will also need to agree on the initial funds they would need to contribute for the financial contract based on DLCs. The initial fund calculation result is shown as follows:

These figures are the contributions of both the Client and the Price Maker in Satoshi.

In this example, the Client is long the Call Spread, so he will pay the option premium of the Call Spread to the Price Maker at the start of the contract. The initiator of the contract will input this value into the “Option Premium” of the P2P Derivatives Beta app.

The Price Maker contribution is the maximum profit of the Client at maturity and it will be locked on-chain into a 2-of-2 multi signature fund. The initiator of the contract will input this value into the “Remote Collateral” of the P2P Derivatives Beta app. In this case, the “Local Collateral” will be zero.

The contribution figures here don’t include blockchain transaction broadcast fees. The fees are separately charged from the wallet based on the transaction sizes. The fee rate (rate for bitcoin transaction fee in satochi/byte) is inputted by the user in the P2P Derivatives Beta app.

Step 3:

After generating the output for DLCs and both the Client and the Pricer maker confirm the values of initial contribution and the different payouts for maturity, the output file can be saved as CSV file to the local drive by clicking on the “Save CSV to Local Drive” button or save to Google Drive by clicking on the “Save CSV to Google Drive” button.

If “Save CSV to Local Drive” is selected, a window as below will pop up and the user can click on “Download” to download the CSV file to his local machine’s Downloads folder.

Warning: Due to frequent updates of browsers, in particular with Chrome, the download link above may not be available. In that case the user could right click on the “Download” link of the popped up window, choose “Save Link As …” and the user can download the CSV file to his Downloads folder.

Or the user can go to “CSV ‘’ sheet of the pricer as shown below, from the “File” top menu, go to “Download”, choose “Comma-separated values (.csv, current sheet)”, and the user can download the sheet as a CSV file to his local drive).

If “Save CSV to Google Drive” is selected, a window as below will pop up informing the user about the location where the CSV file is saved.

With the CSV file that is generated, the user can input the Initial Fund Contribution and upload this CSV file into the P2P Derivatives Beta app to execute the financial contract that is agreed by the Client and Price Maker.

Step 4:

Keeping a record of the financial contract is in the best interest of the Client and the Price Maker. Under ‘Export Trade Terms to pdf’ tab, press “Save PDF to Local Drive” or “Save PDF to Google Drive” to save the Trade terms as a PDF. This exports the details of the financial contract from the sheet’ Trade Terms’ as a pdf.

If “Save PDF to Local Drive” is selected, a window as below will pop up, and the user can click on Download to start exporting a pdf file named “P2P_Derivative_Pricer — Trade Terms.pdf” to his local’s machine’s Downloads folder.

Warning: Due to frequent updates of browsers, in particular with Chrome, the download link above may not be available. In that case the user could right click on the “Download” link of the popped up window, choose “Save Link As …” and the user can download the PDF file to his Downloads folder.

Or the user can go to “Trade Terms’’ sheet of the pricer as shown below, from the “File” top menu, go to “Download”, choose “PDF document (.pdf)”, and the user can download the sheet as a PDF file to his local drive).

If “Save PDF to Google Drive” is selected, a window as below will pop up informing the user about the location where the pdf file is saved.

ADVANCED FEATURES

PRICING THE FINANCIAL DERIVATIVE

PREREQUISITES

To access the Advanced Features of the pricer, you can access by clicking 「+」under the sheet ‘1. Pricer’.

To use the advanced features, one will need some prior knowledge in option pricing.

The parameters highlighted in yellow are the parameters the user can specify for the option pricing calculation.

  • Spot BTC/USD: By default, today’s spot price of BTC/USD from Deribit is referenced.
  • Trade Start: Is the date on which the trade starts, by default is it today.
  • Implied Vol of K1 or Implied Vol: The default value is implied volatility of the last traded option on Deribit with the same Strike K1 ,Side and Type (Call or Put). When a “Spread” type product is selected, it will appear as Implied Vol of K1. When a “Digital Option” type product is selected, it will appear as an Implied Vol.
  • Implied Vol of K2: The default value is implied volatility of the last traded option on Deribit with the same Strike K1 , Side and Type. When a “Spread” type product is selected, it will appear as Implied Vol of K2. When a “Digital Option” type product is selected, this cell would have a blank value.
  • Interest Rate: The default value is zero in line with Deribit’s convention but can be modified by the user.

Although the parameters below are already specified in the Basic Settings section of the pricer. To offer you more context,

  • Trade Maturity: These maturity dates are retrieved from the last traded options on Deribit.
  • Lower Strike or Strike: These strikes are retrieved from the last traded options on Deribit. When a “Spread” type product is selected, it will appear as Lower Strike. When a “Digital Option” type product is selected, it will appear as Strike.
  • Upper Strike: This parameter is already specified in the Basic Settings of the pricer. When a “Spread” type product is selected, it will appear as Upper Strike. When a “Digital Option” type product is selected, this cell would have a blank value.

For reference we have plotted the bid and the ask for implied volatilities and prices for the last traded options on Deribit with the same option type (Call or Put) and maturity as the product the user has selected for pricing.

CONFIRM THE DETAILS OF THE CSV FILE

On the “output details” sheet the user can verify the contract payout at maturity of both the Client and the Price Maker in the payout diagram below. The user can also confirm the payout figures generated by auditing the numbers in the table on the right side.

The output file generates all the possible settlement payouts for both the Client and the Price Maker.

How the price range is determined is as follows
The spreadsheet imports the historical BTC/USD data for the last 1 year, calculating the 99 percentile of BTC/USD price changes over the same period of time as the trade (the time between the Trade Start Date and the Maturity Date). This 99 percentile is used to estimate the price range for the upper and lower bound of the BTC/USD needed for all the possible settlement payouts at maturity.

Checking purpose
On the top right of the sheet, there is a green highlighted cell that is used for checking that the sum of both the Client and the Price Maker’s payout at maturity is equal to the contribution into the 2-of-2 multi signature fund for each BTCUSD price at Maturity.

If the cell is highlighted in red, then fund contribution does not equal the sum of both the Client and the Price Maker’s payout at maturity. One possible explanation where the cell is red is that the generation of payouts is not finished yet. If the cell remains red for some time even after payouts are generated, this could mean that some error has occurred. In this case, we recommend you to double check the previous steps of the procedure and re-start the procedure from the beginning.

FINAL WORD

By now you have generated the needed CSV output for the P2P Derivatives Beta app and calculated the amount that both contract parties should contribute to start the Discreet Log Contracts (“DLCs”) transaction. For how to use the P2P Derivatives Beta app please follow this step by step guide:

P2P Derivatives application step by step guide.

One last reminder, you can download P2P Derivatives Beta app, and the pricer without your private information.
At Crypto Garage, we are architecting cryptofinance.
If you are interested, please contact us at
info@cryptogarage.co.jp.

REFERENCES

Links to the definition of different derivative products:

DISCLAIMER

Crypto Garage is not a regulated or a licensed financial company. This pricer is a tool to help you calculate the option premiums and generate the outputs needed for entering a P2P Derivatives trade service on testnet. This pricer does not and is not intended to constitute investment/tax advice or an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. Although every effort has been made to provide complete and accurate information, Crypto Garage Inc. makes no warranties, express or implied, or representations as to the accuracy of content. Crypto Garage Inc. assumes no liability or responsibility for any errors or omissions in the information contained in this pricer. We strongly recommend that you take financial and professional advice before making any financial decisions.

--

--