Record Class TradeUpdate

java.lang.Object
java.lang.Record
markets.alpaca.client.ws.model.TradeUpdate
Record Components:
event - order lifecycle event type
executionId - unique execution ID (present on fill events)
price - average fill price (fill and partial_fill events)
qty - filled quantity for this event (fill and partial_fill events)
positionQty - total position size after this event in shares (fill and partial_fill)
timestamp - event timestamp (fill, partial_fill, canceled, expired, replaced, rejected)
order - the full order entity

public record TradeUpdate(String event, String executionId, String price, String qty, String positionQty, String timestamp, Order order) extends Record
An order lifecycle event for the authenticated account.

Emitted for every state change on an order. All events include an event type and the full order object. Fill events also carry price, qty, and positionQty. Cancellation, expiry, and replacement events include a timestamp.

Common event types: new, fill, partial_fill, canceled, expired, replaced, rejected, pending_new, etc.

  • Constructor Details

    • TradeUpdate

      public TradeUpdate(String event, String executionId, String price, String qty, String positionQty, String timestamp, Order order)
      Creates an instance of a TradeUpdate record class.
      Parameters:
      event - the value for the event record component
      executionId - the value for the executionId record component
      price - the value for the price record component
      qty - the value for the qty record component
      positionQty - the value for the positionQty record component
      timestamp - the value for the timestamp record component
      order - the value for the order 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • event

      @SerializedName("event") public String event()
      Returns the value of the event record component.
      Returns:
      the value of the event record component
    • executionId

      @SerializedName("execution_id") public String executionId()
      Returns the value of the executionId record component.
      Returns:
      the value of the executionId record component
    • price

      @SerializedName("price") public String price()
      Returns the value of the price record component.
      Returns:
      the value of the price record component
    • qty

      @SerializedName("qty") public String qty()
      Returns the value of the qty record component.
      Returns:
      the value of the qty record component
    • positionQty

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

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

      @SerializedName("order") public Order order()
      Returns the value of the order record component.
      Returns:
      the value of the order record component