This document outlines the appropriate format that the traders must follow while writing the webhook payload for setting up the following types of Stocks orders to be executed into TastyTrade.
Let’s get started 🚀
Market Order
The traders can write the webhook payload for setting up market orders using these three payload fields:
- Symbol
- Action
- Quantity
Symbol
The ticker symbol of the asset. TastyTrade expresses this asset class using the single ticker symbol of the Stocks. For example, AAPL, AMZN, and MSFT.
Action
The signal action indicates the type of trade to be triggered. The action can be any of the following:
- Buy: Triggers an action to buy the asset.
- Sell: Triggers an action to sell the asset.
- Buy-to-Open: Triggers an action to initiate a new position by buying assets.
- Buy-to-Close: Triggers an action to exit and close an existing position.
- Sell-to-Open: Triggers an action to initiate a new position by selling assets.
- Sell-to-Close: Triggers an action to exit and close an existing short position.
- Close: Triggers an action to close an existing open position and exit the trade.
Quantity
The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
EXAMPLE
I. Buy
{
"symbol": "AAPL",
"action": "buy",
"quantity": 123
}
II. Sell
{
"symbol": "AAPL",
"action": "sell",
"quantity": 123
}
III. Buy-To-Open
{
"symbol": "AAPL",
"action": "buy_to_open",
"quantity": 123
}
IV. Buy-To-Close
{
"symbol": "AAPL",
"action": "buy_to_close",
"quantity": 123
}
V. Sell-To-Open
{
"symbol": "AAPL",
"action": "sell_to_open",
"quantity": 123
}
VI. Sell-To-Close
{
"symbol": "AAPL",
"action": "sell_to_close",
"quantity": 123
}
VII. Close
{
"symbol": "AAPL",
"action": "close"
}
Limit Order
The traders can write the webhook payload for setting up Limit orders using these four payload fields:
- Symbol
- Action
- Quantity
- Limit_price
Symbol
The ticker symbol of the asset. TastyTrade expresses this asset class using the single ticker symbol of the Stocks. For example, AAPL, AMZN, and MSFT.
Action
The signal action indicates the type of trade to be triggered. The action can be any of the following:
- Buy: Triggers an action to buy the asset.
- Sell: Triggers an action to sell the asset.
- Buy-to-Open: Triggers an action to initiate a new position by buying assets.
- Buy-to-Close: Triggers an action to exit and close an existing position.
- Sell-to-Open: Triggers an action to initiate a new position by selling assets.
- Sell-to-Close: Triggers an action to exit and close an existing short position.
- Close: Triggers an action to close an existing open position and exit the trade.
Quantity
The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
Limit_Price
An optional field specifying the execution price for a “buy” or “sell” trade. If you specify the limit price the trade will be executed at the specified limit price. Or If you choose not to specify a limit price, the trade will be executed at the current market price.
EXAMPLE
I. Buy
{
"symbol": "AAPL",
"action": "buy",
"quantity": 123,
"limit_price": 123.98
}
II. Sell
{
"symbol": "AAPL",
"action": "sell",
"quantity": 123,
"limit_price": 123.98
}
III. Buy-To-Open
{
"symbol": "AAPL",
"action": "buy_to_open",
"quantity": 123,
"limit_price": 123.98
}
IV. Buy-To-close
{
"symbol": "AAPL",
"action": "buy_to_close",
"quantity": 123,
"limit_price": 123.98
}
V. Sell-To-Open
{
"symbol": "AAPL",
"action": "sell_to_open",
"quantity": 123,
"limit_price": 123.98
}
VI. Sell-To-Close
{
"symbol": "AAPL",
"action": "sell_to_close",
"quantity": 123,
"limit_price": 123.98
}
VII. Close
{
"symbol": "AAPL",
"action": "close",
"limit_price": 123.98
}
Stop Order
The traders can write the webhook payload for setting up Stop orders using these four payload fields:
- Symbol
- Action
- Quantity
- Stop_price
Symbol
The ticker symbol of the asset. TastyTrade expresses this asset class using the single ticker symbol of the Stocks. For example, AAPL, AMZN, and MSFT.
Action
The signal action indicates the type of trade to be triggered. The action can be any of the following:
- Buy: Triggers an action to buy the asset.
- Sell: Triggers an action to sell the asset.
- Buy-to-Open: Triggers an action to initiate a new position by buying assets.
- Buy-to-Close: Triggers an action to exit and close an existing position.
- Sell-to-Open: Triggers an action to initiate a new position by selling assets.
- Sell-to-Close: Triggers an action to exit and close an existing short position.
- Close: Triggers an action to close an existing open position and exit the trade.
Quantity
The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
Stop_price
An optional field specifying the price level at which a stop-loss or stop-limit order should be triggered. It helps limit potential losses by automatically closing the position when the specified price is reached.
EXAMPLE
I. Buy
{
"symbol": "AAPL",
"action": "buy",
"quantity": 123,
"stop_price": 123.98
}
II. Sell
{
"symbol": "AAPL",
"action": "sell",
"quantity": 123,
"stop_price": 123.98
}
III. Buy-To-Open
{
"symbol": "AAPL",
"action": "buy_to_open",
"quantity": 123,
"stop_price": 123.98
}
IV. Buy-To-close
{
"symbol": "AAPL",
"action": "buy_to_close",
"quantity": 123,
"stop_price": 123.98
}
V. Sell-To-Open
{
"symbol": "AAPL",
"action": "sell_to_open",
"quantity": 123,
"stop_price": 123.98
}
VI. Sell-To-Close
{
"symbol": "AAPL",
"action": "sell_to_close",
"quantity": 123,
"stop_price": 123.98
}
VII. Close
{
"symbol": "AAPL",
"action": "close",
"stop_price": 123.98
}
Stop-Limit Order
The traders can write the webhook payload for setting up Stop-Limit orders using these five payload fields:
- Symbol
- Action
- Quantity
- Limit_price
- Stop_price
Symbol
The ticker symbol of the asset. TastyTrade expresses this asset class using the single ticker symbol of the Stocks. For example, AAPL, AMZN, and MSFT.
Action
The signal action indicates the type of trade to be triggered. The action can be any of the following:
- Buy: Triggers an action to buy the asset.
- Sell: Triggers an action to sell the asset.
- Buy-to-Open: Triggers an action to initiate a new position by buying assets.
- Buy-to-Close: Triggers an action to exit and close an existing position.
- Sell-to-Open: Triggers an action to initiate a new position by selling assets.
- Sell-to-Close: Triggers an action to exit and close an existing short position.
- Close: Triggers an action to close an existing open position and exit the trade.
Quantity
The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
Limit_Price
An optional field specifying the execution price for a “buy” or “sell” trade. If you specify the limit price the trade will be executed at the specified limit price. Or If you choose not to specify a limit price, the trade will be executed at the current market price.
Stop_price
An optional field specifying the price level at which a stop-loss or stop-limit order should be triggered. It helps limit potential losses by automatically closing the position when the specified price is reached.
EXAMPLE
I. Buy
{
"symbol": "AAPL",
"action": "buy",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
II. Sell
{
"symbol": "AAPL",
"action": "sell",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
III. Buy-To-Open
{
"symbol": "AAPL",
"action": "buy_to_open",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
IV. Buy-To-close
{
"symbol": "AAPL",
"action": "buy_to_close",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
V. Sell-To-Open
{
"symbol": "AAPL",
"action": "sell_to_open",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
VI. Sell-To-Close
{
"symbol": "AAPL",
"action": "sell_to_close",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
VII. Close
{
"symbol": "AAPL",
"action": "close",
"limit_price": 123.98,
"stop_price": 123.98
}