|
Category
Settings
Description
Specifies the path to a CSV file which helps RealTest generate orders with correct symbols, exchange names, and GAT/GTD times
Notes
An exchange map is required in order for RealTest to generate orders in any OrdersMode other than Text.
If an ExchangeMap Setting is not specified, RealTest looks for a file called ExchangeMap.csv in the following locations:
1.the current OrderClerkFolder when OrdersMode is OrderClerk
2.the RealTest installation folder
The default ExchangeMap.csv file installed with RealTest looks like this:
.png)
.png)
The columns can be in any sequence but must use the names listed below.
The content and purpose of each column is described here:
|
Column
|
Content
|
Purpose
|
|
Exchange
|
exchange name with optional * or ? Match wildcard characters
|
matches the ?Exchange of the stock for which an order is being generated
|
|
Primary
|
brokerage exchange
|
specifies the primary exchange in SMART/primary
|
|
Market
|
symbol matching pattern
|
allows different symbols on the same exchange to have different settings (e.g. for futures)
|
|
Match1
|
symbol matching pattern
|
if the stock has no exchange specified, matches the symbol pattern to determine the exchange to use
|
|
Match2
|
same as above
|
alternative symbol pattern (multiple data sources)
|
|
HasOpg
|
0 or 1
|
1 if this exchange supports open-price-guarantee orders
|
|
HasMoc
|
0 or 1
|
1 if this exchange supports market-on-close orders else 0
|
|
HasLoc
|
0 or 1
|
1 if this exchange supports limit-on-close orders else 0
|
|
TimeZone
|
Exchange timezone name in IANA tz database format
|
Appended to all date+time order fields for this exchange (required by IB)
|
|
LastMocTime
|
24-hour hh:mm:ss
|
"Good Until" time for entry orders for same-day MOC exit
|
|
NearCloseTime
|
same as above
|
"Good After" time for "ThisClose" or "NextClose" entry or exit MKT orders including MOC if not supported by exchange (date determined automatically)
|
|
EarlyLastMocTime
|
same as above
|
LastMocTime for early-close days
|
|
EarlyNearCloseTime
|
same as above
|
NearCloseTime for early-close days
|
|
LateLocTime
|
same as above
|
closing auction LOC placement time
|
|
EarlyLateLocTime
|
same as above
|
ditto on early close days
|
|
WeeklyLastMocTime
|
same as above
|
Friday "Good Until" time for weekly MOC
|
|
LastOpenTime
|
same as above
|
GTD time for "at-open" STP orders
|
|
FuturesOpenTime
|
time of day
|
time after which to increment date when processing fill reports (0 or blank means never do so)
|
|
AllHours
|
0 or 1
|
always generate GTD rather than DAY orders (set OutsideRTH flag in brokerage order)
|
The Match1 and Match2 symbol matching patterns are also used to know when to remove the country-specific suffix from a symbol when generating orders, e.g. changing BHP.au to BHP.
If you're generating orders for futures, see also exchangemap_csi.csv or exchangemap_ndu.csv (both are in the Examples folder).
Row Matching Logic
Rows are evaluated top-to-bottom, and the first match is used:
1.Symbol suffix matching: The stock's symbol is tested against Match1 and Match2 using wildcard matching. If either matches, the row is a candidate.
2.Exchange matching: If the stock has a non-empty ?Exchange field, the row's Exchange pattern is matched against it. If the stock has no exchange field, the symbol suffix match alone determines the row.
3.Market-specific filtering: If the row has a non-empty Market field, the symbol must also match that pattern, or the row is skipped. This allows multiple rows for the same exchange with different session parameters (e.g. different futures products).
4.Wildcard fallback: The last row typically has Exchange = *, which acts as the default for US equities.
Order matters: more specific rows (e.g. TSX Venture) must appear before less specific ones (e.g. TSX), and the wildcard * row must be last.
Exchange and Order Routing
When RealTest generates an order file, it finds the matching ExchangeMap row for each stock. The Primary field is used to construct the exchange routing string SMART/Primary which is written into the order's {exch} template field.
Example: A stock with exchange ASX maps to Primary = ASX, so orders get SMART/ASX. A Canadian stock on TSX maps to Primary = TSE, producing SMART/TSE.
Symbol Suffix Handling
Data providers append suffixes to international symbols (e.g. Norgate uses BHP.AU, Yahoo uses BHP.AX). IB does not use these suffixes.
When RealTest matches a symbol via Match1 or Match2:
1.If the match was on a country suffix pattern like *.AU, the dot and suffix are removed (e.g. BHP.AU becomes BHP).
2.If the dot is a symbol class separator (e.g. BRK.B) and the match pattern had no dot, the dot is replaced with a space for IB format (BRK B).
Order Type Selection
Three boolean flags control order type availability per exchange:
1.HasMoc: If true, exit orders for "next close" can use the MOC order type. If false, a timed MKT order with a good-after-time is used instead.
2.HasLoc: If true, exit limit orders for "next close" can use the LOC order type. If false, a timed LMT order is used instead.
3.HasOpg: If true, market-on-open entry orders use OPG TIF. If false, DAY (or GTC for AllHours markets) TIF is used.
Order Timing
When generating orders, RealTest combines the time value from the matched ExchangeMap row with the timezone to produce a full timestamp (e.g. 15:40:00 US/Eastern).
On early-close days (as defined in the HolidayList), the "Early" variants of each time field are used instead:
1.LastMocTime → EarlyLastMocTime
2.NearCloseTime → EarlyNearCloseTime
3.LateLocTime → EarlyLateLocTime
For weekly (or larger) bar strategies, WeeklyLastMocTime is used instead of LastMocTime.
All-Hours Trading
When AllHours = 1:
1.DAY TIF is never used. Entry orders use GTC instead. Exit orders use GTD.
2.The {allhours} template field outputs 1, which can set the OutsideRTH flag on IB orders.
3.Entry limit orders on non-daily strategies use GTD with NearCloseTime expiry.
Futures Trade Import Date Adjustment
The FuturesOpenTime column is used during trade import. Futures like CME products have sessions that begin in the evening (e.g. 5:00 PM) and run through the next calendar day. A trade executed at 6:00 PM on Monday belongs to Tuesday's daily bar.
RealTest checks each imported trade's execution time against FuturesOpenTime. If the trade time is at or after this threshold, the trade date is incremented by one trading day.
|