Strategy Field

Quantity calculation method

The Quantity calculation method field controls how entry quantity is calculated. You can set it in your strategy or override it in a webhook by sending quantityType and quantity. Allowed quantityType values:

  • fixed_quantity
  • dollar_amount
  • risk_dollar_amount
  • risk_percent
  • percent_of_equity
  • percent_of_position

Fixed quantity

Same share (or contract) count for every entry.

  • Calculation: quantity = value you provide
  • Example: 100100 shares
{
    "ticker": "AAPL",
    "action": "buy",
    "quantityType": "fixed_quantity",
    "quantity": 100
}

Dollar amount

Position size from a target notional dollar amount.

  • Calculation: quantity = dollar amount ÷ entry price
  • Example: $1000 at $100 → 10 shares
{
    "ticker": "AAPL",
    "action": "buy",
    "quantityType": "dollar_amount",
    "quantity": 1000
}

Risk dollar amount

Position sized so max loss equals a fixed dollar amount.

  • Calculation: quantity = risk $ ÷ |entry − stop|
  • Example: $100 risk, entry $100, stop $90 → $10/share → 10 shares

Requires stopLoss.stopPrice in the signal.

{
    "ticker": "AAPL",
    "action": "buy",
    "quantityType": "risk_dollar_amount",
    "quantity": 100,
    "stopLoss": {
        "stopPrice": 90
    }
}

Risk percent

Position sized so max loss is a percentage of account equity.

  • Calculation: risk $ = portfolio × (risk% ÷ 100); quantity = risk $ ÷ |entry − stop|
  • Example: 0.25% on $10,000 → $25 risk; entry $100, stop $90 → $10/share → 2.5 shares (rounded)

Requires stopLoss.stopPrice in the signal.

{
    "ticker": "AAPL",
    "action": "buy",
    "quantityType": "risk_percent",
    "quantity": 0.25,
    "stopLoss": {
        "stopPrice": 90
    }
}

Percent of equity

Position size as a percentage of account equity.

  • Calculation: notional = portfolio × (percent ÷ 100); quantity = notional ÷ entry price
  • Example: 10% of $10,000 at $100 → $1,000 notional → 10 shares
{
    "ticker": "AAPL",
    "action": "buy",
    "quantityType": "percent_of_equity",
    "quantity": 10
}

Percent of position

Exit a percentage of the current position.

  • Calculation: quantity = position size × (percent ÷ 100)
  • Example: sell 50% of 100 shares → 50 shares (exit quantity)
{
    "ticker": "AAPL",
    "action": "sell",
    "quantityType": "percent_of_position",
    "quantity": 50
}

Start trading at scale today. Sign up for free.

Free 7-day trial

Set-up in 3 minutes

Paper account for testing

Start now