xstation API Communication Protocol Documentation v. 2.2



Similar documents
Terms and definitions

EF MetaTrader 5 for Android OS

AGREEMENT ON QUOTING SYSTEM AND TRANSACTIONS PROCEDURE. LiteForex Investments Limited

One Click Trader. Manual

MetaTrader 4 for iphone Guide

SirixWeb 3.0. User guide

MetaTrader 4 for Android TM Guide

1. Introduction Logging In Screen Lock Logging Out 6

Commander FIX. Rules of Engagement. Corporates and Markets. 5 Jul 2013 Version 1.5

OVERVIEW TABLE OF CONTENTS. Logging in 1. Main Screen 2. Tool Bar 2. Market Rates 4. Trading Cubes 5. Orders 6. Pending Orders Tab 7.

MT4i Internet Trade Mirror - Receiver

MT4 Multiterminal USER MANUAL

TRADING MECHANISM FOR DYNAMIC STP & DYNAMIC FIXED SPREAD TRADING ACCOUNTS Contents

Meta Trader 4 for iphone User Guide

Sirix Web 6.0 User Guide. Leverate Sirix Web 6.0 User Guide 1

WINDSOR BROKERS LTD Ref: TRADING MECHANISM FOR MINI & MICRO TRADING ACCOUNTS. Contents

Forex Trade Copier 2 User manual

Terms for Provision of Forex Trading Services and Use of MetaTrader4 AM UK Trading Platform

MT4i Personal Trade Copier

Tading Platform Manual

User Guide. For more information us on:

Nordea e-markets FIX - Rules of Engagement

REST Webservices API Reference Manual

MOCAZ FINANCIAL MARKETS

Forex Trading. Instruction manual

SWFX - Swiss FX Marketplace Manual V

FOREX PLATFORM USER S GUIDE

Logging into the platform

Trading Contracts for Difference on margin involves a high degree of risk and may not be suitable for all investors.

easy-forex MT4 User Manual Version: Date: April 2010

iphone Application User Guide

WEB TRADER USER MANUAL

Karvy NEST Web (Next Generation Securities Trading System)

Trader Manual. NatureForex.com

Sirix Tablet 6.5 User Guide

META QUOTES IPAD USER GUIDE

Trader 4 Client User Guide Provided by Henyep Investment (UK) Limited

PROfit 3.7. User manual Copyright 2014 Internovus Bulgaria. All rights reserved.

OANDA FXTrade Platform: User Interface Reference Manual

Lesson 5: The Trading Station

WEBTrader. User Guide

How To Use The Market Watch On A Microsoft Mt4/5 App On A Pc Or Macbook

Bitcoin Payment Gateway API

TeleTrader Toolbox for MATLAB

xsocial Platform Manual User Manual

Appendix. Web Command Error Codes. Web Command Error Codes

MetaTrader 4/5 for Android. User Guide

TERMS FOR PROVISION OF FOREX TRADING SERVICESAND USE OF METATRADER 4AM TRADING PLATFORM

User Guide for ios. 14 November Copyright GMO-Z.com Bullion HK Limited. All rights reserved.

Developing Algo Trading Applications with SmartQuant Framework The Getting Started Guide SmartQuant Ltd Dr. Anton B.

SQ TRADING STATION User Guide & Installation

Job Reference Guide. SLAMD Distributed Load Generation Engine. Version 1.8.2

Mobile Forex trading with TradeRoom Mini

Client Agreement. 1. Introduction

VANTAGE FX FOR ANDROID

Prestige International Bullion Limited. MT4 Operation Manual

LMAX Exchange FIX4.4 & API FAQs April 2015

MetaTrader 4 and MetaEditor

ODBC Client Driver Help Kepware, Inc.

User Guide for Android OS

NASDAQ ITCH to Trade Options

Trading Station II / MetaTrader 4 Product Guide 12 November Page 1 of 14

ROBOFOREX LP Address: Level 3, 13 O Connell St, Auckland, 1010, New Zealand Telephone:

SUPER TREND PROFIT. (Trend Indicator with alert popup and alert) DISCLAIMER

E*TRADE Developer Platform. Developer Guide and API Reference. October 24, 2012 API Version: v0

Forex Trading Guide & Tutorial For Beginner

Exchange Web Services [EWS] support in The Bat! v7

WINDSOR DIRECT 4 USER GUIDE

MEFFGate Trading FIX INTERFACE SPECIFICATIONS

CommSeC CFDS: IntroDuCtIon to FX

The purpose of this ebook is to introduce newcomers to the forex marketplace and CMTRADING. Remember that trading in forex is inherently risky, and

High-frequency Trading Using Hlaiman EA Generator. Usage of the High-frequency Trading Module (HFT) for МТ4

PowerTradeCopier. Forex Trade Copier BJF Trading Group

LOYEX TRADING STATION

SATURN WEB USER GUIDE: Spread Betting

Riverbed Cascade Shark Common REST API v1.0

5. Foreign Currency Futures

MT4 ANDROID USER GUIDE. FASTEST GROWING FX PROVIDER 2012 World Finance Awards. BEST TRADING PLATFORM World Finance Awards

DataLogger Kepware, Inc.

USER MANNUAL. Version 1.9.6

Z.com Trader. User Guide version 1.4

Any symbols displayed within these pages are for illustrative purposes only, and are not intended to portray any recommendation.

META QUOTES ANDROID USER GUIDE - TABLET

MET ATRADER 4 Guid e version 1.0 January 2013

HalifaxOnline Platform and Account Setup Guide

FOREX PROFIT MASTER USER GUIDE.

Forex Trade Copier Manual

Trading Station / MetaTrader 4 Product Guide 2 October Page 1 of 15

Safeguard Ecommerce Integration / API

DoubleInADay Expert Advisor. User's Guide

Ability to trade using two platforms: the Soft-FX Traders Platform and MT4;

Documentation to use the Elia Infeed web services

Managing Users and Identity Stores

Syslog Windows Tool Set (WTS) Configuration File Directives And Help

Transcription:

xstation API Communication Protocol Documentation v. 2.2

1. CONTENTS 2. Introduction... 4 3. Definitions... 4 4. General data format... 5 5. Communication with the xstation API... 6 1. Connection validation... 6 2. Default login credentials... 7 3. Input data format... 7 4. Output data format... 7 5. Time format... 7 6. format... 8 6. Available Commands... 8 1. Login... 8 2. Logout... 9 3. Retrieving trading data... 9 Command: getallspreads... 9 Command: getallsymbolgroups... 10 Command: getallsymbols... 10 Command: getcalendar... 12 Command: getchartlastrequest... 13 Command: getchartrangerequest... 14 Command: getcommissiondef... 15 Command: getcurrentuserdata... 16 Command: getmarginlevel... 16 Command: getmargintrade... 17 Command: getnews... 17 Command: getprofitcalculation... 18 Command: getservertime... 19 Command: getspreads... 19 Command: getsymbol... 19 Command: gettickprices... 20 Command: gettraderecords... 21 2

Command: gettrades... 21 Command: gettradeshistory... 22 Command: gettradinghours... 23 4. Sending orders... 24 Command: tradetransaction... 24 Command: tradetransactionstatus... 25 7. Available streaming commands... 26 Command: gettickprices... 26 Command: gettrades... 27 Command: getbalance... 29 Command: getreqstatus... 30 Command: getprofits... 31 8. Error messages... 31 Generated by Transaction server... 32 3

2. INTRODUCTION This document presents information on xstation API communication protocol. The communication protocol of the xstation API uses JSON format. JSON format used by the server doesn't allow extensions (e.g. comments, other flags). JSON format standardization document is available under the following link: http://tools.ietf.org/html/rfc4627 The connection is performed by clean socket connection. For real trading SSL connection will be used. 3. DEFINITIONS The following definitions will be used in this specification document: simple type: type, which value is itself: int, int64, string, double, bool; j-value (JSON value): any simple type, j-object or j-array; j-object (JSON object): a record containing any number of named j-values (pair <string, j-value>); j-array (JSON array): an array where each element is j-value; j-subvalue: j-value which is a component of a j-object. A j-object can contain zero elements. A j-array can have zero length. The name of j-value can be an empty string. Encoding of strings is set to UTF-8. In this format the server sends and receives data. Definition of unix-time: Unix time, or POSIX time, is a system for describing points in time, defined as the number of milliseconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970. 4

4. GENERAL DATA FORMAT Each packet consists of exactly one main, unnamed j-value. The data stream consists of consecutive j values, with no punctuation. The main j-value is a j-object containing exactly two j-subvalues which are j-objects. The first j-subobject is named header and consists of at least a field type as a simple type string. This is a packet type. The second j-subobject of the main packet j-object is named data and its content is specific for a given packet type. The specifications for different types of packages are described in the next chapter. A sample of properly defined packet: command : login, arguments : userid : 1000, password : PASSWORD 5

5. COMMUNICATION WITH THE XSTATION API There are two IPs, that can be used interchangeably: xapia.x-station.eu xapib.x-station.eu Here are the addresses of DEMO and REAL servers: DEMO: main port: 5124, streaming port: 5125. REAL: main port: 5112, streaming port: 5113. Both servers use SSL connection. Communication is established as long as both server and client have opened and connected sockets. For convenience server guarantees that every separate reply to client command returned by server will be separated by two new line characters ( \n ). 1. CONNECTION VALIDATION In order to provide best service for all users xstation API set rules on connection and data send process. If any of the following rules is breached, then connection is closed immediately without server notification. List of rules: Every new connection that fails to deliver data within one second from when it is established is forced to close with no notification. Each command invocation should not contain more than 1kB of data user should send requests in 200 ms interval. However, this rule can be broken, but after 6th exceeding in a row the connection is dropped. Each command should be proper JSON object Exception: If the client sends a request that is a valid JSON object, but does not conform to the published API (incorrect command, missing fields, etc.), the response is sent back with the error description but the connection is not closed. This rule prevents incorrect messages from reaching further down the processing chain and allows clients to analyze and understand the source of problem. 6

2. DEFAULT LOGIN CREDENTIALS Default login credentials can be obtained at: http://developers.xstore.pro/panel/. 3. INPUT DATA FORMAT The input data format is a JSON object that consists of service name and command name. Some commands also require an object of command's arguments. If optional prettyprint field is set to true, an output JSON is printed in human-readable format. prettyprint field can be omitted. command : commandname, arguments : arg1name : 10, arg2name : Some text,..., prettyprint : true Boolean 4. OUTPUT DATA FORMAT The output data format is a JSON object that consists of status and returndata fields if command succeeded, or status, errorcode and errordescr fields if an error occurred. status : true, returndata : JSON value Boolean JSON value or, in case of error massage: status : false, errorcode : E123, errordescr : Error description Boolean 5. TIME FORMAT 7

Time is number of milliseconds from 01.01.1970, 00:00 GMT. 6. FLOATING NUMBER FORMAT In all s '.' (period) is used as a decimal separator. 6. AVAILABLE COMMANDS Request-Reply commands are performed on main connection socket. The reply is sent by main connection socket. 1. LOGIN In order to perform any action client application have to perform login process. No functionality is available before proper login process. After initial login, a new session is created and all commands are executed for a logged user until he/she logs out or drop the connection. command : login, arguments : userid : 100, password : PASSWORD, appid : test, appname : test Number (optional), application id, given by the xstore Support (optional), application name After successful login the system responds with the status message that can contain the streaming session id field: status : true, Boolean streamsessionid : 8469308861804289383, 8

Alternatively, when redirect is needed, the system responds with: status : false, redirect : REDIRECT_RECORD Boolean (optional) Format of REDIRECT_RECORD: mainport : 1234, streamingport : 1235, address : xapia.x-station.eu Number, main port for communication Number, streaming port, address that the user should reconnect to in order to login The status of the correct login process is true. If the status is false, REDIRECT_RECORD may be present which defines the server that the user should log into instead of the current one. It is assumed that when using REDIRECT_RECORD data, secure connection (SSL) should be used. The streamsessionid field of the string type, if present, is a token that can be used to establish a streaming subscription on a separate network connection. streamsessionid is used in streaming subscription commands. streamsessionid is unique for the given main session and will change between login sessions. 2. LOGOUT command : logout No returndata field in output. Only status message is sent. 3. RETRIEVING TRADING DATA Command: getallspreads Description: returns current spreads for all instruments available. 9

command : getallspreads Format of returndata field in output (example data): [SPREAD_RECORD, SPREAD_RECORD, SPREAD_RECORD,...] Format of SPREAD_RECORD (example data): precision : 3, quoteid : 2, symbol : "FTE.FR", value : 0 Number of decimal places of symbol Number Number, in pips Command: getallsymbolgroups Description: returns object with all groups of instruments available for given account. command : getallsymbolgroups Format of returndata field in output: [SYMBOL_GROUP_RECORD, SYMBOL_GROUP_RECORD ] Format of SYMBOL_GROUP_RECORD (example data): description : Foreign Exchange, name : Forex, type : 0 Number: Instrument group number, is used for type field in SYMBOL_RECORD Command: getallsymbols Description: returns array of all symbols available for the user. 10

command : getallsymbols Format of returndata field in output: [SYMBOL_RECORD, SYMBOL_RECORD...] Format of SYMBOL_RECORD (example data): ask : 4000.0, bid : 4000.0, categoryname : Forex contractsize : 100000, currency : USD, currencyprofit : SEK, description : USD/PLN, digits : 0, exemode : 2, expiration : null groupname : Minor, high : 4000.0, initialmargin : 0, instantmaxvolume : 0, longonly : false, lotmax : 10.0, lotmin : 0.1, lotstep : 0.1, low : 3500.0, marginhedged : 0, marginhedgedstrong : false, marginmaintenance : null, marginmode : 4, Number, size of 1 lot in currency The currency of calculated profit Number, price precision Number, mode of execution Time or null if not applicable Number, initial margin for 1 lot order, used for profit/margin calculation Number, maximum instant volume multiplied by 100 Boolean, maximum size of trade, minimum size of trade, A value of minimum step by which the size of trade can be changed (within lotmin - lotmax range). Number, used for profit calculation Boolean, for margin calculation Number, for margin calculation. Null if not applicable Number, for margin 11

calculation percentage : 0.1,, precision : 2, Number, symbol precision profitmode : 1, Number, for profit calculation quoteid : 1, Number, source of price: 1 fixed 2 float 3 depth 4 - cross starting : null, Time, null if not applicable stopslevel : 15, Number, stop level swapenable : true, Boolean, indicates whether swap value is added to position on end of day swaplong : -2.559290000000,, swap value for long positions swapshort : 0E-12,, swap value for short positions swaptype : 0, Number, type of swap calculated swap_rollover3days : 0, Number, time when additional swap is accounted for weekend symbol : USDPLN, ticksize : null,, smallest possible price change, used for profit/margin calculation. Null if not applicable tickvalue : null,, value of smallest possible price change, used for profit/margin calculation. Null if not applicable time : 1272446136891, Time time : Thu May 23 12:23:44 EDT 2013, Time in type : 21, Number, corresponds to key of SYMBOL_GROUP_RECORD Please be advised that result values for profit and margin calculation can be used optionally, because server is able to perform all profit/margin calculations for Client application by commands described later in this document. Command: getcalendar Description: returns calendar with market events. 12

command : getcalendar Format of returndata field in output: [CALENDAR_RECORD, CALENDAR_RECORD...] Format of CALENDAR_RECORD (example data): country : CA, : Two letter country code current :, : Market value (current), empty before time of release of this value (time from time record) forecast :, : Forecasted value impact : 3, : Impact on market (1- low, 2 - medium, 3 - high) period : (FEB), : Information period previous : 58.3, : Value from previous information release time : 1354806000000, Time: Time, when the information will be released (in this time empty current value should be changed with exact released value) title : Ivey Purchasing Managers Index, : Name of the indicator for which values will be released Command: getchartlastrequest Description: returns chart info, from start date to the current time. command : getchartlastrequest, arguments : info : CHART_LAST_INFO_RECORD 13

Format of CHART_LAST_INFO_RECORD (example data): symbol : PKN.PL, period : 5, start : 1262944112000 : symbol Number: period code Time: start of chart block Format of returndata field in output: digits : 2, Number, price precision exemode : 2, Number rateinfos : [RATE_INFO_RECORD,RATE_INFO_RECORD,...] Array of RATE_INFO_RECORDs Command: getchartrangerequest Description: returns chart info with data between given start and end dates. command : getchartrangerequest, arguments : info : CHART_RANGE_INFO_RECORD Format of CHART_RANGE_INFO_RECORD (example data): symbol : PKN.PL, period : 5, start : 1262944112000, end : 1262944412000 ticks : 0 : symbol Number: period code Time: start of chart block Time: end of chart block Number: numbers needed ticks, this field is optional, please read description below Chart period codes: PERIOD_M1 = 1 PERIOD_M5 = 5 PERIOD_M15 = 15 PERIOD_M30 = 30 PERIOD_H1 = 60 PERIOD_H4 = 240 PERIOD_D1 = 1440 1 minute 5 minutes 15 minutes 30 minutes 60 minutes (1 hour) 240 minutes (4 hours) 1440 minutes (1 day) 14

PERIOD_W1 = 10080 PERIOD_MN1 = 43200 10080 minutes (1 week) 43200 minutes (30 days) Format of returndata field in output: digits : 2, Number, price precision exemode : 2, Number rateinfos : [RATE_INFO_RECORD, RATE_INFO_RECORD,...] Array of RATE_INFO_RECORDs Method receives two oldest RATE_INFO_RECORDS in case no data is available for selected period. Format of RATE_INFO_RECORD (example data): close : 1.0, : value of close price (shift from open price) ctm : 1262944112000, Time: rate time ctm : Mar 21, 2013 4:15:00 PM, Number: value of close price (shift from open price) high : 6.0, : highest value in period (shift from open price) low : 0.0, : lowest value in period (shift from open price) open : 41848.0, : example value of real open price: 119.87 vol : 12.00 : volume Price values must be divided by 10 digits in order to obtain exact prices. Ticks field if ticks is not set or value is 0, getchartrangerequest work as before (you must send valid field start and end time. If ticks value not equal 0, field end is ignored. If ticks>0 (e.g. N) then api return N candles from time start. If ticks<0 then api return N candles to time start. It's possible situation when api return less chart candles than is set in tick field. Command: getcommissiondef Description: returns calculation of commission and rate of exchange. The value is calculated as expected value, and therefore might not be perfectly accurate. 15

command : getcommissiondef, arguments : symbol : T.US, volume : 1.0 Format of returndata field in output if commission is applicable: commission : 0.51 rateofexchange : 0.1609 showcomdef : false Floating: calculated commission Floating: rate of exchange between account currency and instrument base currency Boolean Format of returndata field in output if commission is NOT applicable: commission : null, rateofexchange : null null value null value Command: getcurrentuserdata Description: returns information about account currency, and account leverage. command : getcurrentuserdata, Format of returndata field in output if commission is applicable: currency : PLN, leverage : 100, account currency Number, leverage for account. Leverage is used for margin calculation for Forex instruments. User might want to have such information. Command: getmarginlevel Description: returns margin level for account. This command can be invoked more often than once a second. 16

command : getmarginlevel Format of returndata field in output: balance : 10768.10,, balance + credit currency : CZK : user currency equity : 10762.10,, equity margin : 75.00, : margin requirements margin_free : 10597.10, : free margin margin_level : 14229.47, : margin level Command: getmargintrade Description: returns expected margin for given instrument and volume. The value is calculated as expected margin value, and therefore might not be perfectly accurate. "arguments": "symbol": "EURPLN", "volume": 1.0, "command": "getmargintrade" Format of returndata field in output: "returndata": 4399.350 "status": true, calculated margin Command: getnews Description: returns news from trading server which were sent within specified period of time. 17

command : getnews, arguments : start : 1275993488000, Time end : 0 Time, 0 means current time for simplicity Format of returndata field in output: [NEWS_TOPIC_RECORD, NEWS_TOPIC_RECORD...] Array of NEWS_TOPIC_RECORDs Format of NEWS_TOPIC_RECORD (example data): body : <HTML>...</HTML>, : body bodylen : 110, Number: body length category : Normal, : news category, can be null key : 278599, : news key keywords :, : news keywords, can be null priority : 0, Number: news priority: 0-general, 1-high read : false, Boolean time : 1262944112000, Time time : May 17, 2013 4:30:00 PM, title :, : news title topic :, : news topic Command: getprofitcalculation Description: calculates estimated profit for given deal data Should be used for calculator-like apps only. Profit for opened transactions should be taken from server, due to higher precision of server calculation. command : getprofitcalculation, arguments : symbol : EURUSD, volume : 1.0, cmd : 0, Number, OPERATION_CODE openprice : 1.2233, theoretical open price of order closeprice : 1.3000, theoretical close price of order 18

Format of returndata field in output if commission is applicable: profit : 714.3030, Command: getservertime Description: returns current time on trading server. command : getservertime Format of returndata field in output (example data): time : 1272462188000 Time time : Oct 25, 2012 3:39:53 PM, time described in form set on server (local time of server) Command: getspreads Description: returns current spreads for predeterminded instruments. command : getspreads, arguments : symbols : [ EURPLN, AGO.PL ] Format of returndata field return the same fields as getallspreads. Command: getsymbol 19

Description: gets information about symbol available for the user. command : getsymbol, arguments : symbol : EURPLN Format of returndata field return the same fields as getallsymbols. Command: gettickprices Description: returns array of current quotations for given symbols, only quotations that changed from given timestamp are returned. New timestamp obtained from output will be used as an argument of the next call of this command. command : gettickprices, arguments : symbols : [ KOMB.CZ, AGO.PL,...], Array of symbols timestamp : 1262944112000, level : 0 Time Number, price level, level equals -1: all available levels greater than -1: only specified level. Zero indicates base level (Bid and Ask price) for instrument. Format of returndata field in output: quotations : [TICK_RECORD, TICK_RECORD...] Array of quotations Format of TICK_RECORD (example data): ask : 4000.0, bid : 4000.0, askvolume : 15000, bidvolume : 16000, Number, null if not applicable Number, null if not 20

exemode : 2, high : 4000.0, low : 3500.0, symbol : KOMB.CZ, timestamp : 1272529161605, level : 0 applicable Number Time Number, price level Command: gettraderecords Description: returns array of trades listed in orders argument. command : gettraderecords, arguments : orders : [7489839,7489841,...] Array of orders Format of returndata field in output: [TRADE_RECORD, TRADE_RECORD...] Array of TRADE_RECORDs Command: gettrades Description: returns array of user's trades command : gettrades arguments : openedonly : true Boolean, if true then only opened trades will be returned Format of returndata field in output: [TRADE_RECORD, TRADE_RECORD...] Array of TRADE_RECORDs Format of TRADE_RECORD (example data): close_price : 1.3256, close_time : null, Time or null if order is not closed 21

close_time : null, Time or null if order is not closed closed : false, Boolean cmd : 0, Number, operation code comment : Web Trader, commission : 0.0, digits : 4, Number, price precision expiration : null, Time or null if not applicable expiration : null, or null if not applicable login : 100, Number margin_rate : 3.9149000, open_price : 1.4, open_time : 1272380927000, Time open_time : Fri Jan 11 10:03:36 CET 2013, order : 7497776, Number, order number for opened transaction order2 : 1234567, Number, order number for closed transaction position : 1234567, Number, order number common both for opened and closed transaction profit : -2196.44, sl : 0.0,, zero if stop loss is not set spread : 0, Number storage : -4.46, symbol : EURUSD, taxes : 0.0, timestamp : 1272540251000, Time tp : 0.0,, zero if take profit is not set volume : 0.10 cmd is the operation code, for user's trade operations it equals to cmd from TRADE_TRANS_INFO record used as an argument in tradetransaction and confirmpriced commands. Command: gettradeshistory Description: returns array of user's trades which were closed within specified period of time. command : gettradeshistory, arguments : start : 1275993488000, Time end : 0 Time, 0 means current time for simplicity 22

Format of returndata field in output: [TRADE_RECORD, TRADE_RECORD...] Array of TRADE_RECORDs Command: gettradinghours Description: returns quotes and trading times. command : gettradinghours, arguments : symbols : [ EURPLN, AGO.PL, EURJPY, SAN.ES, EURUSD ] Array of s Format of returndata field in output: symbol : EURPLN, quotes : [QUOTES_RECORD, QUOTES_RECORD,...], Array of QUOTES_RECORDs trading : [TRADING_RECORD, TRADING_RECORD,...] Array of TRADING_RECORDS Format of QUOTES_RECORD and TRADING_RECORD(example data): day : 2, Number, day of week fromt : 63000000, Time, start time from 00:00 in ms tot : 63300000 Time, end time from 00:00 in ms Possible day field values: 1 Monday 2 Tuesday 3 Wednesday 23

4 Thursday 5 Friday 6 Saturday 7 Sunday 4. SENDING ORDERS Command: tradetransaction Description: starts trade transaction. tradetransaction sends main transaction information to the server. command : tradetransaction, arguments : tradetransinfo : TRADE_TRANS_INFO Format of TRADE_TRANS_INFO (example data): Operation codes: cmd : 0, type : 0, price : 37.47, sl : 0.0, tp : 0.0, symbol : PKN.PL, volume : 5.00, ie_deviation : 0, order : 7489843, comment : Some text, expiration : 1262944112000 Number, trade operation Number, trade transaction type, trade price, stop loss, take profit, trade symbol, trade volume Number, deviation on instant execution Number, order number (0 if new trade is opened), comment Time, pending order expiration time BUY = 0 SELL = 1 BUY_LIMIT = 2 SELL_LIMIT = 3 BUY_STOP = 4 SELL_STOP = 5 24

Transaction type codes: ORDER_OPEN = 0 ORDER_CLOSE = 2 ORDER_MODIFY = 3 ORDER_DELETE = 4 Used for opening order, also for asking for prices in EXE_REQUEST mode Format of returndata field in output: requestid : 43 Number, unique request id, can be negative Command: tradetransactionstatus Description: returns current transaction status. At any time of transaction processing client might check the status of transaction on server side. In order to do that client must provide unique requestid taken from tradetransaction invocation. command : tradetransactionstatus, arguments : requestid : 43, Number Format of returndata field in output: ask : 1.392, bid : 0.0, order : 0, requestid : 43, requeststatus : 3 message : null Number Number, can be negative Number, can be null Request status codes: ERROR = 0 PENDING = 1 REQUOTED = 2 ACCEPTED = 3 Price was requoted by dealer, used in EXE_INSTANT mode The transaction has been executed successfully 25

REJECTED = 4 PRICED = 5 The transaction has been rejected. Prices received, used in EXE_REQUEST mode Field order should be filled with order number always when new trade order was opened successfully. 7. AVAILABLE STREAMING COMMANDS Streaming commands are performed on streaming connection on port 23461 of the server. Each streaming command takes as an argument streamsessionid which is sent in response message for login command performed in main connection. streamsessionid token allows to identify user in streaming connection. In one streaming connection multiple commands with different streamsessionid can be invoked. It will cause sending streaming data for multiple login sessions in one streaming connection. streamsessionid is valid until logout command is performed on main connection or main connection is disconnected. Command: gettickprices Description: The gettickprices command establishes subscription for quotations and allows to obtain the relevant information in real-time, as soon as it is available in the system. Moreover, gettickprices command response send profit information for all opened orders with given symbol number. Format of input to subscribe: command : gettickprices, symbol : EURUSD, streamsessionid : 8469308861804289383 Format of input to unsubscribe: command : stoptickprices, symbol : EURUSD, The streamsessionid should contain the string value that was obtained from the system after successful login (see the description of the login command). The gettickprices command can be invoked many times for the same symbol, but only one subscription for a given symbol will be created. This command has no confirmation. After the subscription is established, the system sends data packets of the STREAMING_TICK_RECORD format. Format of tick prices in stream: 26

command : tickprices, data : STREAMING_TICK_RECORD STREAMING_TICK_RECORD: ask : 4000.0, bid : 4000.0, askvolume : 15000, bidvolume : 16000, high : 4000.0, low : 3500.0, symbol : KOMB.CZ, timestamp : 1272529161605, level : 0, quoteid : 0, Number, null if not applicable Number, null if not applicable Time Number, price level Number, source of price: 1 fixed 2 float 3 depth 4 - cross Command: gettrades Description: The gettrades command establishes subscription for user trade status data and allows to obtain the relevant information in real-time, as soon as it is available in the system. Format of input to subscribe: command : gettrades, streamsessionid : 8469308861804289383 Format of input to unsubscribe: command : stoptrades The streamsessionid should contain the string value that was obtained from the system after successful login (see the description of the login command). 27

The gettrades command can be invoked many times, but only one subscription for the trade data will be created. This command has no confirmation. After the subscription is established, the system sends data packets of the STREAMING_TRADE_RECORD format. Format of trade in stream: command : trade, data : STREAMING_TRADE_RECORD STREAMING_TRADE_RECORD: close_price : 1.3256, close_time : null, closed : false, cmd : 0, comment : Web Trader, commission : 0.0, digits : 4, expiration : null, margin_rate : 3.9149000, open_price : 1.4, open_time : 1272380927000, order : 7497776, order2 : 7497777, position : 123456, sl : 0.0, storage : -4.46, symbol : EURUSD, timestamp : 1272540251000, tp : 0.0, type : 0.0, volume : 0.10 Time or null if order is not closed Boolean Number, operation code Number, price precision Time or null if not applicable Time Number, order number for opened transaction Number, transaction id Number, position number (if type is 0 and 2) or transaction parameter (if type is 1), zero if stop loss is not set Time, zero if take profit is not set Number, 0 order opened, 1 order pending, 2 order closed New STREAMING_TRADE_RECORD are sent by streaming socket only in several cases: - Opening the trade 28

- Closing the trade - Modification of trade parameters - Explicit trade update done by server system to synchronize data. Situation that trade was closed can be checked by field closed set to true in TRADE_RECORD format. Also close_time field will NOT be set to null. Various reasons of trade close could be found out by information in comment field of STREAMING_TRADE_RECORD for closed order. If the comment remained unchanged from that of opened order, then the order was closed by user. If there is annotation in comment string like: - sl, then the trade was closed by stop loss - tp, then the trade was closed by take profit - so, then the trade was closed because of Stop Out (lack of money to maintain position) The annotation are in brackets (regular or square, depending on situation) with additional data about the closing action. Command: getbalance Description: The getbalance command allows to get actual balance value for an account in real-time, as soon as it is available in the system. Format of input to subscribe: command : getbalance, streamsessionid : 8469308861804289383 Format of input to unsubscribe: command : stopbalance, Format of balance in stream: command : balance, data : STREAMING_BALANCE_RECORD Format of STREAMING_BALANCE_RECORD: balance : 10023.13, margin : 75.00, sum of balance and credit, margin 29

equity : 75.00 requirements, sum of balance and all profits Command: getreqstatus Description: The getreqstatus command allows to get status for sent requests in real-time, as soon as it is available in the system. Format of input to subscribe: command : getreqstatus, streamsessionid : 8469308861804289383 Format of input to unsubscribe: command : stopreqstatus, Format of balance in stream: command : reqstatus, data : STREAMING_REQ_STATUS_RECORD Format of STREAMING_REQ_STATUS_RECORD: requestid : 123, requeststatus : 23, Number, unique request id, can be negative Request status codes: ERROR=0 PENDING=1 REQUOTED=2 Price was requoted by dealer, used in EXE_INSTANT mode ACCEPTED=3 The transaction has been executed successfully 30

order : 123456 Number, order number Command: getprofits Description: subscribes and unsubscribes for profits. Format of input to subscribe: command : getprofits, streamsessionid : 8469308861804289383 Format of input to unsubscribe: command : stopprofits, Format of balance in stream: command : profit, data : STREAMING_PROFIT_RECORD Format of STREAMING_PROFIT_RECORD: profit : 7076.52, order : 7497776, order2 : 7497777, position : 7497776 Number, order number Number, transaction ID Number, position number 8. ERROR MESSAGES 31

GENERATED BY TRANSACTION SERVER Main reason of generated transaction server error messages is an error in the business logic of the application. Errors list returned from transaction server: Error Code BE001 BE002 BE003 BE004 BE005 BE006 BE007 BE008 BE009 BE010 BE011 BE012 BE013 BE014 BE015 BE016 BE017 BE018 BE019 Error Description Invalid price Invalid StopLoss or TakeProfit Invalid Volume Login disabled Login not found Market for instrument is closed Mismatched parameters Modification is denied Not enough money on account to perform trade Off quotes Opposite positions prohibited Short positions prohibited Price has changed Request too frequent Requote Too many trade requests Too many trade requests Trading on instrument disabled Trading timeout 32

BE020 BE033, BE099 BE094 BE095 BE096 BE097 BE098 BE101 BE102 BE103 BE104 BE105 BE106 BE107 BE109 BE110 BE111, BE111 BE113 BE115, BE116 BE118 EX001-, SExxx Other error Symbol do not exist for given account Account cannot trade on given symbol Pending order cannot be closed. Pending order must be deleted Cannot close already closed order No such transaction Unknown instrument symbol Unknown transaction type User is not logged Method not exist Incorrect period given Missing data Sort category not recognized Incorrect parameter given Incorrect command format Incorrect provider chart parameter Invalid provider chart parameter Symbol does not exist User already logged Internal error, in case of such error, please contact support 33

34