Sample Script: All Trades
The “All Trades” sample script looks for every Trade that occurred in a session and produces a complete record of every trade from that session. Each line in the output is a summary of the Trade. Trades that hit stop orders or clear multiple price levels even though they are made up of multiple trade messages from the exchange will still just be one result. If you would like to get an output of each trade message sent out by the exchange, run the “Raw Trades” sample script.
Every new trade will get a new row in the output table. The first row of the table will be the first trade of the session and the last row will be the last trade of the session. Occasionally at the start of the session the CME will send a few random messages before they reconstruct the book. Those messages could be trade messages, so any trades before 17:00:00 should be ignored.
FIELDS IN EACH ROW:
1. Symbol: Futures contract these trades are from
2. Date: Session date these trades are from (formatted in YYYYMMDD)
3. Time: Time (Tag 60) the Trade Occurred. Clicking on this time load this trade in the Event Viewer
4. Entry: First price of the trade
5. Exit: Last price of the trade. Will match the Entry price unless the trade is a trade sweep
6. Levels: Number of price levels that were traded in this trade
7. Orders: Total number of aggressive and matched orders in the trade
8. Quantity: Total volume of the trade
9. Aggressor: The side of the Aggressive order. If it says none or empty that means it is an implied trade
Triggers are built in functions that look for specific market behaviors. Users can just call them verses writing all the code defining a behavior. This script uses the Trades Trigger. For a breakdown of all available triggers, see the API doc (this will be a link).
This output allows for columns to be sorted highest to lowest or the reverse. It can also launch visualization of any of the results by simply clicking on the time or, if available, OrderID. This output allows users to get the most out of the results returned from a script.