Record Class Position

java.lang.Object
java.lang.Record
edu.yu.marketmaker.model.Position
Record Components:
symbol - ticker
netQuantity - positive for long, negative for short
version - monotonic per symbol
lastFillId -
All Implemented Interfaces:
Identifiable<String>, Serializable

public record Position(String symbol, int netQuantity, long version, UUID lastFillId) extends Record implements Identifiable<String>, Serializable
Authoritative net quantity held for a symbol. Object to hold position generated by the Trading State Service. A position is updated by applying recorded fills.
See Also:
  • Constructor Details

    • Position

      public Position(String symbol, int netQuantity, long version, UUID lastFillId)
      Creates an instance of a Position record class.
      Parameters:
      symbol - the value for the symbol record component
      netQuantity - the value for the netQuantity record component
      version - the value for the version record component
      lastFillId - the value for the lastFillId record component
  • Method Details

    • getId

      public String getId()
      Description copied from interface: Identifiable
      Returns the unique identifier for this entity.
      Specified by:
      getId in interface Identifiable<String>
      Returns:
      the unique key
    • 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 '=='.
      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.
    • symbol

      public String symbol()
      Returns the value of the symbol record component.
      Returns:
      the value of the symbol record component
    • netQuantity

      public int netQuantity()
      Returns the value of the netQuantity record component.
      Returns:
      the value of the netQuantity record component
    • version

      public long version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • lastFillId

      public UUID lastFillId()
      Returns the value of the lastFillId record component.
      Returns:
      the value of the lastFillId record component