# Parameters
We will go through detailed examples of the JSON parameter payload when submitting a backtest. There are 4 major sections in the JSON parameter payload. And within the sections, there are sub-sections to specify the parameters for modelling your option strategy.
# GENERAL SECTION
The general section of the JSON payload consists of the overall configuration of the backtest.
Parameter | Definition | Values/Types |
---|---|---|
strategyName | Name of the strategy. Only relevant when return type is margin. | Backtest Strategies |
backtestName | Custom name of the backtest. You can name it anything for your reference. | any string |
startDate | Start date of the backtest. | YYYY-MM-DD |
endDate | End date of the backtest. The backtest will stop searching for trades at the end date but can go beyond the end date to calculate the daily returns until the strategy exits. | YYYY-MM-DD |
symbols | Symbols will take an array of objects containing symbol, weight, and signals. Click on symbols link for more details. | symbols |
stockPosition | Stock position is set to run a strategy with a stock component like covered call, married put, overlay, and stock only. Click on the links for more details. | type = null | overlay | married | stockOnly, ratio = 0 | -1 | 1. |
exitAtSignal | If signal dates are set, it will exit at the exit date or else it will exit on expiration. | true | false |
signalRoll | If signal dates are set, setting signalRoll to false will only trade once per entry/exit date pair. If signalRoll is set to true, it will keep rolling into new trades after exit until the exit date is reached. | true | false |
expirationType | Set to ALL to find both weekly and monthly options, WEEKLY to search for only weekly options, or MONTHLY to search for only monthly options. | ALL | WEEKLY | MONTHLY |
returnType | Set perTrade to notional to calculate returns using notional and margin to calculate returns using margin. Set daily to average to calculate annual returns as an average. Set daily to compound to calculate annual returns using compounding. | perTrade = notional | margin, daily = average | compound. |
commission | Set option to 1.00 for $1.00 per contract and stock to 0.01 for $0.01 per share. | option = float, stock = float. |
adjustmentMaxCount | Set to an integer when using adjustment strategy. This tells the system to adjust the option strategy X amount of times. | null | integer |
{
"general": {
"strategyName": "LongCall",
"backtestName": "MyIBMLongCall",
"startDate": 2007-01-03,
"endDate": 2019-04-16,
"symbols": [{
"symbol": "IBM",
"weight": null,
"signals": null
}],
"stockPosition": {
"type": null,
"ratio": 0
},
"exitAtSignal": false,
"signalRoll": false,
"expirationType": "ALL",
"returnType": {
"perTrade": "notional",
"daily": "average"
},
"commission": {
"option": 1.00,
"stock": 0.01
},
"adjustmentMaxCount": null
}
}
# Symbols
You could add multiple symbols in your option strategy by simply adding more symbols with weightings. For example, if you want 30% SPY, 30% DIA, 20% QQQ, and 20% IWM in your option strategy, you could add them in the symbols section.
{
"symbols": [{
"symbol": "SPY",
"weight": 0.30,
"signals": null
},
{
"symbol": "DIA",
"weight": 0.30,
"signals": null
},
{
"symbol": "QQQ",
"weight": 0.20,
"signals": null
},
{
"symbol": "IWM",
"weight": 0.20,
"signals": null
}]
}
# Signal Dates
If you have your own entry/exit signal dates, you can add them in the symbols section. This will give you the ability to enter and exit at a specific date that you control.
TIP
If you want to exit at the exact exit date oppose to having your trade exit at expiration, you would set exitAtSignal to true.
If the trade's expiration date is earlier than your exitDate, then it will exit at expiration.
Below is an example of the signals JSON array with entry and exit dates:
{
"general": {
"symbols": [{
"symbol": "SPY",
"weight": null,
"signals": [
{"entryDate":"2014-06-02","exitDate":"2014-07-02"},
{"entryDate":"2015-02-13","exitDate":"2015-02-26"},
{"entryDate":"2015-03-11","exitDate":"2015-03-23"},
{"entryDate":"2015-03-27","exitDate":"2015-04-24"},
{"entryDate":"2015-05-11","exitDate":"2015-05-22"},
{"entryDate":"2015-06-05","exitDate":"2015-06-09"},
{"entryDate":"2015-06-09","exitDate":"2015-06-29"},
{"entryDate":"2015-07-23","exitDate":"2015-07-24"}
]
}],
"exitAtSignal": true,
...
}
}
# Signal Dates with multiple symbols
You could combine signals and multiple symbols in your option strategy.
TIP
Signals don't have to be the same for each of the tickers.
{
"general": {
"symbols": [{
"symbol": "SPY",
"weight": 0.30,
"signals": [
{"entryDate":"2014-06-02","exitDate":"2014-07-02"},
{"entryDate":"2015-02-13","exitDate":"2015-02-26"},
{"entryDate":"2015-03-11","exitDate":"2015-03-23"},
{"entryDate":"2015-03-27","exitDate":"2015-04-24"},
{"entryDate":"2015-05-11","exitDate":"2015-05-22"},
{"entryDate":"2015-06-05","exitDate":"2015-06-09"},
{"entryDate":"2015-06-09","exitDate":"2015-06-29"},
{"entryDate":"2015-07-23","exitDate":"2015-07-24"}
]
},
{
"symbol": "DIA",
"weight": 0.30,
"signals": [
{"entryDate":"2014-06-02","exitDate":"2014-07-02"},
{"entryDate":"2015-02-13","exitDate":"2015-02-26"},
{"entryDate":"2015-03-11","exitDate":"2015-03-23"},
{"entryDate":"2015-03-27","exitDate":"2015-04-24"},
{"entryDate":"2015-05-11","exitDate":"2015-05-22"},
{"entryDate":"2015-06-05","exitDate":"2015-06-09"},
{"entryDate":"2015-06-09","exitDate":"2015-06-29"},
{"entryDate":"2015-07-23","exitDate":"2015-07-24"}
]
},
{
"symbol": "QQQ",
"weight": 0.20,
"signals": [
{"entryDate":"2014-06-02","exitDate":"2014-07-02"},
{"entryDate":"2015-02-13","exitDate":"2015-02-26"},
{"entryDate":"2015-03-11","exitDate":"2015-03-23"},
{"entryDate":"2015-03-27","exitDate":"2015-04-24"},
{"entryDate":"2015-05-11","exitDate":"2015-05-22"},
{"entryDate":"2015-06-05","exitDate":"2015-06-09"},
{"entryDate":"2015-06-09","exitDate":"2015-06-29"},
{"entryDate":"2015-07-23","exitDate":"2015-07-24"}
]
},
{
"symbol": "IWM",
"weight": 0.20,
"signals": [
{"entryDate":"2014-06-02","exitDate":"2014-07-02"},
{"entryDate":"2015-02-13","exitDate":"2015-02-26"},
{"entryDate":"2015-03-11","exitDate":"2015-03-23"},
{"entryDate":"2015-03-27","exitDate":"2015-04-24"},
{"entryDate":"2015-05-11","exitDate":"2015-05-22"},
{"entryDate":"2015-06-05","exitDate":"2015-06-09"},
{"entryDate":"2015-06-09","exitDate":"2015-06-29"},
{"entryDate":"2015-07-23","exitDate":"2015-07-24"}
]
}],
"exitAtSignal": true,
...
}
}
# Stock Position
If you want to create an overlay strategy where you hold a stock position from startDate to endDate together with your option strategy, you could do that by adding the following JSON snippet anywhere inside the general section of the JSON object:
"stockPosition": {
"type": "overlay",
"ratio": 1
}
To create a covered call or married put strategy where you enter and exit the stock at the same time as the option strategy, add the following JSON snippet inside the general section:
"stockPosition": {
"type": "married",
"ratio": 1
}
To create a stock only strategy, set the stockPosition to stockOnly and ratio to 1 for long stock or -1 for short stock.
Add the following JSON snippet inside the general section:
"stockPosition": {
"type": "stockOnly",
"ratio": 1
}
TIP
The difference between overlay and married type: Overlay you hold the stock from start to finish through out the backtesting period. Married type is a stock position that is entered and exited at the same time as the option strategy. Ratio of 1 is long stock and ratio of -1 is short stock. Stock is 100 shares per 1 contract of the option.
# Expiration Type
By default, all expiration dates are available in the backtest. Setting it to ALL will allow all expiration dates to be traded.
"expirationType": "ALL"
If you want to trade only standard monthly expirations (non-weekly), then add the following JSON snippet anywhere inside the general section of the JSON object:
"expirationType": "MONTHLY"
If you want to trade only weekly options, set expirationType to WEEKLY.
"expirationType": "WEEKLY"
# Commission
By default, we automatically use $1.00 per option contract and $0.01 per share for stock so commissions is not required in the JSON input.
Add the following JSON snippet anywhere inside the general section of the JSON object:
"commission": {
"option": 1,
"stock": 0.01
}
# ENTRY SECTION
The entry section of the JSON payload consists of all the entry parameters to scan for trades in the backtest.
TIP
The minimum parameter requirement to run a backtest is Days to Expiration (dte) and Strike Selection (absDelta or stockOTMPct) in the options section.
Parameter | Definition | Values/Types |
---|---|---|
entryDays | Enter trades between X amount of days after a trade (a value of 1 will enter a trade everyday, 2 will enter a trade every 2 days. Setting it to null will only hold 1 trade at a time.) | null | integer |
mktWidthPct | mktWidthPct = (optionAsk - optionBid) / strike. | min = null | float, max = null | float. |
absCpDiffStkPxRatioMax | absCpDiffStkPxRatio = abs(absCpDiff / stock price). Entry trades if the absCpDiffStkPxRatio is less than or equal to absCpDiffStkPxRatioMax. cpdiff is the call market price minus the call theoretical price minus the put market price plus the put theoretical. This filter is used to exclude bad option prices. | null | float. |
dateTriggers | Date triggers are triggers to enter a trade between min and max days before or after a earning, conference & event, dividend, or split date. | |
indicatorTriggers | Indicator triggers are triggers to enter a trade between min and max value for a given indicator type ie. ivrank, contango, etc. Click here for more indicator types. | |
options | Options is an array of objects that details each entry leg of the overall option strategy. Please click the options link for more in-depth explanation. | options |
spread | You can set the price, delta, and yieldPct for the option spread as a whole. | more details |
legRelation | This is used for multi-leg strategies for controlling which option leg to enter relative to each other. For example, for a 5 point wide long call spread, you would specify leg1leg2 strikeWidth min/max = 5. | more details |
"entry": {
"entryDays": null | integer,
"mktWidthPct": {
"min": null | float,
"max": null | float
},
"absCpDiffStkPxRatioMax" : null | float,
"dateTriggers" : null |
[
{
"type" : "earnings" | "confevents" | "divs" | "splits",
"occurrence" : "before" | "after",
"daysMin": integer, "daysMax" : integer
}
],
"indicatorTriggers" : null |
[
{
"indicators": [{
"type": "ivrank",
"ti": null,
"symbol": "VIX"
}],
"min": null,
"max": 15
},
{
"indicators": [{
"type": "contango",
"ti": null,
"symbol": "SPY"
}],
"min": 0.40,
"max": 3.0
}
],
"options":
[
{
"leg": integer,
"ratio": integer,
"optionType": "call" | "put",
"iBidVol": {
"min": null | float,
"max": null | float
},
"iAskVol": {
"min": null | float ,
"max": null | float
},
"optionBid" : {
"min": null | float,
"max": null | float
},
"optionAsk" : {
"min": null | float,
"max": null | float
},
"opening":
{
"dte": {
"target": integer,
"min": integer,
"max": integer
},
"strikeSelection": {
"type": "absDelta" | "stockOTMPct",
"value": {
"target": float,
"min": float,
"max": float
}
}
},
"reEnter": null | { (can be null or json object)
"dte": {
"target": integer,
"min": integer,
"max": integer
},
"strikeSelection": {
"type": "absDelta" | "stockOTMPct",
"value": {
"target": float,
"min": float,
"max": float
}
}
},
"adjustment": null | (can be null or json object)
{
"daysForAdjusting": {
"min": null,
"max": null
},
"trigger": {
"type": "absDelta" | "stockOTMPct",
"value" : {
"min": null | float,
"max": null | float
},
"tiedTo": {
"leg": null | integer,
"min": null | float,
"max": null | float
},
"adjustLegs" : array of integers
},
"dte": {
"target": integer,
"min": integer,
"max": integer
},
"strikeSelection": {
"type": "absDelta" | "stockOTMPct",
"value": {
"target": float,
"min": float,
"max": float
}
}
}
}
],
"spread": {
"price": {
"target": null | float,
"min": null | float,
"max": null | float
},
"delta": {
"target": null | float,
"min": null | float,
"max": null | float
},
"yieldPct": {
"target" : null | float,
"min": null | float,
"max": null | float
}
},
"legRelation": {
"strikeWidth": {
"leg1Leg2": {
"min": null | float,
"max": null | float
},
"leg2Leg3": {
"min": null | float,
"max": null | float
},
"leg3Leg4": {
"min": null | float,
"max": null | float
}
},
"deltaTotal": {
"leg1Leg2": {
"min": null | float,
"max": null | float
},
"leg2Leg3": {
"min": null | float,
"max": null | float
},
"leg3Leg4": {
"min": null | float,
"max": null | float
}
},
"dteDiff": {
"leg1Leg2": {
"min": null | float,
"max": null | float
},
"leg2Leg3": {
"min": null | float,
"max": null | float
},
"leg3Leg4": {
"min": null | float,
"max": null | float
}
}
}
}
# Entry Days
If you want to stagger trades, you could use entry days to accomplish that. Set entryDays to enter a trade every X amount of days. For example, if you set entryDays = 10, it will enter an option trade every 10 days (if there is a trade found for that day).
For more information about entry days, read about it on our blog (opens new window)
Add the following JSON snippet anywhere inside the entry section:
"entryDays": 10 //enter trade every 10 days
# Market Width Percentage
To filter out wide market width, we use market width percentage relative to the strike. The formula we use is mktWidthPct = (optionAsk - optionBid) / strike. So to filter out any option strikes that have 5% of market width relative to the strike, we would set the max to .05.
Add the following JSON snippet anywhere inside the entry section of the JSON object:
"mktWidthPct": {
"min": null,
"max": 0.05
}
# Date Triggers
To enter trades by days to date type. You can enter as many date types as you like.
Add the following JSON snippet inside the entry section:
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "before", "daysMin": 10, "daysMax" : 100},
{"type" : "confevents", "occurrence" : "before", "daysMin": 10, "daysMax" : 100}
{"type" : "divs", "occurrence" : "before", "daysMin": 10, "daysMax" : 100}
{"type" : "splits", "occurrence" : "before", "daysMin": 10, "daysMax" : 100}
]
More Examples below:
# Earnings Date Trigger
To enter a trade at least 10 days before an earnings date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "before", "daysMin": 10, "daysMax" : null}
]
To enter a trade at least 1 days after an earnings date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "after", "daysMin": 1, "daysMax" : null}
]
# Conference & Events Date Trigger
To enter a trade at least 20 days to 100 days before a conference and events date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "confevents", "occurrence" : "before", "daysMin": 20, "daysMax" : 100}
]
To enter a trade at least 10 days after a conference and events date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "confevents", "occurrence" : "after", "daysMin": 10, "daysMax" : null}
]
# Dividends Date Trigger
To enter a trade at least 3 days before an ex-dividend date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "divs", "occurrence" : "before", "daysMin": 3, "daysMax" : 100}
]
To enter a trade at least 5 days after an ex-dividend date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "divs", "occurrence" : "after", "daysMin": 5, "daysMax" : null}
]
# Splits Date Trigger
To enter a trade at least 1 day before a stock split date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "splits", "occurrence" : "before", "daysMin": 1, "daysMax" : null}
]
To enter a trade at least 1 day after a stock split date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "splits", "occurrence" : "after", "daysMin": 1, "daysMax" : null}
]
# Indicator Triggers
To enter trades by a given indicator type between min and max value. You can enter as many indicator types as you like.
Add the following JSON snippet inside the entry section:
"indicatorTriggers" : [
{
"indicators": [{
"type": "ivrank",
"ti": null,
"symbol": "VIX"
}],
"min": 50,
"max": null
},
{
"indicators": [{
"type": "contango",
"ti": null,
"symbol": "SPY"
}],
"min": 1,
"max": 4.0
}
]
# IV Rank
Implied Volatility Rank tells us whether implied volatility is high or low in a specific underlying based on the past year of IV data. IV Rank = (the current IV level - the 52 week IV low) / (the 52 week IV high - 52 week IV low) * 100.
To enter trades by Implied Volatility Rank above 50, add the following JSON snippet inside the entry section:
"indicatorTriggers" : [
{
"indicators": [{
"type": "ivrank",
"ti": null,
"symbol": "SPY"
}],
"min": 50,
"max": null
}
]
# Contango
Short-term contango of at-the-money implied volatilities ex-earnings.
To enter trades by contango between 1.0 and 5.0, add the following JSON snippet:
"indicatorTriggers" : [
{
"indicators": [{
"type": "contango",
"ti": null,
"symbol": "SPY"
}],
"min": 1.0,
"max": 5.0
}
]
# More Indicator Types
You can see more indicator types on our data api docs at core general and core earn. Or see the tables below:
# Core General
Field | Definition |
---|---|
priorCls | closing price on the prior trading day |
pxAtmIv | stock price taken at time of IV calculation |
mktCap | market capitalization (shares outstanding * stock price) (in 000s) |
cVolu | today’s call option volume for all strikes for the current trading day |
cOi | total call open interest |
pVolu | today’s put option volume for all strikes |
pOi | total put open interest |
orFcst20d | ORATS forecast of stock volatility for the next 20 days based on data with earnings taken out. The forecasts of the next 20 trading days of statistical/historical volatility are developed using short term ex-earnings historical volatility; ex earnings implied volatility and the IV HV relationships, related ETF HV IV relationships |
orIvFcst20d | ORATS forecast of implied volatility in 20 days with earnings taken out. Could be compared to ORATS 20d IV implied volatility.The forecasts of the implied volatility in 20 trading days are developed using ex-earnings historical volatility; ex earnings implied volatility and the IV HV relationships, related ETF HV IV relationships |
orFcstInf | ORATS forecast of the infinite implied volatility. Could be compared to actual implied volatility or actual infinite. The forecasts of the two year implied volatility are developed using long term ex-earnings historical volatility, ex-earnings implied volatility and the IV HV relationships, related ETF HV IV relationships |
orIvXern20d | 20 day interpolated implied option volatility with earnings effect taken out |
orIvXernInf | infinite implied option volatility |
iv200Ma | 200 day moving average of the ORATS 20day ex-earn implied volatility |
atmIvM1 | implied volatility for the first standard expiration |
atmFitIvM1 | the at-the-money monthly fit volatility for month 1 using the term structure of the forecast and the implied at-the-money volatility |
atmFcstIvM1 | forecast of volatility for month 1 using the ex-earnings forecast plus the earnings effect at this days to expiration |
dtExM1 | days to expiration in month 1 standard expiration (not weekly or quarterly expirations) |
atmIvM2 | implied volatility for month 2 |
atmFitIvM2 | at-the-money monthly fit volatility for month 2 |
atmFcstIvM2 | forecast of volatility for month 2 |
dtExM2 | days to expiration in month 2 |
atmIvM3 | implied volatility for month 3 |
atmFitIvM3 | at-the-money monthly fit volatility for month 3 |
atmFcstIvM3 | forecast of volatility for month 3 |
dtExM3 | days to expiration in month 3 |
atmIvM4 | implied volatility for month 4 |
atmFitIvM4 | at-the-money monthly fit volatility for month 4 |
atmFcstIvM4 | forecast of volatility for month 4 |
dtExM4 | days to expiration in month 4 |
iRate5wk | short term risk-free interest rate from treasuries |
iRateLt | long term risk-free interest rate from treasuries |
px1kGam | estimated cost of 1000 gamma per day for 30-day options |
volOfVol | annualized standard deviation of daily (1day ORATS intraday vol) statistical volatility for one year |
volOfIvol | annualized standard deviation of the ORATS ex-earnings 30 day implied. |
slope | best-fit regression line through the strike volatilities adjusted to the tangent slope at the 50 delta. The slope is the change in the implied volatility for every 10 delta increase in the call delta |
slopeInf | implied infinite slope |
slopeFcst | ORATS forecast of the slope of implied volatility skew. Could be compared to the actual slope |
slopeFcstInf | slope forecast infinite |
deriv | derivative or curvature of the monthly strikes at 30 day interpolated. The derivative is the change in the slope for every 10 delta increase in the call delta |
derivInf | derivative infinite implied |
derivFcst | forecast derivative at 30 day interpolated |
derivFcstInf | forecast infinite derivative |
mktWidthVol | market width in implied vol points at the interpolated 30 days to expiration |
mktWidthVolInf | market width in implied vol points at the interpolated 2 years to expiration |
cAddPrem | deprecated item. |
pAddPrem | deprecated item. |
rip | dollar amount of options to start ignoring in delta calculation |
ivEarnReturn | average of the volatility day of and day after earnings / implied day before divided by implied day before / implied day after |
fcstR2 | goodness of fit of the 20-day forecast to the 20-day future statistical volatility |
fcstR2Imp | goodness of fit of the implied forecast vs actual implied in 20 days |
stkVolu | total stock volume for an underlyer |
avgOptVolu20d | average for the last 20 days of total options volume for the symbol |
orHv1d | 1-day historical intraday volatility |
orHv5d | 5-day historical intraday volatility |
orHv10d | 10-day historical intraday volatility |
orHv20d | 20-day historical intraday volatility |
orHv60d | 60-day historical intraday volatility |
orHv90d | 90-day historical intraday volatility |
orHv120d | 120-day historical intraday volatility |
orHv252d | 252-day historical intraday volatility |
orHv500d | 500-day historical intraday volatility |
orHv1000d | 1000-day historical intraday volatility |
clsHv5d | 5-day historical close to close volatility |
clsHv10d | 10-day historical close to close volatility |
clsHv20d | 20-day historical close to close volatility |
clsHv60d | 60-day historical close to close volatility |
clsHv90d | 90-day historical close to close volatility |
clsHv120d | 120-day historical close to close volatility |
clsHv252d | 252-day historical close to close volatility |
clsHv500d | 500-day historical close to close volatility |
clsHv1000d | 1000-day historical close to close volatility |
iv20d | 20 calendar day interpolated implied volatility |
iv30d | 30 calendar day interpolated implied volatility |
iv60d | 60 calendar day interpolated implied volatility |
iv90d | 90 calendar day interpolated implied volatility |
iv6m | 6 month interpolated implied volatility |
clsPx1w | stock price at the prior week (5 trading days ago) |
stkPxChng1wk | stock price change over the prior week (5 trading days) |
clsPx1m | stock price at the prior month (21 trading days ago) |
stkPxChng1m | stock price change over the prior month (21 trading days) |
clsPx6m | stock price at the prior 6 months (252/2) trading days ago |
stkPxChng6m | stock price change over the prior 6 months (252/2) trading days |
clsPx1y | stock price at the prior year (252 trading days ago) |
stkPxChng1y | stock price change over the prior year (252 trading days) |
divFreq | number of dividends per year |
divYield | annualized dividends divided by stock price |
divGrwth | slope of the forecasted dividends annualized |
divAmt | dividend amount. |
absAvgErnMv | average Earnings Move percentage: an average of the absolute values of the stock price moves corresponding to the time of the next earnings announcement |
impliedIee | market implied earnings effect is found by solving for a term structure equation where the earnings effects adjust the months affected by earnings |
tkOver | 0 - Not a takeover. 1 - A takeover or rumored takeover stock |
correlSpy1m | ORATS 30 day implied volatility ex-earnings (ORiv) correlation with SPY one month |
correlSpy1y | ORATS 30 day implied volatility ex-earnings (ORiv) correlation with SPY one year |
correlEtf1m | orIv correlation with the Best ETF 30 day IV over the last month |
correlEtf1y | orIv correlation with the SPDR Sector ETF 30 day IV over the last year |
beta1m | short term price beta with SPY for 30 calendar days |
beta1y | long term price beta, 365 calendar days |
ivPctile1m | percentile of the current orIv vs. month range |
ivPctile1y | percentile of the current orIv vs. year range |
ivPctileSpy | percentile of the current orIv / SPY vs. year range |
ivPctileEtf | percentile of the current ETF orIv vs. year range |
ivStdvMean | number of stdevs the orIv is away from mean for the year |
ivStdv1y | standard deviation of the orIv for the year |
ivSpyRatio | orIv divided by SPY 30 day ORATS implied volatility |
ivSpyRatioAvg1m | orIv divided by SPY 30 day ORATS implied volatility 30 day average |
ivSpyRatioAvg1y | orIv divided by SPY 30 day ORATS implied volatility one year average |
ivSpyRatioStdv1y | orIv divided by SPY 30 day ORATS implied volatility one year standard deviation |
ivEtfRatio | orIv divided by ETF 30 day ORATS implied volatility |
ivEtfRatioAvg1m | orIv divided by ETF 30 day ORATS implied volatility 30 day average |
ivEtfRatioAvg1y | orIv divided by ETF 30 day ORATS implied volatility one year average |
ivEtFratioStdv1y | orIv divided by ETF 30 day ORATS implied volatility one year standard deviation |
ivHvXernRatio | orIv / orHvXern20d Ratio |
ivHvXernRatio1m | orIv / orHvXern20d Ratio vs monthly average |
ivHvXernRatio1y | orIv / orHvXern20d Ratio vs yearly average |
ivHvXernRatioStdv1y | orIv / orHvXern20d Ratio vs yearly range standard deviation |
etfIvHvXernRatio | orIv / orHvXern20d Ratio divided by ETF 30day implied / orHv20d ratio. |
etfIvHvXernRatio1m | orIv / orHvXern20d Ratio divided by ETF 30day implied / orHv20d ratio month average. |
etfIvHvXernRatio1y | orIv / orHvXern20d Ratio divided by ETF 30day implied / orHv20d ratio year average |
etfIvHvXernRatioStdv1y | orIv / orHvXern20d Ratio divided by ETF 30day implied / orHv20d ratio year standard deviation |
slopepctile | one-year percentile for the slope |
slopeavg1m | slope average for trailing month |
slopeavg1y | slope average for trailing year |
slopeStdv1y | standard deviation of the Slope |
etfSlopeRatio | slope divided by ETF slope current |
etfSlopeRatioAvg1m | slope divided by ETF slope month average |
etfSlopeRatioAvg1y | slope divided by ETF slope year average |
etfSlopeRatioAvgStdv1y | slope divided by ETF slope year standard deviation |
impliedR2 | regression formula goodness of fit of the 30 day ORATS implied volatility to the 20 day future statistical ex-earnings volatility |
contango | short-term contango of at-the-money implied volatilities ex-earnings |
nextDiv | next dividend amount |
impliedNextDiv | next implied dividend given options prices put call parity |
annActDiv | annual dividend from the next year of expected dividends |
annIdiv | annual implied dividend given options prices put call parity |
borrow30 | implied hard-to-borrow interest rate at 30 days to expiration given options prices put call parity |
borrow2yr | implied hard-to-borrow interest rate at two years to expiration given options prices put call parity |
error | total weighted squared error times the confidence in the monthly implied volatility |
confidence | total weighted confidence from the monthly implied volatilities derived from each month’s number of options and bid ask width of the options markets |
# Core Earn
Field | Definition |
---|---|
pxCls | underlying price at the last close |
wksNextErn | weeks to the next earnings is available through another subscription |
avgOptVolu20d | average option volume for all strikes over the last 20 days |
oi | total open interest for all strikes. |
atmIvM1 | at-the-money implied volatility for month 1 interpolated using strikes weighted to at-the-money |
dtExM1 | days to expiration for month 1 |
atmIvM2 | at-the-money implied volatility for month 2 |
dtExm2 | Days to expiration for month 2 |
atmIvM3 | at-the-money implied volatility for month 3 |
dtExM3 | days to expiration for month 3 |
atmIvM4 | at-the-money implied volatility for month 4 |
dtExM4 | days to expiration for month 4 |
straPxM1 | straddle price for month 1 closest to the money strikes |
straPxM2 | straddle price for month 2 |
smoothStraPxM1 | straddle ORATS smooth theo for month 1 based on a smoothed line through all strikes |
smoothStrPxM2 | straddle ORATS smooth theo for month 2 |
fcstStraPxM1 | straddle ORATS Forecast theo for month 1 |
fcstStraPxM2 | straddle ORATS Forecast theo for month 2 |
loStrikeM1 | low strike of the straddle or strangle for month 1 |
hiStrikeM1 | high strike of the straddle or strangle for month 1 |
loStrikeM2 | low strike of the straddle or strangle for month 2 |
hiStrikeM2 | high strike of the straddle or strangle for month 2 |
ernMv1 | percentage move for earnings date back 1 |
ernMv2 | percentage move for earnings date back 2 |
ernMv3 | percentage move for earnings date back 3 |
ernMv4 | percentage move for earnings date back 4 |
ernMv5 | percentage move for earnings date back 5 |
ernMv6 | percentage move for earnings date back 6 |
ernMv7 | percentage move for earnings date back 7 |
ernMv8 | percentage move for earnings date back 8 |
ernMv9 | percentage move for earnings date back 9 |
ernMv10 | percentage move for earnings date back 10 |
ernMv11 | percentage move for earnings date back 11 |
ernMv12 | percentage move for earnings date back 12 |
ernStraPct1 | earn straddle price as a percent of the stock price for earnings date number 1 |
ernStraPct2 | earn straddle price as a percent of the stock price for earnings date number 2 |
ernStraPct3 | earn straddle price as a percent of the stock price for earnings date number 3 |
ernStraPct4 | earn straddle price as a percent of the stock price for earnings date number 4 |
ernStraPct5 | earn straddle price as a percent of the stock price for earnings date number 5 |
ernStraPct6 | earn straddle price as a percent of the stock price for earnings date number 6 |
ernStraPct7 | earn straddle price as a percent of the stock price for earnings date number 7 |
ernStraPct8 | earn straddle price as a percent of the stock price for earnings date number 8 |
ernStraPct9 | earn straddle price as a percent of the stock price for earnings date number 9 |
ernStraPct10 | earn straddle price as a percent of the stock price for earnings date number 10 |
ernStraPct11 | earn straddle price as a percent of the stock price for earnings date number 11 |
ernStraPct12 | earn straddle price as a percent of the stock price for earnings date number 12 |
ernEffct1 | earn effect for earnings date number 1 |
ernEffct2 | earn effect for earnings date number 2 |
ernEffct3 | earn effect for earnings date number 3 |
ernEffct4 | earn effect for earnings date number 4 |
ernEffct5 | earn effect for earnings date number 5 |
ernEffct6 | earn effect for earnings date number 6 |
ernEffct7 | earn effect for earnings date number 7 |
ernEffct8 | earn effect for earnings date number 8 |
ernEffct9 | earn effect for earnings date number 9 |
ernEffct10 | earn effect for earnings date number 10 |
ernEffct11 | earn effect for earnings date number 11 |
ernEffct12 | earn effect for earnings date number 12 |
orHv5d | 5-day historical intraday volatility |
orHv10d | 10-day historical intraday volatility |
orHv20d | 20-day historical intraday volatility |
orHv60d | 60-day historical intraday volatility |
orHv90d | 90-day historical intraday volatility |
orHv120d | 120-day historical intraday volatility |
orHv252d | 252-day historical intraday volatility |
orHv500d | 500-day historical intraday volatility |
orHv1000d | 1000-day historical intraday volatility |
orHvXern5d | 5-day historical intraday volatility excluding day of and after earnings (5 observations less day of or day after earnings if applicable) |
orHvXern10d | 10-day historical intraday volatility excluding day of and after earnings |
orHvXern20d | 20-day historical intraday volatility excluding day of and after earnings |
orHvXern60d | 60-day historical intraday volatility excluding day of and after earnings |
orHvXern90d | 90-day historical intraday volatility excluding day of and after earnings |
orHvXern120d | 120-day historical intraday volatility excluding day of and after earnings |
orHvXern252d | 252-day historical intraday volatility excluding day of and after earnings |
orHvXern500d | 500-day historical intraday volatility excluding day of and after earnings |
orHvXern1000d | 1000-day historical intraday volatility excluding day of and after earnings |
clsHv5d | 5-day historical close to close volatility |
clsHv10d | 10-day historical close to close volatility |
clsHv20d | 20-day historical close to close volatility |
clsHv60d | 60-day historical close to close volatility |
clsHv90d | 90-day historical close to close volatility |
clsHv120d | 120-day historical close to close volatility |
clsHv252d | 252-day historical close to close volatility |
clsHv500d | 500-day historical close to close volatility |
clsHv1000d | 1000-day historical close to close volatility |
clsHvXern5d | 5-day historical close to close volatility excluding day of and after earnings |
clsHvXern10d | 10-day historical close to close volatility excluding day of and after earnings |
clsHvXern20d | 20-day historical close to close volatility excluding day of and after earnings |
clsHvXern60d | 60-day historical close to close volatility excluding day of and after earnings |
clsHvXern90d | 90-day historical close to close volatility excluding day of and after earnings |
clsHvXern120d | 120-day historical close to close volatility excluding day of and after earnings |
clsHvXern252d | 252-day historical close to close volatility excluding day of and after earnings |
clsHvXern500d | 500-day historical close to close volatility excluding day of and after earnings |
clsHvXern1000d | 1000-day historical close to close volatility excluding day of and after earnings |
iv10d | 10 calendar day interpolated implied volatility |
iv20d | 20 calendar day interpolated implied volatility |
iv30d | 30 calendar day interpolated implied volatility |
iv60d | 60 calendar day interpolated implied volatility |
iv90d | 90 calendar day interpolated implied volatility |
iv6m | 6 month interpolated implied volatility |
iv1yr | 1 year interpolated implied volatility |
orIvXern20d | ORATS short term implied volatility parameter solve of term structure at 30 calendar day with an 2 year IV parameter and earnings effect out |
orIvXernInf | ORATS long term implied volatility parameter solve of term structure at 2 year out with 30 calendar day parameter and earnings effect out |
slope | put call slope at the interpolated 30 calendar days of the tangent at 50 delta |
fcstSlope | ORATS forecasted 30 calendar day put/call slope |
fcstErnEffct | ORATS forecasted earnings effect considers day of and day after earnings, seasonality, recentness, median and average of move divided by expected move |
absAvgErnMv | absolute average percent earnings move 12 observations at the time of the historical earnings announcement |
ernMvStdv | standard deviation of the 12 earnings moves absolute values |
impliedEe | The implied earnings effect (percentage of expected normal move) to make the best-fit term structure of the month implied volatilities |
impErnMv | percentage stock move in the implied earnings effect to make the best-fit term structure of the month implied volatilities |
impMth2ErnMv | percentage stock move in the implied earnings effect to make the best-fit term structure of the month implied volatilities |
fairVol90d | IV of the first earnings month |
fairXieeVol90d | smoothed term structure ex-earnings Ivs at the front earnings month plus the solved earnings effect |
fairMth2XieeVol90d | 30 calendar day interpolated implied volatility with earnings effect out plus the additional IV earnings effect from the first earnings month |
impErnMv90d | additional IV the front earnings month has over its ex-earnings IV |
impErnMvMth290d | additional IV the second earnings month has over its ex-earnings IV |
exErnIv10d | implied 10 calendar day interpolated implied volatility with earnings effect out |
exErnIv20d | implied 20 calendar day interpolated implied volatility with earnings effect out |
exErnIv30d | implied 30 calendar day interpolated implied volatility with earnings effect out |
exErnIv60d | implied 60 calendar day interpolated implied volatility with earnings effect out |
exErnIv90d | implied 90 calendar day interpolated implied volatility with earnings effect out |
exErnIv6m | implied 6 month interpolated implied volatility with earnings effect out |
exErnIv1yr | implied 1 year interpolated implied volatility with earnings effect out |
# Full Example
Full Example with IV Rank greater than 50, contango above 1.0, entry days to earnings at least 10 days before earnings, only search for standard expirations (monthly expire dates), and filter out market width greater than 5% of the strike:
{
"general": {
"startDate": "2007-01-03",
"endDate": "2019-04-16",
"symbols": [{
"symbol": "SPY",
"weight": null,
"signals": null
}],
"expirationType": "ALL"
},
"entry": {
"mktWidthPct": {
"min": null,
"max": 0.05
},
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "before", "daysMin": 10, "daysMax" : null}
],
"indicatorTriggers" : [
{
"indicators": [{
"type": "ivrank",
"ti": null,
"symbol": "SPY"
}],
"min": 50,
"max": null
},
{
"indicators": [{
"type": "contango",
"ti": null,
"symbol": "SPY"
}],
"min": 1,
"max": 4.0
}
],
"options": [{
"ratio": 1,
"optionType": "call",
"leg": 1,
"opening": {
"dte": {
"target": 40,
"min": 30,
"max": 50
},
"strikeSelection": {
"type": "absDelta",
"value": {
"target": 0.65,
"min": 0.55,
"max": 0.75
}
}
}
}]
}
}
# Options
Options is where you set the entry parameters for each leg of the option. Options is an array of objects. Each JSON object represents 1 leg of the spread. So if the strategy is a Long Call, you would have 1 object in the array. If it is a Short Strangle, you would have 2 objects in the array, etc.
Below is a table of parameters that you can define.
Parameter | Definition | Values/Types |
---|---|---|
leg | The leg number of the overall strategy starting from 1 to 4. | integer |
ratio | The ratio of the leg. Positive number to go long and negative number to short. | integer. |
optionType | Call or Put option. | call | put. |
iBidVol | Implied volatility based on the option's bid price. | min/max = null | integer. |
iAskVol | Implied volatility based on the option's ask price. | min/max = null | integer. |
optionBid | Bid Price of an option. | min/max = null | integer. |
optionAsk | Ask Price of an option. | min/max = null | integer. |
opening | This is where you set your opening trade by specifying days to expiration and strike selection. | more details |
reEnter | reEnter is used only after an exit is triggered and it will reEnter at the specified dte and strikeSelection. | more details |
adjustment | adjustment is used for adjusting the option trade based on triggers that you specify. | more details |
dte | The days to expiration target to enter a trade. | target/min/max = integer |
strikeSelection | Absolute Delta or Out of the Money Stock Percentage to target for the strike. | type = absDelta | stockOTMPct, target/min/max = float. |
# Opening
Opening is required in order to run any option strategy backtest unless your strategy is a stock only strategy. Opening has two required parameters, days to expiration and strike selection. Opening is required and used to enter a new trade unless you set reEnter or adjustment parameters. When a trade is exited at expiration or at an exit trigger, it will roll to another new trade at the dte and strikeSelection that you have set.
This example says we are scanning for 30 days to expiration with a min/max range from 20 to 40 days and a strike selection type of absDelta targeting 25 delta with a min/max range from 20 to 30 delta.
"opening":
{
"dte": {
"target": 30,
"min": 20,
"max": 40
},
"strikeSelection": {
"type": "absDelta",
"value": {
"target": 0.25,
"min": 0.20,
"max": 0.30
}
}
}
# ReEnter
ReEnter has two required parameters to set, days to expiration and strike selection. ReEnter is used if you want to re-enter a trade at a different dte and strikeSelection compare to the opening. ReEnter is only triggered when you exit only after an exit is triggered and it will reEnter at the specified dte and strikeSelection. To disable reEnter, set it to null.
This example says we are scanning for 50 days to expiration with a min/max range from 40 to 60 days and a strike selection type of stockOTMPct targeting 1.05 with a min/max range from 1.02 to 1.08. For more details on how stockOTMPct works, please click on the link.
"reEnter":
{
"dte": {
"target": 50,
"min": 40,
"max": 60
},
"strikeSelection": {
"type": "stockOTMPct",
"value": {
"target": 1.05,
"min": 1.02,
"max": 1.08
}
}
}
# Adjustment
Adjusting an option position can get very complex but we try to create an effective way to adjust your position per option leg or the strategy as a whole. Adjustment section is set for each leg in the options array. There are two familiar parameters that are still required to set, days to expiration and strike selection.
There will be 2 sections that are new: daysForAdjusting and trigger. We will go through these in detail.
# daysForAdjusting
Days for adjusting allows you to control valid times when you could adjust your current opening option position with min and max days to expiration.
For example, if your daysForAdjusting is set to min = 5 and max = 10, the backtester will only look for adjustments when your current option position is inbetween 5 DTE and 10 DTE. This will allow you to adjust your option position closer to expiration and avoid adjusting when you still have a lot of time in your trade.
# trigger
Trigger is the main section that describes how your adjustment will be triggered and handled. The first part is to pick a trigger type between absDelta and stockOTMPct.
Select the trigger value min/max where if the value falls below min or rises above max, it will trigger an adjustment to be made.
For example, if the type = absDelta, min = 0.10, and max = 0.90, the adjustment will be made if the absDelta falls below 10 delta or rises above 90 delta.
# tiedTo
TiedTo is optional. It is another trigger but tiedTo a leg that you specify. If tiedTo is set, both the main trigger type you set in the value section and tiedTo has to be true.
Lets look at a Short Strangle example with leg 1 as the call side and leg 2 as the put side. If the trigger type of absDelta, value (leg 1) min = 0.10, max = 0.90, tiedTo leg = 2 (the other side leg), min = 0.15, and max = 0.85 then both the value and tiedTo criterias has to be true in order for adjustment to be triggered.
There are 2 scenarios that has to happen in order to make an adjustment.
- Leg 1 absDelta of the strangle falls below 0.10 and leg 2 absDelta rises above 0.85. Both of those critera has to be true in order to make an adjustment. The put side (leg 2) is being challenged. Since it is a strangle, the absDelta on each side moves opposite of each other if the stock moves in one direction.
- Leg 1 absDelta of the strange rises above 0.90 and leg 2 absDelta falls below 0.15. The call side (leg 1) is being challenged. Both of those critera has to be true in order to make an adjustment.
TIP
Remember, tiedTo is an optional parameter and you might not care what the other legs are doing.
# adjustLegs
AdjustLegs is required. It is an array of integers. You will set the leg number(s) that will adjust when the adjustment trigger is triggered.
Lets look at the same Short Strangle example from above, except that we want to only adjust the leg that is challeged above 90 delta. In order to do that, you will set the main absDelta trigger value min = null and max = 0.90. You will set all the tiedTo parameters to null. AdjustLegs will be set to [1]. JSON example below:
"adjustLegs" : [1]
This tells the backtester that you want to adjust leg 1 when the trigger is hit. Lets say you want to adjust the unchallenged side. You would set the adjustLegs to [2]. You could also adjust both legs when the trigger is hit by setting adjustLegs to [1,2]. This parameter is useful to control which legs to adjust when the trigger is hit.
# dte and strikeSelection
Once the daysForAdjusting and trigger event happens, the adjustment is made using the entry criteria Dte and strikeSelection. This is set just like the (opening)[/backtest-api-guide/parameters.html#opening] trade. They behave exactly the same way. This is the criteria for your adjustment entry trade.
"adjustment":
{
"daysForAdjusting": {
"min": null,
"max": null
},
"trigger": {
"type": "absDelta" | "stockOTMPct",
"value" : {
"min": null | float,
"max": null | float
},
"tiedTo": {
"leg": null | integer,
"min": null | float,
"max": null | float
},
"adjustLegs" : array of integers
},
"dte": {
"target": integer,
"min": integer,
"max": integer
},
"strikeSelection": {
"type": "absDelta" | "stockOTMPct",
"value": {
"target": float,
"min": float,
"max": float
}
}
}
TIP
Please remember to set adjustmentMaxCount in the general section if you want to limit the amount of adjustments for the opening trade.
# Days to expiration
Entry criteria to scan for entry trades at the target days to expiration with acceptable min/max dte.
Example below enters trades closest to 30 dte and acceptable min/max range between 20 to 40.
"dte": {
"target": 30,
"min": 20,
"max": 40
}
# Strike Selection
Entry criteria to scan for entry trades using absDelta or stockOTMPct.
"strikeSelection": {
"type": "absDelta" | "stockOTMPct",
"value": {
"target": float,
"min": float,
"max": float
}
}
# Absolute Delta
Absolute Delta controls which strikes to select based on absolute delta of the option.
Example below enters trades closest to 30 delta and acceptable min/max range between 25 and 40.
"strikeSelection": {
"type": "absDelta",
"value": {
"target": 0.30,
"min": 0.25,
"max": 0.40
}
}
# OTM Stock Percentage
Out of the money stock percentage controls which strikes to select based on the percentage of the stock price.
Entry target formual: Strike = StockPrice * stockOTMPct
Entry range formula: Strike >= StockPrice * stockOTMPctMin and Strike <= StockPrice * stockOTMPctMax
# OTM Call Strike
To better describe how it works, lets go through a concrete example using a Long Call.
We want to select a strike that is 10% out of the money from the stock price with an acceptable range of 5% to 15% OTM. We would set the target = 1.10, min = 1.05, and max = 1.15.
If the stock is currently trading at $100, then the strike target is $110 ($100 * 1.10), min = $105 ($100 * 1.05), and max = $115 ($100 * 1.15).
The backtester will select a strike closest to $110 if available and min strike of $105 and a max strike of $115.
Example JSON below:
"strikeSelection": {
"type": "stockOTMPct",
"value": {
"target": 1.10,
"min": 1.05,
"max": 1.15
}
}
# ITM Call Strike
Sometimes we want to enter an in the money strike. Lets use the same example above but we want to select a strike that is 10% in the money and an acceptable range of 5% to 15% in the money. We would set the target = 0.90, min = 0.85, and max = 0.95.
This is a bit confusing because min is now 15% in the money and max is 5% in the money. To figure out the min, you would use the formula 0.85 = 1 - 0.15 and max 0.95 = 1 - 0.05.
So now, if the stock is currently trading at $100, then the strike target is $90 ($100 * 0.90), min = $85 ($100 * 0.85), and max = $95 ($100 * 0.95).
Example JSON below:
"strikeSelection": {
"type": "stockOTMPct",
"value": {
"target": 0.90,
"min": 0.85,
"max": 0.95
}
}
# OTM Put Strike
To better describe how it works, lets go through a concrete example using a Long Put.
We want to select a strike that is 10% out of the money from the stock price with an acceptable range of 5% to 15% OTM. We would set the target = 0.90, min = 0.85, and max = 0.95.
TIP
Because puts strikes are more out of the money as the strikes gets lower (opposite of long call), we would select strikes lower to find trades that are OTM.
If the stock is currently trading at $100, then the strike target is $90 ($100 * 0.90), min = $85 ($100 * 0.85), and max = $95 ($100 * 0.95).
The backtester will select a strike closest to $90 if available and min strike of $85 and a max strike of $95.
Example JSON below:
"strikeSelection": {
"type": "stockOTMPct",
"value": {
"target": 0.90,
"min": 0.85,
"max": 0.95
}
}
# ITM Put Strike
Sometimes we want to enter an in the money strike. Lets use the same example above but we want to select a strike that is 10% in the money and an acceptable range of 5% to 15% in the money. We would set the target = 1.10, min = 1.05, and max = 1.15.
If the stock is currently trading at $100, then the strike target is $110 ($100 * 1.10), min = $105 ($100 * 1.05), and max = $115 ($100 * 1.15).
Example JSON below:
"strikeSelection": {
"type": "stockOTMPct",
"value": {
"target": 1.10,
"min": 1.05,
"max": 1.15
}
}
# Spread
Spread entry filters allows you to filter based on the whole spread total for multi-leg strategies. You can also use this section for single leg options. For example if you want to enter a Long Call Spread close to $1.50 but would not mind if you enter it at $1.20 and a max at $2.10, then you would set the price target to $1.50, min to $1.20 and max to $2.10.
Spread delta allows you to filter by the total delta of the option spread. YieldPct allows you to filter out the spread based on the option trade price relative to the stock price.
The formula for price, delta, and yieldPct is below:
price = leg1Ratio * leg1OptPrice + leg2Ratio * leg2OptPrice + ...
delta = leg1Ratio * leg1Delta + leg2Ratio * leg2Delta + ...
yieldPct = spreadOptPx / stock price. The spreadOptPx = price that's calculated above.
Add the following JSON snippet anywhere inside the entry section of the JSON object:
"spread": {
"price": {
"target": 1.50,
"min": 1.20,
"max": 2.10
},
"delta": {
"target": null,
"min": null,
"max": null
},
"yieldPct": {
"target" : null,
"min": null,
"max": null
}
}
# Leg Relation
LegRelation lets you control the relationship of each leg relative to one another during entry.
There are 3 values you can control: strikeWidth, deltaTotal, and dteDiff. Let's go through each one.
# strikeWidth
Strike width allows you to specify the strike width of the spread. For example, in a $5 wide Long Call Spread where leg1 is the long leg and leg 2 is the short leg, you would set strikeWidth.leg1Leg2.min = 5 and strikeWidth.leg1Leg2.max = 5.
Strike width formula:
strikeWidth.leg1Leg2 = leg1Strike - leg2Strike
strikeWidth.leg2Leg3 = leg2Strike - leg3Strike
strikeWidth.leg3Leg4 = leg3Strike - leg4Strike
You could also specify a range of strike width by setting min = 5 and max = 20. This says the acceptable strike width difference between leg1 and leg2 will be $5 to $20 wide.
TIP
Make sure that the strike that you are subtracting from is higher or else you will have to deal with negative numbers.
The example above, if leg1 was the short leg and leg2 was the long leg, then the strikeWidth calculation will be negative.
If it is negative, then min/max will have to be switched to reflect negative. If you want $5 to $20 strikes wide, then you would set min = -20 and max = -5 in this case as -20 (min) is less than -5.
"strikeWidth": {
"leg1Leg2": {
"min": null | float,
"max": null | float
},
"leg2Leg3": {
"min": null | float,
"max": null | float
},
"leg3Leg4": {
"min": null | float,
"max": null | float
}
}
# deltaTotal
Delta total allows you to specify the total delta of the spread. For example, if you want a delta neutral Short Straddle and an acceptable range of -5 to 5 delta where leg1 is the short call and leg 2 is the short put, you would set deltaTotal.leg1Leg2.min = -0.05 and deltaTotal.leg1Leg2.max = 0.05.
Delta total formula:
deltaTotal.leg1Leg2 = leg1Ratio * leg1Delta + leg2Ratio * leg2Delta
deltaTotal.leg2Leg3 = leg2Ratio * leg2Delta + leg3Ratio * leg3Delta
deltaTotal.leg3Leg4 = leg3Ratio * leg3Delta + leg4Ratio * leg4Delta
"deltaTotal": {
"leg1Leg2": {
"min": null | float,
"max": null | float
},
"leg2Leg3": {
"min": null | float,
"max": null | float
},
"leg3Leg4": {
"min": null | float,
"max": null | float
}
}
# dteDiff
Dte Diff allows you to specify the days to expiration difference of the spread. Most of the time, you would want to set min/max to 0 in order for each leg to have the same expiration date. A Long Call Calendar would be a good example to have min/max set to different ranges so the front month leg would expire earlier than the back month leg.
Formula for dteDiff.leg1Leg2 = leg1Dte - leg2Dte
Dte Diff formula:
dteDiff.leg1Leg2 = leg1Dte - leg2Dte
dteDiff.leg2Leg3 = leg2Dte - leg3Dte
dteDiff.leg3Leg4 = leg3Dte - leg4Dte
"dteDiff": {
"leg1Leg2": {
"min": null | float,
"max": null | float
},
"leg2Leg3": {
"min": null | float,
"max": null | float
},
"leg3Leg4": {
"min": null | float,
"max": null | float
}
}
# EXIT SECTION
The exit section of the JSON payload consists of all the exit parameters to exit the current option position when an exit trigger has hit.
Parameter | Definition | Values/Types |
---|---|---|
dteDays | Days to expiration trigger where if it hits X dte, it will exit. Default value is expire. | expire | integer |
holdDays | Amount of days to hold from entry date. | null | integer. |
dateTriggers | Date triggers are triggers to exit a trade on X days before or after a earning, conference & event, dividend, or split date. | |
indicatorTriggers | Indicator triggers are triggers to exit a trade if a given indicator type falls below min or rises above max value. ie. ivrank, contango, etc. Click here for more indicator types. | |
options | To exit on a specific option leg trigger using absDelta or stockOTMPct | more details |
spread | You can exit the option spread based on price, profitLossPct, strikeTrigger, and strikeDiffPctValue | more details |
options | Options is an array of objects that details each entry leg of the overall option strategy. Please click the options link for more in-depth explanation. | options |
spread | You can set the price, delta, and yieldPct for the option spread as a whole. | more details |
legRelation | This is used for multi-leg strategies for controlling which option leg to enter relative to each other. For example, for a 5 point wide long call spread, you would specify leg1leg2 strikeWidth min/max = 5. | more details |
# Exit Days to Expiration
There are 2 ways to exit, either set dteDays to "expire" or X number of days. If you set dteDays to "expire", it will let the option expire assuming there are no other exit triggers that you set. If you set dteDays to say 5, the trade will exit at 5 days left to expiration.
Add the following JSON snippet anywhere at the exit section of the JSON object:
"dteDays": "expire" //expire or X number of days
# Exit Hold Days
Set holdDays to X number of days to exit after X number of days held from entry. So if you set holdDays to 10 and entered an option trade at 10/3/2018, the trade will exit 10 days after entry at 10/13/2018. Since 10/13/2018 is a weekend Saturday, it will exit the next business day at 10/15/2018.
Add the following JSON snippet anywhere at the exit section of the JSON object:
"holdDays": 10 //hold trade for 10 days
# Exit Date Triggers
To exit trades by X amount of days before or after a date type. You can enter as many date types as you like.
Add the following JSON snippet inside the exit section:
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "after", "days": 10},
{"type" : "confevents", "occurrence" : "before", "days": 10},
{"type" : "divs", "occurrence" : "before", "days": 3},
{"type" : "splits", "occurrence" : "after", "days": 1}
]
# Exit Earnings Date Trigger
To exit a trade 1 day before an earnings date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "before", "days": 1}
]
To exit a trade 1 day after an earnings date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "earnings", "occurrence" : "after", "days": 1}
]
# Exit Conference & Events Date Trigger
To exit a trade 20 days before a conference and events date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "confevents", "occurrence" : "before", "days": 20}
]
To exit a trade 20 days after a conference and events date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "confevents", "occurrence" : "after", "days": 20}
]
# Exit Dividends Date Trigger
To exit a trade 1 day before an ex-dividend date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "divs", "occurrence" : "before", "days": 1}
]
To exit a trade 1 day after an ex-dividend date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "divs", "occurrence" : "after", "days": 1}
]
# Exit Splits Date Trigger
To exit a trade 1 day before a stock split date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "splits", "occurrence" : "before", "days": 1}
]
To exit a trade 2 days after a stock split date, add the following JSON snippet:
"dateTriggers" : [
{"type" : "splits", "occurrence" : "after", "days": 2}
]
# Exit Indicator Triggers
To exit trades by a given indicator type below min or above max value. You can enter as many indicator types as you like.
Add the following JSON snippet inside the exit section:
"indicatorTriggers" : [
{
"indicators": [{
"type": "ivrank",
"ti": null,
"symbol": "SPY"
}],
"min": 5,
"max": null
},
{
"indicators": [{
"type": "contango",
"ti": null,
"symbol": "SPY"
}],
"min": -2.0,
"max": 10.0
}
]
# Exit IV Rank
Implied Volatility Rank tells us whether implied volatility is high or low in a specific underlying based on the past year of IV data. IV Rank = (the current IV level - the 52 week IV low) / (the 52 week IV high - 52 week IV low) * 100.
To exit trades when Implied Volatility Rank falls below 5, add the following JSON snippet inside the entry section:
"indicatorTriggers" : [
{
"indicators": [{
"type": "ivrank",
"ti": null,
"symbol": "SPY"
}],
"min": 5,
"max": null
}
]
# Exit Contango
Short-term contango of at-the-money implied volatilities ex-earnings.
To exit trades when contango falls below -2.0 or rises above 5.0, add the following JSON snippet:
"indicatorTriggers" : [
{
"indicators": [{
"type": "contango",
"ti": null,
"symbol": "SPY"
}],
"min": -2.0,
"max": 5.0
}
]
# More Exit Indicator Types
Click here to see more indicator types or see our data api docs at core general and core earn.
# Exit Options
To exit on a specific option leg trigger using absolute delta or stock otm %, we can set a option trigger. This is similar to the strike selection for entry but it is for exits. You can set a specific leg, for instance, if you want your Iron Condor to exit when the 3rd leg absolute delta rises over 0.75.
Example below:
"options" :
[
{
"leg" : 3, //Look for leg 3
"trigger" : {
"type" : "absDelta", //absDelta or stockOTMPct
"value" : {
"min" : null, //no min trigger is set
"max" : 0.75 //exit if delta is above 0.75
}
}
}
]
As you noticed, the JSON options object is an array, so you can add multiple legs in the options object to exit. For example below, we set leg1 min to 0.05 absDelta and leg4 min to 0.10 absDelta. It will exit the Iron Condor if leg1 absDelta falls below 5 delta or if leg4 absDelta falls below 10 delta.
Add the following JSON snippet anywhere at the exit section of the JSON object:
"options" : [
{
"leg" : 1, //Look for leg 1
"trigger" : {
"type" : "absDelta", //absDelta or stockOTMPct
"value" : {
"min" : 0.05, //exit if below 5 delta.
"max" : null //no max exit is set
}
}
},
{
"leg" : 4, //Look for leg 4
"trigger" : {
"type" : "absDelta", //absDelta or stockOTMPct
"value" : {
"min" : 0.10, //exit if below 10 delta.
"max" : null //no max exit is set
}
}
}
]
# Exit Spread
The exit spread section allows you to control when to exit based on the spread price, profitLossPct, strikeTrigger, and strikeDiffPctValue.
Parameter | Definition | Values/Types |
---|---|---|
price | Exit when the spread price is below min or above max | min = null | float, max = null | float |
profitLossPct | Exit when the loss is below min or when the profit is above max. | min = null | float, max = null | float |
strikeTrigger | Exit when the total delta or absDelta falls below min or rises above max. | type = delta | absDelta, min = null | float, max = null | float |
strikeDiffPctValue | We use strikeDiffPctValue to exit if the max strike width of the spread is lower than the min or higher than the max set. | more details |
"spread":
{
"price": {
"min": null | float,
"max": null | float
},
"profitLossPct": {
"min": null | float,
"max": null | float
},
"strikeTrigger": {
"type": "absDelta" | "delta",
"value": {
"min": null | float,
"max": null | float
}
},
"strikeDiffPctValue": {
"min": null | float,
"max": null | float
}
}
# Exit on Spread Price
Just like spread price entry, you could exit on spread price when it falls below min or rises above max.
Spread Price = Leg1Ratio * Leg1TradePrice + Leg2Ratio * Leg2TradePrice +...
Add the following JSON snippet anywhere at the exit.spread section of the JSON object:
"price": {
"min": 0.50, //exit if spread price is below 0.50.
"max": null //no max exit trigger is set.
}
# Exit on Profit or Loss %
You can set a stop loss or manage profit using profitLossPct exit parameter. We base our profit and loss % on the debit paid (net long option) or credit received (net short option). For example, if you paid $5.00 on a Long Straddle and you want to set a stop loss at 50% ($2.50 spread price) and take profit at 75% ($8.75 spread price), you would set the min to -0.50 and max at 0.75. If it is a Short Straddle, you would still set min to -0.50 and max 0.75 since we calculate the profit or loss % for you based on debit or credit.
Add the following JSON snippet anywhere at the exit.spread section of the JSON object:
"profitLossPct": {
"min": -0.50, //exit if trade goes below 50% loss.
"max": 0.75 //exit if trade goes above 75% profit.
}
# Exit on Spread Delta
Just like spread delta entry, you could exit on spread delta total or absDelta when it falls below min or rises above max.
delta = Leg1Ratio * Leg1Delta + Leg2Ratio * Leg2Delta +...
absDelta = Abs(Leg1Ratio * Leg1Delta + Leg2Ratio * Leg2Delta +...)
If you are using delta, becareful with negative deltas when you set min and max. For instance, if you have a short strangle position and you want to exit if it goes below 5 delta you would actually want to set the max to -0.5 since -0.4, -0.3, -0.2, etc... is greater than -0.5.
Add the following JSON snippet anywhere at the exit.spread section of the JSON object:
"strikeTrigger": {
"type": "absDelta", //absDelta or delta
"value": {
"min": null, //exit if trade goes below min
"max": null //exit if trade goes below max
}
}
# Exit on Strike Diff %
We use strikeDiffPctValue to exit if the max strike width of the spread is lower than the min or higher than the max set. So for example, with an Iron Condor of 100, 105, 120, 130 strikes, the max width of the spread is $10 which is between 130 and 120. Then we use the min/max set times the max width of the spread to calculate the % value of the width. Then we check that value if the absolute spread price is lower or higher than the min/max.
strikeDiffValueMin = strikeDiffPctValue.Min * maxWidthOfSpread
strikeDiffValueMax = strikeDiffPctValue.Max * maxWidthOfSpread
If absSpreadPx < strikeDiffValueMin then we exit.
If absSpreadPx > strikeDiffValueMax then we exit.
In the above example, if the current price of the Iron Condor is $0.90 and we set the strikeDiffPctValue.min = 10% then the strikeDiffValueMin = $1.00 ($10 * .10). Since the Iron Condor spread price of $0.90 is lower than $1.00 we would exit this spread.
Add the following JSON snippet anywhere at the exit.spread section of the JSON object:
"strikeDiffPctValue": {
"min": 0.10, //If absSpreadPx < (min * maxWidthOfSpread) we exit
"max": null //If absSpreadPx > (max * maxWidthOfSpread) we exit
}
# HEDGE SECTION
To delta hedge your option position with stock, set either the days or deltaTolerance parameter. Setting days will hedge your position every X amount of days. Delta tolerance will delta hedge your option position if the total delta triggers below the min or above your max allowable delta.
Example: set days to 1 if you want to delta hedge everyday. Set deltaTolerance.max = .30 if you want to delta hedge every time your delta position goes rises above 30 delta.
TIP
Only set either days or deltaTolerance, not both.
Add the following JSON snippet anywhere at the root section (sibling of general section) of the JSON object:
"hedge": {
"days": 1, //hedge with stock everyday
"deltaTolerance": {
"min": null,
"max": null
}
}