























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Agreement in coinspro users essential in business development
Typology: Transcriptions
1 / 63
This page cannot be seen from the preview
Don't miss anything!
























































Version 0.3.0 (13 September) - added GetDepositTickets, GetWithdrawTickets methods. Added API keys management methods.
URLs
Message Frame Format
"m":0, "i":0, "n":"GetProducts", "o":"{"OMSId":1"}" }
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
Client 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 your sequence number variable should
frame.o = json.Stringify(requestPayload); WS.Send(json.Stringify(frame));
When receiving a frame from our API, use the frame to determine the context, and then 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; } } }
Standard API Responses
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 params
"result":false, "errormsg":"Invalid Request", "errorcode":100, "detail":"OMSId must be an Integer" }
Unauthenticated Calls
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 }, ... ]
Attribute Name Example Description
OMSId 1 Order Management System ID. Always 1.
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]
Supported values:
DecimalPlaces 9 Product's Precision [Integer]
Requests a list of available instruments from the API.
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", }, ... ]
Attribute Name Example Description
OMSId 1 Order Management System ID. Always 1.
Attribute Name Example Description
Authentication
Request -> { "m":0, "i":0, "n":"WebAuthenticateUser", "o":"{"UserName":"User1","Password":"Password"}" }
Response <- (full frame omitted, please read Message Frame Format)
{ "Authenticated": true, "SessionToken":"7d0ccf3a-ae63-44f5-a409-2301d80228bc", "UserId": 1 }
Attribute Name Example Description
UserName "User1" Username [String]
Password "Password" Password [String]
Attribute Name Example Description
Authenticated true Is session authenticated now [Bool]
Note: this will be false if auth failed.
SessionToken "7d0ccf3a-ae63- f5-a409-2301d 28bc"
Session token [String]
UserId 1 Authenticated user ID [Integer]
The endpoint will return existing APIKeys with assigned permissions. APISecret field will be blank.
Attribute Name Example Description
UserId 4 User ID [Integer]
Attribute Name Example Description
UserId 4 User ID [Integer]
ApiKey “ab1eb50a1b0cb a9130cdccba995a 47da77a22e”
Key that you will need to authenticate with [String]
ApiSecret “” Secret that you will use for signature generation [String]
Permissions [‘Deposit’, ‘Withdraw’]
Permissions enabled for API Keys [Array of Strings]
In order to authenticate using an API key, you will need to create an ApiKey and ApiSecret using this endpoint. Your UserId will need to be provided along with the permissions you wish to enable in payload.
The endpoint will return a UserAPIKey classtype 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.
Attribute Name Example Description
UserId 4 User ID [Integer]
Permissions [‘Deposit’, ‘Withdraw’]
Permissions you wish to enable for this API Key [Array of Strings]
47da77a22e”
Nonce “1534750973” Current timestamp as a string [String]
Signature “6a8de403af40e 27ce00fd1d5c03e eeca0d5ced5227d 273122c398143be 499”
This is a HMAC-SHA256 signature with ApiSecret as a key and nonce + UserId + ApiKey as a message.
Attribute Name Example Description
User {"UserId":1,"UserNa me":"[email protected] om","Email":"email @email.com","Email Verified":true,"Acco untId":3,"OMSId":1," Use2FA":false}
User info [Object]
Authenticated true If authentication was successful [Bool]
User Account Calls
Request -> { "m":0, "i":0, "n":"GetUserAccounts", "o":"" }
Response <- (full frame omitted, please read Message Frame Format)
[4]
Attribute Name Example Description
An array of account IDs
[4] Array of Account IDs [Integer]
Request -> { "m":0, "i":0, "n":"GetAccountTransactions", "o":"{"OMSId":1,"AccountId": 1,"Depth": 200}" }
Response <- (full frame omitted, please read Message Frame Format) [ { "TransactionId": 945, "AccountId": 4, "CR": 76, "DR": 0, "TransactionType": "Trade", "ReferenceId": 232, "ReferenceType": "Trade", "ProductId": 2, "Balance": 101111.1, "TimeStamp": 1501354796418 }, ... ]
Attribute Name Example Description
OMSId 1 Order Management System ID. Always 1.
AccountId 1 Account ID of user. Should be populated using GetUserAccounts.
Values:
TimeStamp 1501354796418 [Long Integer] Time at which the transaction took place, in POSIX format and UTC time zone.
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, }]
Attribute Name Example Description
OMSId 1 Order Management System ID. Always 1.
AccountId 4 Account ID [Integer]
Attribute Name Example Description
AccountId 4 Your account id. [Integer]
ProductId 5 Product's ID Number [Integer]
ProductSymbol "BTC" The product symbol for this record. [String]
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 withdraw is (Amount - Hold). [Decimal]
PendingDeposits 0 Total Deposits Pending for the specified product. [Decimal]
PendingWithdraws 0 Total Withdraws Pending for the specified product. [Decimal]
TotalDayDeposits 10500 The total 24 hour deposits for the specified product. [Decimal]
TotalDayWithdraws 0 The total 24 hour withdraws for the specified product. [Decimal]
TotalMonthWithdraws 0 The total month withdraws for the specified product. [Decimal]
Retrieves Trade History for a specific account.
Request -> { "m":0, "i":0, "n":"GetAccountTrades", "o":"{"OMSId":1,"AccountId":4,"Count":50,"StartIndex":0}" }