Class Order
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:
-
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 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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLegsItem(OrderLeg legsItem) assetClass(AssetClass assetClass) canceledAt(OffsetDateTime canceledAt) clientOrderId(String clientOrderId) createdAt(OffsetDateTime createdAt) booleanexpiredAt(OffsetDateTime expiredAt) expiresAt(OffsetDateTime expiresAt) extendedHours(Boolean extendedHours) failedAt(OffsetDateTime failedAt) filledAt(OffsetDateTime filledAt) filledAvgPrice(String filledAvgPrice) static OrderCreate an instance of Order given an JSON stringReturn the additional (undeclared) property.Return the additional (undeclared) property with the specified name.Get assetClassAsset ID (For options this represents the option contract ID)Get canceledAtClient unique order IDGet createdAtGet expiredAtGet expiresAtIf true, eligible for execution outside regular trading hours.Get failedAtGet filledAtFilled average priceFilled quantitygetHwm()The highest (lowest) market price seen since the trailing stop order was submitted.getId()Order IDgetLegs()When querying non-simple order_class orders in a nested style, an array of Order entities associated with this order.Limit priceOrdered notional amount.Get orderClassDeprecated.Get positionIntentgetQty()Ordered quantity.The proportional quantity of this leg in relation to the overall multi-leg order quantity.Get replacedAtThe order ID that this order was replaced byThe order ID that this order replacesgetSide()Get sideGet statusStop priceGet submittedAtAsset symbol, required for all order classes except for `mleg`Get timeInForceThe percent value away from the high water mark for trailing stop orders.The dollar value away from the high water mark for trailing stop orders.getType()Get typeGet updatedAtinthashCode()limitPrice(String limitPrice) orderClass(OrderClass orderClass) Deprecated.positionIntent(PositionIntent positionIntent) putAdditionalProperty(String key, Object value) Set the additional (undeclared) property with the specified name and value.ratioQty(BigDecimal ratioQty) replacedAt(OffsetDateTime replacedAt) replacedBy(UUID replacedBy) voidsetAssetClass(AssetClass assetClass) voidsetAssetId(UUID assetId) voidsetCanceledAt(OffsetDateTime canceledAt) voidsetClientOrderId(String clientOrderId) voidsetCreatedAt(OffsetDateTime createdAt) voidsetExpiredAt(OffsetDateTime expiredAt) voidsetExpiresAt(OffsetDateTime expiresAt) voidsetExtendedHours(Boolean extendedHours) voidsetFailedAt(OffsetDateTime failedAt) voidsetFilledAt(OffsetDateTime filledAt) voidsetFilledAvgPrice(String filledAvgPrice) voidsetFilledQty(String filledQty) voidvoidvoidvoidsetLimitPrice(String limitPrice) voidsetNotional(String notional) voidsetOrderClass(OrderClass orderClass) voidsetOrderType(String orderType) Deprecated.voidsetPositionIntent(PositionIntent positionIntent) voidvoidsetRatioQty(BigDecimal ratioQty) voidsetReplacedAt(OffsetDateTime replacedAt) voidsetReplacedBy(UUID replacedBy) voidsetReplaces(UUID replaces) voidvoidsetStatus(OrderStatus status) voidsetStopPrice(String stopPrice) voidsetSubmittedAt(OffsetDateTime submittedAt) voidvoidsetTimeInForce(TimeInForce timeInForce) voidsetTrailPercent(String trailPercent) voidsetTrailPrice(String trailPrice) voidvoidsetUpdatedAt(OffsetDateTime updatedAt) status(OrderStatus status) submittedAt(OffsetDateTime submittedAt) timeInForce(TimeInForce timeInForce) toJson()Convert an instance of Order to an JSON stringtoString()trailPercent(String trailPercent) trailPrice(String trailPrice) updatedAt(OffsetDateTime updatedAt) static voidvalidateJsonElement(com.google.gson.JsonElement jsonElement) Validates the JSON Element and throws an exception if issues found
-
Field Details
-
SERIALIZED_NAME_ASSET_CLASS
- See Also:
-
SERIALIZED_NAME_ASSET_ID
- See Also:
-
SERIALIZED_NAME_CANCELED_AT
- See Also:
-
SERIALIZED_NAME_CLIENT_ORDER_ID
- See Also:
-
SERIALIZED_NAME_CREATED_AT
- See Also:
-
SERIALIZED_NAME_EXPIRED_AT
- See Also:
-
SERIALIZED_NAME_EXPIRES_AT
- See Also:
-
SERIALIZED_NAME_EXTENDED_HOURS
- See Also:
-
SERIALIZED_NAME_FAILED_AT
- See Also:
-
SERIALIZED_NAME_FILLED_AT
- See Also:
-
SERIALIZED_NAME_FILLED_AVG_PRICE
- See Also:
-
SERIALIZED_NAME_FILLED_QTY
- See Also:
-
SERIALIZED_NAME_HWM
- See Also:
-
SERIALIZED_NAME_ID
- See Also:
-
SERIALIZED_NAME_LEGS
- See Also:
-
SERIALIZED_NAME_LIMIT_PRICE
- See Also:
-
SERIALIZED_NAME_NOTIONAL
- See Also:
-
SERIALIZED_NAME_ORDER_CLASS
- See Also:
-
SERIALIZED_NAME_ORDER_TYPE
- See Also:
-
SERIALIZED_NAME_POSITION_INTENT
- See Also:
-
SERIALIZED_NAME_QTY
- See Also:
-
SERIALIZED_NAME_RATIO_QTY
- See Also:
-
SERIALIZED_NAME_REPLACED_AT
- See Also:
-
SERIALIZED_NAME_REPLACED_BY
- See Also:
-
SERIALIZED_NAME_REPLACES
- See Also:
-
SERIALIZED_NAME_SIDE
- See Also:
-
SERIALIZED_NAME_STATUS
- See Also:
-
SERIALIZED_NAME_STOP_PRICE
- See Also:
-
SERIALIZED_NAME_SUBMITTED_AT
- See Also:
-
SERIALIZED_NAME_SYMBOL
- See Also:
-
SERIALIZED_NAME_TIME_IN_FORCE
- See Also:
-
SERIALIZED_NAME_TRAIL_PERCENT
- See Also:
-
SERIALIZED_NAME_TRAIL_PRICE
- See Also:
-
SERIALIZED_NAME_TYPE
- See Also:
-
SERIALIZED_NAME_UPDATED_AT
- See Also:
-
openapiFields
-
openapiRequiredFields
-
-
Constructor Details
-
Order
public Order()
-
-
Method Details
-
assetClass
-
getAssetClass
Get assetClass- Returns:
- assetClass
-
setAssetClass
-
assetId
-
getAssetId
Asset ID (For options this represents the option contract ID)- Returns:
- assetId
-
setAssetId
-
canceledAt
-
getCanceledAt
Get canceledAt- Returns:
- canceledAt
-
setCanceledAt
-
clientOrderId
-
getClientOrderId
Client unique order ID- Returns:
- clientOrderId
-
setClientOrderId
-
createdAt
-
getCreatedAt
Get createdAt- Returns:
- createdAt
-
setCreatedAt
-
expiredAt
-
getExpiredAt
Get expiredAt- Returns:
- expiredAt
-
setExpiredAt
-
expiresAt
-
getExpiresAt
Get expiresAt- Returns:
- expiresAt
-
setExpiresAt
-
extendedHours
-
getExtendedHours
If true, eligible for execution outside regular trading hours.- Returns:
- extendedHours
-
setExtendedHours
-
failedAt
-
getFailedAt
Get failedAt- Returns:
- failedAt
-
setFailedAt
-
filledAt
-
getFilledAt
Get filledAt- Returns:
- filledAt
-
setFilledAt
-
filledAvgPrice
-
getFilledAvgPrice
Filled average price- Returns:
- filledAvgPrice
-
setFilledAvgPrice
-
filledQty
-
getFilledQty
Filled quantity- Returns:
- filledQty
-
setFilledQty
-
hwm
-
getHwm
The highest (lowest) market price seen since the trailing stop order was submitted.- Returns:
- hwm
-
setHwm
-
id
-
getId
Order ID- Returns:
- id
-
setId
-
legs
-
addLegsItem
-
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
-
limitPrice
-
getLimitPrice
Limit price- Returns:
- limitPrice
-
setLimitPrice
-
notional
-
getNotional
Ordered notional amount. If entered, qty will be null. Can take up to 9 decimal points.- Returns:
- notional
-
setNotional
-
orderClass
-
getOrderClass
Get orderClass- Returns:
- orderClass
-
setOrderClass
-
orderType
Deprecated. -
getOrderType
Deprecated.Deprecated in favour of the field \"type\"- Returns:
- orderType
-
setOrderType
Deprecated. -
positionIntent
-
getPositionIntent
Get positionIntent- Returns:
- positionIntent
-
setPositionIntent
-
qty
-
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
-
ratioQty
-
getRatioQty
The proportional quantity of this leg in relation to the overall multi-leg order quantity.- Returns:
- ratioQty
-
setRatioQty
-
replacedAt
-
getReplacedAt
Get replacedAt- Returns:
- replacedAt
-
setReplacedAt
-
replacedBy
-
getReplacedBy
The order ID that this order was replaced by- Returns:
- replacedBy
-
setReplacedBy
-
replaces
-
getReplaces
The order ID that this order replaces- Returns:
- replaces
-
setReplaces
-
side
-
getSide
Get side- Returns:
- side
-
setSide
-
status
-
getStatus
Get status- Returns:
- status
-
setStatus
-
stopPrice
-
getStopPrice
Stop price- Returns:
- stopPrice
-
setStopPrice
-
submittedAt
-
getSubmittedAt
Get submittedAt- Returns:
- submittedAt
-
setSubmittedAt
-
symbol
-
getSymbol
Asset symbol, required for all order classes except for `mleg`- Returns:
- symbol
-
setSymbol
-
timeInForce
-
getTimeInForce
Get timeInForce- Returns:
- timeInForce
-
setTimeInForce
-
trailPercent
-
getTrailPercent
The percent value away from the high water mark for trailing stop orders.- Returns:
- trailPercent
-
setTrailPercent
-
trailPrice
-
getTrailPrice
The dollar value away from the high water mark for trailing stop orders.- Returns:
- trailPrice
-
setTrailPrice
-
type
-
getType
Get type- Returns:
- type
-
setType
-
updatedAt
-
getUpdatedAt
Get updatedAt- Returns:
- updatedAt
-
setUpdatedAt
-
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 Order 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 Order
-
fromJson
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
Convert an instance of Order to an JSON string- Returns:
- JSON string
-