A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 )...

74
API Specification Version 0.3.3 13 August, 2020

Transcript of A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 )...

Page 1: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

 

 API Specification  

Version 0.3.3 

13 August, 2020   

Page 2: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Changelog Version 0.3.2 (01 June, 2020) Updated API endpoint Version 0.3.2 (01 June, 2020) Updated Return Parameters for

● GetAccountTransactions ● GetAccountPositions ● GetAccountTrades ● GetDepositTickets ● CreateWithdrawTicket ● GetWithdrawTickets ● SubscribeLevel1 ● Level1UpdateEvent ● Level2UpdateEvent ● AccountPositionEvent ● OrderStateEvent ● OrderTradeEvent ● SendOrder

Updated order types

● Added GetWithdrawTicket ● PingPong endpoints

Version 0.3.1 (27 March, 2018) Removed WebAuthenticateUser, response updates. Version 0.3.0 (13 September, 2018) Added GetDepositTickets, GetWithdrawTickets and API keys management methods.

   

Page 3: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Table of contents

Changelog 2

URLs 5

Message Frame Format 5 How to use the frame. 6

Standard API Responses 8 Common error codes 8

Unauthenticated Calls 10 GetProducts 10 GetInstruments 11

Authentication 13 GetUserAPIKeys 13 AddUserAPIKey 14 RemoveUserAPIKey 15 AuthenticateUser 15

User Account Calls 16 GetUserAccounts 16 GetAccountTransactions 16 GetAccountPositions 19 GetAccountTrades 21

Order Handling Calls 24 Description of Order Types used in various calls 24 SendOrder 24 CancelOrder 27 GetOrderStatus 28 GetOrderFee 31 GetOrderHistory 32 GetOpenOrders 34

Deposits 37 GetDepositTickets 37

Withdrawals 40 CreateWithdrawTicket 40 GetWithdrawTicket 41 GetWithdrawTickets 44

Market Data 47 Overview of Level 1 and Level 2 Market Information 47 Level 1 Data 47

Page 4: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

SubscribeLevel1 47 Level1UpdateEvent 49 UnsubscribeLevel1 51

Level 2 data 52 SubscribeLevel2 52 Level2UpdateEvent 54 UnsubscribeLevel2 55

Trades feed 56 SubscribeTrades 56 TradeDataUpdateEvent 57 UnsubscribeTrades 58

Account events feed 60 SubscribeAccountEvents 60 PendingDepositUpdate 61 AccountPositionEvent 61 OrderStateEvent 63 OrderTradeEvent 67 NewOrderRejectEvent 69 CancelOrderRejectEvent 70 MarketStateUpdate 71 Ping 73

Page 5: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

URLs You can access the Coins PRO API using the following websocket addresses: 

Production wss://api.coins.asia/WSGateway/

Message Frame Format All WebSocket Calls and Replies are embedded into a JSON-Formatted Frame object containing the relevant information about the call or reply, as well as the payload. Take attention, that all sections about functions, contains format only of response payload ("o" in the frame). 

 

 

Example

{  "m":0,  "i":0,  "n":"GetProducts",  "o":"{\"OMSId":1\"}" } 

Frame Payload Parameters

Attribute Name  Example  Description 

m: Message Type  "m":0,  Describes the type of call the message relates to.  Supported types:   0 = Request  1 = Reply  2 = Subscribe To Event  3 = Event  4 = Unsubscribe from Event  5 = Error  Users should only use 0 (Request) and 2 to subscribe to data feed. 

i: Sequence Number  "i":0,  This is the sequence number of the message. The Client-Side sequence number should always be an Even Number, such that 

Page 6: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

your sequence number variable should always be incremented by 2 (i += 2). All messages will contain either an original sequence number (message types 0, 2, 3, 4), or will contain the ID of the request message the message is in reply to (1, 5 types). For example, if you requested something using i=0, you'll get a reply, with i=0 as well, but with message type 1. 

n: Function Name  "n": "GetProducts"  This is the name of the Remote Function that the message type is a Request or Reply to. For instance, if you wish to make a call to the "GetProducts" function, the Request should contain "GetProducts" in this field, and the Reply will also contain "GetProducts" in this field. 

o: Payload  "o": "{"OMSId":1}"  This is a JSON-formatted string containing the data being sent with the message, either as Parameters in a Request, or as the data in a Reply to a Request. 

Note: the rest of functions described below, contain only payload description, so we do not include the whole frame in the rest of the documentation. For requests with zero parameters, users should send a “{}” as Payload. 

Note: OMSId refers to an internal ID of the order management system and should be always 1. 

How to use the frame. When sending a Request to our API using javascript, an example of a call request as follows below: 

var frame =  {  "m":0,  "i":0,  "n":"GetProducts",  "o":"{\"OMSId":1\"}" };  

Page 7: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

var requestPayload =  {  "OMSId":1, };  frame.o = json.Stringify(requestPayload); WS.Send(json.Stringify(frame)); 

 

When receiving a frame from our API, use the frame below to determine the context, and then to unwrap the content: 

 

var frame = json.Parse(wsMessage);  if (frame.i == 1) {  //This is a Reply  if (frame.n == "GetProducts")  {  var LoginReply = json.Parse(frame.o);  if (LoginReply.Authenticated)  {  var user = LoginReply.User;  }  } } 

Page 8: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Standard API Responses Response payloads not returning object data and common error responses will follow the response pattern are per below. Please note that the function may include extra error codes, which are described below under the function section. 

Common error codes

Error Code  Description 

20  Not Authorized 

100  Invalid Request  

101  Operation Failed 

102  Server Error  

104  Resource Not Found  

Successful call with no return object

{  "result":true,  "errormsg":null,  "errorcode":0,  "detail":null } 

Unsuccessful call due to an issue with authorization

{  "result":false,  "errormsg":"Not Authorized",  "errorcode":20,   "detail":null  } 

Unsuccessful call due to invalid request parameters

{  "result":false,  "errormsg":"Invalid Request",  "errorcode":100,  "detail":"OMSId must be an Integer" } 

Page 9: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Unsuccessful call due to operation not completing successfully

{  "result":false,  "errormsg":"Operation Failed",  "errorcode":101,  "detail":null } 

Unsuccessful call due to unexpected server error

{  "result":false,  "errormsg":"Server Error",  "errorcode":102,  "detail":null  } 

Unsuccessful call due to missing resource (user id not in system, etc)

{  "result":false,  "errormsg":"Resource Not Found",  "errorcode":104,  "detail":null  } 

Page 10: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Unauthenticated Calls For all calls requiring OMSId, set OMSId = 1. Also, all sections here represent separate function names. You can find additional information about OMS and function names in the Message Frame Format section.  

GetProducts Requests a list of available Products from the API. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetProducts",  "o":"{\"OMSId\": 1}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {   "ProductId": 1,  "Product": "BTC",    "ProductFullName": "Bitcoin",  "ProductType": "CryptoCurrency",  "DecimalPlaces": 9  },  ... ] 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

Response Parameters

Attribute Name  Example  Description 

ProductId  1  Product's ID Number [Integer] 

Product  "BTC"  Product's Symbol [String] 

ProductFullName  "Bitcoin"  Product's Full Name [String] 

ProductType  "CryptoCurrency"  Product's Type [String]  

Page 11: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Supported values:  

- "NationalCurrency" - "CryptoCurrency" 

 

DecimalPlaces  9  Product's Precision [Integer] 

GetInstruments

Requests a list of available instruments from the API. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetInstruments",  "o":"{\"OMSId\": 1}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {  "InstrumentId":1,   "Symbol":"BTCUSD",  "Product1":1,  "Product1Symbol":"BTC",  "Product2":2,  "Product2Symbol":"USD",  "InstrumentType": "Standard",  },  ... ] 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

Response Parameters

Attribute Name  Example  Description 

Page 12: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

InstrumentId  1  Instrument's Identifier [Integer] 

Symbol  "BTCUSD"  Instrument's Symbol [String] 

Product1  1  Instrument's Product 1 Identifier [Integer] 

Product1Symbol  "BTC"  Instrument's Product 1 Symbol [String] 

Product2  2  Instrument's Product 2 Identifier [Integer] 

Product2Symbol  "USD"  Instrument's Product 2 Symbol [String] 

InstrumentType  "Standard"  Type of Instrument [String]  All instrument types currently are standard, an exchange of one product for another (or unknown, an error condition), but this may expand to new types in the future. 

priceIncrement  0.1  The amount by which the instrument can rise or fall in the market. [Decimal] 

Page 13: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Authentication

GetUserAPIKeys The endpoint will return existing APIKeys with assigned permissions. APISecret field will not be returned.  

Example

Request -> {  "m":0,  "i":0,  "n":"GetUserAPIKeys",  "o":"{\"UserId\": 4}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {   "UserId": 4,    "APIKey": “ab1eb50a1b0cb56a9130cdccba995a47da77a22e”,  "APISecret": "”,    "Permissions": [‘Deposit’, ‘Withdraw’],  },  ... ] 

 

Request Parameters

Attribute Name  Example  Description 

UserId  4  User ID [Integer] 

Response Parameters

Attribute Name  Example  Description 

UserId  4  User ID [Integer] 

ApiKey  “ab1eb50a1b0cb56a9130cdccba995a47da77a22e” 

Key used for authentication [String] 

Page 14: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

ApiSecret  “”  Secret that you will use for signature generation [String] 

Permissions  [‘Deposit’, ‘Withdraw’] 

Permissions enabled for API Keys [Array of Strings] 

AddUserAPIKey In order to authenticate using an API key, you will need to create an ApiKey and ApiSecret using this endpoint. Your UserId will be needed along with the permissions you wish to enable in payload.  The endpoint will return a UserAPIKey class type json string containing the APIKey and APISecret.  Note: Please save the APIKey and APISecret values returned in a secure location. Both of these values are needed for authentication and signature generation. 

Request Parameters

Attribute Name  Example  Description 

UserId  4  User ID [Integer] 

Permissions  [‘Deposit’, ‘Withdraw’] 

Permissions you wish to enable for this API Key [Array of Strings]  Possible values: Deposit, Withdraw, Trading 

Response Parameters

Attribute Name  Example  Description 

UserId  4  User ID [Integer] 

ApiKey  “abc123456789”  Key used for authentication [String] 

ApiSecret  “123456789abc”  Secret that you will use for signature generation [String] 

Permissions  [‘Deposit’, ‘Withdraw’] 

Permissions you wish to enable for this API   Key [Array of Strings]  Possible values: Deposit, Withdraw, Trading 

Page 15: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

RemoveUserAPIKey Request Parameters

Attribute Name  Example  Description 

UserId  4  User ID [Integer] 

ApiKey  “ab1eb50a1b0cb56a9130cdccba995a47da77a22e” 

String returned from AddUserAPIKey call [String] 

AuthenticateUser In order to authenticate with a key you need to use AuthenticateUser call with nonce and generated signature.

Request Parameters

Attribute Name  Example  Description 

UserId  “4”  User ID [String] 

APIKey  “ab1eb50a1b0cb56a9130cdccba995a47da77a22e” 

String returned from AddUserAPIKey call [String] 

Nonce  “1534750973”  Current timestamp as a string [String] 

Signature  “6a8de403af40e227ce00fd1d5c03e9eeca0d5ced5227d273122c398143be2499” 

This is a HMAC-SHA256 signature with ApiSecret as a key and `nonce + UserId + ApiKey` as a message. 

Response Parameters

Attribute Name  Example  Description 

User  {"UserId":1,"UserName":"[email protected]","Email":"[email protected]","EmailVerified":true,"AccountId":3,"OMSId":1,"Use2FA":false} 

User info [Object] 

Authenticated  true  If authentication was successful [Bool] 

Page 16: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

User Account Calls

GetUserAccounts

Retrieves a list of account IDs for the current user. The Request should have an empty string as the payload. Typically, each user is assigned one account. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetUserAccounts",  "o":"" }  Response <- (full frame omitted, please read Message Frame Format)  [4] 

Response Parameters

Attribute Name  Example  Description 

An array of account IDs 

[4]  Array of Account IDs [Integer] 

GetAccountTransactions

Retrieves a list of recent transactions from your account. 

 

Example

Request -> {  "m":0,  "i":0,  "n":"GetAccountTransactions",  "o":"{\"OMSId\":1,\"AccountId\": 1,\"Depth\": 200}" }  Response <- (full frame omitted, please read Message Frame Format) [ 

Page 17: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

{  "TransactionId": 945,  "AccountId": 4,  "CR": 76,  "DR": 0,  "TransactionType": "Trade",  "ReferenceId": 232,  "ReferenceType": "Trade",  "ProductId": 2,  "Balance": 101111.1,  "TimeStamp": 1501354796418  ...  },  ... ] 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  1  Account ID of user. Should be populated using GetUserAccounts. 

Depth  200  Number of transactions API should retrieve, starting with the most recent one. 

Response Parameters

Attribute Name  Example  Description 

TransactionId  945  The Transaction Id [64 Bit Integer] 

ReferenceId  4b9ad1de  The ID of the action or event that triggered this transaction. [String]  

OMSId  1  Order Management System ID. Always 1. [Integer] 

AccountId  4  Your Account Id [Integer] 

CR  76  The amount credited to your account. [Decimal] 

DR  0  The amount debited from your account. [Decimal] 

Page 18: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

CounterParty  41  The ID of the other party in a trade [Integer] 

TransactionType  "Trade"  The nature/type of the transaction. [String] 

Values: 

- "Other" - "Trade" - "Fee" 

TransactionType  ReferenceType 

"Other"  Deposit 

"Other"  Withdraw 

"Trade"  Trade 

"Fee"  Trade 

 

ReferenceId  4b9ad1de  The ID of the action or event that triggered this transaction. [String]  

ProductId  2  Product Id [Integer] 

Balance  101111.1  The resulting balance after this transaction for the specified product. [Decimal] 

ReferenceType  "Trade"  The type of action or event that triggered this transaction. [String]  Values: 

- Trade - Deposit - Withdraw - Transfer - OrderHold - WithdrawHold - DepositHold - MarginHold 

TimeStamp  1501354796418  [Long Integer] Time at which the transaction took place, in POSIX format and UTC time zone. 

Page 19: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

GetAccountPositions

Retrieves a list of Positions(Balances) on a specific account. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetAccountPositions",  "o":"{\"OMSId\":1,\"AccountId\":4}" }  Response <- (full frame omitted, please read Message Frame Format)  [{  "AccountId": 4,  "ProductSymbol": "BTC",  "ProductId": 1,  "Amount": 10497.3,  "Hold": 3.19,  "PendingDeposits": 0,  "PendingWithdraws": 0,  "TotalDayDeposits": 10500,  "TotalDayWithdraws": 0,  "TotalMonthWithdraws": 0, }]  

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  4  Account ID [Integer] 

Response Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. [Integer] 

AccountId  4  Your account id. [Integer] 

ProductId  5  Product's ID Number [Integer] 

ProductSymbol  "BTC"  The product symbol for this record. [String] 

Page 20: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Amount  10497.3  The Total Balance for the specified product. [Decimal] 

Hold  3.19  The total amount of your balance that is on hold. Your Available balance for trading and withdrawals is (Amount - Hold). [Decimal] 

PendingDeposits  0  Total Deposits Pending for the specified product. [Decimal] 

PendingWithdraws  0  Total Withdrawals Pending for the specified product. [Decimal] 

TotalDayDeposits  10500  The total 24 hour deposits for the specified product. [Decimal] 

TotalMonthDeposits  1451.41  Total deposits for the month as of today's date. [Decimal] 

TotalYearDeposits  100100.19  Total deposits for the year as of today's date. [Decimal] 

TotalYearDepositNotional 

451200.12  Yearly Deposit amount of crypto-currencies. It is usually calculated as value = (Amount * Bid/Ask Price) [Decimal] 

TotalDayWithdraws  154141.94  The total 24 hour withdrawal for the specified product. [Decimal] 

TotalMonthWithdraws  410141.54  The total month withdrawals for the specified product. [Decimal] 

TotalYearWithdraws  1982452.12  The total yearly withdrawals for the specified product. [Decimal] 

TotalYearWithdrawNotional 

4512315.58  Yearly withdrawal amount for crypto-currencies. It is usually calculated as value = (Amount * Bid/Ask Price) [Decimal] 

NotionalProductId  7  PHP Product Id. [Integer] 

NotionalProductSymbol 

“PHP”  Notional Symbol. [String] 

NotionalValue  80124.12  Value of selected instrument in PHP. [Decimal] 

Page 21: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

GetAccountTrades

Retrieves Trade History for a specific account. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetAccountTrades",  "o":"{\"OMSId\":1,\"AccountId\":4,\"Count\":50,\"StartIndex\":0}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {  "TradeId": 230,  "OrderId": 9861,  "AccountId": 4,  "ClientOrderId": 0, //Your client order id. [64 bit Integer]  "InstrumentId": 1, //Instrument Id [Integer]  "Side": "Buy", //Side [String] Values are "Buy", "Sell"  "Quantity": 2, //Quantity [Decimal]  "Price": 95, //Price [Decimal]  "Value": 190, //Value [Decimal]  "TradeTime": 1501354796418,  …..  },  ... ]  

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  4  Account ID [Integer] 

Count  50  Number of trades - defaults to 100, and max is 200 [Integer] 

StartIndex  0  Start Index - for pagination. 0 is the most recent trade. [Integer] 

Response Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. [Integer] 

Page 22: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

ExecutionID  2607327  Execution Id [64 bit Integer] 

TradeId  230  Trade Id [64 bit Integer] 

OrderId  9861  Order Id [64 bit Integer] 

AccountId  4  Your account id. [Integer] 

AccountName  “[email protected]”  Your account name. [String] 

SubAccountId  0  Not currently used; reserved for future use. Defaults to 0. [Integer] 

ClientOrderId  0  Your client order id. [64 bit Integer] 

InstrumentId  1  Instrument's Identifier [Integer] 

Side  "Buy"  Side of the trade [String]  Values: 

- "Buy" - "Sell" 

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) 

Quantity  2  Quantity [Decimal] 

RemainingQuantity  41.51  The number of units remaining to be traded by the order after this execution. [Decimal] 

Price  95  Price [Decimal] 

Value  190  Value = price * quantity [Decimal] 

CounterParty  41  The ID of the other party in a trade [Integer] 

OrderTradeRevision  1  The revision number of this trade; usually 1 [Integer] 

Direction  0  Shows if the trade represents a movement of the book price up, down, or no change. 

Values: - 0=NoChange 

Page 23: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

- 1=Uptick - 2=Downtick 

[Integer] 

IsBlockTrade  false  A value of true means that this trade was a block trade; a value of false that it was not a block trade. [Bool] 

Fee  0.014  Fee [Decimal] 

FeeProductId  7  ProductId of Fee [Integer] 

OrderOriginator  45  The ID of the user who initiated the trade. [Integer] 

Username  “[email protected]”  Your username[String] 

TradeTimeMS  1501354796418  Timestamp [Integer]  The time at which the trade took place, in POSIX format and UTC time zone. 

MakerTaker  0  0 Unknown 1 Maker 2 Taker [Integer] 

AdapterTradeId  1   The adapter ID of the overall trade. [Integer] 

InsideBid  71.24  If this order is a quote, this value is the Inside Bid price. [Decimal] 

InsideBidSize  1042.12  If this order is a quote, this value is the quantity of the Inside Bid quote. [Decimal] 

InsideAsk  51.24  If this order is a quote, this value is the Inside Ask price. [Decimal] 

InsideAskSize  721.42  If this order is a quote, this value is the quantity of the Inside Ask quote. [Decimal] 

IsQuote  false  If this order is a quote, the value for IsQuote is true, else false [boolean] 

Page 24: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Order Handling Calls

Description of Order Types used in various calls

Market - An order used to buy or sell at the best available price. No restrictions on price or time frame.  Limit - An order to buy or sell at a specified price or better. A limit order may not be executed if the price set is not met during the time that the order is open.  StopMarket - An order to buy or sell only when an instrument reaches a set price. Once the instrument reaches this price, the order becomes a market order.   StopLimit - An order to buy or sell only when a set price is reached. Once this price is reached, the order becomes a limit order to buy or sell at the limit price or better.  TrailingStopMarket - An order that sets the stop price at a price with a fixed offset relative to the market price. If the market moves and the stop price is reached, the order becomes a market order.  TrailingStopLimit - An order that recalculates the stop price at a fixed offset relative to the market price. It also recalculates a limit price based on a different fixed offset. If the market reaches the stop price, the order becomes a limit order.  

SendOrder

Sends a new order through the API. It is important that you are subscribed to Account Actions (SubscribeAccountEvents) in order to receive updated status events for entered orders. Alternatively, you can also call GetOpenOrders and/or GetOrderHistory to check order status.  

Example

Request -> (full frame omitted, please read Message Frame Format)  {  "OMSId": 1,  "AccountId": 4,  "ClientOrderId": 99,  "Quantity": 1,  "DisplayQuantity": 0,  "UseDisplayQuantity": true,  "LimitPrice": 95,   "OrderIdOCO": 0,  "OrderType": 2,  

Page 25: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

"PegPriceType": 1,  "InstrumentId": 1,  "TrailingAmount": 1.0,   "LimitOffset": 2.0,   "Side": 0,   "StopPrice": 96,  "TimeInForce": 1 }   Response <- (full frame omitted, please read Message Frame Format)  {   "status":"Accepted",  "errormsg":"",  "OrderId": 123 // Server order id } 

Request Parameters

Attribute Name  Example  Description 

AccountId  4  Your account id. [Integer] 

ClientOrderId  99  Set this to your own id if you wish to use one. It will be useful for recognizing future order states related to this call. [64 bit Integer] 

OMSId  1  Order Management System ID. Always 1. 

UseDisplayQuantity  true  [Boolean] If you enter a Limit order with a reserve, you must set UseDisplayQuantity to true. 

Quantity  1  Quantity of the Order [Decimal] 

DisplayQuantity  0  Quantity of an order to display publicly on the order book. If you have an order for 1,000 and you want the order book to reflect a quantity of only 100 at any one time, set this to 100. This functionality can only be used for limit orders. Set to 0 to display all. [Decimal] 

LimitPrice optional 

95  The limit price for this order. [Decimal] 

OrderIdOCO optional 

0  If you would like to have this order cancel another on execution, set this field to the other order's server order id. Omit or set to 0 if no OCO is required. [64 Bit Integer] 

Page 26: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) 

PegPriceType optional 

1  When entering a Stop/Trailing order, set this to the type of price you would like to peg the Stop to. [Integer]  Values: 

- 1 (Last) - 2 (Bid) - 3 (Ask) 

InstrumentId  1  Instrument's Identifier [Integer] 

TrailingAmount optional 

1.0  When entering a Trailing order, set this to the quantity required, which the trigger price will trail the market by. [Decimal] 

LimitOffset optional 

2.0  When entering a Trailing Limit order, this specifies the distance from activation price to your limit order price. [Decimal] 

Side  0  0 (Buy) or 1 (Sell) 

StopPrice optional 

96  The Stop Price for this order, if it is a stop order. Otherwise you may omit this field. [Decimal] 

TimeInForce  1  Values: - 1 (Good ‘til Canceled), - 3 (Immediate or Cancel), - 4 (Fill or Kill) 

Response Parameters

Attribute Name  Example  Description 

status  "Accepted"  Status of the order [String] 

errormsg  ""  Error message in case of error [String] 

OrderId  123  Order Identifier [Integer] 

Page 27: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

CancelOrder

Cancels an open order, by either specifying the OrderId returned when the order was created, or by specifying both the ClientOrderId and AccountId of the order. If AccountId is not specified, the default user account will be used. 

Example

Request -> {  "m":0,  "i":0,  "n":"CancelOrder",  "o":"{\"OMSId\":1,\"AccountId\":4,\"OrderId\":12}" }  Response <- (full frame omitted, please read Message Frame Format)  {   "status":"Processing",  "errormsg":""   "errorcode": 104, //An error code  "detail": "" } 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  4  Account ID [Integer] 

ClientOrderId  99  The client order id of the order to cancelled. [64 bit Integer] 

OrderId  12  The server order id of the order to cancelled. [64 bit Integer] 

Response Parameters

Attribute Name  Example  Description 

status  "Processing"  Status [String] 

"Processing" status means that the system received the order cancellation request for this order. To check the actual status of the order please use GetOrderStatus, GetOpenOrders or OrderStateEvent functions (more details are available in the 

Page 28: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

SubscribeAccountEvents section), which contain order status in the payload. If the order was successfully canceled, order state will be "Canceled". 

errormsg  ""  Error message [String] 

detail  “”  Detailed error description [String] 

errorcode  104  Error code [Integer] 

GetOrderStatus

Gets the current operating status of an order submitted to the Order Management System. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetOrderStatus",  "o":"{\"OMSId\":1,\"AccountId\":4,\"OrderId\":12}" }  Response <- (full frame omitted, please read Message Frame Format) {  "Side": "Sell",  "OrderId": 9849,  "Price": 97,  "Quantity": 0.29,  "Instrument": 1,  "Account": 4,  "OrderType": "Limit",  "ClientOrderId": 0,  "OrderState": "FullyExecuted",  "ReceiveTime": 1532346260831,  "OrigQuantity": 1,  "QuantityExecuted": 0.71,  "OrigOrderId": 9849,  "OrigClOrdId": 0,  "RejectReason": "" } 

Page 29: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  4  Account ID [Integer] 

OrderId  12  The server order id of the order to cancel (response returned in SendOrder call). [64 bit Integer] 

Response Parameters

Attribute Name  Example  Description 

Account  4  Your account id. [Integer] 

ClientOrderId  99  Set this to your own id if you wish to use one. It will be useful for recognizing future order states related to this call. [64 bit Integer] 

Quantity  1  The Quantity (Remaining if partially or fully executed) of your order. [Decimal] 

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) - 4 (StopLimit) - 5 (TrailingStopMarket) - 6 (TrailingStopLimit) 

Instrument  1  Instrument's Identifier [Integer] 

Side  "Sell"  The side of your order. [String] Values are "Sell", "Buy"  Values: 

- "Buy" - "Sell" 

OrderId  123  The Server-Assigned Order Id. [64 bit Integer] 

Price  96  The Price of your order. [Decimal] 

OrderState  "Working"  The current state of the order. [String] Values: 

- "Working" - "Rejected" - "FullyExecuted" 

Page 30: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

- "Canceled" - "Expired" 

OrigQuantity  1  The original quantity of your order. [Decimal] 

QuantityExecuted  0.71  The total executed quantity. [Decimal] 

RejectReason  ""  If the trade was rejected, this string provides the reason [String] 

OrigOrderId  9849  The Original Server-Assigned Order Id, if the order has changed. [64 bit Integer] 

OrigClOrdId  1  The Original Client-Designate Order Id. [64 bit Integer] 

ReceiveTime  1532346260831  Timestamp 

CancelReason  “”  If this order has been canceled, this string provides the cancelation reason. [String] 

ChangeReason  “”  [If the order has been changed, this string value provides the reason [String] Values: 

- “Unknown” - “NewInputAccepted” - “NewInputRejected” - “OtherRejected” - “Expired” - “Trade” - “SystemCanceled_NoMoreMarket” - “SystemCanceled_BelowMinimum” - “SystemCanceled_PriceCollar” - “SystemCanceled_MarginFailed” - “UserModified” 

Page 31: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

GetOrderFee

Returns an estimate of the fee for a specific order and order type. 

Example

Request -> (full frame omitted, please read Message Frame Format)  {  "OMSId": 1,  "AccountId": 1,  "InstrumentId": 1,  "ProductId": 1,  "Amount": 500,   "OrderType": "Market",   "MakerTaker": "Maker" }   Response <- (full frame omitted, please read Message Frame Format)  {  "OrderFee": 0,  "ProductId": 1 } 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  1  Your account ID [Integer] 

InstrumentId  1  Instrument's Identifier [Integer] 

ProductId  1  Product's Identifier [Integer] 

Amount  500  Amount [Decimal] 

OrderType  "Market"  The type of order. [String] Values: 1 (Market) 2 (Limit) 3 (StopMarket) 

MakerTaker  "Maker"  Whether the order is expected to execute instantly against existing orders in the order 

Page 32: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

book (“Taker”) or rest in the order book as an open order (“Maker”) 

Response Parameters

Attribute Name  Example  Description 

OrderFee  10  Fee amount [Decimal] 

ProductId  2  ID of the product in which the fee is denominated [Integer] 

GetOrderHistory

Retrieves a list of the last 100 orders placed on your account. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetOrderHistory",  "o":"{\"OMSId\": 1,\"AccountId\": 1}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {  "Side": "Sell",  "OrderId": 9849,  "Price": 97,  "Quantity": 0.29,  "Instrument": 1,  "Account": 4,  "OrderType": "Limit",  "ClientOrderId": 0,  "OrderState": "FullyExecuted",  "ReceiveTime": 1532346260831,  "OrigQuantity": 1,  "QuantityExecuted": 0.71,  "OrigOrderId": 9849,  "OrigClOrdId": 0,  "RejectReason": ""  },  ... ] 

Page 33: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  4  Account ID [Integer] 

Response Parameters

Attribute Name  Example  Description 

Account  4  Your account id. [Integer] 

ClientOrderId  99  Set this to your own id if you wish to use one. It will be useful for recognizing future order states related to this call. [64 bit Integer] 

Quantity  1  The Quantity (Remaining if partially or fully executed) of your order. [Decimal] 

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) 

Instrument  1  Instrument's Identifier [Integer] 

Side  "Sell"  The side of your order. [String] Values are "Sell", "Buy"  Values: 

- "Buy" - "Sell" 

OrderId  123  The Server-Assigned Order Id. [64 bit Integer] 

Price  96  The Price of your order. [Decimal] 

OrderState  "Working"  The current state of the order. [String] Values: 

- "Working" - "Rejected" - "FullyExecuted" 

Page 34: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

- "Canceled" - "Expired" 

OrigQuantity  1  The original quantity of your order. [Decimal] 

QuantityExecuted  0.71  The total executed quantity. [Decimal] 

RejectReason  ""  If the trade was rejected, this string provides the reason [String] 

OrigOrderId  9849  The Original Server-Assigned Order Id if the order has been changed. [64 bit Integer] 

OrigClOrdId  1  The Original Client-Designated Order Id if the order has been changed. [64 bit Integer] 

ReceiveTime  1532346260831  Timestamp 

GetOpenOrders

Retrieves the Open Orders for a specified account of the current user. Keep in mind that if your order is no longer in a working state, you will not find it using GetOpenOrders. 

Example

Request -> {  "m":0,  "i":0,  "n":"GetOpenOrders",  "o":"{\"OMSId\": 1,\"AccountId\": 1}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {  "Side": "Sell",  "OrderId": 9849,  "Price": 97,  "Quantity": 0.29,  "Instrument": 1,  "Account": 4,  "OrderType": "Limit",  "ClientOrderId": 0,  "OrderState": "FullyExecuted",  "ReceiveTime": 1532346260831,  "OrigQuantity": 1, 

Page 35: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

"QuantityExecuted": 0.71,  "AvgPrice": 0,  "OrigOrderId": 9849,  "OrigClOrdId": 0,  "RejectReason": ""  },  ... ] 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

AccountId  4  Account ID [Integer] 

Response Parameters

Attribute Name  Example  Description 

Account  4  Your account id. [Integer] 

ClientOrderId  99  Set this to your own id if you wish to use one. It will be useful for recognizing future order states related to this call. [64 bit Integer] 

Quantity  1  The Quantity (Remaining if partially or fully executed) of your order. [Decimal] 

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) - 4 (StopLimit) - 5 (TrailingStopMarket) - 6 (TrailingStopLimit) 

Instrument  1  Instrument's Identifier [Integer] 

Side  "Sell"  The side of your order. [String] Values are "Sell", "Buy", "Short"  Values: 

- "Buy" - "Sell" 

OrderId  123  The Server-Assigned Order Id. [64 bit Integer] 

Price  96  The Price of your order. [Decimal] 

Page 36: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

OrderState  "Working"  The current state of the order. [String] Values: 

- "Working" - "Rejected" - "FullyExecuted" - "Canceled" - "Expired" 

OrigQuantity  1  The original quantity of your order. [Decimal] 

QuantityExecuted  0.71  The total executed quantity. [Decimal] 

OrigOrderId  9849  The Original Server-Assigned Order Id if the order has been changed. [64 bit Integer] 

OrigClOrdId  1  The Original Client-Designated Order Id if the order has been changed. [64 bit Integer] 

ReceiveTime  1532346260831  Timestamp 

RejectReason  ""  If the trade was rejected, this string provides the reason [String] 

Page 37: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Deposits Deposits of all currencies to Coins Pro are done through the user’s Coins.ph wallet. These transactions are initiated using the Coins.ph mobile / web clients or API.  For further details on initiating a deposit using the Coins.ph API, please refer to the POST /v2/sellorder endpoint in the Coins.ph API documentation.  

GetDepositTickets Get a list of deposits for an account. 

Example

Request -> (full frame omitted, please read Message Frame Format)  {  "OMSId":1,  "AccountId":4,  "Limit":100,  "OperatorId":1  "StartIndex":0 }   Response <- (full frame omitted, please read Message Frame Format)  {  "AccountId":4,  "AssetId":4,  "AssetName":"Philippine Peso",  "Amount":23,  "OMSId":1,  "RequestCode":"178ab0fb-bbe1-4095-abf8-dca5ea4b6624",  "Status":"FullyProcessed",  "DepositInfo":"{\\"Bank Name\\": \\"Coins.ph\\", \\"Comment\\": \\"Cash in from Coins.ph\\", \\"OrderId\\": \\"3675137698bd4f08b4b608a398176e26\\"}",  "CreatedTimestamp":"2018-07-12T11:20:16Z",  "LastUpdateTimeStamp":"2018-07-12T11:20:16Z" }  

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

Page 38: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Limit  100  Number of last deposits to fetch [Integer] 

AccountId  4  Your account ID [Integer] 

OperatorId  1  Always 1 [Integer] 

StartIndex  0  Offset in deposits list [Integer] 

Response Parameters

Attribute Name  Example  Description 

AssetManagerId  1  The ID of the system's asset manager module, usually 1 [Integer] 

AccountId  4  Your account ID [Integer] 

AssetId  1  The ProductId of the deposit. [Integer] 

AccountName  “[email protected]”  Your account name. [String] 

AssetName  "Philippine Peso"  Name of the asset [String] 

Amount  23  Deposit amount [Decimal] 

NotionalValue  80124.12  Value of selected instrument in PHP. [Decimal] 

NotionalProductId  7  PHP Product Id. [Integer] 

OMSId  1  Order Management System ID. Always 1. 

RequestCode  "178ab0fb-bbe1-4095-abf8-dca5ea4b6624" 

Request code of deposit, this ID is a common reference between Coins.ph and Coins Pro APIs and can be used to track transactions between the two systems [String]  Use settlement_detail.confirmation_code field in Coins.ph SellOrder API to match transactions. 

ReferenceId  4b9ad1de  The ID of the action or event that triggered this transaction. [String]  

RequestIP  123.123.0.123  The IP address from which the calling user makes the request. [String] 

RequestUser  45  Your UserID [Integer] 

RequestUserName  “[email protected]”  Your user name[String] 

OperatorId  1  Always 1. [Integer] 

Page 39: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Status  "FullyProcessed"  Status of deposit [String]. 

Possible values: 

- New - AdminProcessing - Accepted - Rejected - SystemProcessing - FullyProcessed - Failed - Pending 

FeeAmt  91.71  Fee Amount [Decimal] 

UpdatedByUser  45  Updated by UserID [Decimal] 

TicketNumber  14102  Ticket identifier [Integer] 

DepositInfo  "{}"  JSON-format meta information about this deposit [String]. 

CreatedTimestamp  "2018-07-12T11:20:16Z" 

Timestamp of creation [ISO datetime] 

LastUpdateTimeStamp 

"2018-07-12T11:20:16Z" 

Timestamp of last update [ISO datetime] 

Page 40: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Withdrawals

CreateWithdrawTicket

Creates a withdrawal ticket to send funds from Coins Pro to the user’s Coins.ph wallet. 

Example

Request -> (full frame omitted, please read Message Frame Format)  {  "OMSId":1,  "ProductId":4,  "AccountId":146,  "Amount":"100" }   Response <- (full frame omitted, please read Message Frame Format)  {  "result":true,  "errormsg":null,  "errorcode":0 } 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

ProductId  4  ID of the product which will be withdrawn [Integer] 

AccountId  4  Your account ID [Integer] 

Amount  100  Amount for withdrawal [Decimal] 

Response Parameters

Attribute Name  Example  Description 

result  true  Result of operation, true if withdrawal ticket was created successfully [Bool] 

errormsg  ""  Error message if request was unsuccessful 

Page 41: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

[String] 

errorcode  0  Error code [Integer]. Zero in case of no errors. 

detail  "178ab0fb-bbe1-4095-abf8-dca5ea4b6624" 

Detail code of withdraw, this ID is a common reference between Coins.ph and Coins Pro APIs and can be used to track transactions between the two systems [String]  Use settlement_detail.confirmation_code field in Coins.ph BuyOrder API to match transactions. 

GetWithdrawTicket Gets the current operating status of a Withdraw Ticket. 

Example

Request -> (full frame omitted, please read Message Frame Format)  {  "OMSId":1,  "AccountId":4,  "RequestCode":abc12345-1234ac-abc12-8dca-abc123456,  }   Response <- (full frame omitted, please read Message Frame Format)  {  "AssetManagerId":1,  "AccountId":1,  "AccountName":"[email protected]",  "AssetId":1,  "Amount":100,  "NotionalValue":100,  ... } 

Request Parameters

Attribute Name  Example  Description 

Page 42: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

AccountId  1  Order Management System ID. Always 1. 

OMSId  1  Order Management System ID. Always 1. 

RequestCode  "178ab0fb-bbe1-4095-abf8-dca5ea4b6624" 

Request code of withdrawal, this ID is a common reference between Coins.ph and Coins Pro APIs and can be used to track transactions between the two systems [String]  Use payment_validation_code field in Coins.ph BuyOrder API to match transactions. 

Response Parameters

Attribute Name  Example  Description 

AccountId  4  Your account ID [Integer] 

AccountName  “[email protected]” 

Your account name. [String] 

AssetManagerId  1  The ID of the system's asset manager module, usually 1 [Integer] 

AssetId  1  The ProductId of the withdrawal. [Integer] 

AssetName  "Philippine Peso"  Name of the asset [String] 

Amount  23  Withdraw amount [Decimal] 

NotionalValue  80124.12  Value of selected instrument in PHP. [Decimal] 

NotionalProductId  7  PHP Product Id. [Integer] 

TemplateForm  {}  Withdrawal Template [Object] 

TemplateFormType  “Standard”  The name of the template being used. [String] 

OMSId  1  Order Management System ID. Always 1. 

RequestCode  "178ab0fb-bbe1-4095-abf8-dca5ea4b6624" 

Request code of withdrawal, this ID is a common reference between Coins.ph and Coins Pro APIs and can be used to track transactions between the two systems [String]  Use payment_validation_code field in Coins.ph BuyOrder API to match 

Page 43: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

transactions. 

RequestIP  123.123.0.123  The IP address from which the calling user makes the request. [String] 

RequestUserId  45  Your UserID [Integer] 

RequestUserName  “[email protected]” 

Your user name[String] 

OperatorId  1  Always 1. [Integer] 

Status  "FullyProcessed"  Status of withdrawal [String]. 

Possible values: 

- New - AdminProcessing - Accepted - Rejected - SystemProcessing - FullyProcessed - Failed - Pending - Pending2Fa - AutoAccepted - Delayed 

FeeAmt  91.71  Fee Amount [Decimal] 

UpdatedByUser  45  Updated by UserID [Decimal] 

TicketNumber  14102  Ticket identifier [Integer] 

WithdrawTransactionDetails 

{}  Withdrawal Ticket Information [Object] 

RejectReason  ""  If the trade was rejected, this string provides the reason [String] 

CreatedTimestamp  "2018-07-12T11:20:16Z" 

Timestamp of creation [ISO datetime] 

LastUpdateTimestamp  "2018-07-12T11:20:16Z" 

Timestamp of creation [ISO datetime] 

CreatedTimestampTick 

637194309505569739 

long integer Time of the created timestamp tick, in POSIX format and UTC 

LastUpdateTimestamp 63719430950556 Long integer Time of the last update 

Page 44: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Tick  9739  timestamp tick, in POSIX format and UTC 

Comments  null  Any comment made on the ledger entry. [String] 

Attachments  null  Any attachments made on the ledger entry. [String] 

AuditLog  null  Reserved for future use. [Object] 

GetWithdrawTickets Get a list of withdrawals for an account. 

Example

Request -> (full frame omitted, please read Message Frame Format)  {  "OMSId":1,  "AccountId":4,  "Limit":100,  “StartIndex”:0,  “OperatorId:1, }   Response <- (full frame omitted, please read Message Frame Format)  {  "AccountId":152,  "AssetId":5,  "AssetName":"BitcoinCash",  "Amount":0.0001,  "OMSId":1,  "RequestCode":"0d390b87-e482-48ce-81de-ac208f66817e",  "Status":"FullyProcessed",  "CreatedTimestamp":"2018-06-07T06:26:07Z",  "LastUpdateTimestamp":"2018-06-07T06:27:20Z", } 

Request Parameters

Attribute Name  Example  Description 

OperatorId  1  Always 1. 

OMSId  1  Order Management System ID. Always 1. 

Page 45: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Limit  100  Number of last deposits to fetch [Integer] 

AccountId  4  Your account ID [Integer] 

StartIndex  0  Offset in withdrawals list [Integer] 

Response Parameters

Attribute Name  Example  Description 

AccountId  4  Your account ID [Integer] 

AccountName  “[email protected]” 

Your account name. [String] 

AssetManagerId  1  The ID of the system's asset manager module, usually 1 [Integer] 

AssetId  1  The ProductId of the withdrawal. [Integer] 

AssetName  "Philippine Peso"  Name of the asset [String] 

Amount  23  Withdraw amount [Decimal] 

NotionalValue  80124.12  Value of selected instrument in PHP. [Decimal] 

NotionalProductId  7  PHP Product Id. [Integer] 

TemplateForm  {}  Withdrawal Template [Object] 

TemplateFormType  “Standard”  The name of the template being used. [String] 

OMSId  1  Order Management System ID. Always 1. 

RequestCode  "178ab0fb-bbe1-4095-abf8-dca5ea4b6624" 

Request code of withdrawal, this ID is a common reference between Coins.ph and Coins Pro APIs and can be used to track transactions between the two systems [String]  Use payment_validation_code field in Coins.ph BuyOrder API to match transactions. 

RequestIP  123.123.0.123  The IP address from which the calling user makes the request. [String] 

Page 46: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

RequestUserId  45  Your UserID [Integer] 

RequestUserName  “[email protected]” 

Your user name[String] 

OperatorId  1  Always 1. [Integer] 

Status  "FullyProcessed"  Status of withdrawal [String]. 

Possible values: 

- New - AdminProcessing - Accepted - Rejected - SystemProcessing - FullyProcessed - Failed - Pending - Pending2Fa - AutoAccepted - Delayed 

FeeAmt  91.71  Fee Amount [Decimal] 

UpdatedByUser  45  Updated by UserID [Decimal] 

TicketNumber  14102  Ticket identifier [Integer] 

WithdrawTransactionDetails 

{}  Withdrawal Ticket Information [Object] 

RejectReason  ""  If the trade was rejected, this string provides the reason [String] 

CreatedTimestamp  "2018-07-12T11:20:16Z" 

Timestamp of creation [ISO datetime] 

LastUpdateTimestamp  "2018-07-12T11:20:16Z" 

Timestamp of creation [ISO datetime] 

CreatedTimestampTick 

637194309505569739 

long integer Time of the created timestamp tick, in POSIX format and UTC 

LastUpdateTimestampTick 

637194309505569739 

Long integer Time of the last update timestamp tick, in POSIX format and UTC 

Comments  null  Any comment made on the ledger entry. [String] 

Page 47: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Attachments  null  Any attachments made on the ledger entry. [String] 

AuditLog  null  Reserved for future use. [Object] 

Market Data

Overview of Level 1 and Level 2 Market Information Level 1 information Consists of real-time bid and ask quotes for a specific instrument ID or instrument symbol. Level 1 provides last trade information; session’s market prices for open, high, low, and close; current, and rolling information.  Level 2 information Also consists of real-time bid and ask quotes for a specific instrument ID or instrument symbol as does Level 1, but allows the user to specify the level of market depth information on either side of the bid and ask order books, and to see quantities.

Level 1 Data

SubscribeLevel1 Retrieves the latest Level 1 Ticker information and Subscribes the user to Level 1 Market Data updates for the specified Instrument. After subscribing, the user will receive periodic Level1UpdateEvent event information until they call UnsubscribeLevel1. 

Example

Request -> {  "m":0,  "i":0,  "n":"SubscribeLevel1",  "o":"{\"OMSId\":1,\"InstrumentId\":1}" }  Response <- (full frame omitted, please read Message Frame Format)  {  "InstrumentId": 1,   "BestBid": 0.00,  "BestOffer": 0.00,  "LastTradedPx": 0.00,  "LastTradedQty": 0.00,  "LastTradeTime": 635872032000000000,  "SessionOpen": 0.00, 

Page 48: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

"SessionHigh": 0.00,  "SessionLow": 0.00,  "SessionClose": 0.00,  "Volume": 0.00,  "CurrentDayVolume": 0.00,  "CurrentDayNumTrades": 0,  "CurrentDayPxChange": 0.0,  "Rolling24HrVolume": 0.0,  "Rolling24NumTrades": 0.0,  "Rolling24HrPxChange": 0.0,  "TimeStamp": 635872032000000000 }  

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

Response Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

BestBid  0.00  The current Best Bid for the Instrument. [Decimal] 

BestOffer  0.00  The current Best Offer for the Instrument. [Decimal] 

LastTradedPx  0.00  The last traded price for the Instrument. [Decimal] 

LastTradedQty  0.00  The last traded quantity for the Instrument. [Decimal] 

LastTradeTime  635872032000000000 

Timestamp in .NET UTC Ticks.  

SessionOpen  0.00  The Opening price. [Decimal] 

SessionHigh  0.00  The Highest price. [Decimal] 

SessionLow  0.00  The Lowest price. [Decimal] 

SessionClose  0.00  The Closing price. [Decimal] 

Page 49: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Volume  0.00  Volume traded. [Decimal] 

CurrentDayVolume  0.00  Current day volume traded. [Decimal] 

CurrentDayNumTrades 

0  Number of trades for current day. [Integer] 

CurrentDayPxChange  0.00  Current Day price change. [Decimal] 

Rolling24HrVolume  0.00  Last 24 hr volume. [Decimal] 

Rolling24NumTrades  0.00  Last 24 number of trades. [Integer] 

Rolling24HrPxChange  0.00  Last 24 hr price change. [Decimal] 

AskOrderCt  45  The count of sell orders on the order book. [Integer] 

AskQty  12  The quantity of all the sell orders on the order book. [Integer] 

BidOrderCt  95  The count of buy orders on the order book. [Integer] 

BidQty  20  The quantity of all the buy orders on the order book. [Integer] 

TimeStamp  635872032000000000 

Timestamp in .NET UTC Ticks. 

Level1UpdateEvent When subscribed to Level1 Market Data (after calling SubscribeLevel1), the user will receive Level1UpdateEvent messages from the server. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "InstrumentId": 1,   "BestBid": 0.00,  "BestOffer": 0.00,  "LastTradedPx": 0.00,  "LastTradedQty": 0.00,  "LastTradeTime": 635872032000000000,  "SessionOpen": 0.00,  "SessionHigh": 0.00,  "SessionLow": 0.00,  "SessionClose": 0.00, 

Page 50: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

"Volume": 0.00,  "CurrentDayVolume": 0.00,  "CurrentDayNumTrades": 0,  "CurrentDayPxChange": 0.0,  "Rolling24HrVolume": 0.0,  "Rolling24NumTrades": 0.0,  "Rolling24HrPxChange": 0.0,  "TimeStamp": 635872032000000000 } 

Response Parameters

Attribute Name  Example  Description 

OMSId  1  Always 1 [Integer] 

InstrumentId  1  Instrument's Identifier [Integer] 

BestBid  0.00  The current Best Bid for the Instrument. [Decimal] 

BestOffer  0.00  The current Best Offer for the Instrument. [Decimal] 

LastTradedPx  0.00  The last traded price for the Instrument. [Decimal] 

LastTradedQty  0.00  The last traded quantity for the Instrument. [Decimal] 

LastTradeTime  635872032000000000 

Timestamp in .NET UTC Ticks.  

SessionOpen  0.00  The Opening price. [Decimal] 

SessionHigh  0.00  The Highest price. [Decimal] 

SessionLow  0.00  The Lowest price. [Decimal] 

SessionClose  0.00  The Closing price. [Decimal] 

Volume  0.00  Volume traded. [Decimal] 

CurrentDayVolume  0.00  Current day volume traded. [Decimal] 

CurrentDayNumTrades 

0  Number of trades for current day. [Integer] 

CurrentDayPxChange  0.00  Current Day price change. [Decimal] 

Rolling24HrVolume  0.00  Last 24 hr volume. [Decimal] 

Page 51: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Rolling24NumTrades  0.00  Last 24 number of trades. [Integer] 

Rolling24HrPxChange  0.00  Last 24 hr price change. [Decimal] 

TimeStamp  635872032000000000 

Timestamp in .NET UTC Ticks. 

BidOrderCt  95  The count of sell orders on the order book. [Integer] 

BidQty  20  The quantity of all the sell orders on the order book. [Integer] 

AskOrderCt  45  The count of buy orders on the order book. [Integer] 

AskQty  12  The quantity of all the buy orders on the order book. [Integer] 

UnsubscribeLevel1 Unsubscribes the user from receiving Level 1 Market Data updates for the specified Instrument. 

Example

Request -> {  "m":0,  "i":0,  "n":"UnsubscribeLevel1",  "o":"{\"OMSId\":1,\"InstrumentId\":1}" }  Response <- (full frame omitted, please read Message Frame Format)  {  "result": true // [Boolean]   } //on error: {  "result": false, // [Boolean]  "errormsg": "Error", //A message describing the error. [String]  "errorcode": 104, //An error code  "detail": "Instrument not Found" } 

Request Parameters

Page 52: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

Response Parameters

Attribute Name  Example  Description 

result  true  Result of operation, true if unsubscribed [Bool] 

errormsg  ""  Error message [String] 

detail  “Instrument not Found” 

Detailed error description [String] 

errorcode  104  Error code [Integer] 

Level 2 data

SubscribeLevel2

Retrieves the latest Level 2 Snapshot and Subscribes user to Level 2 Market Data updates for the specified Instrument.Example

Request -> {  "m":0,  "i":0,  "n":"SubscribeLevel2",  "o":"{\"OMSId\":1,\"InstrumentId\":1,\"Depth\":10}" }  Response <- (full frame omitted, please read Message Frame Format)  [  [18981,0,635872032000000000,2,300000,0,300000,1,0,1],  [18982,1,635872032000000000,0,300000,1,300000,1,2,0],  ... ] 

Request Parameters

Attribute Name  Example  Description 

Page 53: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

Depth  10  The Depth of the book to subscribe to updates for. In this example, you would receive 10 price levels on each side of the market. [Integer] 

Response Parameters

Attribute  Example  Description 

1  18981  Market Data Sequence Number [64 bit Integer] 

2  0  Number of Traders at this price level [Integer] 

3  635872032000000000 

Timestamp [64 bit Integer] .NET UTC Ticks. See code snippets for examples on converting this to other formats. 

4  2  Change Type [Integer]  Values: 

- 0=New - 1=Update - 2=Delete 

5  300000  Last Traded Price [Decimal] 

6  0  Number of Orders at this price level [Integer] 

7  300000  Price [Decimal] 

8  1  InstrumentId [Integer] 

9  0  Quantity [Decimal] 

10  1  Side [Integer]  Values: 

- 0=Buy - 1=Sell 

Page 54: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Level2UpdateEvent

When subscribed to Level 2 Market Data, the user will receive Level2UpdateEvent messages from the server. 

Example

Response <- (full frame omitted, please read Message Frame Format)  [  [18981,0,635872032000000000,2,300000,0,95,1,0,1],  [18982,1,635872032000000000,0,300000,1,95,1,2,0],  ... ] 

Response Parameters

Attribute #  Example  Description 

1  18981  Market Data Sequence Number [64 bit Integer] 

2  0  Number of Traders at this price level [Integer] 

3  635872032000000000 

Timestamp [64 bit Integer] .NET UTC Ticks.  

4  2  Change Type [Integer]  Values: 

- 0=New - 1=Update - 2=Delete 

5  300000  Last Traded Price [Decimal] 

6  0  Number of Orders at this price level [Integer] 

7  300000  Price [Decimal] 

8  1  InstrumentId [Integer] 

Page 55: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

9  0  Quantity [Decimal] 

10  1  Side [Integer] Values: 

- 0=Buy - 1=Sell 

UnsubscribeLevel2 Unsubscribes from Level 2 Market Data updates for the specified Instrument. 

Example

Request -> {  "m":0,  "i":0,  "n":"UnsubscribeLevel2",  "o":"{\"OMSId\":1,\"InstrumentId\":1}" }  Response <- (full frame omitted, please read Message Frame Format)  {  "result": true // [Boolean]   } //on error: {  "result": false, // [Boolean]  "errormsg": "Error" //A message describing the error. [String]  "errorcode": 104, //An error code  "detail": "Instrument not Found" } 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

Response Parameters

Attribute Name  Example  Description 

result  true  Result of operation, true if unsubscribed [Bool] 

errormsg  ""  Error message [String] 

Page 56: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

detail  “Instrument not Found” 

Detailed error description [String] 

errorcode  104  Error code [Integer] 

Page 57: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Trades feed

SubscribeTrades

Retrieves the latest public market trades and Subscribes User to Trade updates for the specified Instrument. 

Example

Request -> {  "m":0,  "i":0,  "n":"SubscribeTrades",  "o":"{\"OMSId\":1,\"InstrumentId\":1,\"IncludeLastCount\":100}" }  Response <- (full frame omitted, please read Message Frame Format)  [  [87,1,0.01,450.98,635872032000000000,0,1],  [88,1,0.01,450.98,635872032000000000,0,1],  [89,1,0.0368,450.98,635872032000000000,0,1],  ... ] 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

IncludeLastCount  10  Specifies the number of previous trades to retrieve in the immediate snapshot. Default is 100. [Integer] 

Response Parameters

Attribute #  Example  Description 

1  87  Trade Number [64 bit Integer] 

2  1  InstrumentId [Integer] 

3  0.01  Quantity [Decimal] 

4  450.98  Price [Decimal] 

7  635872032000000000 

Timestamp 

Page 58: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

8  0  Direction [Integer] Shows if this trade represents a movement of the book price up, down, or no change.  Values: 

- 0=NoChange - 1=Uptick - 2=Downtick 

9  1  TakerSide [Integer] Side of trade representing the Taker 

TradeDataUpdateEvent

When subscribed to Trades, you will receive TradeDataUpdateEvent messages from the server. 

Example

Response <- (full frame omitted, please read Message Frame Format)  [  [87,1,0.01,450.98,635872032000000000,0,1],  [88,1,0.01,450.98,635872032000000000,0,1],  [89,1,0.0368,450.98,635872032000000000,0,1],  ... ] 

Response Parameters

Attribute #  Example  Description 

1  87  Trade Number [64 bit Integer] 

2  1  InstrumentId [Integer] 

3  0.01  Quantity [Decimal] 

4  450.98  Price [Decimal] 

7  635872032000000000 

Timestamp 

8  0  Direction [Integer]  Shows if this trade represents a movement of the book price up, down, or no change.  

Page 59: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Values: - 0=NoChange - 1=Uptick - 2=Downtick 

[Integer] 

9  1  TakerSide [Integer]  Indicates the Side of trade representing the Taker 

UnsubscribeTrades Unsubscribes the user from Trades Market Data Feed. 

Example

Request -> {  "m":0,  "i":0,  "n":"UnsubscribeTrades",  "o":"{\"OMSId\":1,\"InstrumentId\":1}" }  Response <- (full frame omitted, please read Message Frame Format)  {  "result": true // [Boolean]   } //on error: {  "result": false, // [Boolean]  "errormsg": "Error" //A message describing the error. [String]  "errorcode": 104, //An error code  "detail": "Instrument not Found" } 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

Page 60: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Response Parameters

Attribute Name  Example  Description 

result  true  Result of operation, true if unsubscribed [Bool] 

errormsg  ""  Error message [String] 

detail  “Instrument not Found” 

Detailed error description [String] 

errorcode  104  Error code [Integer] 

Page 61: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Account events feed

SubscribeAccountEvents

Subscribe to account-level events, such as orders, trades, deposits and withdraws. We highly recommend that you use this subscription to track your order states. 

Example

Request -> {  "m":0,  "i":0,  "n":"SubscribeAccountEvents",  "o":"{\"OMSId\":1,\"AccountId\":1}" }  Response <- (full frame omitted, please read Message Frame Format)  {   "result": true  } 

Request Parameters

Attribute Name  Example  Description 

OMSId  1  Order Management System ID. Always 1. 

InstrumentId  1  Instrument's Identifier [Integer] 

Response Parameters

Attribute Name  Example  Description 

result  true  Result of operation, true if unsubscribed [Bool] 

errormsg  ""  Error message [String] 

Page 62: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

PendingDepositUpdate

When subscribed to Account Events, the user will receive a PendingDepositUpdate message when a deposit is pending to be credited into the user’s account. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "AccountId": 4,  "AssetId": 1,  "TotalPendingDepositValue": 0.01 } 

Response Parameters

Attribute Name  Example  Description 

AccountId  4  Your account id number. [Integer] 

AssetId  1  The ProductId of the pending deposit. [Integer] 

TotalPendingDepositValue 

0.01  The value of the pending deposit. [Decimal] 

AccountPositionEvent

When subscribed to Account Events, the user will receive an AccountPositionEvent update anytime the balance of their account changes. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "AccountId":4, //Your account id number. [Integer]  "ProductSymbol":"BTC", //The Product Symbol for this balance message. [String]  "ProductId":1, //The Product Id for this balance message. [Integer]  "Amount":10499.1, //  "Hold":2.1, //  "PendingDeposits":0, // 

Page 63: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

"PendingWithdraws":0, //  "TotalDayDeposits":0, //  "TotalDayWithdraws":0 // } 

Response Parameters

Attribute Name  Example  Description 

OMSId  1  Internal ID of the order management system. [Integer] 

AccountId  4  Your account id number. [Integer] 

ProductId  1  The Product Id for this balance message. [Integer] 

ProductSymbol  1  The Product Symbol for this balance message. [String] 

Amount  10499.1  The total balance for the specified product. [Decimal] 

Hold  2.1  The total amount of your balance that is on hold. Your Available balance for trading and withdrawal is (Amount - Hold). [Decimal] 

PendingDeposits  0  Total Deposits Pending for the specified product. [Decimal] 

PendingWithdraws  0  Total Withdrawals Pending for the specified product. [Decimal] 

TotalMonthDeposits  1451.41  Total deposits for the month as of today's date for a specified product. [Decimal] 

TotalYearDeposits  100100.19  Total deposits for the year as of today's date for a specified product. [Decimal] 

TotalYearDepositNotional 

451200.12  Yearly notional amount of deposits for crypto-currencies. Usually calculated as value = (Amount * Bid/Ask Price) [Decimal] 

TotalDayDeposits  0  The total 24 hour deposits for the specified product. [Decimal] 

TotalDayWithdraws  154141.94  The total 24 hour withdrawals for the specified product. [Decimal] 

Page 64: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

TotalMonthWithdraws  410141.54  Total withdrawals for the month as of today’s date for a specified product. [Decimal] 

TotalYearWithdraws  1982452.12  Total withdrawals for the year as of today's date a specified product. [Decimal] 

TotalYearWithdrawNotional 

4512315.58  Yearly notional amount of withdrawals for crypto-currencies. Usually calculated as value = (Amount * Bid/Ask Price) [Decimal] 

NotionalProductId  7  PHP Product Id. [Integer] 

NotionalProductSymbol 

“PHP”  Notional Symbol. [String] 

NotionalValue  80124.12  Value of selected instrument in PHP. [Decimal] 

OrderStateEvent

When subscribed to Account Events, the user will receive OrderState event updates anytime the status of an order on their account changes. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "Side":"Sell",  "OrderId":9849,  "Price":97,  "Quantity":1,  "Instrument":1,  "Account":4,  "OrderType":"Limit",  "ClientOrderId":0,  "OrderState":"Working",  "ReceiveTime":0,  "OrigQuantity":1,  "QuantityExecuted":0,  "ChangeReason": "" }  

Response Parameters

Attribute Name  Example  Description 

Page 65: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Account  4  Your account id. [Integer] 

AccountName  “[email protected]”  Your account name. [String] 

ClientOrderId  99  Set this to your own id if you wish to use one. It will be useful for recognizing future order states related to this call. [64 bit Integer] 

OrderState  "Working"  The current state of the order. [String] Values: 

- "Working" - "Rejected" - "FullyExecuted" - "Canceled" - "Expired" 

Quantity  1  The Quantity (Remaining if partially or fully executed) of your order. [Decimal] 

DisplayQuantity  0  Quantity of an order to display publicly on the order books. If you have an order for 1,000 and you want the order books to reflect a quantity of only 100 at any one time, set this to 100. This functionality can only be used for limit orders. Set to 0 to display all. [Decimal] 

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) - 4 (StopLimit) - 5 (TrailingStopMarket) - 6 (TrailingStopLimit) 

Instrument  1  Instrument's Identifier [Integer] 

Side  "Sell"  The side of your order. [String] Values are "Sell", "Buy"  Values: 

- "Buy" - "Sell" 

 

OrderId  123  The Server-Assigned Order Id. [64 bit Integer] 

Price  96  The Price of your order. [Decimal] 

OrderState  "Working"  The current state of the order. [String] 

Page 66: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Values: - "Working" - "Rejected" - "FullyExecuted" - "Canceled" - "Expired" 

OrigQuantity  1  The original quantity of your order. [Decimal] 

QuantityExecuted  0.71  The total executed quantity. [Decimal] 

GrossValueExecuted  415.41  Value executed. [Decimal] 

ExecutableValue  41  Executable value. [Decimal] 

AvgPrice    The average executed price for the instrument in the order. [Decimal] 

CounterParty  41  The ID of the other party in a trade [Integer] 

ChangeReason  ""  The reason for the order state change. [String] Values are “NewInputAccepted”, “NewInputRejected”, “OtherRejected”, “Expired”, “Trade”, SystemCanceledBelowMinimum”, “SystemCanceledNoMoreMarket”, “UserModified” 

OrigOrderId  9849  The Original Server-Assigned Order Id if the order has been changed. [64 bit Integer] 

OrigClOrdId  1  The Original Client-Designated Order Id if the order has been changed. [64 bit Integer] 

EnteredBy  45  Shows your User ID. [Integer] 

UserName  “[email protected]”  Your user name. [String] 

IsQuote  false  If this order is a quote, the value for IsQuote is true, else false [boolean] 

InsideAsk  51.24  If this order is a quote, this value is the Inside Ask price. [Decimal] 

InsideAskSize  721.42  If this order is a quote, this value is the quantity of the Inside Ask quote. [Decimal] 

InsideBid  71.24  If this order is a quote, this value is the Inside Bid price. [Decimal] 

InsideBidSize  1042.12  If this order is a quote, this value is the quantity of the Inside Bid quote. [Decimal] 

Page 67: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

LastTradePrice  82.1  The last price that this instrument traded at. [Decimal] 

StopPrice    The price at which to execute the new order, if the order is a stop order. [Decimal] 

PegPriceType  1  When entering a Stop/Trailing order, set this to the type of price you would like to peg the Stop to. [Integer]  Values: 1 (Last) 2 (Bid) 3 (Ask)  

PegOffset  55.12  Peg Offset Price [Integer] 

PegLimitOffset  11.1  Price for Limit offset [Integer] 

RejectReason  ""  If the trade was rejected, this string provides the reason [String] 

IsLockedIn  true  For a block trade, if both parties of the block trade agree that one of the parties will report the trade for both sides, this value is true. Otherwise, false. [Bool] 

CancelReason  “”  If this order has been canceled, this string holds the cancelation reason. [String] 

OrderFlag  1  If Order is Flagged[Integer] 

UseMargin  false   Reserved for future use[Bool] 

ReceiveTime  1532346260831  Timestamp 

ReceiveTimeTicks  637236613765444369 

Time stamp of the order Microsoft Ticks format and UTC time zone 

LastUpdatedTime  1588064576612  The date and time stamp of the last update to the ticket, in POSIX format. All dates and times are UTC. 

LastUpdatedTimeTicks 

637236613766116534 

Time stamp of the last updated order Microsoft Ticks format and UTC time zone 

Page 68: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

OrderTradeEvent

When subscribed to Account Events, the user will receive OrderTradeEvent event updates anytime one of their orders results in a trade. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "TradeId":213,  "OrderId":9848,  "AccountId":4,  "ClientOrderId":0,  "InstrumentId":1,  "Side":"Buy",  "Quantity":0.01,  "Price":95,  "Value":0.95,  "TradeTime":635978008210426109 } 

Response Parameters

Attribute Name  Example  Description 

TradeId  230  Trade Id [64 bit Integer] 

OrderId  9861  Order Id [64 bit Integer] 

AccountId  4  Your account id. [Integer] 

ClientOrderId  0  Your client order id. [64 bit Integer] 

InstrumentId  1  Instrument's Identifier [Integer] 

Side  "Buy"  Side of the trade [String]  Values: 

- "Buy" - "Sell" 

Quantity  2  Quantity [Decimal] 

Price  95  Price [Decimal] 

Page 69: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Value  190  Value = price * quantity [Decimal] 

InsideAskSize  721.42  If this order is a quote, this value is the quantity of the Inside Ask quote. [Decimal] 

InsideBid  71.24  If this order is a quote, this value is the Inside Bid price. [Decimal] 

InsideAsk  51.24  If this order is a quote, this value is the Inside Ask price. [Decimal] 

InsideBidSize  1042.12  If this order is a quote, this value is the quantity of the Inside Bid quote. [Decimal] 

IsBlockTrade  false  A value of true means that this trade was a block trade; a value of false that it was not a block trade. [Bool] 

IsQuote  false  If this order is a quote, the value for IsQuote is true, else false [boolean] 

MakerTaker  0  0 Unknown 1 Maker 2 Taker [Integer] 

OMSId  1  Always 1. [Integer] 

OrderOriginator  45  The ID of the user who initiated the trade. [Integer] 

AccountName  “[email protected]”  Your account name. [String] 

OrderTradeRevision  1  The revision number of this trade; usually 1 [Integer] 

OrderType  2  The type of order. [Integer] Values: 

- 1 (Market) - 2 (Limit) - 3 (StopMarket) 

RemainingQuantity  41.51  The number of units remaining to be traded by the order after this execution. [Decimal] 

SubAccountId  0  Not currently used; reserved for future use. Defaults to 0. [Integer] 

Page 70: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

AdapterTradeId  1   The ID of the adapter of the overall trade. [Integer] 

UserName  “[email protected]”  Your User name. [String] 

CounterParty  41  The ID of the other party in a trade [Integer] 

Direction  0  Shows if this trade represents a movement of the book price up, down, or no change.  Values: 

- 0=NoChange - 1=Uptick - 2=Downtick 

[Integer] 

ExecutionID  2607327  Execution Id [64 bit Integer] 

Fee  0.014  Fee [Decimal] 

FeeProductId  7  ProductId of Fee [Integer] 

TradeTimeMS  1501354796418  Timestamp [Integer]  The time at which the trade took place, in POSIX format and UTC time zone. 

NewOrderRejectEvent

When subscribed to Account Events, the user will receive NewOrderRejectEvent event updates if their order is rejected. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "AccountId": 4,  "ClientOrderId": 1234,  "Status": "Rejected",  "RejectReason": "No More Market" } 

Page 71: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Response Parameters

Attribute Name  Example  Description 

AccountId  4  Your account id number. [Integer] 

ClientOrderId  1234  Your Client Order Id [64 Bit Integer] 

Status  "Rejected"  Always "Rejected" [String] 

RejectReason  "No More Market"  A message describing the reason for the reject [String] 

CancelOrderRejectEvent

When subscribed to Account Events, the user will receive CancelOrderRejectEvent event updates if the attempt to cancel an order is unsuccessful. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "AccountId": 4,  "OrderId": 1,  "OrderRevision": 0,  "OrderType": "Unknown",  "InstrumentId": 1,  "Status": "Rejected",  "RejectReason": "Order Not Found" } 

Response Parameters

Attribute Name  Example  Description 

AccountId  4  Your account id number. [Integer] 

OrderId  1234  The Order Id from your Cancel request. [64 Bit Integer] 

Status  "Rejected"  Always "Rejected" [String] 

RejectReason  "Order Not Found"  A message describing the reason for the rejection. [String] 

Page 72: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

InstrumentId  4  The InstrumentId from your Cancel request. [Integer] 

OrderType  "Unknown"  The Order Type of the order, if it was found. Otherwise, . [String] 

OrderRevision  0  The Revision of the Order, if it was found. [64 Bit Integer] 

MarketStateUpdate

When subscribed to Account Events, the user will receive MarketStateUpdate event updates if the market state is administratively altered. 

Example

Response <- (full frame omitted, please read Message Frame Format)  {  "ExchangeId":1, //   "VenueAdapterId":1, //   "VenueInstrumentId":1, //   "Action":"ReOpen", //   "PreviousStatus":"Stopped", //   "NewStatus":"Running", //   "ExchangeDateTime":"2016-04-21T21:48:22Z" } 

Response Parameters

Attribute Name  Example  Description 

ExchangeId  1  Exchange Id [Integer] 

VenueAdapterId  1  Internal [Integer] 

VenueInstrumentId  1  Instrument Id [Integer] 

Action  "ReOpen"  Market State Action [String]  Values: 

- "Pause" - "Resume" - "Halt" - "ReOpen" 

Page 73: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

PreviousStatus  "Stopped"  Previous Market Status for Instrument [String]   

Values: 

- "Running" - "Paused" - "Stopped" - "Starting" 

NewStatus  "Running"  Market Status for Instrument [String]  Values: 

- "Running" - "Paused" - "Stopped" - "Starting" 

ExchangeDateTime  "2016-04-21T21:48:22Z" 

Exchange datetime [ISO Datetime string] 

Page 74: A P I S p e c ifi c a t i o n · C h a n g e l o g V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2 0 ) Up d a t e d A P I e n d p o i n t V e r s i o n 0 . 3 . 2 (0 1 J u n e , 2 0 2

Ping Used to keep a connection alive. 

Example

Request -> {  "m":0,  "i":0,  "n":"Ping",  "o":"{}" }  Response <- (full frame omitted, please read Message Frame Format)  [  {   "msg”:”PONG”  }, ] 

Request Parameters

Ping requires empty payload to return a proper response.

Response Parameters

Attribute Name Example Description

msg “PONG” Ping Response [String]