Trade Smarter with Automation

$a5 Platform API

$a5 is a globally available API providing useful utility functions and access to all bots, accounts and open opportunities.

Usage

Pause bots tagged "bullish" if they don't have an opportunity:
var bulls = $a5.bots.tag('bullish');
bulls.forEach(function(bot){
    if(!bot.opp){
        bot.pause('Potential market downturn.');
    }
});
Access account metrics:
var acct = $a5.accounts.get('sim');
$log(acct);

Properties

  • Collection

    A collection of your connected brokerage accounts.

    The id of your paper trading account is 'sim'.

    // Paper trading account
    var acct = $a5.accounts.get('sim');
    $log(acct.totalDraw);
  • Collection

    A collection of all active bots.

  • Date

    The current time as a Date object. More about dates...

  • Collection

    A collection of all open opportunities.

    // total capital draw, all open opps
    var draw = $a5.opps.sum('draw');
  • Number

    The current market time as an integer (e.g. 9:30am = 930, 12:15pm = 1215, 3:45pm = 1545).

Functions

copy(dest, source)

Copies all properties from object source to object dest.

Arguments
  • Object

    The object receiving the properties.

  • Object

    The object with the properties to copy.

Usage
// duplicate object
var query2 = $a5.copy({}, query);

isClosing(minutes)

Returns true if the market is with minutes of closing (or closed).

Arguments
  • Number

    The number of minutes until closing.

Usage
// market is closing in 5 min
if($a5.isClosing(5)){
    opp.close('Market closing');
}

round(num, precision = 2)

Rounds a number to specified decimal precision. Also available globally as $$().

Arguments
  • Number

    The number to round.

  • Number

    The desired decimal precision. (defaults to 2)

Usage
var price = $a5.round($stock.last * .9);

// shorthand
var price = $$($stock.last * .9);