Class TradeUpdateEvent

java.lang.Object
markets.alpaca.client.openapi.broker.model.TradeUpdateEvent
All Implemented Interfaces:
Serializable

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.23.0") public class TradeUpdateEvent extends Object implements Serializable
Represents an update to an order/trade, sent over the events streaming api.
See Also:
  • Field Details

  • Constructor Details

    • TradeUpdateEvent

      public TradeUpdateEvent()
  • Method Details

    • accountId

      public TradeUpdateEvent accountId(@Nonnull UUID accountId)
    • getAccountId

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

      public void setAccountId(@Nonnull UUID accountId)
    • at

      public TradeUpdateEvent at(@Nonnull OffsetDateTime at)
    • getAt

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

      public void setAt(@Nonnull OffsetDateTime at)
    • event

      public TradeUpdateEvent event(@Nonnull TradeUpdateEventType event)
    • getEvent

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

      public void setEvent(@Nonnull TradeUpdateEventType event)
    • eventId

      public TradeUpdateEvent eventId(@Nullable Long eventId)
    • getEventId

      @Nullable public Long getEventId()
      Monotonically increasing 64-bit integer not available to new partners, and for backward compatibility purposes only; use `event_ulid` as the stable identifier where possible
      Returns:
      eventId
    • setEventId

      public void setEventId(@Nullable Long eventId)
    • eventUlid

      public TradeUpdateEvent eventUlid(@Nonnull String eventUlid)
    • getEventUlid

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

      public void setEventUlid(@Nonnull String eventUlid)
    • executionId

      public TradeUpdateEvent executionId(@Nonnull 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(@Nonnull UUID executionId)
    • order

      public TradeUpdateEvent order(@Nonnull Order order)
    • getOrder

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

      public void setOrder(@Nonnull Order order)
    • positionQty

      public TradeUpdateEvent positionQty(@Nullable 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(@Nullable String positionQty)
    • previousExecutionId

      public TradeUpdateEvent previousExecutionId(@Nullable UUID previousExecutionId)
    • getPreviousExecutionId

      @Nullable public UUID getPreviousExecutionId()
      ID of the original execution that was busted or corrected (present only in trade_bust and trade_correct events).
      Returns:
      previousExecutionId
    • setPreviousExecutionId

      public void setPreviousExecutionId(@Nullable UUID previousExecutionId)
    • price

      public TradeUpdateEvent price(@Nullable 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(@Nullable String price)
    • qty

      public TradeUpdateEvent qty(@Nullable 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(@Nullable String qty)
    • timestamp

      public TradeUpdateEvent timestamp(@Nonnull 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(@Nonnull OffsetDateTime timestamp)
    • putAdditionalProperty

      public TradeUpdateEvent putAdditionalProperty(String key, Object value)
      Set the additional (undeclared) property with the specified name and value. If the property does not already exist, create it otherwise replace it.
      Parameters:
      key - name of the property
      value - value of the property
      Returns:
      the TradeUpdateEvent instance itself
    • getAdditionalProperties

      public Map<String,Object> getAdditionalProperties()
      Return the additional (undeclared) property.
      Returns:
      a map of objects
    • getAdditionalProperty

      public Object getAdditionalProperty(String key)
      Return the additional (undeclared) property with the specified name.
      Parameters:
      key - name of the property
      Returns:
      an object
    • 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
      Validates the JSON Element and throws an exception if issues found
      Parameters:
      jsonElement - JSON Element
      Throws:
      IOException - if the JSON Element is invalid with respect to TradeUpdateEvent
    • 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