Record Class CryptoBar

java.lang.Object
java.lang.Record
markets.alpaca.client.ws.model.CryptoBar
Record Components:
symbol - crypto pair symbol (e.g. "BTC/USD")
open - opening price
high - highest price
low - lowest price
close - closing price
volume - volume
timestamp - RFC-3339 bar start timestamp
tradeCount - number of trades aggregated in the bar
vwap - volume-weighted average price

public record CryptoBar(String symbol, BigDecimal open, BigDecimal high, BigDecimal low, BigDecimal close, BigDecimal volume, String timestamp, int tradeCount, BigDecimal vwap) extends Record
An aggregated crypto price bar (minute, daily, or updated).

The listener method that delivers this record already identifies the bar type ( onMinuteBar, onDailyBar, or onUpdatedBar).

  • Constructor Details

    • CryptoBar

      public CryptoBar(String symbol, BigDecimal open, BigDecimal high, BigDecimal low, BigDecimal close, BigDecimal volume, String timestamp, int tradeCount, BigDecimal vwap)
      Creates an instance of a CryptoBar 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
      tradeCount - the value for the tradeCount record component
      vwap - the value for the vwap 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 BigDecimal 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
    • tradeCount

      @SerializedName("n") public int tradeCount()
      Returns the value of the tradeCount record component.
      Returns:
      the value of the tradeCount record component
    • vwap

      @SerializedName("vw") public BigDecimal vwap()
      Returns the value of the vwap record component.
      Returns:
      the value of the vwap record component