Class CreateOrderRequest

java.lang.Object
markets.alpaca.client.openapi.broker.model.CreateOrderRequest
All Implemented Interfaces:
Serializable

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.23.0") public class CreateOrderRequest extends Object implements Serializable
CreateOrderRequest
See Also:
  • Field Details

  • Constructor Details

    • CreateOrderRequest

      public CreateOrderRequest()
  • Method Details

    • advancedInstructions

      public CreateOrderRequest advancedInstructions(@Nullable AdvancedInstructions advancedInstructions)
    • getAdvancedInstructions

      @Nullable public AdvancedInstructions getAdvancedInstructions()
      Get advancedInstructions
      Returns:
      advancedInstructions
    • setAdvancedInstructions

      public void setAdvancedInstructions(@Nullable AdvancedInstructions advancedInstructions)
    • clientOrderId

      public CreateOrderRequest clientOrderId(@Nullable String clientOrderId)
    • getClientOrderId

      @Nullable public String getClientOrderId()
      A unique identifier for the order. Automatically generated if not sent. (<= 128 characters)
      Returns:
      clientOrderId
    • setClientOrderId

      public void setClientOrderId(@Nullable String clientOrderId)
    • commission

      public CreateOrderRequest commission(@Nullable BigDecimal commission)
    • getCommission

      @Nullable public BigDecimal getCommission()
      The commission you want to collect from the user.
      Returns:
      commission
    • setCommission

      public void setCommission(@Nullable BigDecimal commission)
    • commissionBps

      @Deprecated public CreateOrderRequest commissionBps(@Nullable BigDecimal commissionBps)
      Deprecated.
    • getCommissionBps

      @Deprecated @Nullable public BigDecimal getCommissionBps()
      Deprecated.
      **deprecated**: Please use the commission_type = bps instead and set the desired bps value in the `commission` field. The percent commission you want to charge the end user on the order (expressed in bps). Alpaca will convert the order to a notional amount for purposes of calculating commission.
      Returns:
      commissionBps
    • setCommissionBps

      @Deprecated public void setCommissionBps(@Nullable BigDecimal commissionBps)
      Deprecated.
    • commissionType

      public CreateOrderRequest commissionType(@Nullable CommissionType commissionType)
    • getCommissionType

      @Nullable public CommissionType getCommissionType()
      Get commissionType
      Returns:
      commissionType
    • setCommissionType

      public void setCommissionType(@Nullable CommissionType commissionType)
    • extendedHours

      public CreateOrderRequest extendedHours(@Nullable Boolean extendedHours)
    • getExtendedHours

      @Nullable public Boolean getExtendedHours()
      Defaults to false. If true, order will be eligible for execution in the pre-market, after-hours, and overnight sessions. Only works with type `limit` and time_in_force set to either `day` or `gtc`.
      Returns:
      extendedHours
    • setExtendedHours

      public void setExtendedHours(@Nullable Boolean extendedHours)
    • instructions

      public CreateOrderRequest instructions(@Nullable String instructions)
    • getInstructions

      @Nullable public String getInstructions()
      Get instructions
      Returns:
      instructions
    • setInstructions

      public void setInstructions(@Nullable String instructions)
    • legs

      public CreateOrderRequest legs(@Nullable List<MLegOrderLeg> legs)
    • addLegsItem

      public CreateOrderRequest addLegsItem(MLegOrderLeg legsItem)
    • getLegs

      @Nullable public List<MLegOrderLeg> getLegs()
      list of order legs (<= 4)
      Returns:
      legs
    • setLegs

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

      public CreateOrderRequest limitPrice(@Nullable BigDecimal limitPrice)
    • getLimitPrice

      @Nullable public BigDecimal getLimitPrice()
      Required if type is `limit` or `stop_limit`. - In case of `mleg`, the limit_price parameter is expressed with the following notation: - A positive value indicates a debit, representing a cost or payment to be made. - A negative value signifies a credit, reflecting an amount to be received. - In case of Fied Income, the price is expressed in percentage of par value (face value). Price is always clean price, meaning it does not include accrued interest.
      Returns:
      limitPrice
    • setLimitPrice

      public void setLimitPrice(@Nullable BigDecimal limitPrice)
    • notional

      public CreateOrderRequest notional(@Nullable BigDecimal notional)
    • getNotional

      @Nullable public BigDecimal getNotional()
      Dollar amount to trade. Cannot work with qty. Only market and limit orders supported with time_in_force = day; Only limit orders for extended hours.
      Returns:
      notional
    • setNotional

      public void setNotional(@Nullable BigDecimal notional)
    • orderClass

      public CreateOrderRequest orderClass(@Nullable OrderClass orderClass)
    • getOrderClass

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

      public void setOrderClass(@Nullable OrderClass orderClass)
    • positionIntent

      public CreateOrderRequest positionIntent(@Nullable PositionIntent positionIntent)
    • getPositionIntent

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

      public void setPositionIntent(@Nullable PositionIntent positionIntent)
    • qty

      public CreateOrderRequest qty(@Nullable BigDecimal qty)
    • getQty

      @Nullable public BigDecimal getQty()
      - For equities, the number of shares to trade. Can be fractionable for only market and day order types. - Required for `mleg` order class, represents the number of units to trade of this strategy. - For Fixed Income securities, qty represents the order size in par value (face value). For example, to place an order for 1 bond with a face value of $1,000, provide a qty of 1000.
      Returns:
      qty
    • setQty

      public void setQty(@Nullable BigDecimal qty)
    • side

      public CreateOrderRequest side(@Nullable OrderSide side)
    • getSide

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

      public void setSide(@Nullable OrderSide side)
    • source

      public CreateOrderRequest source(@Nullable String source)
    • getSource

      @Nullable public String getSource()
      Get source
      Returns:
      source
    • setSource

      public void setSource(@Nullable String source)
    • stopLoss

      public CreateOrderRequest stopLoss(@Nullable CreateOrderRequestStopLoss stopLoss)
    • getStopLoss

      @Nullable public CreateOrderRequestStopLoss getStopLoss()
      Get stopLoss
      Returns:
      stopLoss
    • setStopLoss

      public void setStopLoss(@Nullable CreateOrderRequestStopLoss stopLoss)
    • stopPrice

      public CreateOrderRequest stopPrice(@Nullable BigDecimal stopPrice)
    • getStopPrice

      @Nullable public BigDecimal getStopPrice()
      Required if type is stop or stop_limit
      Returns:
      stopPrice
    • setStopPrice

      public void setStopPrice(@Nullable BigDecimal stopPrice)
    • subtag

      public CreateOrderRequest subtag(@Nullable String subtag)
    • getSubtag

      @Nullable public String getSubtag()
      Get subtag
      Returns:
      subtag
    • setSubtag

      public void setSubtag(@Nullable String subtag)
    • swapFeeBps

      public CreateOrderRequest swapFeeBps(@Nullable BigDecimal swapFeeBps)
    • getSwapFeeBps

      @Nullable public BigDecimal getSwapFeeBps()
      Get swapFeeBps
      Returns:
      swapFeeBps
    • setSwapFeeBps

      public void setSwapFeeBps(@Nullable BigDecimal swapFeeBps)
    • symbol

      public CreateOrderRequest symbol(@Nullable String symbol)
    • getSymbol

      @Nullable public String getSymbol()
      Symbol or asset ID to identify the asset to trade. Required for all order classes except for `mleg`.
      Returns:
      symbol
    • setSymbol

      public void setSymbol(@Nullable String symbol)
    • takeProfit

      public CreateOrderRequest takeProfit(@Nullable CreateOrderRequestTakeProfit takeProfit)
    • getTakeProfit

      @Nullable public CreateOrderRequestTakeProfit getTakeProfit()
      Get takeProfit
      Returns:
      takeProfit
    • setTakeProfit

      public void setTakeProfit(@Nullable CreateOrderRequestTakeProfit takeProfit)
    • timeInForce

      public CreateOrderRequest timeInForce(@Nonnull TimeInForce timeInForce)
    • getTimeInForce

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

      public void setTimeInForce(@Nonnull TimeInForce timeInForce)
    • trailPercent

      public CreateOrderRequest trailPercent(@Nullable BigDecimal trailPercent)
    • getTrailPercent

      @Nullable public BigDecimal getTrailPercent()
      If type is trailing_stop, then one of trail_price or trail_percent is required
      Returns:
      trailPercent
    • setTrailPercent

      public void setTrailPercent(@Nullable BigDecimal trailPercent)
    • trailPrice

      public CreateOrderRequest trailPrice(@Nullable BigDecimal trailPrice)
    • getTrailPrice

      @Nullable public BigDecimal getTrailPrice()
      If type is trailing_stop, then one of trail_price or trail_percent is required
      Returns:
      trailPrice
    • setTrailPrice

      public void setTrailPrice(@Nullable BigDecimal trailPrice)
    • type

      public CreateOrderRequest type(@Nonnull OrderType type)
    • getType

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

      public void setType(@Nonnull OrderType type)
    • putAdditionalProperty

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

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

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