Example 5. Market Data Client API
High, Low, Open Close, Volume...
The requirements for this program is over a sample time for each equity keeps track of the High, Low, Open Close
and Volume of a trade. However, for my own personal interest I will also keep track of the number of times a trade
occurs within the open close interval.

I assume that you know C++ and the boost libraries so I will only point out some key implementation ideas in the
code of
example 5. As usual I ask you to view the output for the example program.

Key ideas:
  1. For a trade the fields of interest for a stock are 'last', 'volume', 'open', 'high', 'trade_time', 'trade_time_hos'.
    trade_time_hos is the time to within 100th of a second when the trade_time occurred. The 'qt_status' tell
    the state of the quoted tic/symbol being reported. In our particular case the qt_status must indicate a trade.
  2. The const int's fid_qt_status, fid_volume, fid_last, fid_trade_time, and fid_trade_time_hos values were
    determined from values in the default cross reference file "cross-reference.cfg" used to map alias stock
    and field name to there respective ids.
  3. The reported field of the hlocv_s structure is used to indicate when the information within the structure has
    been displayed and therefore the bar sample time period has elapsed. When it is true it mean a new bar
    has to be initialized.




While looking that the output of the program there statistics are of some importance:
  1. lost tell you how many packets has be lost through out your run. The lost is typically between 1 and 7
    percent of the entire execution of the program. I have determined that the lost in my environment is a result
    of normal UDP broadcast over my network. and at this time a none issue for me and should be for most
    people using the program.
  2. queued tells you if the client is processing the information as fast as it is getting from the server. Ideally it
    should remain zero at all times.
  3. activity tells how many trade occurred during the open, close sample period of your bar.



Have fun and enjoy trading...