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:
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>
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";
}