Below are the allowed values for quantityType
and examples for each.
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
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
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
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
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
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.
DISCLAIMER:
Trading in the financial markets involves a significant risk of loss. The content and strategies shared by TradersPost are provided for informational or educational purposes only and do not constitute trading or investment recommendations or advice. The views and opinions expressed in the materials are those of the authors and do not necessarily reflect the official policy or position of TradersPost.
Please be aware that the authors and contributors associated with our content may hold positions or trade in the financial assets, securities, or instruments mentioned herein. Such holdings could present a conflict of interest or influence the perspective provided in the content. Readers should consider their financial situation, objectives, and risk tolerance before making any trading or investment decisions based on the information shared. It is recommended to seek advice from a qualified financial advisor if unsure about any investments or trading strategies.
Remember, past performance is not indicative of future results. All trading and investment activities involve high risks and can result in the loss of your entire capital. TradersPost is not liable for any losses or damages arising from the use of this information. All users should conduct their own research and due diligence before making financial decisions.