Trade Smarter with Automation

Opportunities

Opening opportunities

Opportunities are opened by calling $bot.open, e.g.

$bot.open({
    type: 'equity',
    symbol: 'JPM',
    price: 55.23
});

Below is a list of the types of opportunities Alta5 currently supports:

Equity (Long/Short)

// short LVS
$bot.open({
    type: 'shortequity',
    symbol: 'LVS',
    memo: 'LVS is going down'
});
// Long JPM, hard-coded price
$bot.open({
    type: 'equity',
    symbol: 'JPM',
    price: 55.23,
    timeout: 60    // cancel order in 60 seconds
});
Options
  • String

    'equity' or 'shortequity'

  • String

    The stock ticker symbol (e.g. 'JPM')

  • Mixed

    A fixed limit price, array of prices or price settings object. More info...

  • Number

    The quantity for the order. More info...

  • Number/String

    The amount of time to keep the order open. More info...

  • Object

    Any storable data you want to attach to the opportunity.

  • String

    A memo message displayed in the app when viewing the opportunity.

  • String

    A comma separated list of tags.

Options (Long/Short)

$bot.open({
    type: 'call',
    symbol: 'AAPL',
    strike: 120,
    days: 10    // <-- at least 10 days to exp
});
$bot.open({
    type: 'shortput',
    symbol: 'JPM',
    strike: 55,
    expiration: 'next friday',
    price: [.9, .85, .8],
    tags: 'naked'
});

If you have an option security ($option) returned by the $data.option or $data.optionchain APIs, use option instead of providing symbol, strike, days and expiration:

$bot.open({
    type: 'shortcall',
    option: $option
});
Options
  • String

    'call', 'put', 'shortcall' or 'shortput'

  • String

    The underlying ticker symbol (e.g. 'JPM')

  • Number

    The strike price of the option (matches exact). Either strike or delta is required.

  • Number

    The delta of the option (matches nearest). Either strike or delta is required.

  • Security

    An option security returned by $data.option or $data.optionchain. If option is supplied then symbol, strike, days and expiration can be omitted.

  • Number

    Select option from the first option series with at least days to expiration. Optional if a expiration is provided.

  • String/Date

    Select option from the first option series that expires on or after the expiration date. Optional if a days is provided. Date formats...

  • Mixed

    A fixed limit price, array of prices or price settings object. More info...

  • Number

    The quantity for the order. More info...

  • Number/String

    The amount of time to keep the order open. More info...

  • String

    Filter option series by expiration style. Valid values are *, weeklys, monthlys, eom, standard, quarterlys. Defaults to *. Use a comma separated list to include more than 1 (e.g. 'weeklys,quarterlys').

  • String

    Filter option series by settlement style. Valid values are *, open, close. Defaults to close.

  • Object

    Any storable data you want to attach to the opportunity.

  • String

    A memo message displayed in the app when viewing the opportunity.

  • String

    A comma separated list of tags.

Credit Spreads

$bot.open({
    type: 'bullput',
    symbol: 'AAPL',
    legs: [131, 130],
    expiration: 'next friday'
});

If you load a variable using the $data.spreads API, use the spread option:

$bot.open({
    type: 'bearcall',
    spread: $spread
});
Options
  • String

    'bullput' or 'bearcall'

  • String

    The underlying ticker symbol (e.g. 'JPM')

  • Array

    An array containing the strike prices of the options in the spread, e.g. [55, 56].

  • Spread

  • Mixed

    A fixed limit price, array of prices or price settings object. More info...

  • Number

    The quantity for the order. More info...

  • Number/String

    The amount of time to keep the order open. More info...

  • String

    Filter option series by expiration style. Valid values are *, weeklys, monthlys, eom, standard, quarterlys. Defaults to *. Use a comma separated list to include more than 1 (e.g. 'weeklys,quarterlys').

  • String

    Filter option series by settlement style. Valid values are *, open, close. Defaults to close.

  • Object

    Any storable data you want to attach to the opportunity.

  • String

    A memo message displayed in the app when viewing the opportunity.

  • String

    A comma separated list of tags.

All Opportunities

Properties

  • Number

    The total amount paid to close the opportunity. closeCost will be negative for long and positive for short opportunities.

  • Date

    The date the opportunity was closed.

  • Date

    Total P/L for any closed positions of this opportunity.

  • Number

    The total trade commissions for the opportunity.
    * Paper trading commission values are not real charges and are solely for performance analysis.

  • Number

    The total amount paid to open the opportunity. The value will be negative for opportunities that collect premium.

  • Number

    The number of days this opportunity has been open.

  • Number

    The highest amount of capital drawn by this opportunity at any time.

  • Number

    The highest amount of capital drawn by this opportunity today.

  • Number

    P/L as a decimal percent of capital drawn. This value is either markGain or marketGain, depending on your settings (under "Advanced Settings" in the app).

  • String

    The id of this opportunity.

  • String

    The id of the bot that opened this opportunity.

  • Boolean

    true if this opportunity is closed.

  • Number

    The amount of capital or margin reserved to secure this opportunity.

  • Number

    P/L as a decimal percent of capital drawn by this opportunity. Calculated using marketPnl and highDraw.

  • Number

    P/L for the opportunity using the market asking price(s).

  • Number

    The current value of the opportunity using the market asking price(s).

  • Number

    P/L as a decimal percent of capital drawn by this opportunity. Calculated using markPnl and highDraw.

  • Number

    P/L calculated using the mark price(s) midway between the bid/ask spread.

  • Number

    The current value of the opportunity using the mark price(s) midway between the bid/ask spread.

  • Date

    The date the opportunity was opened.

  • Date

    The total capital drawn by open positions or active trades.

  • Number

    The total P/L. This value is either markPnl or marketPnl, depending on your settings (under "Advanced Settings" in the app).

  • Date

    openDraw plus any previous losses.

  • Date

    The total capital drawn by active trades.

  • Number

    The current value of the opportunity. This value is either markValue or marketValue, depending on your settings (under "Advanced Settings" in the app).

Functions

close(memo)

Close the opportunity.

Arguments
  • String

    Memo text displayed in the application.

Usage
$bot.opp.close('Stop Loss');

Options (Long/Short)

Properties

  • Number

    The number of days until expiration.

  • Number

    The delta greek value for the option.

  • Date

    The expiration date for the option.

  • Number

    The gamma greek value for the option.

  • Number

    The implied volatility value for the option. Also aliased as iv.

  • Number

    Total open interest for the option.

  • Number

    For call options, this is the difference between the underlying's price and the strike price. For put options, it is the difference between the strike price and the underlying's price.

  • Boolean

    True for call options.

  • Boolean

    True if the option is expired.

  • Boolean

    True for put options.

  • Boolean

    True if the option is in the money (ITM).

  • Boolean

    Alias for impliedVolatility.

  • Number

    The rho greek for the option.

  • Number

    The strike price value for the option.

  • Number

    The theta greek value for the option.

  • Number

    The option price - intrinsicValue.

  • String

    'call' or 'put'.

  • Security

    A Security object for the underlying.

  • Number

    The vega greek value for the option.

Functions

roll(opts)

Rolls an option opportunity to different strike price, delta or expiration.

Options
  • Number

    The strike price of the option (matches exact). Either strike or delta is required.

  • Number

    The delta of the option (matches nearest). Either strike or delta is required.

  • Security

    An option security returned by $data.option or $data.optionchain. If option is supplied then delta, strike, days and expiration can be omitted.

  • Number

    Rolls to an option in the first option series with at least days to expiration. Optional if a expiration is provided.

  • String/Date

    Rolls to an option in the first option series that expires on or after the expiration date. Optional if a days is provided. Date formats...

  • Mixed

    A fixed limit price, array of prices, 'auto' or price settings object. Use negative numbers for a debit, positive for a credit. For example, -.15 would roll for a 15 cents per share debit. More info...

  • Number/String

    The amount of time to keep the order open. More info...

  • String

    A memo message displayed in the app when viewing the opportunity.

Usage
var calls = $bot.opps.first('shortcall');
if(calls && calls.daysOpen > 3 && calls.timeValue < $timeValue){
    calls.roll({
        delta: $delta,
        expiration: calls.expiration.nextMonthlyDate
    });
}