Package edu.yu.marketmaker.model
Record Class Position
java.lang.Object
java.lang.Record
edu.yu.marketmaker.model.Position
- Record Components:
symbol- tickernetQuantity- positive for long, negative for shortversion- monotonic per symbollastFillId-
- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getId()Returns the unique identifier for this entity.final inthashCode()Returns a hash code value for this object.Returns the value of thelastFillIdrecord component.intReturns the value of thenetQuantityrecord component.symbol()Returns the value of thesymbolrecord component.final StringtoString()Returns a string representation of this record class.longversion()Returns the value of theversionrecord component.
-
Constructor Details
-
Position
Creates an instance of aPositionrecord class.- Parameters:
symbol- the value for thesymbolrecord componentnetQuantity- the value for thenetQuantityrecord componentversion- the value for theversionrecord componentlastFillId- the value for thelastFillIdrecord component
-
-
Method Details
-
getId
Description copied from interface:IdentifiableReturns the unique identifier for this entity.- Specified by:
getIdin interfaceIdentifiable<String>- Returns:
- the unique key
-
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. -
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. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
symbol
Returns the value of thesymbolrecord component.- Returns:
- the value of the
symbolrecord component
-
netQuantity
public int netQuantity()Returns the value of thenetQuantityrecord component.- Returns:
- the value of the
netQuantityrecord component
-
version
public long version()Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
lastFillId
Returns the value of thelastFillIdrecord component.- Returns:
- the value of the
lastFillIdrecord component
-