Webhook Message

Invalid Quantity Type

Invalid quantityType, must be one of: fixed_quantity, dollar_amount, risk_dollar_amount, percent_of_equity, 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, 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"
    }
}

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 automate your trading? Sign up for free today.