{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"fa5fbc53-8c21-4993-9bf6-24855b73cc5b","name":"Fabriik Markets Trading API Document","description":"# Overview  \n  \nWelcome to [Fabriik Markets](https://fabriik.com/markets) Trading API!\nOur REST API allows our customers to generate quotes, set locked-in price, execute trades and more.\n\nPlease note: to use the REST API make sure service URLs and *API key* and *API secret* are properly filled.\n\n------\n\n# Production URL\nTrading API production is hosted at \n\n \n```https://api.trading.fabriik.com```\n\n------\n \n# Authentication\n\nFor authentication purposes, our API uses an *API key* in addition to an *API secret*. The *API key* will be needed for each private API call and should be included each request header. If you do not have an API key or have problems using your balances and trade limits, please contact your Fabriik wealth manager.\n\nWe use base64 encoded [HMAC](https://en.wikipedia.org/wiki/HMAC) SHA384 signature for authentication. The signature is calculated as: \n\n```Base64Encode(HmacSHA384(METHOD+PATH+CONTENT_TYPE+NONCE, APISecret))```\n\nOnce signature is calculated, three headers are expected in those private endpoints:\n\n| Headers |Value|\n|:--|:--|\n|X-BM-APIKEY| {{Your Fabriik API Key}} |\n|X-BM-SIGNATURE|{{Calculated signature}} |\n|X-BM-NONCE|{{Current Epoch time in milliseconds}}|\n\nBelow is a Java code example on generating and using the HMAC signature for `/quotes` endpoint or you can find external code examples [here](https://github.com/danharper/hmac-examples).\n\n```\n/*\n * The sample code works with Apache httpcomponents-client 4.5.13\n*/\nimport org.apache.http.HttpResponse;\nimport org.apache.http.client.HttpClient;\nimport org.apache.http.client.methods.HttpPost;\nimport org.apache.http.entity.StringEntity;\nimport org.apache.http.impl.client.HttpClientBuilder;\nimport org.apache.http.util.EntityUtils;\n\nimport javax.crypto.Mac;\nimport javax.crypto.spec.SecretKeySpec;\nimport java.io.IOException;\nimport java.security.InvalidKeyException;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Base64;\n\npublic static void main(String[] args) throws IOException, InvalidKeyException, NoSuchAlgorithmException {\n    // Variables apiKey, apiSecret, host need to be predeclared.\n    long nonce = System.currentTimeMillis();\n    String signature = calculateSignature(\"POST\" + \"/quotes\" + \"application/json\" + nonce, apiSecret);\n\n    // Post method\n    String uri = host + \"/quotes\";\n    HttpPost post = new HttpPost(uri);\n    post.addHeader(\"Content-Type\", \"application/json\");\n    post.addHeader(\"X-BM-APIKEY\", apiKey);\n    post.addHeader(\"X-BM-SIGNATURE\", signature);\n    post.addHeader(\"X-BM-NONCE\", String.valueOf(nonce));\n    String requestBody = \"{\\\"from\\\":\\\"BSV\\\", \\\"to\\\":\\\"BTC\\\", \\\"quantityTo\\\":0.001, \\\"expireTime\\\":60}\";\n    // If not entitled to set expireTime\n    // String requestBody = \"{\\\"from\\\":\\\"BSV\\\", \\\"to\\\":\\\"BTC\\\", \\\"quantityTo\\\":0.001}\";\n    post.setEntity(new StringEntity(requestBody));\n    \n    HttpClient httpClient = HttpClientBuilder.create().build();\n    HttpResponse response = httpClient.execute(post);\n    int statusCode = response.getStatusLine().getStatusCode();\n    String result = EntityUtils.toString(response.getEntity());\n}\n\n// Method to calculate signature\nprivate static String calculateSignature(String message, String apiSecret)\n        throws NoSuchAlgorithmException, InvalidKeyException {\n    final String HMAC_SHA_ALGORITHM = \"HmacSHA384\";\n    Mac sha384_HMAC = Mac.getInstance(HMAC_SHA_ALGORITHM);\n    SecretKeySpec keySpec = new SecretKeySpec(apiSecret.getBytes(), HMAC_SHA_ALGORITHM);\n    sha384_HMAC.init(keySpec);\n    return Base64.getEncoder().encodeToString(sha384_HMAC.doFinal(message.getBytes()));\n}\n```","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"12680379","collectionId":"fa5fbc53-8c21-4993-9bf6-24855b73cc5b","publishedId":"TzRLkAkC","public":true,"publicUrl":"https://developer.fabriik.com","privateUrl":"https://go.postman.co/documentation/12680379-fa5fbc53-8c21-4993-9bf6-24855b73cc5b","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.10.0","publishDate":"2021-04-30T18:10:24.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"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/768118b36f06c94b0306958b980558e6915839447e859fe16906e29d683976f0","favicon":"https://fabriik.com/favicon.ico"},"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"}],"canonicalUrl":"https://developer.fabriik.com/view/metadata/TzRLkAkC"}