Class Position
java.lang.Object
markets.alpaca.client.openapi.trading.model.Position
- All Implemented Interfaces:
Serializable
@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen",
comments="Generator version: 7.23.0")
public class Position
extends Object
implements Serializable
The positions API provides information about an account's current open positions. The response will include information such as cost basis, shares traded, and market value, which will be updated live as price information is updated. Once a position is closed, it will no longer be queryable through this API.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumlong -
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 String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassetClass(AssetClass assetClass) assetMarginable(Boolean assetMarginable) avgEntryPrice(String avgEntryPrice) avgEntrySwapRate(BigDecimal avgEntrySwapRate) changeToday(String changeToday) currentPrice(String currentPrice) booleanexchange(ExchangeForPosition exchange) static PositionCreate an instance of Position 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 assetMarginableAverage entry price of the positionThe weighted-average exchange rate at the time the position was entered.Percent change from last day price (by a factor of 1)Total cost basis in dollarCurrent asset price per shareGet exchangeLast day's asset price per share based on the closing value of the last trading dayTotal dollar amount of the positionThe exchange rate as of the previous close (i.e.getQty()The number of sharesTotal number of shares available minus open orders / locked for options covered callgetSide()longThe current exchange rate (without mark-up) used to convert local-currency position values into USD.Symbol name of the assetUnrealized profit/loss in dollars for the dayUnrealized profit/loss percent (by a factor of 1)Unrealized profit/loss in dollarsUnrealized profit/loss percent (by a factor of 1)getUsd()Get usdinthashCode()lastdayPrice(String lastdayPrice) marketValue(String marketValue) prevSwapRate(BigDecimal prevSwapRate) putAdditionalProperty(String key, Object value) Set the additional (undeclared) property with the specified name and value.qtyAvailable(String qtyAvailable) voidsetAssetClass(AssetClass assetClass) voidsetAssetId(UUID assetId) voidsetAssetMarginable(Boolean assetMarginable) voidsetAvgEntryPrice(String avgEntryPrice) voidsetAvgEntrySwapRate(BigDecimal avgEntrySwapRate) voidsetChangeToday(String changeToday) voidsetCostBasis(String costBasis) voidsetCurrentPrice(String currentPrice) voidsetExchange(ExchangeForPosition exchange) voidsetLastdayPrice(String lastdayPrice) voidsetMarketValue(String marketValue) voidsetPrevSwapRate(BigDecimal prevSwapRate) voidvoidsetQtyAvailable(String qtyAvailable) voidsetSide(Position.SideEnum side) voidsetSwapRate(BigDecimal swapRate) voidvoidsetUnrealizedIntradayPl(String unrealizedIntradayPl) voidsetUnrealizedIntradayPlpc(String unrealizedIntradayPlpc) voidsetUnrealizedPl(String unrealizedPl) voidsetUnrealizedPlpc(String unrealizedPlpc) voidsetUsd(USDPositionValues usd) side(Position.SideEnum side) swapRate(BigDecimal swapRate) toJson()Convert an instance of Position to an JSON stringtoString()unrealizedIntradayPl(String unrealizedIntradayPl) unrealizedIntradayPlpc(String unrealizedIntradayPlpc) unrealizedPl(String unrealizedPl) unrealizedPlpc(String unrealizedPlpc) usd(USDPositionValues usd) 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_ASSET_MARGINABLE
- See Also:
-
SERIALIZED_NAME_AVG_ENTRY_PRICE
- See Also:
-
SERIALIZED_NAME_AVG_ENTRY_SWAP_RATE
- See Also:
-
SERIALIZED_NAME_CHANGE_TODAY
- See Also:
-
SERIALIZED_NAME_COST_BASIS
- See Also:
-
SERIALIZED_NAME_CURRENT_PRICE
- See Also:
-
SERIALIZED_NAME_EXCHANGE
- See Also:
-
SERIALIZED_NAME_LASTDAY_PRICE
- See Also:
-
SERIALIZED_NAME_MARKET_VALUE
- See Also:
-
SERIALIZED_NAME_PREV_SWAP_RATE
- See Also:
-
SERIALIZED_NAME_QTY
- See Also:
-
SERIALIZED_NAME_QTY_AVAILABLE
- See Also:
-
SERIALIZED_NAME_SIDE
- See Also:
-
SERIALIZED_NAME_SWAP_RATE
- See Also:
-
SERIALIZED_NAME_SYMBOL
- See Also:
-
SERIALIZED_NAME_UNREALIZED_INTRADAY_PL
- See Also:
-
SERIALIZED_NAME_UNREALIZED_INTRADAY_PLPC
- See Also:
-
SERIALIZED_NAME_UNREALIZED_PL
- See Also:
-
SERIALIZED_NAME_UNREALIZED_PLPC
- See Also:
-
SERIALIZED_NAME_USD
- See Also:
-
openapiFields
-
openapiRequiredFields
-
-
Constructor Details
-
Position
public Position()
-
-
Method Details
-
assetClass
-
getAssetClass
Get assetClass- Returns:
- assetClass
-
setAssetClass
-
assetId
-
getAssetId
Asset ID (For options this represents the option contract ID)- Returns:
- assetId
-
setAssetId
-
assetMarginable
-
getAssetMarginable
Get assetMarginable- Returns:
- assetMarginable
-
setAssetMarginable
-
avgEntryPrice
-
getAvgEntryPrice
Average entry price of the position- Returns:
- avgEntryPrice
-
setAvgEntryPrice
-
avgEntrySwapRate
-
getAvgEntrySwapRate
The weighted-average exchange rate at the time the position was entered.- Returns:
- avgEntrySwapRate
-
setAvgEntrySwapRate
-
changeToday
-
getChangeToday
Percent change from last day price (by a factor of 1)- Returns:
- changeToday
-
setChangeToday
-
costBasis
-
getCostBasis
Total cost basis in dollar- Returns:
- costBasis
-
setCostBasis
-
currentPrice
-
getCurrentPrice
Current asset price per share- Returns:
- currentPrice
-
setCurrentPrice
-
exchange
-
getExchange
Get exchange- Returns:
- exchange
-
setExchange
-
lastdayPrice
-
getLastdayPrice
Last day's asset price per share based on the closing value of the last trading day- Returns:
- lastdayPrice
-
setLastdayPrice
-
marketValue
-
getMarketValue
Total dollar amount of the position- Returns:
- marketValue
-
setMarketValue
-
prevSwapRate
-
getPrevSwapRate
The exchange rate as of the previous close (i.e. yesterday's rate)- Returns:
- prevSwapRate
-
setPrevSwapRate
-
qty
-
getQty
The number of shares- Returns:
- qty
-
setQty
-
qtyAvailable
-
getQtyAvailable
Total number of shares available minus open orders / locked for options covered call- Returns:
- qtyAvailable
-
setQtyAvailable
-
side
-
getSide
long- Returns:
- side
-
setSide
-
swapRate
-
getSwapRate
The current exchange rate (without mark-up) used to convert local-currency position values into USD. Present only for LCT (Local Currency Trading) accounts- Returns:
- swapRate
-
setSwapRate
-
symbol
-
getSymbol
Symbol name of the asset- Returns:
- symbol
-
setSymbol
-
unrealizedIntradayPl
-
getUnrealizedIntradayPl
Unrealized profit/loss in dollars for the day- Returns:
- unrealizedIntradayPl
-
setUnrealizedIntradayPl
-
unrealizedIntradayPlpc
-
getUnrealizedIntradayPlpc
Unrealized profit/loss percent (by a factor of 1)- Returns:
- unrealizedIntradayPlpc
-
setUnrealizedIntradayPlpc
-
unrealizedPl
-
getUnrealizedPl
Unrealized profit/loss in dollars- Returns:
- unrealizedPl
-
setUnrealizedPl
-
unrealizedPlpc
-
getUnrealizedPlpc
Unrealized profit/loss percent (by a factor of 1)- Returns:
- unrealizedPlpc
-
setUnrealizedPlpc
-
usd
-
getUsd
Get usd- Returns:
- usd
-
setUsd
-
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 Position 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 Position
-
fromJson
Create an instance of Position given an JSON string- Parameters:
jsonString- JSON string- Returns:
- An instance of Position
- Throws:
IOException- if the JSON string is invalid with respect to Position
-
toJson
Convert an instance of Position to an JSON string- Returns:
- JSON string
-