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:
  • Field Details

  • Constructor Details

    • Position

      public Position()
  • Method Details

    • assetClass

      public Position assetClass(@Nonnull AssetClass assetClass)
    • getAssetClass

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

      public void setAssetClass(@Nonnull AssetClass assetClass)
    • assetId

      public Position assetId(@Nonnull UUID assetId)
    • getAssetId

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

      public void setAssetId(@Nonnull UUID assetId)
    • assetMarginable

      public Position assetMarginable(@Nonnull Boolean assetMarginable)
    • getAssetMarginable

      @Nonnull public Boolean getAssetMarginable()
      Get assetMarginable
      Returns:
      assetMarginable
    • setAssetMarginable

      public void setAssetMarginable(@Nonnull Boolean assetMarginable)
    • avgEntryPrice

      public Position avgEntryPrice(@Nonnull String avgEntryPrice)
    • getAvgEntryPrice

      @Nonnull public String getAvgEntryPrice()
      Average entry price of the position
      Returns:
      avgEntryPrice
    • setAvgEntryPrice

      public void setAvgEntryPrice(@Nonnull String avgEntryPrice)
    • avgEntrySwapRate

      public Position avgEntrySwapRate(@Nullable BigDecimal avgEntrySwapRate)
    • getAvgEntrySwapRate

      @Nullable public BigDecimal getAvgEntrySwapRate()
      The weighted-average exchange rate at the time the position was entered.
      Returns:
      avgEntrySwapRate
    • setAvgEntrySwapRate

      public void setAvgEntrySwapRate(@Nullable BigDecimal avgEntrySwapRate)
    • changeToday

      public Position changeToday(@Nonnull String changeToday)
    • getChangeToday

      @Nonnull public String getChangeToday()
      Percent change from last day price (by a factor of 1)
      Returns:
      changeToday
    • setChangeToday

      public void setChangeToday(@Nonnull String changeToday)
    • costBasis

      public Position costBasis(@Nonnull String costBasis)
    • getCostBasis

      @Nonnull public String getCostBasis()
      Total cost basis in dollar
      Returns:
      costBasis
    • setCostBasis

      public void setCostBasis(@Nonnull String costBasis)
    • currentPrice

      public Position currentPrice(@Nonnull String currentPrice)
    • getCurrentPrice

      @Nonnull public String getCurrentPrice()
      Current asset price per share
      Returns:
      currentPrice
    • setCurrentPrice

      public void setCurrentPrice(@Nonnull String currentPrice)
    • exchange

      public Position exchange(@Nonnull ExchangeForPosition exchange)
    • getExchange

      @Nonnull public ExchangeForPosition getExchange()
      Get exchange
      Returns:
      exchange
    • setExchange

      public void setExchange(@Nonnull ExchangeForPosition exchange)
    • lastdayPrice

      public Position lastdayPrice(@Nonnull String lastdayPrice)
    • getLastdayPrice

      @Nonnull public String getLastdayPrice()
      Last day's asset price per share based on the closing value of the last trading day
      Returns:
      lastdayPrice
    • setLastdayPrice

      public void setLastdayPrice(@Nonnull String lastdayPrice)
    • marketValue

      public Position marketValue(@Nonnull String marketValue)
    • getMarketValue

      @Nonnull public String getMarketValue()
      Total dollar amount of the position
      Returns:
      marketValue
    • setMarketValue

      public void setMarketValue(@Nonnull String marketValue)
    • prevSwapRate

      public Position prevSwapRate(@Nullable BigDecimal prevSwapRate)
    • getPrevSwapRate

      @Nullable public BigDecimal getPrevSwapRate()
      The exchange rate as of the previous close (i.e. yesterday's rate)
      Returns:
      prevSwapRate
    • setPrevSwapRate

      public void setPrevSwapRate(@Nullable BigDecimal prevSwapRate)
    • qty

      public Position qty(@Nonnull String qty)
    • getQty

      @Nonnull public String getQty()
      The number of shares
      Returns:
      qty
    • setQty

      public void setQty(@Nonnull String qty)
    • qtyAvailable

      public Position qtyAvailable(@Nullable String qtyAvailable)
    • getQtyAvailable

      @Nullable public String getQtyAvailable()
      Total number of shares available minus open orders / locked for options covered call
      Returns:
      qtyAvailable
    • setQtyAvailable

      public void setQtyAvailable(@Nullable String qtyAvailable)
    • side

      public Position side(@Nonnull Position.SideEnum side)
    • getSide

      @Nonnull public Position.SideEnum getSide()
      long
      Returns:
      side
    • setSide

      public void setSide(@Nonnull Position.SideEnum side)
    • swapRate

      public Position swapRate(@Nullable BigDecimal swapRate)
    • getSwapRate

      @Nullable public BigDecimal 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

      public void setSwapRate(@Nullable BigDecimal swapRate)
    • symbol

      public Position symbol(@Nonnull String symbol)
    • getSymbol

      @Nonnull public String getSymbol()
      Symbol name of the asset
      Returns:
      symbol
    • setSymbol

      public void setSymbol(@Nonnull String symbol)
    • unrealizedIntradayPl

      public Position unrealizedIntradayPl(@Nonnull String unrealizedIntradayPl)
    • getUnrealizedIntradayPl

      @Nonnull public String getUnrealizedIntradayPl()
      Unrealized profit/loss in dollars for the day
      Returns:
      unrealizedIntradayPl
    • setUnrealizedIntradayPl

      public void setUnrealizedIntradayPl(@Nonnull String unrealizedIntradayPl)
    • unrealizedIntradayPlpc

      public Position unrealizedIntradayPlpc(@Nonnull String unrealizedIntradayPlpc)
    • getUnrealizedIntradayPlpc

      @Nonnull public String getUnrealizedIntradayPlpc()
      Unrealized profit/loss percent (by a factor of 1)
      Returns:
      unrealizedIntradayPlpc
    • setUnrealizedIntradayPlpc

      public void setUnrealizedIntradayPlpc(@Nonnull String unrealizedIntradayPlpc)
    • unrealizedPl

      public Position unrealizedPl(@Nonnull String unrealizedPl)
    • getUnrealizedPl

      @Nonnull public String getUnrealizedPl()
      Unrealized profit/loss in dollars
      Returns:
      unrealizedPl
    • setUnrealizedPl

      public void setUnrealizedPl(@Nonnull String unrealizedPl)
    • unrealizedPlpc

      public Position unrealizedPlpc(@Nonnull String unrealizedPlpc)
    • getUnrealizedPlpc

      @Nonnull public String getUnrealizedPlpc()
      Unrealized profit/loss percent (by a factor of 1)
      Returns:
      unrealizedPlpc
    • setUnrealizedPlpc

      public void setUnrealizedPlpc(@Nonnull String unrealizedPlpc)
    • usd

      public Position usd(@Nullable USDPositionValues usd)
    • getUsd

      @Nullable public USDPositionValues getUsd()
      Get usd
      Returns:
      usd
    • setUsd

      public void setUsd(@Nullable USDPositionValues usd)
    • putAdditionalProperty

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

      public static Position fromJson(String jsonString) throws IOException
      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

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