ZuluTrading Forex API Reference

ZuluTrading Binary API Reference

Go to the ZuluTrading Binary API Reference

1. Introduction

2. Environment

3. Services

Trading
• Open Market
Description
:
Opens a market trade
REST URL
:
/open/market
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
lotsDoubletrueThe trade's volume in STD lots.0.1
buyBooleantrueIndicates if market trade is buy or sell.true
requestedPriceDoubletrueIndicative open price, zulu will open at market rate.1.12
uniqueIdStringtrueThe unique id assigned to this trade, it can be accessed later using this id."1234567"
Sample Call
http://tradingserver.zulutrade.com/open/market/?currencyName=EUR/USD&lots=1.0&buy=true&requestedPrice=1.4&uniqueId=1430761124723
JSON Response
{ "success": true, "uniqueId": "1430761124723", "brokerTicket": "01430079698041", "openUtcTimestamp": 1430761125000, "currencyName": "EUR/USD", "buy": true, "lots": 1, "entryRate": 1.11612, "stopValue": 0, "trailingStopValue": 0, "trailingStopConditionPipsValue": 0, "limitValue": 0, "floatingPnl": 0, "errorCode": 0, "errorMessage": null, "dateOpenedAsString": "2015-05-04 17:38:45" }
• Open Pending
Description
:
Opens a pending order
REST URL
:
/open/pending
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
lotsDoubletrueThe order's volume in STD lots.0.1
buyBooleantrueIndicates if order is buy or sell.true
requestedPriceDoubletrueThe target entry rate of new order.1.12
uniqueIdStringtrueThe unique id assigned to this order, it can be accessed later using this id."1234567"
Sample Call
http://tradingserver.zulutrade.com/open/pending/?currencyName=EUR/USD&lots=1.0&buy=true&requestedPrice=1.4&uniqueId=1430761273619
JSON Response
{ "success": true, "uniqueId": "1430761273619", "brokerTicket": "01430079698099", "dateOpenedAsString": "2015-05-04 17:41:14", "openUtcTimeStamp": 1430761274000, "currencyName": "EUR/USD", "buy": true, "lots": 1, "entryRate": 1.4, "stopValue": 0, "trailingStopValue": 0, "trailingStopConditionPipsValue": 0, "limitValue": 0, "errorCode": 0, "errorMessage": null }
• Close Market
Description
:
Closes a market trade
REST URL
:
/close/market
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
lotsDoubletrueThe trade's volume in STD lots.0.1
buyBooleantrueIndicates if market trade is buy or sell.true
providerTicketStringfalseThe provider ticket of the trade to be closed."123.12345678"
uniqueIdStringfalseThe unique id of the trade to be closed, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the trade."123543"
requestedPriceDoubletrueIndicative close rate on market trade, zulutrade will close at current market rate.1.12
Sample Call
http://tradingserver.zulutrade.com/close/market/?currencyName=EUR/USD&buy=true&lots=1.0&uniqueId=1430761416592&requestedPrice=1.4
JSON Response
{ "success": true, "uniqueId": "1378728350223", "brokerTicket": "3031379425737380", "currencyName": "EUR/USD", "buy": true, "lots": 1, "dateOpen": "2013-09-23 08:51:02", "openUtcTimestamp": 1379926262000, "dateClosed": "2013-09-23 08:53:58", "closeUtcTimestamp": 1379926438000, "priceOpen": 1.35201, "priceClosed": 1.35185, "grossPnl": -16, "commission": 0, "interest": 0, "netPnl": -16, "errorCode": 0, "errorMessage": null }
• Close Pending
Description
:
Cancels a pending order
REST URL
:
/close/pending
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
lotsDoubletrueThe order's volume in STD lots.0.1
buyBooleantrueIndicates if order is buy or sell.true
providerTicketStringfalseThe provider ticket of the order to be canceled."123.12345678"
uniqueIdStringfalseThe unique id of the order to be closed, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the order to be canceled."123543"
Sample Call
http://tradingserver.zulutrade.com/close/pending/?currencyName=EUR/USD&lots=1.0&buy=true&uniqueId=1430761273619
JSON Response
{ "success": true, "uniqueId": "1379926231593", "brokerTicket": "3031379425737405", "dateCanceled": "2013-09-23 08:58:32", "canceledUtcTimestamp": 1379926712000, "errorCode": 0, "errorMessage": null }
• Update Stop
Description
:
Updates the stop value of a pending order/market trade
REST URL
:
/update/stop
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
buyBooleantrueIndicates if market trade / pending order is buy or sell.true
providerTicketStringfalseThe provider ticket of the trade/order to be updated."123.12345678"
uniqueIdStringfalseThe unique id of the trade/order to be updated, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the trade/order to be updated."123543"
stopValueDoubletrueThe stop value to be assigned to the trade/order.0.5
Sample Call
http://tradingserver.zulutrade.com/update/stop/?currencyName=EUR/USD&lots=1.0&buy=true&uniqueId=14307617326499&stopValue=0.9
JSON Response
{ "success": true, "uniqueId": "1379926231592", "brokerTicket": "3031379425737380", "providerTicket": "37119.1379926231592", "newValue": 1, "valueType": "STOP_LOSS", "errorCode": 0, "errorMessage": null }
• Update Limit
Description
:
Updates the limit value of a pending order/market trade
REST URL
:
/update/limit
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
buyBooleantrueIndicates if market trade / pending order is buy or sell.true
providerTicketStringfalseThe provider ticket of the trade/order to be updated."123.12345678"
uniqueIdStringfalseThe unique id of the trade/order to be updated, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the trade/order to be updated."123543"
limitValueDoubletrueThe limit value to be assigned to the trade/order.1.5
Sample Call
http://tradingserver.zulutrade.com/update/limit/?currencyName=EUR/USD&lots=1.0&buy=true&uniqueId=1430761889861&limitValue=2.11
JSON Response
{ "success": true, "uniqueId": "1379926231593", "brokerTicket": "3031379425737405", "providerTicket": "37119.1379926231593", "newValue": 2.1, "valueType": "TAKE_PROFIT", "errorCode": 0, "errorMessage": null }
• Update Entry
Description
:
Updates the entry of a pending order
REST URL
:
/update/entry
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
buyBooleantrueIndicates if pending order is buy or sell.true
providerTicketStringfalseThe provider ticket of the order to be updated."123.12345678"
uniqueIdStringfalseThe unique id of the order to be updated, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the order to be updated."123543"
entryValueDoubletrueThe entry rate to be assigned to the pending order.1.5
Sample Call
http://tradingserver.zulutrade.com/update/entry/?currencyName=EUR/USD&lots=1.0&buy=true&uniqueId=1378728350224&entryValue=1.5
JSON Response
{ "success": true, "uniqueId": "1379926231593", "brokerTicket": "3031379425737405", "providerTicket": "37119.1379926231593", "newValue": 1.5, "valueType": "ENTRY_RATE", "errorCode": 0, "errorMessage": null }
• Update trailing Stop
Description
:
Updates the traling stop of a pending order/market trade
REST URL
:
/update/stop/trailing
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
buyBooleantrueIndicates if market trade / pending order is buy or sell.true
providerTicketStringfalseThe provider ticket of the trade/order to be updated."123.12345678"
uniqueIdStringfalseThe unique id of the trade/order to be updated, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the trade/order to be updated."123543"
trailingStopValueIntegertrueThe trailing stop value to be assigned to the trade/order.50
Sample Call
http://tradingserver.zulutrade.com/update/stop/trailing/?currencyName=EUR/USD&lots=1.0&buy=true&uniqueId=1427816459458&trailingStopValue=50
JSON Response
{ "success": true, "uniqueId": "1427816459458", "brokerTicket": "13131427812531921", "providerTicket": "61725.1427816459458", "newTrailingStopValue": 50, "newStopValue": 1.06949, "newTrailingStopConditionValue": 0, "valueType": "TRAILING_STOP", "errorCode": 0, "errorMessage": null }
• Update conditional Stop
Description
:
Updates the traling stop value of a pending order/market trade when profit reaches a certain profit in pips
REST URL
:
/update/stop/trailingCondition
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
currencyNameStringtrueThe name of the currency pair."EUR/USD"
buyBooleantrueIndicates if market trade / pending order is buy or sell.true
providerTicketStringfalseThe provider ticket of the trade/order to be updated."123.12345678"
uniqueIdStringfalseThe unique id of the trade/order to be updated, the same used in the corresponding open request."1234567"
brokerTicketStringfalseThe broker ticket of the trade/order to be updated."123543"
trailingStopValueIntegertrueThe trailing stop value to be assigned to the trade/order.50
trailingStopConditionPipsValueIntegertrueThe profit in pips. When this value is reached, the trailing stop parameter "trailingStopValue" will be applied.50
Sample Call
http://tradingserver.zulutrade.com/update/stop/trailingCondition/?currencyName=USD/JPY&lots=1.0&buy=true&uniqueId=1428334516120&trailingStopValue=150&trailingStopConditionPipsValue=200
JSON Response
{ "success": true, "uniqueId": "1428334516120", "brokerTicket": "13131428325253710", "providerTicket": "300557.1428334516120", "newTrailingStopValue": 150, "newStopValue": 120.48, "newTrailingStopConditionValue": 200, "valueType": "TRAILING_STOP_CONDITION_PIPS", "errorCode": 0, "errorMessage": null }
• Get open trades
Description
:
Gets the open trades of a user
REST URL
:
/getOpen
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Sample Call
http://tradingserver.zulutrade.com/getOpen
JSON Response
{ "openOrders": [ { "success": true, "uniqueId": "9.635658262467112184", "brokerTicket": "01430079307991", "dateOpenedAsString": "2015-04-28 16:44:18", "openUtcTimeStamp": 1430239458000, "currencyName": "NZD/CHF", "buy": true, "lots": 1, "entryRate": 0.75, "stopValue": 0.65, "trailingStopValue": 1000, "trailingStopConditionPipsValue": 0, "limitValue": 0.788, "errorCode": 0, "errorMessage": null } ], "openPositions": [ { "success": true, "uniqueId": "534915.1430390918726", "brokerTicket": "01430079491042", "openUtcTimestamp": 1430390919000, "currencyName": "EUR/USD", "buy": true, "lots": 1, "entryRate": 1.11907, "stopValue": 0, "trailingStopValue": 100, "trailingStopConditionPipsValue": 200, "limitValue": 0, "floatingPnl": -391, "errorCode": 0, "errorMessage": null, "dateOpenedAsString": "2015-04-30 10:48:39" } ] }
• Get Historic Trades/Orders
Description
:
Gets trades/pending orders that got closed between the given dates
REST URL
:
/getHistory
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Request Parameters
Name Type Required Description Sample
startDateStringtrueThe start date to search closed trades/orders."2015-03-29"
endDateStringtrueThe end date to search closed trades/orders."2015-04-01"
Sample Call
http://tradingserver.zulutrade.com/getHistory/?startDate=2015-03-29&endDate=2015-04-01
JSON Response
{ "canceledOrders": [ { "success": true, "uniqueId": "300557.1427824822803", "brokerTicket": "13131427812533077", "dateCanceled": "2015-03-31 18:00:23", "canceledUtcTimestamp": 1427824823000, "currencyName": "EUR/USD", "buy": true, "lots": 10, "priceOpen": 1.5, "dateOpened": "2015-03-31 18:00:23", "openedUtcTimestamp": 1427824823000, "errorCode": 0, "errorMessage": null } ], "closedPositions": [ { "success": true, "uniqueId": "300557.1427823780424", "brokerTicket": "13131427812532909", "currencyName": "EUR/USD", "buy": true, "lots": 10, "dateOpen": "2015-03-31 17:43:00", "openUtcTimestamp": 1427823780000, "dateClosed": "2015-03-31 17:43:00", "closeUtcTimestamp": 1427823780000, "priceOpen": 1.0735, "priceClosed": 1.07326, "grossPnl": -24, "commission": 0, "interest": 0, "netPnl": -24, "errorCode": 0, "errorMessage": null } ], "errorCode": 0, "errorMessage": null, "success": true }
Notes

There are some restrictions when getting historic trades/orders:

  • "startDate" and "endDate" must be explicitly in the format "yyyy-MM-dd" (e.g. 2015-03-23). Any other format will not be accepted by the system and you will receive an error message.
  • Trades/orders that got closed during today's trading activity cannot be returned.
  • Historic trades/orders can be obtained for a maximum timeframe of 3 days at a request.
  • Each request can return maximum 500 past trades and 500 past orders.
  • Only one request in a minute is allowed
• Get provider statistics
Description
:
Gets the provider's performance page statistics, if the user is a provider
REST URL
:
/getProviderStatistics
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Sample Call
http://tradingserver.zulutrade.com/getProviderStatistics
JSON Response
{ "success": true, "countryName": "United Kingdom", "zuluRank": 91, "necessaryMinEquity": 37.8, "ammountFollowing": 0, "profit": 502, "weeks": 0, "followers": 0, "trades": 1, "totalWinTrades": 1, "totalWinTradesPercent": 100, "avgPipsPerTrade": 502, "avgTradeTimeInSecs": 8902490, "maxDrawDownPercent": 55, "maxDrawDown": 278, "maxOpenTrades": 0, "worstTradePips": -277, "bestTradePips": 502, "hasLiveFollowers": "NO", "statsLastUpdateDateUtcTimeStamp": 1422888821000, "statsLastUpdateDate": "2015-02-02 14:53:41", "errorCode": 0, "errorMessage": null }
• Get trading configuration
Description
:
Gets the minimum amount and minimum amount step available for trading of a user
REST URL
:
/getTradingConfiguration
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Sample Call
http://tradingserver.zulutrade.com/getTradingConfiguration
JSON Response
{ "success": true, "minAmount": 0.01, "minAmountStep": 0.01 }
Rates
• Get instruments list
Description
:
Gets the available instruments of your ZuluTrade account
REST URL
:
/getInstruments
Header
:
Basic authentication
Response content type
:
application/json
Method
:
GET
Sample Call
http://tradingserver.zulutrade.com/getInstruments
JSON Response
{ "success": true, "errorCode": null, "instruments": [ { "instrumentName": "EUR/JPY" }, { "instrumentName": "EUR/USD" }, { "instrumentName": "GBP/USD" }, { "instrumentName": "USD/JPY" }, { "instrumentName": "USD/CHF" } ], "errorMessage": null }
• Stream
Description
:
Gets the stream of rates of your ZuluTrade account
REST URL
:
/stream
Header
:
Basic authentication
Response content type
:
text/event-stream
Method
:
GET
Sample Call
http://tradingserver.zulutrade.com/stream
JSON Response
{ "currency": "USD/JPY", "buy": "121.509", "sell": "121.487", "dateUTCTimeStamp": 1436439860740, "dateAsString": "2015-07-09T11:04:20.740Z" }
Notes
  • Only one active rate stream is allowed for each ZuluTrade user.
  • The client applications receiving streaming rates should terminate the connection and re-connect in case no data has been received for more than 10 seconds.

4. Errors

Trading
The following error codes may be returned
Error code Name Description
-1Unknown errorAn unknown error occurred during execution of the call.
1Invalid instrumentYou requested to open a trade with an unknown instrument name.
2Broker errorA broker error occurred during the execution of your call, errorMessage field will hold the broker-rejection message.
3Trade not foundYou tried to update/close/cancel a trade that could not be found in your account using the identifier provided (broker ticket/provider ticket/unique id).
4Access violationYou tried to modify a trade that you don't have access to.
5Invalid operationYou tried to update the entry rate of a market order.
6Server timeoutServer failed to respond in a timely manner.
7Invalid trading amountProvided lots amount is not valid.
8Invalid stop valueProvided stop value is not valid.
9Invalid limit valueProvided limit value is not valid.
10Invalid entry valueProvided entry value is not valid.
11No unique id setYou tried to open a trade without providing a valid unique id.
12Unique id exceeds max limitYou tried to open a trade with a unique id that exceeds the maximum allowed limit. You will be notified how many characters you need to reduce the unique id.
13Invalid Trailing Stop ValueProvided trailing stop value is not valid.
14Invalid Trailing Stop Conditions ValueProvided trailing stop conditions value is not valid.
15Account is not a provider accountOperation is not allowed for non-provider accounts.
16Requests for history trades/orders exceeded maximum allowed thresholdRequests for historic trades/orders exceeded one per minute.
17Date input is not correctThe startDate and/or endDate are not valid.
18Date range between startDate and endDate exceeded maximum allowed thresholdDifference between start and end date are more than 3 days.
19Not unique request id setThis unique id has been used in a previous "Open Market" or "Open Pending" request.
Notes

As you may have observed, providerTicket, brokerTicket and uniqueId are not mandatory for the REST calls, however, if a REST call to update/close/cancel a trade is not provided with one of those parameters, you will receive an 11 (no unique id set) rejection.

Modifying/closing trades using the uniqueId is only applicable for trades opened with the trading REST API.

Rates
The following error codes may be returned
Error code Type Message Description
401Not authorizedInvalid credentials or REST API access is not enabledThe requested resource requires user authentication.
403ForbiddenAccess is deniedUser has already subscribed for rate feed.
404Not foundThe requested URL was not found on this server. Please check the URL to ensure the path is correctThe requested URL was not found on this server.
500Internal Server ErrorThere is a problem with the resource you are looking forAn internal server error has occurred.

5. Tutorials

Trading
  • Java
    • Click here for a step-by-step tutorial on using the API, using Java and the eclipse IDE.
  • C#
    • Click here for a step-by-step tutorial on using the API, using C# and the Visual Studio IDE.
Rates
  • Java
    • Click here for a step-by-step tutorial on using the API, using Java and the eclipse IDE.
  • C#
    • Click here for a step-by-step tutorial on using the API, using C# and the Visual Studio IDE.

6. Support

5. Support

  • Please, visit our dedicated section in our ZuluTrade forum for any questions regarding the ZuluTrading Forex API.
  • Please, visit our dedicated section in our ZuluTrade forum for any questions regarding the ZuluTrading Binary API.

7. Changelog