Built-in Product: Cash Settled Futures (CSF)
This built-in product provides "direct" futures (i.e. opposite of inverse futures) that are cash-settled, i.e. they are margined and settled in a single asset.
Futures are a simple "delta one" product and the first product supported by Vega. Note that in future there will likely be a number of other products (synthetics, contracts for difference).
trading_termination_trigger (Data Source)
: triggers the market to move totrading terminated
status ahead of settlement at expiry (required to ensure no trading can occur after the settlement result may be known by participants). (This would usually be a date/time based trigger but may also use an oracle.) This will move market tocancelled
state if market never leftpending state
(opening auction).settlement_data (Data Source: number)
: this data is used by the product to calculate the final settlement cashflows. The receipt of this data triggers this calculation and therefore also moving the product to thesettled
status.settlement_asset (Settlement Asset)
: this is used to specify the single asset that an instrument using this product settles in.
Validation: none required as these are validated by the asset and data source frameworks.
Optional parameters:
fully_collateralised
: when set totrue
margins will be calculated so that orders and positions are fully-collateralised. This flag can only be specified at market creation time. It cannot be modified on an existing market.max_price
: specifies the price cap for the market, an integer understood in the context of market decimal places,binary_settlement
: if set totrue
settlement price other than0
ormax_price
will be ignored.
Validation: max_price
> 0.
- Returns
[cash_settled_future.settlement_asset]
. - It is not possible to change settlement asset via governance.
// Futures are quoted in directly terms of price
cash_settled_future.value(quote) {
return quote
}
cash_settled_future.trading_termination_trigger(event) {
setMarketStatus(TRADING_TERMINATED)
}
cash_settled_future.settlement_data(event) {
// If settlement data was received prior to trading termination use the last value received, otherwise use the first value received after trading is terminated
while market.status != TRADING_TERMINATED {
waitForMarketStatus(TRADING_TERMINATED)
}
final_cashflow = cash_settled_future.value(event.data) - cash_settled_future.value(market.mark_price)
settle(cash_settled_future.settlement_asset, final_cashflow)
setMarkPrice(event.data)
setMarketStatus(SETTLED)
}
Optional parameters allow creating capped futures (all prices including settlement price must be in the range [0, max_price]
) or binary options (all intermediate prices must be in the range [0, max_price]
, settlement price must be either 0
or max_price
) markets.
If max_price
is specified the order prices should be validated so that the maximum price of any order is max_price
. Peg orders should be validated so that if the resulting price would be higher at any point it gets temporarily capped at max_price
.
If max_price
is specified, mark price candidates greater than max_price
should be ignored and mark-to-market settlement should not be carried out until a mark price within the [0, max_price]
range arrives.
If max_price
is specified:
- When
binary_settlement
parameter is set tofalse
any value0 <= settlement_price <= max_price
should be accepted as a settlement price. - When
binary_settlement
parameter is set totrue
onlysettlement_price=0
orsettlement_price=max_price
should be accepted. - Any other values get ignored and market does not settle, instead it still waits for subsequent values from the settlement oracle until a value which passes the above conditions arrives.
Please note that selecting a future product with max_price
specified and binary_settlement
flag set to true
allows representing binary options markets.
Validation:
fully-collateralised mode
is only allowed when there is amax_price
specifiedbinary_settlement
is only allowed when there is amax_price
specified
Note that these fields are not specified on the market update types. Once a capped future is created and set to fully collateralised (and/or binary settlement), it cannot be changed.
- Create a Cash Settled Future with trading termination triggered by a date/time based data source (0016-PFUT-001)
- Create a Cash Settled Future with trading termination triggered by an external data source (0016-PFUT-002)
- Create a Cash Settled Future with the settlement data provided by an external data source (0016-PFUT-003)
- Create a Cash Settled Future for any settlement asset that's configured in Vega
- Either data source can be changed via governance (0016-PFUT-004)
- Mark to market settlement works correctly (0016-PFUT-006)
- Settlement at expiry works correctly (0016-PFUT-007)
- A market that receives settlement data before trading termination always stores the newest one and upon receiving the trading termination trigger settles the market (0016-PFUT-008)
- A market that has already settled and is in trading terminated status never processes any more lifecycle events even if the data source sends more valid data (0016-PFUT-009)
- Lifecycle events are processed atomically as soon as they are triggered, i.e. the above condition always holds even for two or more transactions arriving at effectively the same time - only the transaction that is sequenced first triggers final settlement (0016-PFUT-010)
- Once a market is finally settled, the mark price is equal to the settlement data and this is exposed on event bus and market data APIs (0016-PFUT-011)
- Assure settment-at-expiry.feature executes correctly (0016-PFUT-012)
Optional parameters:
- Attempt to specify a
max_price
of0
fails. (0016-PFUT-013) - When
max_price
is specified, an order with aprice > max_price
gets rejected. (0016-PFUT-014) - When
max_price
is specified and the reference of a pegged sell order moves so that the implied order price is higher thanmax_price
the implied order price gets capped at.max_price
(0016-PFUT-015) - When
max_price
is specified and market is setup to use oracle based mark price and the value received from oracle is less thanmax_price
then it gets used as is and mark-to-market flows are calculated according to that price. (0016-PFUT-016) - When
max_price
is specified and the market is setup to use oracle based mark price and the value received from oracle is greater thanmax_price
then it gets ignored and mark-to-market settlement doesn't occur until a mark price candidate within the[0, max_price]
range arrives. (0016-PFUT-017) - When
max_price
is specified andbinary_settlement
flag is set tofalse
, and the final settlement price candidate received from the oracle is less than or equal tomax_price
then it gets used as is and the final cashflows are calculated according to that price. (0016-PFUT-018) - When
max_price
is specified and the final settlement price candidate received from the oracle is greater thanmax_price
the value gets ignored, next a value equal tomax_price
comes in from the settlement oracle and market settles correctly. The market behaves in this way irrespective of howbinary_settlement
flag is set. (0016-PFUT-019) - When
max_price
is specified, thebinary_settlement
flag is set totrue
and the final settlement price candidate received from the oracle is greater than0
and less thanmax_price
the value gets ignored, next a value of0
comes in from the settlement oracle and market settles correctly. (0016-PFUT-020) - When
max_price
is specified and the market is ran in a fully-collateralised mode and it has parties with open positions settling it at a price ofmax_price
works correctly and the sum of all final settlement cashflows equals 0 (loss socialisation does not happen). Assuming general account balances of all parties were0
after opening the positions and all of their funds were in the margin accounts: long parties end up with balances equal toposition size * max_price
and short parties end up with0
balances. (0016-PFUT-021) - When
max_price
is specified and the market is ran in a fully-collateralised mode and it has parties with open positions settling it at a price of0
works correctly and the sum of all final settlement cashflows equals 0 (loss socialisation does not happen). Assuming general account balances of all parties were0
after opening the positions and all of their funds were in the margin accounts: short parties end up with balances equal toabs(position size) * max_price
and long parties end up with0
balances. (0016-PFUT-022) - When
max_price
is specified and the market is ran in a fully-collateralised mode and a party opens a long position at amax_price
, no closeout happens when mark to market settlement is carried out at a price of0
. (0016-PFUT-023) - When
max_price
is specified and the market is ran in a fully-collateralised mode and a party opens a short position at a price of0
, no closeout happens when mark to market settlement is carried out at amax_price
. (0016-PFUT-024) - Futures market can be created without specifying any of the optional paramters. (0016-PFUT-025)
- Futures market can be created with a with hardcoded risk factors. (0016-PFUT-026)
- Updating a risk model on a futures market with regular risk model to with hardcoded risk factors results in recalculation of all margin levels in line with hardcoded values and collateral search/release where appropriate. (0016-PFUT-027)
- Updating a risk model on a futures market with hardcoded risk factors to a regular risk model results in recalculation of all margin levels in line with the specified risk model (hardcoded value are no longer used) and collateral search/release where appropriate. (0016-PFUT-028)