Websocket API Specs and Mapping Specifications

This is NTerminal’s documentation for a custom Websocket API. For full API documentation, please refer to the Splunk REST API and SDK resources. Most of the events clients receive are real-time events. NTerminal will start streaming real-time events once you establish the connection and until you disconnect. NTerminal will transmit all information that is available from the sources your token is subscribed to. Filtering is also available. In some cases you will get periodic updates (spot pricing) while others will arrive as soon as the platform sees them (trade quotes).

Standardized fields and static trading venue information is also available. For source-specific information and dynamic updates on trading venues and other sources, please use our REST API.


Websocket URIwss://ws.nterminal.com/v1/stream
Custom handshake headerX-INCA-TOKEN: token

Request example

websocat wss://ws.nterminal.com/v1/stream -H 'X-INCA-TOKEN: <insert_token>'

Response examples





Event filtering

Event filtering is available by 4 fields: market_venue, symbol, base, and type (quote or trade).

All parameters are optional. Filter parameters are specified in the URI in the query part. Parameters can contain either a single element or a list.


C++ Client Code Snippet

The example below shows how to connect and read one message in blocking mode. This is not a production ready code and you may consider scaling concerns for high-load applications.

#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/beast/websocket/ssl.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/stream.hpp>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <memory>
#include <string>

int main()
   std::string const host = "ws.nterminal.com";
   std::string const path = "/stream";
   std::string const port = "443";
   std::string const token = "<Enter your token>";
   std::string const cert  = "<Enter your certificate>";

   boost::asio::io_context ioc;
   boost::asio::ssl::context ctx{boost::asio::ssl::context::sslv23_client};

   boost::system::error_code ec;
   ctx.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()), ec);
       return 1;

   boost::asio::ip::tcp::resolver resolver{ioc};
   boost::beast::websocket::stream<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> ws{ioc, ctx};

   auto const results = resolver.resolve(host, port);

   boost::asio::connect(ws.next_layer().next_layer(), results.begin(), results.end());
   SSL_set_tlsext_host_name(ws.next_layer().native_handle(), host.c_str());
   ws.handshake_ex(host, path,
                   [&token](boost::beast::websocket::request_type& m)
                       m.insert("X-INCA-TOKEN", token);

   boost::beast::static_buffer<256> buffer;

   auto b = buffer.prepare(256);

   std::cout << boost::beast::buffers_to_string(b) << std::endl;


   return 0;