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:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLegsItem(TradeUpdateEventV2Leg legsItem) at(OffsetDateTime at) booleanevent(TradeUpdateEventType event) executionId(String executionId) static TradeUpdateEventV2Create an instance of TradeUpdateEventV2 given an JSON stringAccount UUIDReturn the additional (undeclared) property.Return the additional (undeclared) property with the specified name.getAt()Timestamp of eventgetEvent()Get eventlexically sortable, monotonically increasing character arrayCorresponding execution of an order.getLegs()Only present when event is for `MultilegOptions`.getOrder()Get orderOnly present when event is either `fill` or `partial_fill` other than `MultilegOptions`.Only present when event is either `fill` or `partial_fill` for `MultilegOptions`.ID of the original execution that was busted or corrected (present only in trade_bust and trade_correct events).getPrice()Only present when event is either `fill` or `partial_fill`.getQty()Only present when event is either `fill`, `partial_fill`, `trade_bust` and `trade_correct`.Machine-readable code that explains **why** the event occurred.Settlement date of the trade in format `YYYY-MM-DD` for `fill` and `partial_fill` eventsOnly present for `local currency trading account` or `crypto asset trade` when event is either `fill` or `partial_fill`.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.inthashCode()legs(List<TradeUpdateEventV2Leg> legs) positionQty(String positionQty) positionQtys(String positionQtys) previousExecutionId(UUID previousExecutionId) putAdditionalProperty(String key, Object value) Set the additional (undeclared) property with the specified name and value.voidsetAccountId(UUID accountId) voidsetAt(OffsetDateTime at) voidsetEvent(TradeUpdateEventType event) voidsetEventId(String eventId) voidsetExecutionId(String executionId) voidsetLegs(List<TradeUpdateEventV2Leg> legs) voidvoidsetPositionQty(String positionQty) voidsetPositionQtys(String positionQtys) voidsetPreviousExecutionId(UUID previousExecutionId) voidvoidvoidvoidsetSettleDate(LocalDate settleDate) voidsetSwapRate(String swapRate) voidsetTimestamp(OffsetDateTime timestamp) settleDate(LocalDate settleDate) timestamp(OffsetDateTime timestamp) toJson()Convert an instance of TradeUpdateEventV2 to an JSON stringtoString()static voidvalidateJsonElement(com.google.gson.JsonElement jsonElement) Validates the JSON Element and throws an exception if issues found
-
Field Details
-
SERIALIZED_NAME_ACCOUNT_ID
- See Also:
-
SERIALIZED_NAME_AT
- See Also:
-
SERIALIZED_NAME_EVENT
- See Also:
-
SERIALIZED_NAME_EVENT_ID
- See Also:
-
SERIALIZED_NAME_EXECUTION_ID
- See Also:
-
SERIALIZED_NAME_LEGS
- See Also:
-
SERIALIZED_NAME_ORDER
- See Also:
-
SERIALIZED_NAME_POSITION_QTY
- See Also:
-
SERIALIZED_NAME_POSITION_QTYS
- See Also:
-
SERIALIZED_NAME_PREVIOUS_EXECUTION_ID
- See Also:
-
SERIALIZED_NAME_PRICE
- See Also:
-
SERIALIZED_NAME_QTY
- See Also:
-
SERIALIZED_NAME_REASON
- See Also:
-
SERIALIZED_NAME_SETTLE_DATE
- See Also:
-
SERIALIZED_NAME_SWAP_RATE
- See Also:
-
SERIALIZED_NAME_TIMESTAMP
- See Also:
-
openapiFields
-
openapiRequiredFields
-
-
Constructor Details
-
TradeUpdateEventV2
public TradeUpdateEventV2()
-
-
Method Details
-
accountId
-
getAccountId
Account UUID- Returns:
- accountId
-
setAccountId
-
at
-
getAt
Timestamp of event- Returns:
- at
-
setAt
-
event
-
getEvent
Get event- Returns:
- event
-
setEvent
-
eventId
-
getEventId
lexically sortable, monotonically increasing character array- Returns:
- eventId
-
setEventId
-
executionId
-
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
-
legs
-
addLegsItem
-
getLegs
Only present when event is for `MultilegOptions`. Represents filled qty/price of legs.- Returns:
- legs
-
setLegs
-
order
-
getOrder
Get order- Returns:
- order
-
setOrder
-
positionQty
-
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
-
positionQtys
-
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
-
previousExecutionId
-
getPreviousExecutionId
ID of the original execution that was busted or corrected (present only in trade_bust and trade_correct events).- Returns:
- previousExecutionId
-
setPreviousExecutionId
-
price
-
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
-
qty
-
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
-
reason
-
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
-
settleDate
-
getSettleDate
Settlement date of the trade in format `YYYY-MM-DD` for `fill` and `partial_fill` events- Returns:
- settleDate
-
setSettleDate
-
swapRate
-
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
-
timestamp
-
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
-
putAdditionalProperty
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 propertyvalue- value of the property- Returns:
- the TradeUpdateEventV2 instance itself
-
getAdditionalProperties
Return the additional (undeclared) property.- Returns:
- a map of objects
-
getAdditionalProperty
Return the additional (undeclared) property with the specified name.- Parameters:
key- name of the property- Returns:
- an object
-
equals
-
hashCode
public int hashCode() -
toString
-
validateJsonElement
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
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
Convert an instance of TradeUpdateEventV2 to an JSON string- Returns:
- JSON string
-