Market Data Ticker Plant
Libraries:
  • boost C++
    LIBRARIES,  
    emphasize libraries
    that work well with the
    C++ Standard Library.
    Boost libraries are
    intended to be widely
    useful, and usable
    across a broad
    spectrum of
    applications.
  • Boost Spirit,  LL
    parser framework
    represents parsers
    directly as EBNF
    grammars in inlined
    C++.
  • Boost Integer Library,
    The organization of
    boost integer headers
    and classes is
    designed to take
    advantage of <stdint.
    h> types from the
    1999 C standard
    without resorting to
    undefined behavior
    in terms of the 1998
    C++ standard.
  • Boost.Smart Pointers
    behave much like
    built-in C++ pointers
    except that they
    automatically delete
    the object pointed to
    at the appropriate
    time.
  • Boost.Program
    Options
    program_options
    library allows program
    developers to obtain
    program options, that
    is (name, value) pairs
    from the user, via
    conventional
    methods such as
    command line and
    config file.
Introduction:
This Market Data Ticker Plant had formed the basis of a number of products I created and
sold for a number of years under my company's name Trader Kiosk. The company no
longer exist, however, a number of useful tools for the Wall Street Markets still do exist.

I am limited to what extent what aspect of the Market Data Ticker Plant I can Open Source
as a result of a number none disclosure agreements (NDA) I signed with DTN.

DTN sends you a an embedded device that is a receiver. The receiver input is either via a
satellite signal or several (at least 3) dedicated T1 lines. The receiver output are: 10/100
BASE-T Either USB and RS-232 serial  That output from the DTN device, true to many
embedded devices, is not friendly. It is a stream of unintelligible bytes unless you happen
to have signed a NDA with DTN and paid a few hundred dollars to gained access to the
'DTN Advanced Receiver "PassThru" Specification'.

Do not make light of the of the difficulties in writing an application that manages the I/O to
this device; especially if you have never worked on any type for firmware development.
The whole purpose of the Trader Kiosk Market Data Ticker Plant (TKTP) is to significantly
simplify control of DTN receiver (see image on right). This accomplished by:
  1. Allowing the control of the DTN receivers by logging on to the TKTP via a telnet
    like or terminal program and issue high level text commands to the server which in
    turns call high level C++ API's which finally send low level binary bit patterns to
    the receiver via one of it inputs; TCP, USB, RS-232.
  2. Decode the DTN proprietary data streaming from the receiver into events such as
    field updates, insert, delete, and correction tics.
  3. Decode, decompress and simplify DTN proprietary tic field format into C/C++ std::
    string, char, int, unsigned and double. (The API/component, that is used by TKTP,
    that does this is a complex and detail coding effort where machine byte ordering
    comes into play)

Market Data Ticker Plant:
The ticker plant is designed to run as a service. Its architecture is composed of the
following components two major components:
  1. The embedded device (DTN D80x0 where x=0,8,9) communication
    management. This is the component I cannot release into open source since I
    had to sign a nondisclosure agreement in order to get 'DTN Advanced Receiver
    "PassThru" Specification'
  2. Server and service management component.

The Server and service management component have the following responsibilities:
  • Management of users connection to the server to issue high level commands to
    the server and the DTN receiver.
  • Creation of tic by tic replay of all markets data supported by the DTN receiver.
  • UDP socket broadcast of market data to connected clients applications
  • Management and distribution market news & weather and weather maps
  • Management of all communication threads including the embedded device
    communication

The embedded device communication management has the following responsibilities:
  • Manage socket TCP and UDP communication with the receiver. The receiver also
    allows USB and RS-232 communication. The server no longer supports RS-232
    communication. It may support  USB communication if there is a user need for it.
  • Communication thread management.
  • Manage packet of data sent to and received from the receiver. There are two
    primary type of packets: request packet and response packets. There are
    notification packets; these are response packets that are sent from the receiver that
    have no specific request packet eg. new, quote, file updates etc. packet
    notifications
  • To host CPU of byte ordering. It is possible for the packets to have several byte
    ordering; in particular INTEL, MOTOROLA and TMS340 byte order.
  • Production of callback events from the packet stream.
  • Transformation of market data fields into C/C++ double, int, unsigned, char, std::
    string. DTN uses a very effective market data compressing algorithms in order to
    broadcast effectively over T1 and satellite channels. The transformation of this
    dynamically flexible and compressed data to something usable by most users is a
    difficult task. Happily my algorithms has stood the test to time and has not needed
    to be modified since early 2002
  • Dynamically adjust to handling of new and unknown data and field formats.  


The upgrade and update started November 2008:

Recently I decide to standardize my entire C++ software development environment to:

To my great disappointment the ticker plant stopped working. The original ticker plant,
written between 2002 and 2003 was built on a 32 bit machine where I intimately knew the
byte length of every C/C++ integer for the particular version of gcc; an important fact to
know when doing embedded device software development.  

Surprisingly even when compiled on a 32 bit machine using the new development
environment the ticker plant failed to execute properly. The solution was to carefully
replace all the C/C++ integer types with exact integer types found in the
Boost Integer
Library, When that was done the Ticker Plant functioned in both 32 and 64 bit operating
system environments.

As robust and well tested the ACE libraries are the
Boost.Program_options implementation
of command line option I feel is more elegant than the ACE variant. Using the
Boost.
Program_options has reduced the number of line of code from the management of the
command line and configuration file from about 140 line of code to about 50 lines of
code when using
ACE_Get_Opt. Aside of the reduction of code size there is a certain
desired elegance obtained using the
Boost.Program_options

Although I like the design of Boost.Thread and the Boost.Asio there does not seem to be
any compelling reasons in going to the trouble in replacing ACE variants with in the Ticker
Plant code.

When the original project was started Generic programing was not well understood or worse
yet not properly implemented within the C++ complier. That is no longer the case so in
and effort to simplify and reduce code size Generic/Template programing is being used.
The results of those efforts is 61 less files and 1664 less lines of code. This resulted in the
code being even more high level resembling the original documentation as it was written.
Click image to enlarge
Libraries:
  • The ADAPTIVE
    Communication
    Environment (ACE
    (TM)) a freely
    available, open-
    source object-
    oriented (OO)
    framework that
    implements many
    core patterns for
    concurrent
    communication
    software. ACE
    provides a rich set of
    reusable C++ wrapper
    facades and
    framework
    components that
    perform common
    communication
    software tasks across a
    range of OS platforms.
  • Boost.Asio is a
    portable networking,
    including sockets,
    timers, hostname
    resolution and socket
    iostreams.

  • Boost.Thread
    Portable C++ multi-
    threading.
  • Boost.Utility Class
    noncopyable plus
    checked_delete(),
    checked_array_delete
    (), next(), prior()
    function templates,
    plus base-from-
    member idiom.