Class TradeUpdateEventV2

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

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

  • Constructor Details

    • TradeUpdateEventV2

      public TradeUpdateEventV2()
  • Method Details

    • accountId

      public TradeUpdateEventV2 accountId(@Nullable UUID accountId)
    • getAccountId

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

      public void setAccountId(@Nullable UUID accountId)
    • at

      public TradeUpdateEventV2 at(@Nullable OffsetDateTime at)
    • getAt

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

      public void setAt(@Nullable OffsetDateTime at)
    • event

      public TradeUpdateEventV2 event(@Nullable TradeUpdateEventType event)
    • getEvent

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

      public void setEvent(@Nullable TradeUpdateEventType event)
    • eventId

      public TradeUpdateEventV2 eventId(@Nullable String eventId)
    • getEventId

      @Nullable public String getEventId()
      lexically sortable, monotonically increasing character array
      Returns:
      eventId
    • setEventId

      public void setEventId(@Nullable String eventId)
    • executionId

      public TradeUpdateEventV2 executionId(@Nullable String executionId)
    • getExecutionId

      @Nullable public String 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. Not present for `MultilegOptions`
      Returns:
      executionId
    • setExecutionId

      public void setExecutionId(@Nullable String executionId)
    • legs

      public TradeUpdateEventV2 legs(@Nullable List<TradeUpdateEventV2Leg> legs)
    • addLegsItem

      public TradeUpdateEventV2 addLegsItem(TradeUpdateEventV2Leg legsItem)
    • getLegs

      @Nullable public List<TradeUpdateEventV2Leg> getLegs()
      Only present when event is for `MultilegOptions`. Represents filled qty/price of legs.
      Returns:
      legs
    • setLegs

      public void setLegs(@Nullable List<TradeUpdateEventV2Leg> legs)
    • order

      public TradeUpdateEventV2 order(@Nullable Order order)
    • getOrder

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

      public void setOrder(@Nullable Order order)
    • positionQty

      public TradeUpdateEventV2 positionQty(@Nullable String positionQty)
    • getPositionQty

      @Nullable public String getPositionQty()
      Only present when event is either `fill` or `partial_fill` other than `MultilegOptions`. 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)
    • positionQtys

      public TradeUpdateEventV2 positionQtys(@Nullable String positionQtys)
    • getPositionQtys

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

      public void setPositionQtys(@Nullable String positionQtys)
    • previousExecutionId

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

      @Nullable public String getQty()
      Only present when event is either `fill`, `partial_fill`, `trade_bust` and `trade_correct`. The amount of shares this Trade order was for. <br /> For `trade_bust` events, the qty field may be negative, representing a reversal of the original quantity.
      Returns:
      qty
    • setQty

      public void setQty(@Nullable String qty)
    • reason

      public TradeUpdateEventV2 reason(@Nullable String reason)
    • getReason

      @Nullable public String getReason()
      Machine-readable code that explains **why** the event occurred. Only present when a reason applies; omitted from routine lifecycle events such as `new`, `fill`, and `partial_fill`. Known values: | Value | Event(s) | Meaning | | --- | --- | --- | | `CORPORATE_ACTION` | `canceled` | Alpaca canceled the order internally because the underlying is scheduled for a mandatory corporate action other than a cash dividend (e.g. reverse split, symbol/CUSIP change, merger, liquidation). Emitted by the overnight-session lifecycle and, where enabled by Alpaca, the daytime GTC corporate-action sweep. Not emitted when the cancel is routed to the upstream venue instead (e.g. day-session, `extended_hours=false`, agency- or mixed-capacity orders); those `canceled` events carry the venue's own text in `reason` if any. | | `TOO_LATE_TO_CANCEL` | `order_cancel_rejected`, `order_replace_rejected` | The cancel or replace request arrived after the order had already reached a terminal state (typically `filled`). | | `TRADE_BUST` | `trade_bust` | Alpaca operations replayed or synthesized a bust of a previously reported execution. Busts that originate from the upstream venue surface the venue's own text in `reason` (or omit it entirely), so consumers should not rely on `TRADE_BUST` alone to identify all busts — key on the `event` field (`trade_bust`) for that. | Free-form strings may also appear in `reason`. In particular, `canceled`, `trade_bust`, and `trade_correct` events originating from the upstream venue carry the venue's own text field (when the venue provides one) rather than an Alpaca-defined code. Consumers should tolerate unknown values and, where they need to distinguish cases, key on `event` first and use `reason` as a secondary hint.
      Returns:
      reason
    • setReason

      public void setReason(@Nullable String reason)
    • settleDate

      public TradeUpdateEventV2 settleDate(@Nullable LocalDate settleDate)
    • getSettleDate

      @Nullable public LocalDate getSettleDate()
      Settlement date of the trade in format `YYYY-MM-DD` for `fill` and `partial_fill` events
      Returns:
      settleDate
    • setSettleDate

      public void setSettleDate(@Nullable LocalDate settleDate)
    • swapRate

      public TradeUpdateEventV2 swapRate(@Nullable String swapRate)
    • getSwapRate

      @Nullable public String getSwapRate()
      Only present for `local currency trading account` or `crypto asset trade` when event is either `fill` or `partial_fill`. The swap rate at which the current trade was filled.
      Returns:
      swapRate
    • setSwapRate

      public void setSwapRate(@Nullable String swapRate)
    • timestamp

      public TradeUpdateEventV2 timestamp(@Nullable OffsetDateTime timestamp)
    • getTimestamp

      @Nullable 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(@Nullable OffsetDateTime timestamp)
    • putAdditionalProperty

      public TradeUpdateEventV2 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 TradeUpdateEventV2 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 TradeUpdateEventV2
    • fromJson

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

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