Class TradeUpdateEvent

java.lang.Object
net.jacobpeterson.alpaca.openapi.broker.model.TradeUpdateEvent

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", date="2024-03-23T18:58:47.485165-07:00[America/Los_Angeles]") public class TradeUpdateEvent extends Object
Represents an update to an order/trade, sent over the events streaming api.
  • Field Details

  • Constructor Details

    • TradeUpdateEvent

      public TradeUpdateEvent()
  • Method Details

    • accountId

      public TradeUpdateEvent accountId(UUID accountId)
    • getAccountId

      @Nonnull public UUID getAccountId()
      Account UUID
      Returns:
      accountId
    • setAccountId

      public void setAccountId(UUID accountId)
    • at

    • getAt

      @Nonnull public OffsetDateTime getAt()
      Timestamp of event
      Returns:
      at
    • setAt

      public void setAt(OffsetDateTime at)
    • event

      public TradeUpdateEvent event(TradeUpdateEventType event)
    • getEvent

      @Nonnull public TradeUpdateEventType getEvent()
      Get event
      Returns:
      event
    • setEvent

      public void setEvent(TradeUpdateEventType event)
    • eventId

      public TradeUpdateEvent eventId(Long eventId)
    • getEventId

      @Nonnull public Long getEventId()
      Monotonically increasing 64bit integer
      Returns:
      eventId
    • setEventId

      public void setEventId(Long eventId)
    • eventUlid

      public TradeUpdateEvent eventUlid(String eventUlid)
    • getEventUlid

      @Nonnull public String getEventUlid()
      lexically sortable, monotonically increasing character array
      Returns:
      eventUlid
    • setEventUlid

      public void setEventUlid(String eventUlid)
    • executionId

      public TradeUpdateEvent executionId(UUID executionId)
    • getExecutionId

      @Nonnull public UUID getExecutionId()
      Corresponding execution of an order. If an order gets filled over two executions (a partial_fill for example), you will receive two events with different IDs.
      Returns:
      executionId
    • setExecutionId

      public void setExecutionId(UUID executionId)
    • order

      public TradeUpdateEvent order(Order order)
    • getOrder

      @Nonnull public Order getOrder()
      Get order
      Returns:
      order
    • setOrder

      public void setOrder(Order order)
    • timestamp

      public TradeUpdateEvent timestamp(OffsetDateTime timestamp)
    • getTimestamp

      @Nonnull public OffsetDateTime getTimestamp()
      Has various different meanings depending on the value of `event`, please see the [Trading Events](https://alpaca.markets/docs/api-references/broker-api/events/#trade-events) Enum in the documentation or the TradeUpdateEventType model for more details on when it means different things.
      Returns:
      timestamp
    • setTimestamp

      public void setTimestamp(OffsetDateTime timestamp)
    • price

      public TradeUpdateEvent price(String price)
    • getPrice

      @Nullable public String getPrice()
      Only present when event is either `fill` or `partial_fill`. The average price per share at which the order was filled.
      Returns:
      price
    • setPrice

      public void setPrice(String price)
    • positionQty

      public TradeUpdateEvent positionQty(String positionQty)
    • getPositionQty

      @Nullable public String getPositionQty()
      Only present when event is either `fill` or `partial_fill`. The size of your total position, after this fill event, in shares. Positive for long positions, negative for short positions.
      Returns:
      positionQty
    • setPositionQty

      public void setPositionQty(String positionQty)
    • qty

      public TradeUpdateEvent qty(String qty)
    • getQty

      @Nullable public String getQty()
      Only present when event is either `fill` or `partial_fill`. The amount of shares this Trade order was for
      Returns:
      qty
    • setQty

      public void setQty(String qty)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • validateJsonElement

      public static void validateJsonElement(com.google.gson.JsonElement jsonElement) throws IOException
      Throws:
      IOException
    • fromJson

      public static TradeUpdateEvent fromJson(String jsonString) throws IOException
      Create an instance of TradeUpdateEvent given an JSON string
      Parameters:
      jsonString - JSON string
      Returns:
      An instance of TradeUpdateEvent
      Throws:
      IOException - if the JSON string is invalid with respect to TradeUpdateEvent
    • toJson

      public String toJson()
      Convert an instance of TradeUpdateEvent to an JSON string
      Returns:
      JSON string