Deribit Block Trade Model

Four ways to execute block trades on Deribit


1 Pro.Deribit.com

2 Telegram Quote Request group

3 Third-party solutions

4 API


Block Trade Minimum size

 

Deribit has implemented a minimum trade size for Block Trades to safeguard order book liquidity.

 

Block Trades are privately negotiated trades in futures, options, or a combination of multiple thereof. The following minimum sizes are required for reporting of Block Trades:

BTC

25 options contracts or USD 200.000 in Futures/Perpetual. 

 

ETH

250 options contracts or USD 100.000 in Futures/Perpetual.


 

Block Trade tick sizes

 

Perpetuals and futures

Min tick size of $0.01

Options

Min tick size of 0.0001 BTC

Min tick size of 0.0001 ETH

 

1 Deribit Pro Block solution

https://pro.deribit.com/blocktrades/BTC

 

  1. Party 1= set parameters of trade and executes verify_block_trade. 

  2. Deribit System creates signature* and arty 1 sends that signature to Party 2. 

  3. Party 2 enters the signature in the system

  4. Party 2 verifies trade details

  5. Party 2 then signs the signature with execute_block_trade. 


2 Telegram Quote Request Group

https://t.me/Deribitquotes

The goal of this group is to facilitate simple quote/price requests should the screen size not be sufficient. There is a 25 BTC or 250 ETH minimum size, you can ask for quotes on Deribit futures, options and options combinations only.

 

3 Third-party solutions

 

ACCX

https://accxgroup.com/

Telegram: @fungkinl

Greeks.live

https://www.greeks.live/

jeff@greeks.live

Telegram: @jeffmighty785

Mercury

https://www.mercurydigitalassets.com/

rh@mercurydigitalassets.com

Telegram: @hansen_rj


Paradigm

https://www.paradigm.co/

Telegram Europe @patrickmchu, @crypto_ip

Other @Laura_Edelman, @lauravidiella,  @Short_vol 

4 API Flow


https://docs.deribit.com/#block-trade

 

  1. Party 1= set parameters of trade and executes verify_block_trade. 

  2. Deribit System creates signature* and arty 1 sends that signature to Party 2. 

  3. Party 2 enters the signature in the system

  4. Party 2 verifies trade details

  5. Party 2 then signs the signature with execute_block_trade. 


* The signature is a base64 code of the trade details and the signature. You can easily convert back, see online decoder for an example. In javascript we use btoa ( ) to make base64 from text, and atob ( ) to convert base64 back to text.

https://www.base64decode.org.


Code example


var ws = require('ws');

const crypto = require('crypto');

const https = require('https');

const CryptoJS = require('crypto-js');



const clientId = 'bp9sOgjO'; // App ID

const clientSecret = 'mUG9ptfJE5BnXs2PmMoRp07yNVGo7v2H5IX36QbZ-FE';


let code;

let redirect = "";

let access_token;


let testnet = "test.deribit.com";


let client_id = "xl8hpn9h";  //userID

let client_secret = "b4lHVLSRKG8NU0gNw08cgf4CTciBSV1mAPqRw0zfTgI";



function calcUserSignature(clientSecret, timestamp, nonce, data) {

    return CryptoJS.HmacSHA256(`${timestamp}\n${nonce}\n${data}`, clientSecret).toString();

}


function calcSignature(method, url, clientId, clientSecret, timestamp, nonce, data) {

    let dataToSig = `${method.toUpperCase()}\n${url}\n${data}\n`;

    return CryptoJS.HmacSHA256(`${timestamp}\n${nonce}\n${dataToSig}`, clientSecret).toString();

}


function credentialsRequest(testnet, clientId, clientSecret, redirect, {client_id, client_secret}) {

    let timestamp = Date.now();

    let nonce = "abcd";

    let url = '/api/v2';

    console.log('redirect', redirect);

    let userData = '';


    let userSignature = calcUserSignature(client_secret, timestamp, nonce, userData);


    let ldata = JSON.stringify({

        method: 'public/auth',

        params: {

            grant_type: 'app_user',

            client_id,

            timestamp,

            signature: userSignature,

             nonce,

            data: userData

        }

    });

    let appSignature = calcSignature('POST', url, clientId, clientSecret, timestamp, nonce, ldata);

    var msgPost =  {

        hostname : testnet,

        path : url,

        method: 'POST',

        headers: {

            'authorization': `app-deri-hmac-sha256 id=${clientId},ts=${timestamp},nonce=${nonce},sig=${appSignature}`

        } 

    };


    var req = https.request(msgPost, function (res) {

        var responseString = "";

        res.setEncoding('utf8');

        res.on("data", function (data) {

            responseString += data;

        });

        res.on("end", function () {

           var result = JSON.parse(responseString);

           accessToken = result.result.access_token;

           sendWsRequest();

       }); 

  });


    req.on("error", (e) => {

        console.log(e);

    });

   req.write(ldata)

   req.end(); 

}



function sendWsRequest() {


 var request = {

    "method": "private/subscribe",

    "params": {

      "channels": [

        "user.orders.any.any.raw"

      ]

    },

    "jsonrpc": "2.0",

    "id": 4

  };

    request.params.access_token = accessToken;

    ws.send(JSON.stringify(request));

}



function init() {

   ws = new ws("wss://test.deribit.com/ws/api/v2");



    ws.onmessage = function (e) { onWSMessage(e) };

    ws.onopen = function (e) { onWSOpen(e) };

    ws.onerror = function (e) { onWSError(e) };

    ws.onclose = function (e) { onWSClose(e) };



    var redirect = "" ; 

    var draft =  credentialsRequest(testnet, clientId, clientSecret, redirect, {client_id, client_secret});

}


function onWSOpen(e) {

    console.log("COnnected");

}


function onWSMessage(e) {

    var result = JSON.parse(e.data);

    console.log(result);

    

}


function onWSError(e) {

}


function onWSClose(e) {

}


init();