Simulate A Single Trade
simulateTrade/simulate-tradeBase URL: https://backtester.vast.tastyworks.com (Backtester API)
Returns historical pricing for one trade without defining a full backtest. Supply an `underlying` and one or more `legs` (each leg uses tastytrade/OCC symbology), optionally bounded by `startTime`/`endTime`. The response is a time series of price points with the trade `effect` (debit or credit), `underlyingPrice`, and `delta`.
Code samples
curl -X POST 'https://backtester.vast.tastyworks.com/simulate-trade' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'User-Agent: tastytrade-docs-example/1.0' \
-H 'Content-Type: application/json' \
-d '{
"underlying": "string",
"startTime": "2024-01-15T14:30:00.000Z",
"endTime": "2024-01-15T14:30:00.000Z",
"legs": [
{
"symbol": "AAPL",
"direction": "long",
"quantity": 100
}
]
}'import requests
import json
url = "https://backtester.vast.tastyworks.com/simulate-trade"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
}
payload = json.loads("""
{
"underlying": "string",
"startTime": "2024-01-15T14:30:00.000Z",
"endTime": "2024-01-15T14:30:00.000Z",
"legs": [
{
"symbol": "AAPL",
"direction": "long",
"quantity": 100
}
]
}
""")
resp = requests.post(url, headers=headers, json=payload)
print(resp.status_code, resp.json())const resp = await fetch("https://backtester.vast.tastyworks.com/simulate-trade", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
"Content-Type": "application/json",
},
body: JSON.stringify({
"underlying": "string",
"startTime": "2024-01-15T14:30:00.000Z",
"endTime": "2024-01-15T14:30:00.000Z",
"legs": [
{
"symbol": "AAPL",
"direction": "long",
"quantity": 100
}
]
}),
})
const data = await resp.json()
console.log(resp.status, data)package main
import (
"net/http"
"io"
"fmt"
"strings"
)
func main() {
body := strings.NewReader(`{
"underlying": "string",
"startTime": "2024-01-15T14:30:00.000Z",
"endTime": "2024-01-15T14:30:00.000Z",
"legs": [
{
"symbol": "AAPL",
"direction": "long",
"quantity": 100
}
]
}`)
req, _ := http.NewRequest("POST", "https://backtester.vast.tastyworks.com/simulate-trade", body)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("User-Agent", "tastytrade-docs-example/1.0")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(out))
}import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://backtester.vast.tastyworks.com/simulate-trade"))
.header("Authorization", "Bearer YOUR_ACCESS_TOKEN")
.header("User-Agent", "tastytrade-docs-example/1.0")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"underlying": "string",
"startTime": "2024-01-15T14:30:00.000Z",
"endTime": "2024-01-15T14:30:00.000Z",
"legs": [
{
"symbol": "AAPL",
"direction": "long",
"quantity": 100
}
]
}
"""))
.build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());Parameters
No parameters.
Request bodyapplication/json
Example
{
"underlying": "string",
"startTime": "2024-01-15T14:30:00.000Z",
"endTime": "2024-01-15T14:30:00.000Z",
"legs": [
{
"symbol": "AAPL",
"direction": "long",
"quantity": 100
}
]
}Schema
underlyingstringUnderlying symbol of the trade
startTimestring <date-time>Optionally, start time of the trade in ISO 8601 format.
endTimestring <date-time>Optionally, end time of the trade in ISO 8601 format.
legsarray<object>symbolstringThe leg symbol uses the tastytrade / OCC symbology convention - https://developer.tastytrade.com/api-overview/#tastytrade-symbology
directionstringenum: long, short
quantityinteger
Responses
Example response
[
{
"dateTime": "2024-01-15T14:30:00.000Z",
"price": "100.00",
"effect": "debit",
"underlyingPrice": "100.00",
"delta": "string"
}
]Schema
Array — each item is an object with fields:
dateTimestring <date-time>pricestringeffectstringenum: debit, credit
underlyingPricestringdeltastring
Related
- Rate-limit class:
write· not idempotent — Rate limits & backoff - Error reference — codes, causes, and fixes
Agents: this page is also Markdown (with the embedded OpenAPI definition) — append .md or send Accept: text/markdown. Index at /llms.txt.