Back to Webhook Messages
Webhook Messages

Invalid Quantity Type

The provided quantityType is invalid. The quantityType field must be one of the following values: fixed_quantity, dollar_amount, risk_dollar_amount, risk_percent, percent_of_equity, or percent_of_position.

This message indicates that the quantityType provided in the request is invalid. TradersPost requires that the quantityType parameter be specified as one of the following values: fixed_quantity, dollar_amount, risk_dollar_amount, risk_percent, percent_of_equity, or percent_of_position. Any other value will be considered invalid and the request will not be processed.

Fixed Quantity

The fixed quantity is the simplest quantity type. In this example it will simply buy 10 shares of AAPL.

{
    "ticker": "AAPL",
    "action": "sell",
    "quantityType": "fixed_quantity",
    "quantity": 10
}

Dollar Amount

In this example it will buy $10000 worth of AAPL. If the current price of AAPL Is $100, then it will calculate a quantity of 100.

{
    "ticker": "AAPL",
    "action": "buy",
    "quantityType": "dollar_amount",
    "quantity": 10000
}

Risk Dollar Amount

In this example it will buy 10 shares because we've said that the most we want to be able to lose is $100. If we get filled at $180 and we have a stop loss at $170, then if we get stopped out we'll lose $10 per share, which means we can afford to buy 10 shares.

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 180,
    "quantityType": "risk_dollar_amount",
    "quantity": 100,
    "stopLoss": {
        "type": "stop",
        "stopPrice": "170"
    }
}

Risk Percent

In this example, if you have a $100000 account and you want to risk 0.25% of equity ($250), with entry at $180 and stop at $170 ($10 per share), the quantity will be 25 shares.

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 180,
    "quantityType": "risk_percent",
    "quantity": 0.25,
    "stopLoss": {
        "type": "stop",
        "stopPrice": "170"
    }
}

Percent of Equity

In this example, if you have a $100000 account and you want to buy AAPL using 10% of your total equity, and your limitPrice is $100, then it will calculate a quantity of 100 shares.

{
    "ticker": "AAPL",
    "action": "buy",
    "orderType": "limit",
    "limitPrice": 100,
    "quantityType": "percent_of_equity",
    "quantity": 10
}

Percent of Position

In this example, we are selling 50% of the open AAPL position. If the total quantity of the AAPL position was 100 shares, then it would calculate a quantity of 50.

{
    "ticker": "AAPL",
    "action": "sell",
    "quantityType": "percent_of_position",
    "quantity": 50
}

Ready to put Invalid Quantity Type to work?

Free 7-day trial

Set-up in 3 minutes

Paper account for testing

By continuing, you agree to the TradersPost Terms of Service and Privacy Policy. This site is protected by reCAPTCHA.