The StockTickr API Documentation

The StockTickr API provides an easy way for developers to add executions to StockTickr from code. The API automatically categorizes your executions into "trades" within StockTickr.

So if you enter orders and get filled at different prices, StockTickr recognizes this and collapses the executions into a single order and creates an open trade.

The StockTickr API is HTTP based and uses HTTP-AUTH for authentication. This makes the API very easy to use with support for a wide array of languages and programming environments.

To use the StockTickr API, a valid subscription to StockTickr is required.

The only method available in the API is add_execution.xml. It can be used to add executions to StockTickr. Here is a simple example:

https://api.stocktickr.com/api/add_execution.xml?symbol=MSFT&price=33.94&shares=400&action=buy&fill_time=1200311167&tags=long,StrategyOne

Accessing the URL above will open a long trade in MSFT at 33.94. StockTickr will automatically assign a stop price according to your preferences within your profile.

You can also assign your own stop using the stop_price parameter:

https://api.stocktickr.com/api/add_execution.xml?symbol=MSFT&price=33.94&stop_price=32.99&shares=400&action=buy&fill_time=1200311167&tags=long,StrategyOne

Here is a complete list of available parameters:

  • symbol - (required) ticker symbol
  • price - (required) price the execution was filled
  • shares - (required) quantity of shares in this execution
  • action - (required) one of either "buy" or "sell".
  • fill_time - (required) the time of the execution in one of two formats: "01/10/2008 09:56:07" or epoch time "1200311167"
  • tags - (optional) used to specify a comma delimited list of tags to assign to the trade.
  • stop_price - (optional) stop price to assign to the trade. This parameter is ignored if the execution doesn't open a new trade.
  • signal_price - (optional) used to calculate slippage. This value is compared with price to determine the slippage on the trade. If omitted slippage is not calculated.
  • exec_id - (optional) the execution id from your trading application. This is an optional field, but if it's available to your application it's a good idea to include this field. This helps StockTickr prevent adding duplicate executions.
  • equity - (optional) total account equity (not buying power). If omitted, the most recent equity value is used.
  • journal_comments - (optional) text field for the comment field within StockTickr.
  • commission - (optional) used to specify the commission amount for this execution. If omitted, the default commission will be calculated according to the user's preferences in their profile.
  • multiplier - (optional) use when adding a non equity trading instrument to specify the multiplier or magnifier.
  • description - (optional) used for the description of a non equity trading instrument.

Responses

The responses from the server will be XML and will either be:

<result success="1">Execution added.</result>

for success or:

<error success="0">Execution not added.</error>

for failure.

If you attempt to enter an execution that is already in StockTickr, you'll receive a response like this:

<error success="0">Execution already entered.</error>

Example Code in Perl

use LWP;
use strict;

my $username = "davemabe"; # your StockTickr username
my $password = "mypassword"; # your StockTickr password

my $browser = LWP::UserAgent->new;
$browser->credentials("api.stocktickr.com:443", "StockTickr API", $username => $password);

my $url = "https://api.stocktickr.com/api/add_execution.xml?symbol=MSFT&price=33.94&shares=400&action=buy&fill_time=1200311167&tags=long,StrategyOne";
my $response = $browser->get($url);

if ($response->is_success) {
  print "Success.\n";
} else {
  print "Failure.\n";
}