Record Class SpentOutput

java.lang.Object
java.lang.Record
com.wualabs.qtsurfer.engine.indicators.onchain.model.SpentOutput
Record Components:
valueAtCreation - USD value when the output was received
valueAtSpending - USD value when the output was spent
createdAt - timestamp when the output was created
spentAt - timestamp when the output was spent

public record SpentOutput(double valueAtCreation, double valueAtSpending, Instant createdAt, Instant spentAt) extends Record
Represents a spent transaction output (UTXO) with its USD value at creation and spending time.
  • Constructor Details

    • SpentOutput

      public SpentOutput(double valueAtCreation, double valueAtSpending, Instant createdAt, Instant spentAt)
      Creates an instance of a SpentOutput record class.
      Parameters:
      valueAtCreation - the value for the valueAtCreation record component
      valueAtSpending - the value for the valueAtSpending record component
      createdAt - the value for the createdAt record component
      spentAt - the value for the spentAt record component
  • Method Details

    • lifespan

      public Duration lifespan()
      Returns the lifespan of this output (time between creation and spending).
    • isProfitable

      public boolean isProfitable()
      Returns true if this output was spent at a profit.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • valueAtCreation

      public double valueAtCreation()
      Returns the value of the valueAtCreation record component.
      Returns:
      the value of the valueAtCreation record component
    • valueAtSpending

      public double valueAtSpending()
      Returns the value of the valueAtSpending record component.
      Returns:
      the value of the valueAtSpending record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component
    • spentAt

      public Instant spentAt()
      Returns the value of the spentAt record component.
      Returns:
      the value of the spentAt record component