# API Reference

Scanner endpoint: https://api.orats.io/scanner

# Scan for trades

POST | https://api.orats.io/scanner/scan

# Using BacktestID to Scan for trades

Place the backtestID into the backtest field

{
	"backtest" : "1DMYYa3AcBcBhTahmZ4iDAnMhJPLQE81CN",
	"totalTrades" : 10,
	"tradesPerSymbol" : 4,
	"dataSource" : "delayed"
}
Field Definition
backtest BacktestID or Backtest Input JSON.
totalTrades Max amount of trades to show.
tradesPerSymbol Max amount of trades per symbol to show. It is used for multi-symbol scans.
dataSource delayed or real-time quotes being used.

# Using Backtest JSON Input to Scan for trades

Place the backtest JSON Input into the backtest field

TIP

The scanner only requires the general and entry section of the backtest input.

{
	"backtest" : {
		"general": {
			"startDate": "2007-01-03",
			"endDate": "2019-06-18",
			"symbols": [{
				"symbol": "IBM",
				"weight": null,
				"signals": null
			}]
		},
		"entry": {
			"options": [{
				"ratio": 1,
				"optionType": "call",
				"leg": 1,
				"opening": {
					"dte": {
						"target": 40,
						"min": 30,
						"max": 50
					},
					"strikeSelection": {
						"type": "absDelta",
						"value": {
							"target": 0.35,
							"min": 0.25,
							"max": 0.45
						}
					}
				}
			}]
		}
	},
	"totalTrades" : 10,
	"tradesPerSymbol" : 4,
	"dataSource" : "delayed"
}

# Scan Results

The output of the scan is in the form of an array of array objects.

Field Definition
date trade date (Today's date)
ticker Stock Symbol.
leg Leg number of the trade.
ratio Ratio of the option trade. (ie 1 for long and -1 for short. -2 could be the middle strike for 2 short options in a butterfly).
optionType call or put.
expirDate Expiration date.
strike Strike of the option.
dte Days to expiration.
stockPx Stock price at the time of quote update time.
optionBid Option bid price.
optionAsk Option ask price.
tradeOptPx Option price with slippage.
iVolBid Implied volatility based on the option's bid price.
iVolAsk Implied volatility based on the option's ask price.
tradeVol ORATS final implied Volatility.
theoVol Option theoretical value
fcstRatio ORATS Forecast Price / tradeOptPx. Higher the better when buying.
delta Delta of the option.
gamma Gamma of the option.
vega Vega of the option.
ivr Implied Volatility Rank of the time of entry.
updatedAt Update time of the option quote in UTC.

# IBM Long Call Input

{
	"backtest" : "1DMYYa3AcBcBhTahmZ4iDAnMhJPLQE81CN",
	"totalTrades" : 10,
	"tradesPerSymbol" : 4,
	"dataSource" : "delayed"
}

# IBM Long Call Output

There are 4 total IBM Long call option trades.

[
    [
        {
            "date": "2019-06-18",
            "ticker": "IBM",
            "leg": 1,
            "ratio": 1,
            "optionType": "call",
            "expirDate": "2019-07-12",
            "strike": 140,
            "dte": 25,
            "stockPx": 136.34,
            "optionBid": 0.92,
            "optionAsk": 0.97,
            "tradeOptPx": 0.958,
            "iVolBid": 0.157357,
            "iVolAsk": 0.161607,
            "tradeVol": 16.1,
            "theoVol": 15.9,
            "fcstRatio": 1.36,
            "delta": 0.28,
            "gamma": 0.0607008,
            "vega": 0.117676,
            "ivr": 21.96,
            "updatedAt": "2019-06-18 17:28:40"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "IBM",
            "leg": 1,
            "ratio": 1,
            "optionType": "call",
            "expirDate": "2019-07-12",
            "strike": 139,
            "dte": 25,
            "stockPx": 136.34,
            "optionBid": 1.25,
            "optionAsk": 1.3,
            "tradeOptPx": 1.287,
            "iVolBid": 0.160294,
            "iVolAsk": 0.16415,
            "tradeVol": 16.3,
            "theoVol": 16.2,
            "fcstRatio": 1.29,
            "delta": 0.34,
            "gamma": 0.0653831,
            "vega": 0.129682,
            "ivr": 21.96,
            "updatedAt": "2019-06-18 17:28:40"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "IBM",
            "leg": 1,
            "ratio": 1,
            "optionType": "call",
            "expirDate": "2019-07-19",
            "strike": 140,
            "dte": 32,
            "stockPx": 136.34,
            "optionBid": 2.57,
            "optionAsk": 2.61,
            "tradeOptPx": 2.6,
            "iVolBid": 0.250108,
            "iVolAsk": 0.252728,
            "tradeVol": 25.2,
            "theoVol": 25.3,
            "fcstRatio": 0.74,
            "delta": 0.39,
            "gamma": 0.0382206,
            "vega": 0.152649,
            "ivr": 21.96,
            "updatedAt": "2019-06-18 17:28:40"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "IBM",
            "leg": 1,
            "ratio": 1,
            "optionType": "call",
            "expirDate": "2019-07-19",
            "strike": 145,
            "dte": 32,
            "stockPx": 136.34,
            "optionBid": 1.03,
            "optionAsk": 1.06,
            "tradeOptPx": 1.052,
            "iVolBid": 0.2349,
            "iVolAsk": 0.237556,
            "tradeVol": 23.7,
            "theoVol": 24.1,
            "fcstRatio": 0.62,
            "delta": 0.21,
            "gamma": 0.0302014,
            "vega": 0.117624,
            "ivr": 21.96,
            "updatedAt": "2019-06-18 17:28:40"
        }
    ]
]

# SPY and QQQ Short Straddle Input

{
	"backtest" : "1GH8zWibLjZ6kuW2bMzr2xhJ5Kct2yCECH",
	"totalTrades" : 10,
	"tradesPerSymbol" : 3,
	"dataSource" : "delayed"
}

# SPY and QQQ Short Straddle Output

There are 6 total trades with 3 SPY and 3 QQQ Short Straddle trades.

[
    [
        {
            "date": "2019-06-18",
            "ticker": "SPY",
            "leg": 1,
            "ratio": -1,
            "optionType": "call",
            "expirDate": "2019-07-17",
            "strike": 292,
            "dte": 30,
            "stockPx": 292.21,
            "optionBid": 3.96,
            "optionAsk": 4.01,
            "tradeOptPx": 3.977,
            "iVolBid": 0.130762,
            "iVolAsk": 0.132299,
            "tradeVol": 13.1,
            "theoVol": 12.7,
            "fcstRatio": 0.94,
            "delta": 0.48,
            "gamma": 0.0384759,
            "vega": 0.325298,
            "ivr": 22.9,
            "updatedAt": "2019-06-18 17:45:55"
        },
        {
            "date": "2019-06-18",
            "ticker": "SPY",
            "leg": 2,
            "ratio": -1,
            "optionType": "put",
            "expirDate": "2019-07-17",
            "strike": 292,
            "dte": 30,
            "stockPx": 292.21,
            "optionBid": 4.69,
            "optionAsk": 4.72,
            "tradeOptPx": 4.7,
            "iVolBid": 0.131763,
            "iVolAsk": 0.132688,
            "tradeVol": 13.2,
            "theoVol": 12.7,
            "fcstRatio": 0.9,
            "delta": -0.52,
            "gamma": 0.0384759,
            "vega": 0.325298,
            "ivr": 22.9,
            "updatedAt": "2019-06-18 17:45:55"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "SPY",
            "leg": 1,
            "ratio": -1,
            "optionType": "call",
            "expirDate": "2019-07-17",
            "strike": 291,
            "dte": 30,
            "stockPx": 292.21,
            "optionBid": 4.55,
            "optionAsk": 4.6,
            "tradeOptPx": 4.567,
            "iVolBid": 0.133818,
            "iVolAsk": 0.135349,
            "tradeVol": 13.4,
            "theoVol": 13.1,
            "fcstRatio": 0.95,
            "delta": 0.52,
            "gamma": 0.0372091,
            "vega": 0.326471,
            "ivr": 22.9,
            "updatedAt": "2019-06-18 17:45:55"
        },
        {
            "date": "2019-06-18",
            "ticker": "SPY",
            "leg": 2,
            "ratio": -1,
            "optionType": "put",
            "expirDate": "2019-07-17",
            "strike": 291,
            "dte": 30,
            "stockPx": 292.21,
            "optionBid": 4.27,
            "optionAsk": 4.3,
            "tradeOptPx": 4.28,
            "iVolBid": 0.134814,
            "iVolAsk": 0.135734,
            "tradeVol": 13.5,
            "theoVol": 13.1,
            "fcstRatio": 0.89,
            "delta": -0.48,
            "gamma": 0.0372091,
            "vega": 0.326471,
            "ivr": 22.9,
            "updatedAt": "2019-06-18 17:45:55"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "SPY",
            "leg": 1,
            "ratio": -1,
            "optionType": "call",
            "expirDate": "2019-07-19",
            "strike": 292,
            "dte": 32,
            "stockPx": 292.21,
            "optionBid": 4.21,
            "optionAsk": 4.22,
            "tradeOptPx": 4.213,
            "iVolBid": 0.132904,
            "iVolAsk": 0.133201,
            "tradeVol": 13.3,
            "theoVol": 13.2,
            "fcstRatio": 0.94,
            "delta": 0.49,
            "gamma": 0.0358585,
            "vega": 0.336238,
            "ivr": 22.9,
            "updatedAt": "2019-06-18 17:45:55"
        },
        {
            "date": "2019-06-18",
            "ticker": "SPY",
            "leg": 2,
            "ratio": -1,
            "optionType": "put",
            "expirDate": "2019-07-19",
            "strike": 292,
            "dte": 32,
            "stockPx": 292.21,
            "optionBid": 4.85,
            "optionAsk": 4.86,
            "tradeOptPx": 4.853,
            "iVolBid": 0.133119,
            "iVolAsk": 0.133417,
            "tradeVol": 13.3,
            "theoVol": 13.2,
            "fcstRatio": 0.9,
            "delta": -0.51,
            "gamma": 0.0358585,
            "vega": 0.336238,
            "ivr": 22.9,
            "updatedAt": "2019-06-18 17:45:55"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "QQQ",
            "leg": 1,
            "ratio": -1,
            "optionType": "call",
            "expirDate": "2019-07-19",
            "strike": 187,
            "dte": 32,
            "stockPx": 186.47,
            "optionBid": 3.62,
            "optionAsk": 3.64,
            "tradeOptPx": 3.627,
            "iVolBid": 0.180648,
            "iVolAsk": 0.18157,
            "tradeVol": 18.1,
            "theoVol": 17.4,
            "fcstRatio": 0.97,
            "delta": 0.48,
            "gamma": 0.0423484,
            "vega": 0.216927,
            "ivr": 22.92,
            "updatedAt": "2019-06-18 17:45:51"
        },
        {
            "date": "2019-06-18",
            "ticker": "QQQ",
            "leg": 2,
            "ratio": -1,
            "optionType": "put",
            "expirDate": "2019-07-19",
            "strike": 187,
            "dte": 32,
            "stockPx": 186.47,
            "optionBid": 4.24,
            "optionAsk": 4.26,
            "tradeOptPx": 4.247,
            "iVolBid": 0.180649,
            "iVolAsk": 0.181573,
            "tradeVol": 18.1,
            "theoVol": 17.4,
            "fcstRatio": 0.93,
            "delta": -0.52,
            "gamma": 0.0423484,
            "vega": 0.216927,
            "ivr": 22.92,
            "updatedAt": "2019-06-18 17:45:51"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "QQQ",
            "leg": 1,
            "ratio": -1,
            "optionType": "call",
            "expirDate": "2019-07-12",
            "strike": 186.5,
            "dte": 25,
            "stockPx": 186.47,
            "optionBid": 3.4,
            "optionAsk": 3.43,
            "tradeOptPx": 3.41,
            "iVolBid": 0.183112,
            "iVolAsk": 0.184688,
            "tradeVol": 18.4,
            "theoVol": 18.4,
            "fcstRatio": 0.97,
            "delta": 0.5,
            "gamma": 0.0457009,
            "vega": 0.190345,
            "ivr": 22.92,
            "updatedAt": "2019-06-18 17:45:51"
        },
        {
            "date": "2019-06-18",
            "ticker": "QQQ",
            "leg": 2,
            "ratio": -1,
            "optionType": "put",
            "expirDate": "2019-07-12",
            "strike": 186.5,
            "dte": 25,
            "stockPx": 186.47,
            "optionBid": 3.59,
            "optionAsk": 3.62,
            "tradeOptPx": 3.6,
            "iVolBid": 0.183121,
            "iVolAsk": 0.184698,
            "tradeVol": 18.4,
            "theoVol": 18.4,
            "fcstRatio": 0.92,
            "delta": -0.5,
            "gamma": 0.0457009,
            "vega": 0.190345,
            "ivr": 22.92,
            "updatedAt": "2019-06-18 17:45:51"
        }
    ],
    [
        {
            "date": "2019-06-18",
            "ticker": "QQQ",
            "leg": 1,
            "ratio": -1,
            "optionType": "call",
            "expirDate": "2019-07-19",
            "strike": 186,
            "dte": 32,
            "stockPx": 186.47,
            "optionBid": 4.19,
            "optionAsk": 4.22,
            "tradeOptPx": 4.2,
            "iVolBid": 0.18458,
            "iVolAsk": 0.185971,
            "tradeVol": 18.5,
            "theoVol": 17.7,
            "fcstRatio": 0.98,
            "delta": 0.53,
            "gamma": 0.0415906,
            "vega": 0.215704,
            "ivr": 22.92,
            "updatedAt": "2019-06-18 17:45:51"
        },
        {
            "date": "2019-06-18",
            "ticker": "QQQ",
            "leg": 2,
            "ratio": -1,
            "optionType": "put",
            "expirDate": "2019-07-19",
            "strike": 186,
            "dte": 32,
            "stockPx": 186.47,
            "optionBid": 3.81,
            "optionAsk": 3.83,
            "tradeOptPx": 3.817,
            "iVolBid": 0.184665,
            "iVolAsk": 0.185592,
            "tradeVol": 18.5,
            "theoVol": 17.7,
            "fcstRatio": 0.93,
            "delta": -0.47,
            "gamma": 0.0415906,
            "vega": 0.215704,
            "ivr": 22.92,
            "updatedAt": "2019-06-18 17:45:51"
        }
    ]
]