Register Book

With the help of this function, you can fetch Book Data for a given contract and register the book for updates. The function takes as parameters: the contract, level, dataType, a callback function and an asyncCallback function. The first callback function will be called once the request has succeded and will give you the initial set of data, snapshot. The asyncCallback function will be called every time when a new Book update is available.

function registerBook(contract, level, dataType, callback, callbackBook)

Possible Responses:

  • Success

    {
    "RQT":"registerBook",           // Request Type
    "RQI":"17",                     // Request Id
    "RES":"OK",                     // Result
    "INS":"ESZ19",                  // Contract
    "ASKS":[                        // ASKS
    {
        "PR": "3106.25"             // Ask Value
        "PO": "1",                  // Ask Position
        "PZ": "15"                  // Ask Size
    },
    {
        "PR": "3106.5"              // Ask Value
        "PO": "2",                  // Ask Position
        "PZ": "70"                  // Ask Size
    },
    ...
    ]
    "BIDS":[                        // BIDS
    {
        "PR": "3106.0"              // Bid Value
        "PO": "1",                  // Bid Position
        "PZ": "61"                  // Bid Size
    },
    {
        "PR": "3105.75"             // Bid Value
        "PO": "2",                  // Bid Position
        "PZ": "89"                  // Bid Size
    },
    ...
    ]
}
  • Error

{
    "RQT":"registerBook",           // Request Type
    "RQI":"17",                     // Request Id
    "RES":"ERR",                    // Result
    "MSG":"Unknown contract"        // Error Message
}