How To Use the Option Extension Package¶
To follow the script used in this tutorial, you can
clone the Daml Finance repository. In particular,
the Option test folder src/test/daml/Daml/Finance/Instrument/Option/Test/
is the starting point
of this tutorial.
How To Create an Option Instrument¶
In order to create an option instrument, you first have to decide what type of option you need. The option extension package currently supports the following types of options:
European¶
The European option instrument models cash-settled, auto exercising call or put options. For reference, European options give the holder the right, but not the obligation, to buy (in case of a call) or to sell (in case of a put) the underlying asset at predetermined strike price on a specific expiry date in the future.
As an example, consider an option instrument that gives the holder the right to buy AAPL stock
at a given price. This example is taken from
src/test/daml/Daml/Finance/Instrument/Option/Test/European.daml
, where all the details are
available.
You start by defining the terms:
strike = 50.0
expiryDate = date 2019 May 15
referenceAssetId = "AAPL-CLOSE"
Now that the terms have been defined, you can create the option instrument:
cid <- toInterfaceContractId <$> submitMulti [depository, issuer] [] do
createCmd EuropeanOption.Instrument with
depository; issuer; id = Id label; version = "0"; description
observers = M.fromList observers; lastEventTimestamp
ownerReceives; optionType; strike; expiryDate
referenceAssetId; currency
Once this is done, you can create a holding on it using Account.credit.
If the close price of AAPL on the expiry date is above the strike price, the option holder would profit from exercising the option and buying the stock at the strike price. The value of the option would be spot - strike. Since this option type is cash-settled, this amount would be paid in the option currency after lifecycling.
On the other hand, if the close price of AAPL is below the strike price, the option would expire worthless.
Frequently Asked Questions¶
How do I transfer or trade an option?¶
When you have created a holding on an option instrument this can be transfered to another party. This is described in the Getting Started: Transfer tutorial.
In order to trade an option (transfer it in exchange for cash) you can also initiate a delivery versus payment with atomic settlement. This is described in the Getting Started: Settlement tutorial.
How do I calculate settlement payments for an option?¶
On the expiry date, the issuer will need to lifecycle the European option. This will result in a lifecycle effect for the payoff, which can be cash settled. This is described in detail in the Lifecycling and the Intermediated Lifecycling tutorials.