0062 XLS-62d: Options #186
Replies: 8 comments 8 replies
-
Great proposal Denis |
Beta Was this translation helpful? Give feedback.
-
It the proposal, you say "Five new transaction types" but then only list three. |
Beta Was this translation helpful? Give feedback.
-
IIUC, this draft doesn't consider American style options. Is that right? |
Beta Was this translation helpful? Give feedback.
-
From my going over this everything in the disclaimer is left to the interface implementing the protocol in their interface correct? none of those issues highlighted there could be addressed on ledger? Maybe something could be looked at to leverage the DiD to "check" and flag some of those issue. eg, requiring a DiD that has the accreditation once that is added only then the option to use options becomes available. |
Beta Was this translation helpful? Give feedback.
-
Another question reading over this once again is the Expiration is this yet another case where a standard timestamp is used and not ripple time stamp 🫣 Looking at other documentation it seems to be standard to offer fixed limits to this expiration? What happens in the case someone picks a date 1000 years out.
(Ah understanding the American vs European style covers this) |
Beta Was this translation helpful? Give feedback.
-
A great proposal Denis! I would like to see it to be tested and progressed aswell. |
Beta Was this translation helpful? Give feedback.
-
Strike price also is singular here is offering multiple strike prices not possible or something that could be worked on later as a follow up? |
Beta Was this translation helpful? Give feedback.
-
Updated:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
XLS-62d: Options on XRPL Protocol Chains
Amendment
The proposed amendment introduces a new framework for options trading on the XRPL protocol, providing a lightweight and flexible way to create, trade, and exercise options, thus expanding the financial capabilities of the XRPL for decentralized finance applications.
The amendment adds:
New Ledger Entry Types
0x0083
): Represents an option listing for a specific asset/strike asset pair.0x0084
): Represents both an option listing (for a specific asset/strike asset pair) and a specific option contract.0x0085
): Represents an offer to buy or sell an option contract.New Serialized Fields
Amount
, code32
): The strike price of the option.UInt32
): The expiration time of the option as a UNIX timestamp.Hash256
, code35
): An identifier for the parent OptionPair.Hash256
, code36
): An identifier for theOption
object.Hash256
, code37
): An identifier for theOptionOffer
object.UInt32
, code53
): The quantity of options (number of contracts).UInt32
, code52
): The quantity of options available (unsealed amount).Amount
, code33
): The premium amount per option contract.Object
, code34
): An object representing a sealed (matched) option between counterparties.Array
, code29
): An array ofsfSealedOption
objects in anOptionOffer
.New Transaction Types
ttOPTION_PAIR_CREATE
, code64
): Creates a new pseudo account for an option listing with a specific asset/asset2 pair.ttOPTION_CREATE
, code64
): Creates a new option offer for an existing option contract.ttOPTION_SETTLE
, code65
): Settles an option contract through exercise, expiration, or closing.New Transaction Flags
For OptionCreate Transactions
0x00010000
): Indicates a Put option (default is Call if unset).0x00020000
): Indicates a Market order (default is Limit if unset).0x00080000
): Indicates a Sell offer (default is Buy if unset).tfOptionCreateMask = ~(tfUniversal | tfPut | tfMarket | tfSell)
For OptionSettle Transactions
0x00010000
): Indicates intent to expire the option.0x00020000
): Indicates intent to close the option.0x00040000
): Indicates intent to exercise the option.tfOptionSettleMask = ~(tfUniversal | tfExpire | tfClose | tfExercise)
Pseudo Account Approach for Options
Each option listing is represented by a pseudo account without an owner, similar to the AMM implementation. This creates consistency in the XRPL protocol for derivative products.
Option Pair Pseudo Account Creation and Identification
OptionPairCreate
transaction creates a newAccountRoot
object and associatedOptionPair
object for a specific asset/asset2 pair (e.g., GME/USD).OptionPairID
is the AccountID of the pseudo account.New Ledger Object Type:
OptionPair
The
OptionPair
ledger object represents an option listing for a specific asset/asset2 pair on the XRPL. This object is created when anOptionPairCreate
transaction is processed.Fields
OptionPair
0x0083
).Account
OwnerNode
Asset
Issue
structure).Asset2
Issue
structure).PreviousTxnID
PreviousTxnLgrSeq
Related AccountRoot Extension
The
AccountRoot
object for an option listing includes:OptionPairID
Example
OptionPair
ObjectNew Ledger Object Type:
Option
(for Contracts)The
Option
ledger object can also represent a specific option contract on the XRPL with a designated strike price and expiration date. This object is created when anOptionCreate
transaction is processed for the first time with a unique combination of parameters.Fields (for Option Contracts)
Option
0x0083
).OptionID
OwnerNode
StrikePrice
Amount
).Expiration
OptionType
PreviousTxnID
PreviousTxnLgrSeq
Example
Option
Contract ObjectNew Ledger Object Type:
OptionOffer
The
OptionOffer
ledger object represents an offer to buy or sell an option contract on the XRPL. This object is used to match buyers and sellers in the options market, facilitating the trading of options contracts.Fields
OptionOffer
0x0084
).Owner
OwnerNode
OptionID
Option
object this offer is for.Premium
Quantity
OpenInterest
Amount
BookDirectory
BookNode
SealedOptions
SealedOption
objects representing matched offers.PreviousTxnID
PreviousTxnLgrSeq
SealedOption
Object inSealedOptions
ArrayEach
SealedOption
object represents a matched (sealed) option offer with a counterparty.Fields
Owner
OptionOfferID
OptionOffer
.Quantity
Example
OptionOffer
ObjectNew Transaction Type:
OptionPairCreate
The
OptionPairCreate
transaction is used to create a new option listing for a specific asset/asset2 pair on the XRPL by creating a dedicated pseudo account for the option listing. This establishes the option listing parameters and creates the necessary ledger objects.Fields
TransactionType
OptionPairCreate
, value64
).Account
Asset
Issue
structure).Asset2
Issue
structure).Failure Conditions
The
OptionPairCreate
transaction MUST fail if:Asset
field is missing or invalid.Asset2
field is missing or invalid.State Changes
If the transaction is successful:
AccountRoot
object is created for the option listing.AccountRoot
.OptionPair
object is created with the specified parameters, linked to theAccountRoot
.DirectoryNode
object is created linking theAccountRoot
andOptionPair
objects.OptionPairID
is the AccountID of the new pseudo account.Example
OptionPairCreate
TransactionNew Transaction Type:
OptionCreate
The
OptionCreate
transaction is used to create a new option offer on the XRPL for an existing option contract (identified by itsOptionID
).Fields
TransactionType
OptionCreate
, value64
).Account
OptionID
Premium
Quantity
Flags
OptionCreate
FlagsThe
OptionCreate
transaction uses flags to specify the type of option offer.tfMarket
0x00020000
tfSell
0x00080000
The mask for valid flags is:
tfOptionCreateMask = ~(tfUniversal | tfMarket | tfSell)
Failure Conditions
The
OptionCreate
transaction MUST fail if:OptionID
field is missing or invalid.Option
does not exist.Premium
field is missing, invalid, or improperly formatted.Quantity
field is missing, invalid, not divisible by 100, or zero.tfOptionCreateMask
).State Changes
If the transaction is successful:
OptionOffer
ledger object is created with the specified parameters.OptionOffer
object.Example
OptionCreate
Transaction (Buy Call)New Transaction Type:
OptionSettle
The
OptionSettle
transaction is used to settle an option contract on the XRPL. This transaction allows the holder of a call or put option to exercise their right to buy or sell the underlying asset at the specified strike price, or to expire or close the option.Fields
TransactionType
OptionSettle
, value65
).Account
OptionID
Option
(AccountID of the option pseudo account).OptionOfferID
OptionOffer
ledger object representing the offer.Flags
OptionSettle
FlagstfExpire
0x00010000
tfClose
0x00020000
tfExercise
0x00040000
The mask for valid flags is:
tfOptionSettleMask = ~(tfUniversal | tfExpire | tfClose | tfExercise)
Note: Exactly one of these flags must be set.
Failure Conditions
The
OptionSettle
transaction MUST fail if:OptionID
field is missing or invalid.OptionOfferID
field is missing or invalid.Option
ledger object or theOptionOffer
ledger object does not exist.tfOptionSettleMask
).tfExercise
:tfClose
:State Changes
If the transaction is successful:
For expiration (
tfExpire
):OptionOffer
is removed from the ledger.tecEXPIRED
.For closing (
tfClose
):OptionOffer
is removed from the ledger.For exercising (
tfExercise
):OptionOffer
is removed from the ledger after successful exercise.Example
OptionSettle
Transaction (Exercise)Option Order Book
An option order book is maintained in the ledger to facilitate the matching of option offers. The order book indexes
OptionOffer
ledger objects based on theOptionID
and sorts them byPremium
usingOptionQuality
. This allows for efficient discovery and matching of compatible offers.Order Book Indexing
Offers are organized in directories similar to the existing
Offer
objects for trading currencies. The key differences are:OptionID
and the quality (premium).The methods for indexing include:
getOptionBookBase
: Generates the base index for the option order book directory.getOptionQualityNext
: Determines the next quality index for iteration.getOptionQuality
: Retrieves the quality (premium) component from an index.These methods facilitate the navigation and management of the option order book within the ledger.
Matching Option Offers
When an
OptionCreate
transaction is processed, the ledger attempts to match the newOptionOffer
with existing offers in the order book. Offers are matched based on option parameters and premiums. When a match occurs, the offers are sealed, and theSealedOptions
arrays in the respectiveOptionOffer
objects are updated to reflect the matched quantities and counterparties.RPC Changes
A new RPC method
option_book_offers
is introduced, enabling clients to query the current state of the option order book for a specific option. This allows users to retrieve active offers for buying or selling options, facilitating market transparency and price discovery.option_book_offers
MethodRequest Format
Request Parameters
Response Format
Response Fields
OptionOffer
.Usage Notes
limit
andmarker
parameters.option_id
.Example Usage
Request
Response
Beta Was this translation helpful? Give feedback.
All reactions