java.lang.Object
markets.alpaca.client.openapi.trading.model.Order
All Implemented Interfaces:
Serializable

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.23.0") public class Order extends Object implements Serializable
The Orders API allows a user to monitor, place and cancel their orders with Alpaca. Each order has a unique identifier provided by the client. This client-side unique order ID will be automatically generated by the system if not provided by the client, and will be returned as part of the order object along with the rest of the fields described below. Once an order is placed, it can be queried using the client-side order ID to check the status. Updates on open orders at Alpaca will also be sent over the streaming interface, which is the recommended method of maintaining order state.
See Also:
  • Field Details

  • Constructor Details

    • Order

      public Order()
  • Method Details

    • assetClass

      public Order assetClass(@Nullable AssetClass assetClass)
    • getAssetClass

      @Nullable public AssetClass getAssetClass()
      Get assetClass
      Returns:
      assetClass
    • setAssetClass

      public void setAssetClass(@Nullable AssetClass assetClass)
    • assetId

      public Order assetId(@Nullable UUID assetId)
    • getAssetId

      @Nullable public UUID getAssetId()
      Asset ID (For options this represents the option contract ID)
      Returns:
      assetId
    • setAssetId

      public void setAssetId(@Nullable UUID assetId)
    • canceledAt

      public Order canceledAt(@Nullable OffsetDateTime canceledAt)
    • getCanceledAt

      @Nullable public OffsetDateTime getCanceledAt()
      Get canceledAt
      Returns:
      canceledAt
    • setCanceledAt

      public void setCanceledAt(@Nullable OffsetDateTime canceledAt)
    • clientOrderId

      public Order clientOrderId(@Nullable String clientOrderId)
    • getClientOrderId

      @Nullable public String getClientOrderId()
      Client unique order ID
      Returns:
      clientOrderId
    • setClientOrderId

      public void setClientOrderId(@Nullable String clientOrderId)
    • createdAt

      public Order createdAt(@Nullable OffsetDateTime createdAt)
    • getCreatedAt

      @Nullable public OffsetDateTime getCreatedAt()
      Get createdAt
      Returns:
      createdAt
    • setCreatedAt

      public void setCreatedAt(@Nullable OffsetDateTime createdAt)
    • expiredAt

      public Order expiredAt(@Nullable OffsetDateTime expiredAt)
    • getExpiredAt

      @Nullable public OffsetDateTime getExpiredAt()
      Get expiredAt
      Returns:
      expiredAt
    • setExpiredAt

      public void setExpiredAt(@Nullable OffsetDateTime expiredAt)
    • expiresAt

      public Order expiresAt(@Nullable OffsetDateTime expiresAt)
    • getExpiresAt

      @Nullable public OffsetDateTime getExpiresAt()
      Get expiresAt
      Returns:
      expiresAt
    • setExpiresAt

      public void setExpiresAt(@Nullable OffsetDateTime expiresAt)
    • extendedHours

      public Order extendedHours(@Nullable Boolean extendedHours)
    • getExtendedHours

      @Nullable public Boolean getExtendedHours()
      If true, eligible for execution outside regular trading hours.
      Returns:
      extendedHours
    • setExtendedHours

      public void setExtendedHours(@Nullable Boolean extendedHours)
    • failedAt

      public Order failedAt(@Nullable OffsetDateTime failedAt)
    • getFailedAt

      @Nullable public OffsetDateTime getFailedAt()
      Get failedAt
      Returns:
      failedAt
    • setFailedAt

      public void setFailedAt(@Nullable OffsetDateTime failedAt)
    • filledAt

      public Order filledAt(@Nullable OffsetDateTime filledAt)
    • getFilledAt

      @Nullable public OffsetDateTime getFilledAt()
      Get filledAt
      Returns:
      filledAt
    • setFilledAt

      public void setFilledAt(@Nullable OffsetDateTime filledAt)
    • filledAvgPrice

      public Order filledAvgPrice(@Nullable String filledAvgPrice)
    • getFilledAvgPrice

      @Nullable public String getFilledAvgPrice()
      Filled average price
      Returns:
      filledAvgPrice
    • setFilledAvgPrice

      public void setFilledAvgPrice(@Nullable String filledAvgPrice)
    • filledQty

      public Order filledQty(@Nullable String filledQty)
    • getFilledQty

      @Nullable public String getFilledQty()
      Filled quantity
      Returns:
      filledQty
    • setFilledQty

      public void setFilledQty(@Nullable String filledQty)
    • hwm

      public Order hwm(@Nullable String hwm)
    • getHwm

      @Nullable public String getHwm()
      The highest (lowest) market price seen since the trailing stop order was submitted.
      Returns:
      hwm
    • setHwm

      public void setHwm(@Nullable String hwm)
    • id

      public Order id(@Nullable UUID id)
    • getId

      @Nullable public UUID getId()
      Order ID
      Returns:
      id
    • setId

      public void setId(@Nullable UUID id)
    • legs

      public Order legs(@Nullable List<OrderLeg> legs)
    • addLegsItem

      public Order addLegsItem(OrderLeg legsItem)
    • getLegs

      @Nullable public List<OrderLeg> getLegs()
      When querying non-simple order_class orders in a nested style, an array of Order entities associated with this order. Otherwise, null. Required if order class is `mleg`.
      Returns:
      legs
    • setLegs

      public void setLegs(@Nullable List<OrderLeg> legs)
    • limitPrice

      public Order limitPrice(@Nullable String limitPrice)
    • getLimitPrice

      @Nullable public String getLimitPrice()
      Limit price
      Returns:
      limitPrice
    • setLimitPrice

      public void setLimitPrice(@Nullable String limitPrice)
    • notional

      public Order notional(@Nullable String notional)
    • getNotional

      @Nullable public String getNotional()
      Ordered notional amount. If entered, qty will be null. Can take up to 9 decimal points.
      Returns:
      notional
    • setNotional

      public void setNotional(@Nullable String notional)
    • orderClass

      public Order orderClass(@Nullable OrderClass orderClass)
    • getOrderClass

      @Nullable public OrderClass getOrderClass()
      Get orderClass
      Returns:
      orderClass
    • setOrderClass

      public void setOrderClass(@Nullable OrderClass orderClass)
    • orderType

      @Deprecated public Order orderType(@Nullable String orderType)
      Deprecated.
    • getOrderType

      @Deprecated @Nullable public String getOrderType()
      Deprecated.
      Deprecated in favour of the field \"type\"
      Returns:
      orderType
    • setOrderType

      @Deprecated public void setOrderType(@Nullable String orderType)
      Deprecated.
    • positionIntent

      public Order positionIntent(@Nullable PositionIntent positionIntent)
    • getPositionIntent

      @Nullable public PositionIntent getPositionIntent()
      Get positionIntent
      Returns:
      positionIntent
    • setPositionIntent

      public void setPositionIntent(@Nullable PositionIntent positionIntent)
    • qty

      public Order qty(@Nullable String qty)
    • getQty

      @Nullable public String getQty()
      Ordered quantity. If entered, notional will be null. Can take up to 9 decimal points. Required if order class is `mleg`.
      Returns:
      qty
    • setQty

      public void setQty(@Nullable String qty)
    • ratioQty

      public Order ratioQty(@Nullable BigDecimal ratioQty)
    • getRatioQty

      @Nullable public BigDecimal getRatioQty()
      The proportional quantity of this leg in relation to the overall multi-leg order quantity.
      Returns:
      ratioQty
    • setRatioQty

      public void setRatioQty(@Nullable BigDecimal ratioQty)
    • replacedAt

      public Order replacedAt(@Nullable OffsetDateTime replacedAt)
    • getReplacedAt

      @Nullable public OffsetDateTime getReplacedAt()
      Get replacedAt
      Returns:
      replacedAt
    • setReplacedAt

      public void setReplacedAt(@Nullable OffsetDateTime replacedAt)
    • replacedBy

      public Order replacedBy(@Nullable UUID replacedBy)
    • getReplacedBy

      @Nullable public UUID getReplacedBy()
      The order ID that this order was replaced by
      Returns:
      replacedBy
    • setReplacedBy

      public void setReplacedBy(@Nullable UUID replacedBy)
    • replaces

      public Order replaces(@Nullable UUID replaces)
    • getReplaces

      @Nullable public UUID getReplaces()
      The order ID that this order replaces
      Returns:
      replaces
    • setReplaces

      public void setReplaces(@Nullable UUID replaces)
    • side

      public Order side(@Nullable OrderSide side)
    • getSide

      @Nullable public OrderSide getSide()
      Get side
      Returns:
      side
    • setSide

      public void setSide(@Nullable OrderSide side)
    • status

      public Order status(@Nullable OrderStatus status)
    • getStatus

      @Nullable public OrderStatus getStatus()
      Get status
      Returns:
      status
    • setStatus

      public void setStatus(@Nullable OrderStatus status)
    • stopPrice

      public Order stopPrice(@Nullable String stopPrice)
    • getStopPrice

      @Nullable public String getStopPrice()
      Stop price
      Returns:
      stopPrice
    • setStopPrice

      public void setStopPrice(@Nullable String stopPrice)
    • submittedAt

      public Order submittedAt(@Nullable OffsetDateTime submittedAt)
    • getSubmittedAt

      @Nullable public OffsetDateTime getSubmittedAt()
      Get submittedAt
      Returns:
      submittedAt
    • setSubmittedAt

      public void setSubmittedAt(@Nullable OffsetDateTime submittedAt)
    • symbol

      public Order symbol(@Nullable String symbol)
    • getSymbol

      @Nullable public String getSymbol()
      Asset symbol, required for all order classes except for `mleg`
      Returns:
      symbol
    • setSymbol

      public void setSymbol(@Nullable String symbol)
    • timeInForce

      public Order timeInForce(@Nonnull TimeInForce timeInForce)
    • getTimeInForce

      @Nonnull public TimeInForce getTimeInForce()
      Get timeInForce
      Returns:
      timeInForce
    • setTimeInForce

      public void setTimeInForce(@Nonnull TimeInForce timeInForce)
    • trailPercent

      public Order trailPercent(@Nullable String trailPercent)
    • getTrailPercent

      @Nullable public String getTrailPercent()
      The percent value away from the high water mark for trailing stop orders.
      Returns:
      trailPercent
    • setTrailPercent

      public void setTrailPercent(@Nullable String trailPercent)
    • trailPrice

      public Order trailPrice(@Nullable String trailPrice)
    • getTrailPrice

      @Nullable public String getTrailPrice()
      The dollar value away from the high water mark for trailing stop orders.
      Returns:
      trailPrice
    • setTrailPrice

      public void setTrailPrice(@Nullable String trailPrice)
    • type

      public Order type(@Nonnull OrderType type)
    • getType

      @Nonnull public OrderType getType()
      Get type
      Returns:
      type
    • setType

      public void setType(@Nonnull OrderType type)
    • updatedAt

      public Order updatedAt(@Nullable OffsetDateTime updatedAt)
    • getUpdatedAt

      @Nullable public OffsetDateTime getUpdatedAt()
      Get updatedAt
      Returns:
      updatedAt
    • setUpdatedAt

      public void setUpdatedAt(@Nullable OffsetDateTime updatedAt)
    • putAdditionalProperty

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

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

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