Record Class DatedFutureInstrument
java.lang.Object
java.lang.Record
com.wualabs.qtsurfer.engine.core.instrument.DatedFutureInstrument
- Record Components:
base- base currency, e.g."BTC"quote- quote currency, e.g."USDT"settle- settlement currency — an asset code, never a compound tokenexpiry- delivery date, rendered into the symbol asyyMMdd
- All Implemented Interfaces:
Instrument
public record DatedFutureInstrument(@NonNull String base, @NonNull String quote, @NonNull String settle, @NonNull LocalDate expiry)
extends Record
implements Instrument
A delivery contract that expires on a fixed date:
BTC/USDT:USDT-240628.
This is the variant the rest of the model exists for. Two contracts on the same pair with different expiries trade at different prices on the same underlying, so they are different instruments — unequal, and distinct as map keys. Nothing else in the hierarchy can express that.
Prefer Instrument.of(String, String, String, java.time.LocalDate) over this
constructor. Neither accepts a null or blank component: without an expiry this is a perpetual, and
the caller has to say which one it means.
-
Constructor Summary
ConstructorsConstructorDescriptionDatedFutureInstrument(@NonNull String base, @NonNull String quote, @NonNull String settle, @NonNull LocalDate expiry) Creates an instance of aDatedFutureInstrumentrecord class. -
Method Summary
Modifier and TypeMethodDescription@NonNull Stringbase()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.@NonNull LocalDateexpiry()Returns the value of theexpiryrecord component.final inthashCode()Returns a hash code value for this object.booleanisDated()trueonly for a delivery contract with a fixed expiry.booleantruefor any contract settled in a currency — perpetual or dated.@NonNull Stringquote()Returns the value of thequoterecord component.@NonNull Stringsettle()Returns the value of thesettlerecord component.symbol()CCXT-style canonical string.toString()Returns a string representation of this record class.
-
Constructor Details
-
DatedFutureInstrument
-
-
Method Details
-
isDerivative
public boolean isDerivative()Description copied from interface:Instrumenttruefor any contract settled in a currency — perpetual or dated.- Specified by:
isDerivativein interfaceInstrument
-
isDated
public boolean isDated()Description copied from interface:Instrumenttrueonly for a delivery contract with a fixed expiry.- Specified by:
isDatedin interfaceInstrument
-
symbol
Description copied from interface:InstrumentCCXT-style canonical string. Inverse ofInstrument.parse(String).- Specified by:
symbolin interfaceInstrument
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
base
Returns the value of thebaserecord component.- Specified by:
basein interfaceInstrument- Returns:
- the value of the
baserecord component
-
quote
Returns the value of thequoterecord component.- Specified by:
quotein interfaceInstrument- Returns:
- the value of the
quoterecord component
-
settle
-
expiry
-