{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"918c90d3-9a21-40e2-9b3c-70b48c10ff83","name":"Exmarkets Trade API","description":"In order to use Trade API, user will have to go through few simple steps:\n\n* API key\n* HMAC authorization header\n\n<br/>\n<h4>API key</h4>\n\nTo use Trade API, user will need to obtain API key and secret, which are passed to Trade API with every request.\nAPI keys can be generated in the Exmarkets user panel, under section 'API ACCESS'. Direct link to API key creation panel:<br/>\n<a href=\"http://exmarkets.com/user/api-access\">Create API key</a>\n<br/>\n<br/>\n<h4>HMAC authorization header</h4>\n\nOnce user obtained API key, it is all set up! Now, the only thing left is to form HMAC authorization header. Basically, this header consists of two parts: Basic auth and unique hash (\"Basic {{hash}}\"). Hash is generated from different variables. In order to form this header, user will need following variables:\n<br/>\n<br/>\n<pre><code>\nconst CLIENT_KEY = client_api_key; // key obtained from exmarkets\nconst SECRET_KEY = client_api_secret; // secret obtained from exmarkets\nconst TIMESTAMP = Math.floor(Date.now() / 1000) + 6; // timestamp in seconds plus maximum time for request to reach the server\nconst NONCE = Math.floor((Date.now() + Math.random()) * 100); // unique nonce\nconst AUTH_TYPE = 'Basic'; // authorization type\n</code></pre>\n<br/>\nThe last variable, which is needed is string, from which request signature is formed. It is needed in order to validate request authenticity. This string consists of three concatenated parameters (in this exact order): Request method, request path with query string, request body string. There is no separator:\n<br/>\n<br/>\n<pre><code>\nconst method = request['method']; // GET, PUT, POST, DELETE\nconst additionalData = '&#38;' + '&#116;imestamp=' + TIMESTAMP + '&nonce=' + NONCE; // timestamp and nonce needs to be added to url\nconst pathString = request['url'] + additionalData; // host must be removed. pathString should start with /api/v1/...\nconst bodyString = request['data'] ?? ''; // full raw request body\nconst stringToEncode = method + pathString + bodyString; // all of the above data concatenated\n</code></pre>\n<br/>\nFinally, user has to retrieve a signature by encoding the result and forming authorization header:\n<br/>\n<br/>\n<pre><code>\nconst hmacDigest = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(stringToEncode, SECRET_KEY));\nconst authHeader = AUTH_TYPE + ' ' + btoa(CLIENT_KEY + ':' + hmacDigest);\n</code></pre>\n<br/>\n<b>That's it! User can now use variable 'authHeader' as authorization header to communicate with trade API.</b>\n<br/>\n<br/>\n<hr>\n<br/>\n<br/>\n<i>Here is the complete example of HMAC authorization header in JS (it is included in Postman):\n<br/>\n\n```javascript\nfunction replaceVariables(data, variables) {\n    for (let variable in variables) {\n        data = data.replace('{{' + variable + '}}', variables[variable]);\n    }\n    return data\n}\n\nfunction getPathString() {\n    const url = pm.request.url;\n    return url.getPath() + (url.getQueryString() && '?' + url.getQueryString());\n}\n\nfunction getNonce() {\n    return Math.floor((Date.now() + Math.random()) * 100);\n}\n\nfunction getAuthHeader(request, postman) {\n    const CLIENT_KEY = postman.getEnvironmentVariable('apiKey');\n    const SECRET_KEY = postman.getEnvironmentVariable('apiSecret');\n    const AUTH_TYPE = 'Basic';\n    postman.setEnvironmentVariable('timestamp', Math.floor(Date.now() / 1000) + 6);\n    postman.setEnvironmentVariable('nonce', getNonce());\n    const variables = postman.__environment;\n\n    const pathString = replaceVariables(getPathString(), variables);\n\n    const bodyString = request['data'] && request['data'].length ? replaceVariables(request['data'], variables) : '';\n\n    const stringToEncode = request['method'] + pathString + bodyString;\n    postman.setEnvironmentVariable('stringToEncode', stringToEncode);\n\n    const hmacDigest = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(stringToEncode, SECRET_KEY));\n    const authHeader = AUTH_TYPE + ' ' + btoa(CLIENT_KEY + ':' + hmacDigest);\n    return authHeader;\n}\n\npostman.setEnvironmentVariable('hmacAuthHeader', getAuthHeader(request, postman));\n ```\n \n<br/>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"2435581","team":124604,"collectionId":"918c90d3-9a21-40e2-9b3c-70b48c10ff83","publishedId":"S11BxgzM","public":true,"publicUrl":"https://documenter-api.postman.tech/view/2435581/S11BxgzM","privateUrl":"https://go.postman.co/documentation/2435581-918c90d3-9a21-40e2-9b3c-70b48c10ff83","customColor":{"top-bar":"142233","right-sidebar":"192B41","highlight":"138DEC"},"documentationLayout":"classic-double-column","version":"8.10.1","publishDate":"2019-02-22T12:37:40.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[{"name":"exmarkets.com","id":"6cf31404-952d-4b6f-b313-67c84f1e40b0","owner":"2435581","values":[{"key":"apiKey","value":"20HC5R17W1MSGWW0KWSWWCC8C","enabled":true},{"key":"apiSecret","value":"CO2X2B9RIG0KKCC484K0OGWOS080WO0O8C40O8SGG4S88WK8W","enabled":true},{"key":"host","value":"https://exmarkets.com","enabled":true},{"key":"version","value":"v1","enabled":true},{"key":"hmacAuthHeader","value":"Basic OUY2Ujg4REY5TzhXV0NHV0tXUzhTNFMwODplYTcyYzhjNWFmOGI5MzY3OWIxZjJiZTdiZjRkNzViZGU3ZWFlY2E1OWI3NmM4OWUxYjNmM2MyZTVlZTg2MmE3NDMyY2VjM2E5MGNmNGM0NzNlZTI0NTFmMmFkZGFiMzY3Nzg2Zjc1MDFiNjgzZjdjZmEwNTZmMzYxMmU5ZWVlMA==","enabled":true},{"key":"timestamp","value":"1550838976","enabled":true},{"key":"nonce","value":"159170435421209","enabled":true},{"key":"market","value":"ltc-btc","enabled":true},{"key":"limit","value":"10","enabled":true},{"key":"order_id","value":"64","enabled":true},{"key":"sort","value":"asc","enabled":true},{"key":"offset","value":"0","enabled":true},{"key":"type","value":"limit","enabled":true},{"key":"price","value":"1","enabled":true},{"key":"amount","value":"2","enabled":true},{"key":"queryString","value":"","enabled":true},{"key":"currencies","value":"btc,eth,ltc","enabled":true},{"key":"signature","value":"","enabled":true},{"key":"rawSignature","value":"","enabled":true},{"key":"stringToEncode","value":"","enabled":true}],"published":true}],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/0e351b3d87295cddf0108347d29eeafa96e12338add5d914f2d7f1378beb198b","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"},{"label":"exmarkets.com","value":"2435581-6cf31404-952d-4b6f-b313-67c84f1e40b0"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/S11BxgzM"}