Trade Smarter with Automation

OptionSeries

Contains details about an option series and strike prices.

Usage

Call $data.optionseries with options to select the desired option series:

var query = {
    symbol: 'JPM',
    expiration: 'next friday'
};

$data.optionseries(query).then(function(series){
    // API functions
    var a = series.nearest(50);  // strike nearest $50
    var b = series.gt(50);       // greater than
    var c = series.gte(50);      // greater than / equal to
    var d = series.lt(50);       // less than
    var e = series.lte(50);      // less than / equal to

    var strikes = series.strikes;     // array of all strike prices

    series.forEach(function(price){

    });
});

Looking up strikes

Option strike prices can be inconsistent. You may find it useful to look up strikes to ensure they are always available.

Example

// the first monthly series with
// at least 30 days til expiration
var squery = {
    symbol: $stock.symbol,
    days: 30,
    monthlyOnly: true
};

$data.optionseries(squery).then(function(series){
    // get strikes closest to 1 standard deviation away
    var shortStrike = series.gte($stock.close + $stock.averageMove),
         longStrike = series.gt(shortStrike);

    var query = {
        id: 'spread',
        type: 'bearcall',
        symbol: $stock.symbol,
        days: 30,
        legs: [shortStrike, longStrike]
    };

    $data.spreads(query).then($done);
});

API

Properties

  • Number

    The number of days until expiration for the series.

  • Date

    The expiration date of the series.

  • Number

    The highest strike price.

  • Number

    The number of prices in strikes.

  • Number

    The lowest strike price.

  • Array

    Array of all strike prices in this series.

  • String

    The underlying symbol for the series.

Functions

forEach(fn)

Calls the supplied function, fn, with each strike price in strikes.

Arguments
  • Function

    A function to call. Passed (price, index).

gt(value)

Returns the first strike price greater than value.

Arguments
  • Number

    A strike price, e.g. 52.50.

Usage
var option = $range.gt(.3);
console.log(option.strike);

gte(value)

Returns the first strike price greater than or equal to value.

Arguments
  • Number

    A strike price, e.g. 52.50.

Usage
var option = $range.gte(.3);
console.log(option.strike);

lt(value)

Returns the first strike price less than value.

Arguments
  • Number

    A strike price, e.g. 52.50.

Usage
var option = $range.gte(.3);
console.log(option.strike);

lte(value)

Returns the first strike price less than or equal to value.

Arguments
  • Number

    A strike price, e.g. 52.50.

Usage
var option = $range.gte(.3);
console.log(option.strike);

nearest(value)

Returns the strike price nearest to value.

Arguments
  • Number

    A strike price, e.g. 52.50.

Usage
var option = $range.nearest(.3);
console.log(option.strike);