Introducing Quantity Types in TradersPost Webhooks for Dynamic Order Sizing
With the new quantityType field in TradersPost webhooks, you can now dynamically calculate order sizes directly from your webhook signals. This enhancement allows you to specify quantities using methods such as fixed quantities, dollar amounts, risk-based amounts, percentages of equity, and percentages of open positions. Discover how each quantityType value works with practical examples for seamless integration into your trading strategies.
Founder / CEO
Reviewed by Mike Christensen
Fact-checked by Jonathan Wage
Below are the allowed values for quantityType and examples for each.
- fixed_quantity
- dollar_amount
- risk_dollar_amount
- percent_of_equity
- percent_of_position
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
}
Language:JSON
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
}
Language:JSON
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"
}
}
Language:JSON
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
}
Language:JSON
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
}
Language:JSON
Conclusion
The addition of the quantityType field to TradersPost webhooks marks a significant enhancement in how you can manage and automate your trades. By allowing for dynamic calculation of order sizes, it provides greater flexibility and precision in executing your trading strategies. Whether you're working with fixed quantities, dollar amounts, risk-based amounts, or percentages of your equity or positions, this new feature simplifies the process and ensures your trades align with your strategic objectives. Integrate these options into your webhook settings today and experience more controlled and tailored trading automation with TradersPost.