liveBook · Manning

Transaction cost

As explained in Experimentation for Engineers

Execution cost is the expense incurred when carrying out a trade, including the difference between the intended and obtained transaction price and related charges.

Transaction cost is the business metric for the expense of carrying out a trade. In an agency trading system, lower execution cost is the goal when choosing how customer orders are routed to an exchange. section 2.1

A single trade is a noisy measurement: cost changes with the stock, order size, buy or sell direction, and market participants. Treat the trading system as a black box with an exchange input and an execution-cost output rather than assuming its internal causes are known. section 2.1.1

Comparing exchange costs

One ASDAQ trade costs 12.28 mips and one BYSE trade costs 8.14 mips, yet a repeat can favor ASDAQ. Averaging 100 measurements produces 12.11 mips for ASDAQ and 10.01 for BYSE, making the comparison more reliable. section 2.1.2

Listing 2.1 Simulate the trading system
def trading_system(exchange):
    if exchange == "ASDAQ":
        execution_cost = 12
    elif exchange == "BYSE":
        execution_cost = 10
    execution_cost += np.random.normal()    #1
    return execution_cost

The simulator makes the comparison concrete: each exchange has a baseline cost, while random variation changes each observed trade. section 2.1.1

Measure transaction cost without turning timing into a false exchange effect:

  • Randomize routing between exchanges as orders arrive; measuring one exchange only in the morning and the other in the afternoon can introduce sampling bias. section 2.1.2
  • Set a minimum sample size around the smallest practically meaningful cost improvement, then test both practical and statistical significance. section 2.3.4
  • Compare aggregate costs with delta = cost(BYSE) − cost(ASDAQ), and scale that difference by its standard error to obtain a z score. section 2.3.1

A lower observed average is actionable only after accounting for variation and bias. With randomized measurements, BYSE was about 2.7 mips cheaper, exceeded a 1-mip practical threshold, and passed the stated statistical threshold; routing could then be changed while retaining residual uncertainty. section 2.3.3

How Experimentation for Engineers covers it

How deep it goes
Works through simulation, replication, randomized measurement, aggregate differences, standard errors, and z-score decisions.
Examples
Uses simulated ASDAQ and BYSE trades, including 12.28 versus 8.14 mips and 100-trade averages.
What it assumes
Introduces the trading simulator as a black box while using Python, NumPy, averages, standard errors, and z scores.
What you can do after
Operate/configure it by randomizing exchange measurements and rerouting trades when cost differences meet practical and statistical criteria.
How it connects
Connects execution cost to A/B testing, replication, sampling bias, randomization, practical significance, and statistical significance.

Also explained in

Compare how 4 books explain transaction cost →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Experimentation for Engineers. The section links point to the parts of the book it draws on.