The trading terminal can be accessed through a simple MTS (Mechanical Trading System) API. The programmable interface allows to:
- receive current account state
- receive a list of open positions
- open a new position
- close a position
First a TCP connection should be established from an application with a server secure.akmos.com, port 80 using HTTP protocol (a standard protocol for accessing web servers). If connection is successfully established, issue a command (the following example uses HTTP 0.9 for simplicity)
GET http://secure.akmos.com/mtsterm/?command[CR][LF]
The command format is described below. [CR][LF] - line termination symbols.
If the command is invalid, the server will return a help screen with an explanation of use. If the command is valid, the server will attempt to execute it and will return results of execution. If server fails, it will return an error message which starts with ERROR:.
Comman format:
type=acctype&login=login&password=password&op=action
where
- acctype
- account type - demo, contest, or real. Make sure you debug your application on a demo account first.
- login
- Account login
- password
- self-explanatory
- action
- the requested action (operation)
The following actions are valid (parameter op):
- status
- Get current account status
- getpos
- Get a list of open positions
- open
- Open a new position. Additional parameters (mandatory):
instrum=instrum&bs=BUY/SELL&lots=numlots
instrum
The instrument being traded. The list of possible instruments is here.
BUY/SELL
Side of the trade. The only valid values are BUY and SELL.
numlots
The number of lots to open.
- close
- Close previously open position. Additional parameters:
pos=posnum&lots=numlots
posnum
The number of position being closed.
numlots
The number of lots to close. If the number of lots is more or equal the number of open lots in this position, the position will be closed completely.
The API can be tested using any web browser, for example Microsoft Internet Explorer. In the address field of the browser enter the command as follows:
http://secure.akmos.com/mtsterm/?<command as described above>
The server supports HTTP versions 0.9-1.1 (RFC 1945, 2616), as well as HTTPS.
An example of trading through the MTS API from an MS Excel table.
|