Writing An AutoTrader

HOW DOES THE SIMULATED MARKET WORK?

Multiple Autotraders connect to the exchange and receive information feeds about the state of the order book and the occurrence of trades.

These Autotraders insert, amend or cancel their orders and receive notices about the status of their orders from the exchange, including whether or not an order has traded (these are collectively referred to as ‘execution’ messages or feeds).

MESSAGES SENT TO EACH AUTOTRADER:

Order Book Updates

The exchange regularly sends order book update messages to keep Autotraders up-to-date on the state of the order book for both the future and the ETF. Each message contains the price, in cents, and the available volume at that price for the top five bid and ask prices in the market for one instrument (either the future or the ETF).

Trade Ticks

In addition to order book update messages, the exchange also sends trade ticks messages which contain the prices, in cents, at which there has been trading activity since the last trade ticks message and the number of lots traded at each such price.

Order Status

Whenever the state of an order changes, such as when it trades or is cancelled, the exchange sends an order status message to keep the Autotrader informed.

ORDER FILLS

When an order trades, either partially or fully, the exchange sends an order filled message indicating the price at which the order traded and the number of lots that traded at that price.

Error Messages

If the exchange detects an error, such as an invalid order or a limit breach, an error message will be sent containing a description of the error and, if applicable, the order identifier of the order that caused it.

What’s Inside The Autotrader?

For detailed information about the structure of an Autotrader and how to write one in Python, please download and read this document:

Glossary

These are loose definitions provided in the context of this program. We’d encourage you to search the internet for more general, formal definitions of these common computer programming terms.

Callback:  a function in your auto-trader that will automatically be called when a certain exchange event happens (e.g. a trade).
Class:  
a logical unit / block of code that defines how something (such as your auto-trader) works.
Function:  
a logical unit / block of code that carries out a specific task, does a specific calculation etc.
Interface:
 refers collectively to the set of functions that the market and your auto-trader will use to interact with one another – i.e. all of  the different callbacks and message types.
Message: a collection of data relating to a specific event or action (best explained by example above).
Method: (loosely) another word for “function” relating to a class definition.
Protocol: refers collectively to the structure and contents of messages available for communicating between the auto-trader and the exchange.