JTOOLS HFT QUOTE MONTAGE
JTools Table of Contents
Project Location: \JTools_QuoteMontageHFT
The Quote Montage HFT Application is one I initially wrote to test a new server
and at the same time, we wanted a new tool for viewing specific quoting stats
in any single stock (specifically when we would see high speed algos running in
particular issues). I've since converted it over to the JTools/NxCore framework
and it is humming along better than ever.
The Quote Montage Application demonstrates several key concepts several key
concepts related to both NxCore/GUI systems intended for real world use,
including:
- How to use ExgQuotes and StateExgQuotes in NxCore.
- How to avoid using costly string compares when processing data by making
use of each symbol's userdata members.
- How to collect company names and easily attach them to userdata members for
instant retrieval (one method of many).
- How to keep the entire application integer based (only converting to
floating point when a GUI element is actually populated).
- How to process data rapidly onto the GUI (even when running historical
tapes at full blast) without losing responsiveness.
The stats listed in the HFT Quote Montage application are total since the time
listening (may not represent the entire day unless you've been watching the
same symbol the entire day) and for the most current one second interval.
Composite Stats in upper section of
application:
- LTrade Time - Time of the last trade.
- Last - Price of the last trade.
- Size - Size of the last trade.
- Av Size - Average size of trades.
- NetChg - Net change of price from the previous trading day.
- Spread - Spread of the National Best Bid and National Best Ask.
- Min Spread - Smallest spread of the National Best Bid and National
Best Ask.
- Max Spread - Largest spread of the National Best Bid and National
Best Ask.
- Listen Time - Time listening to the specific equity.
- Trade Counts - Count of total trades and trades for the last second.
- Quote/Trade Ratio - The total quote/trade ratio and the quote/trade
ratio for the last second.
- Quote Counts - Total quote counts for all reporting exchanges and
for the last second.
- BBO Change Counts - Total number of times the NBBO has changed and
for the last second.
- BBO Exchange Counts - Total times the best bid exchange does not
equal the best ask exchange and total times the best bid exchange equals the
best ask exchange.
|
Montage stats specific to each reporting
exchange:
- Exg- The reporting exchange.
- Time - Time of the last quote for the reporting exchange.
- BSize - Size of the bid for the reporting exchange.
- BPrice - Price of the bid quote for the reporting exchange.
- NBBO - If the exchange has captured the National Best Bid, this
field will be highlighted with "NBBO".
- NBBO - If the exchange has captured the National Best Ask, this
field will be highlighted with "NBBO".
- APrice - Price of the ask quote for the reporting exchange
- ASize - Size of the ask quote for the reporting exchange.
- 1Sec - Total number of quotes reported from the exchange the last
second.
- Total - Total number of quotes reported from the exchange since
listening.
- Spread - Spread of the reporting exchange quote.
- MinSpr - Smallest spread of the reporting quote.
- MaxSpr - Largest spread of the reporting quote.
|
|
Symbol Convention:
Since this application is specific to equities, you may enter symbols with or
without the lowercase 'e'. Examples would be "eIBM" (the standard
NxCore convention for equities) or just "IBM".
Furthermore, because a symbol may be duplicated on more than one listing
exchange. For instance GE is listed on both the NYSE and Canadian exchange, and
represent different companies. While the symbols default to the US symbols, it
is possible to specify the listing exchange the symbol. As an example of how to
specify the listing exchange in the symbol:
- GE or GE:3 - General Electric on the NYSE exchange (exchange # 3).
- GE:19 - Granville Pacific Capital Corp on the CDNX exchange (exchange #19).
The exchange designators correspond to the default NxCore exchange codes found
here: NxCore
Exchange Codes
You may enter a new symbol at any time. Simply type in the symbol and press the
ENTER key. If the symbol is valid, the display will clear and immediately
populate with with the current quotes from each exchange and the most recent
price information (through the use of NxCoreStateGetExgQuotes and
NxCoreStateGetLastTrade). After that the stats and montage list are populated
with all streaming trade and quote messages (NxMSG_TRADE and
NxMSG_EXGQUOTE).
If the symbol entered is not valid, a "Symbol Not Found" message is
displayed in the Name field.
You can cancel listening to a symbol by simply clearing the symbol and pressing
the ENTER key.
If you have not started NxCore prior to entering a symbol then NxCore will be
started when you press ENTER. When doing this, it may take a couple seconds for
the symbol's name to appear as NxCore has just started and the category
information (with company names) does not become available for the first few
minutes of the tape. When entering symbols after the tape has been started all
information is delivered immediately.
One further caveat - if you have started NxCore using an NxCore State File (as
opposed to an NxCore historical tape) the company names will most likely not be
available. This is because the state file will (most likely) be from a
timeframe beyond the Category 4 messages (which occur in the first few minutes
of the tape) and as such, they are not available at the point where the state
file begins to process the tape. No other aspect of the application is effected
when running from state files.
Performance:
While the application was written with the intention of viewing equities in
real time, you can also blast through a historical tape as fast as possible and
the application will remain snappy and responsive. This is accomplished through
a variety of mechanisms:
- The use of the userdata1 field contained in each NxCore symbol string which
is unique (and remains static) to all issues in the system. By using this field
to designate when a symbol has interest set, all string compares can be
eliminated during processing of the stream. It cannot be over emphasized how
much processing time is saved when eliminating string compares in a
whole-market feed.
- The application was intended for a human to view. While quotes may change
1000's of times a second, a human can simply not process every change in that
time frame. The human brain will see a seamless display if the display is
updating approx. 24 times a second. Now, updating any GUI element is about the
most processing intensive item you can do in any one single line of code. So,
if the human brain cannot distinguish detail at 24 times a second, why update
the display any more than that? The Quote Montage display list in this
application is updated from a timer which remains constant as the application
runs. The timer is fired every 40 milliseconds, which equates to 25 updates per
second. Additionally, any item that has not changed during a refresh cycle is
not updated. This does mean keeping track of the values set and doing simple
compares at every refresh, but doing those compares is far less expensive than
a GUI field update.
- All values are stored, used and calculated using the raw NxCore price
integer (as opposed to converting every price field to a double for each
message). The price type of each item is also stored and the only time a price
is converted into a double is when it is actually used to update a GUI fields
and be displayed to the user.
JTools Table of Contents
|