Record Class StockBar

java.lang.Object
java.lang.Record
markets.alpaca.client.ws.model.StockBar
Record Components:
symbol - ticker symbol
open - opening price
high - highest price
low - lowest price
close - closing price
volume - volume in shares
timestamp - RFC-3339 bar start timestamp

public record StockBar(String symbol, BigDecimal open, BigDecimal high, BigDecimal low, BigDecimal close, long volume, String timestamp) extends Record
An aggregated stock price bar (minute, daily, or updated).

All three bar types share the same wire format; the listener method that receives this record already indicates which type it is (onMinuteBar, onDailyBar, or onUpdatedBar).

  • Constructor Details

    • StockBar

      public StockBar(String symbol, BigDecimal open, BigDecimal high, BigDecimal low, BigDecimal close, long volume, String timestamp)
      Creates an instance of a StockBar record class.
      Parameters:
      symbol - the value for the symbol record component
      open - the value for the open record component
      high - the value for the high record component
      low - the value for the low record component
      close - the value for the close record component
      volume - the value for the volume record component
      timestamp - the value for the timestamp record component
  • Method Details

    • 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

      @SerializedName("S") public String symbol()
      Returns the value of the symbol record component.
      Returns:
      the value of the symbol record component
    • open

      @SerializedName("o") public BigDecimal open()
      Returns the value of the open record component.
      Returns:
      the value of the open record component
    • high

      @SerializedName("h") public BigDecimal high()
      Returns the value of the high record component.
      Returns:
      the value of the high record component
    • low

      @SerializedName("l") public BigDecimal low()
      Returns the value of the low record component.
      Returns:
      the value of the low record component
    • close

      @SerializedName("c") public BigDecimal close()
      Returns the value of the close record component.
      Returns:
      the value of the close record component
    • volume

      @SerializedName("v") public long volume()
      Returns the value of the volume record component.
      Returns:
      the value of the volume record component
    • timestamp

      @SerializedName("t") public String timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component