---
title: "1.1.5 Costs, settlement, leverage and margin"
description: "Commissions, effective and realized spread, impact, slippage and financing; T+1 and T+2 settlement; margin, leverage and margin calls."
url: "https://pythonparatrading.com/en/python-trading-course/level-1/trading-costs-settlement-leverage-and-margin/"
lang: "en"
image: "https://pythonparatrading.com/og/en/python-trading-course/level-1/trading-costs-settlement-leverage-and-margin.png"
---

# 1.1.5 · Costs, settlement, leverage and margin

> What it costs to trade is rarely on the broker's invoice: it is in the bid-ask spread, in the impact and in the time between deciding and executing. This lesson measures those costs with the NOVA session, explains when a trade settles and calculates the price at which a margin call arrives.

- Course: [Level 1: Financial data, markets and analysis](https://pythonparatrading.com/en/python-trading-course/level-1/)
- Module: 1.1 · How markets work
- Duration: 65 min
- Prerequisites: [1.1.1 · Market participants and trading venues](https://pythonparatrading.com/en/python-trading-course/level-1/market-participants-and-trading-venues/), [1.1.3 · Order book: bid, ask, spread and depth](https://pythonparatrading.com/en/python-trading-course/level-1/order-book-bid-ask-spread-depth/), [1.1.4 · Order types](https://pythonparatrading.com/en/python-trading-course/level-1/order-types-explained/)

## By the end of this lesson

- Separate explicit costs (commissions, fees, financing) from implicit ones (spread, impact, slippage) and express them in basis points.
- Calculate the effective and realized spread of each trade by aligning the tape with the prevailing quote without look-ahead.
- Build an impact curve by walking the book with orders of increasing size, and a cost waterfall for a specific order.
- Calculate settlement dates with an exchange calendar and explain the move to T+1 in the US (2024) and in the EU (2027).
- Calculate the leverage of a margin account and the price at which a margin call is triggered under the Reg T and FINRA minimums.

## What a trade costs

The cost of a trade is the difference between what the system would have earned in a frictionless world and what it
actually earns. Part of it shows up on the broker statement; most of it does not.

| Cost | Type | When it is paid | How it is measured |
|---|---|---|---|
| Broker commission | Explicit | On execution | Per share, per trade or as a % of the amount |
| Exchange and regulatory fees | Explicit | On execution (some only on sales) | According to each market's and country's schedule |
| Bid-ask spread | Implicit | When crossing it | Half spread per side |
| Impact | Implicit | When executing an order larger than the first level | Average price paid versus the best price |
| Slippage (delay) | Implicit | Between the decision and the execution | Execution price versus decision price |
| Financing | Explicit | Every day the position is open | Loan interest, cost of borrowing securities |
| Opportunity | Implicit | If the order is not executed | What the unexecuted part would have earned |

The reference for all the implicit costs is the **decision price**: the midpoint at the moment the system decides to
trade. The difference between that price and what ends up being paid, plus the explicit costs, is called
*implementation shortfall*. Measuring it in **basis points** (hundredths of a percentage point) makes it possible to
add costs of different nature and to compare assets with very different prices.

## Effective spread and realized spread

The quoted spread (lesson 1.1.3) is what it costs to cross the book if the order fits in the first level. The
**effective spread** measures what was actually paid on each trade, against the prevailing midpoint just before it:

$$
s_{\text{eff}} = 2\,D\,\frac{P - M_t}{M_t}
$$

where $P$ is the trade price, $M_t$ the prevailing midpoint and $D = +1$ if the aggressor buys and $-1$ if it sells.
The factor 2 makes it comparable with the quoted spread, which is a round trip. The **realized spread** uses instead
the midpoint a few seconds or minutes later, $M_{t+\Delta}$:

$$
s_{\text{realized}} = 2\,D\,\frac{P - M_{t+\Delta}}{M_t}, \qquad
\text{impact} = s_{\text{eff}} - s_{\text{realized}}
$$

The realized spread is what whoever provided the liquidity keeps if they unwind their position at the midpoint of that
moment. If the price moves in the aggressor's direction, the liquidity provider loses part of the spread, or all of
it: that is **adverse selection**, and the difference between the two spreads is the price impact of the trade.

To calculate them, each trade has to be joined with the quote prevailing **before** it, with
`allow_exact_matches=False`, as in lesson 1.1.1, and with the quote prevailing at $t+\Delta$:

```python
import numpy as np
import pandas as pd

op = pd.read_parquet("nova_operaciones.parquet")
cot = pd.read_parquet("nova_cotizaciones.parquet")
cot["medio"] = (cot["bid"] + cot["ask"]) / 2
medios = cot[["ts", "medio"]]

reg = op[op["condicion"] == "regular"].copy()
reg = pd.merge_asof(reg, medios, on="ts", allow_exact_matches=False)
reg["D"] = np.where(reg["agresor"] == "compra", 1, -1)

def medio_en(ts):
    """Prevailing midpoint at each instant of `ts` (last change <= ts)."""
    m = pd.merge_asof(pd.DataFrame({"ts": ts}), medios, on="ts")
    return m["medio"].to_numpy()

reg["ef_pb"] = (2e4 * reg["D"] * (reg["precio"] - reg["medio"])
                / reg["medio"])
cols = ["ts", "precio", "agresor", "centro", "medio", "ef_pb"]
reg[cols].head(3).round({"ef_pb": 3})
```
```output
                                ts  precio agresor     centro  medio  ef_pb
0 2025-06-02 13:30:00.301051+00:00   53.34   venta  PRINCIPAL  53.35  3.749
1 2025-06-02 13:30:00.301052+00:00   53.34   venta  PRINCIPAL  53.35  3.749
2 2025-06-02 13:30:00.407366+00:00   53.34   venta  PRINCIPAL  53.35  3.749
```

```python
def media_pond(g, col):
    return np.average(g[col], weights=g["tamano"])

por_centro = reg.groupby("centro").apply(
    lambda g: pd.Series({"efectiva_pb": media_pond(g, "ef_pb"),
                         "operaciones": len(g)}))
por_centro.round(3)
```
```output
                efectiva_pb  operaciones
centro
INTERNALIZADOR        1.054       3914.0
MTF_A                 2.039       9640.0
MTF_B                 2.078       7230.0
OSCURO                0.000       4380.0
PRINCIPAL             2.074      25774.0
```

The three lit venues charge on average between 2.04 and 2.08 basis points of effective spread, somewhat more than the
typical one-tick quoted spread (1.9 basis points, lesson 1.1.3) because some orders sweep more than one level. The
dark venue, which crosses at the midpoint, has a zero effective spread: neither buyer nor seller pays spread. The
internalizer, which often improves on the book price (lesson 1.1.1), charges half as much as the visible books. For a
client, that is the economic argument for both.

Now the realized spread, at several horizons, for the trades on the lit venues:

```python
lit = reg[reg["centro"].isin(["PRINCIPAL", "MTF_A", "MTF_B"])].copy()
filas = {}
for h in ("1s", "10s", "1min", "5min"):
    m_desp = medio_en(lit["ts"] + pd.Timedelta(h))
    real = 2e4 * lit["D"] * (lit["precio"] - m_desp) / lit["medio"]
    ef = media_pond(lit, "ef_pb")
    rr = np.average(real, weights=lit["tamano"])
    filas[h] = {"efectiva": ef, "realizada": rr, "impacto": ef - rr}
pd.DataFrame(filas).T.round(2)
```
```output
      efectiva  realizada  impacto
1s        2.07       1.68     0.38
10s       2.07       0.27     1.80
1min      2.07      -6.95     9.02
5min      2.07     -14.47    16.54
```

At one second, the liquidity provider keeps 1.68 of the 2.07 basis points of spread. At ten seconds, almost nothing.
At one minute and at five, the realized spread is negative: the price has followed the aggressor so far that whoever
gave it liquidity loses money if they hold the position. In the simulated NOVA session, the aggressive order flow is
what moves the price, and that is paid for in the spread of whoever provides liquidity. In real data the shape is
usually the same (the realized spread falls with the horizon), although the figures depend on the stock and the day.

<aside class="callout" data-kind="aviso">

Both readings matter to a system. If it takes liquidity (market orders), it pays the effective spread. If it provides
it (limit orders resting in the book), it earns the spread, but it only gets filled when someone wants to cross, and
often right before the price moves against it. A backtest that assumes limit orders are filled “on touch” ignores that
adverse selection and overstates the result.

</aside>

## The impact curve

The average effective spread is about small orders. For a large order, what matters is how much of the book it has to
walk through. With the 2,340 L2 snapshots of the session, a market buy of each size can be simulated on each snapshot
and its average cost measured against the prevailing midpoint:

```python
l2 = pd.read_parquet("nova_libro_l2.parquet")
tamanos = [100, 500, 1_000, 2_000, 5_000,
           10_000, 20_000, 30_000, 50_000]

def coste_pb(foto, n):
    a = foto[foto["lado"] == "ask"].sort_values("precio")
    b = foto[foto["lado"] == "bid"]
    medio = (a["precio"].iloc[0] + b["precio"].max()) / 2
    if a["tamano"].sum() < n:
        return np.nan                     # the visible book is not deep enough
    resto, gasto = n, 0.0
    for p, q in zip(a["precio"], a["tamano"]):
        t = min(resto, q)
        gasto, resto = gasto + t * p, resto - t
        if resto == 0:
            break
    return 1e4 * (gasto / n - medio) / medio

costes = {n: [] for n in tamanos}
for _, foto in l2.groupby("ts"):
    for n in tamanos:
        costes[n].append(coste_pb(foto, n))
curva = pd.DataFrame({n: pd.Series(v) for n, v in costes.items()}).T
pd.DataFrame({"coste_medio_pb": curva.mean(axis=1),
              "mediana_pb": curva.median(axis=1),
              "sin_liquidez_pct": 100 * curva.isna().mean(axis=1)}
             ).round(2)
```
```output
       coste_medio_pb  mediana_pb  sin_liquidez_pct
100              0.98        0.94              0.00
500              1.04        0.94              0.00
1000             1.10        0.94              0.00
2000             1.22        0.94              0.00
5000             1.55        0.95              0.00
10000            2.02        1.68              0.17
20000            2.82        2.40              1.20
30000            3.57        3.02              5.64
50000            5.33        4.81             48.46
```

*Fig. — Average cost of a NOVA market buy by order size, walking each of the 2,340 L2 snapshots of the 2 June 2025 session.* Curve on a log scale of size, from 100 to 50,000 shares. The cost over the mid price stays around 1 basis point up to 2,000 shares, rises to 1.55 at 5,000, 2.02 at 10,000, 2.82 at 20,000, 3.57 at 30,000 (highlighted) and 5.33 at 50,000, a size for which in almost half of the snapshots the visible book lacks enough liquidity.

Up to 2,000 shares, the cost barely exceeds half the spread: a little over one basis point. From 5,000 on, the order
usually goes past the first level and the cost accelerates: 2.0 basis points with 10,000 shares, 3.6 with 30,000. With
50,000 the average is 5.3, and in almost half of the snapshots the visible book does not even have that many shares
for sale across ten levels. That is why large orders are split into pieces and spread over time (the TWAP and VWAP
algorithms of lesson 1.1.4) or sent to a dark venue (lesson 1.1.1).

Two caveats. The curve is optimistic: it assumes the book does not react while the order walks through it, and in
reality liquidity providers pull orders as soon as they see a large one. And it is one-sided: if the position is
unwound later, the cost is paid again.

## One order, all its costs

The header figure is the cost waterfall of a specific order. At 15:00:00 New York time a system decides to buy 20,000
NOVA shares, with the midpoint at 52.745. The market order reaches the book ten seconds later. The system pays an
assumed commission of 0.005 USD per share and finances half of the purchase on margin for five days at an assumed 6%
annual rate (360-day basis). The broker figures are hypothetical; the book figures are those of the L2 snapshot.

```python
def foto_en(ts):
    return l2[l2["ts"] == ts]

def precio_medio_compra(foto, n):
    a = foto[foto["lado"] == "ask"].sort_values("precio")
    resto, gasto = n, 0.0
    for p, q in zip(a["precio"], a["tamano"]):
        t = min(resto, q)
        gasto, resto = gasto + t * p, resto - t
        if resto == 0:
            break
    return gasto / n

def mejores(foto):
    return (foto.loc[foto["lado"] == "bid", "precio"].max(),
            foto.loc[foto["lado"] == "ask", "precio"].min())

n = 20_000
decision = sum(mejores(foto_en("2025-06-02 19:00:00+00:00"))) / 2
f10 = foto_en("2025-06-02 19:00:10+00:00")
bid10, ask10 = mejores(f10)
medio10 = (bid10 + ask10) / 2
pagado = precio_medio_compra(f10, n)

pb = lambda x: 1e4 * x / decision
cascada = pd.Series({
    "retraso": pb(medio10 - decision),
    "media_horquilla": pb(ask10 - medio10),
    "impacto": pb(pagado - ask10),
    "comision": pb(0.005),
    "financiacion": 1e4 * 0.5 * 0.06 * 5 / 360,
})
print(f"decision {decision:.3f} · paid {pagado:.4f}")
print(f"notional {n * pagado:,.0f} USD")
cascada["total"] = cascada.sum()
cascada.round(2)
```
```output
decision 52.745 · paid 52.7693
notional 1,055,386 USD
retraso            1.90
media_horquilla    0.95
impacto            1.76
comision           0.95
financiacion       4.17
total              9.72
dtype: float64
```

In ten seconds the midpoint rises by one cent, from 52.745 to 52.755: 1.90 basis points of **delay** paid before
touching the book (in that snapshot the first level was heavily loaded on the bid side, and lesson 1.1.3 showed that
this anticipates the rise). Then half the **spread**, 0.95, and the **impact** of walking the book beyond the best
ask, 1.76. The assumed commission adds 0.95. Execution costs add up to 5.56 basis points, about 590 USD on 1.06
million. And the **financing** of five days on margin adds 4.17 more basis points: the largest cost in the waterfall
is the one that does not appear in the execution.

<aside class="callout" data-kind="riesgo">

A backtest that only deducts the commission sees a small part of the real cost. For a system that turns over the
portfolio often, 10 basis points per trade are 25% of annual return with 250 round trips (lesson 0.1.2). Model at
least the half spread and an impact that grows with size, and add financing if there is leverage.

</aside>

## Settlement: T+1 in the US, T+2 in Europe

After the trade, the delivery of the securities against cash happens a few business days later: **settlement**
(lesson 1.1.1). Until then, buyer and seller have a commitment, not the securities or the money.

```mermaid
flowchart LR
  T[T: trading] --> C[T: clearing]
  C -->|settlement| L1[T+1: US]
  C -->|settlement| L2[T+2: EU]
```

- **The US** settles stocks on T+1, the next business day, since May 28, 2024, the compliance date of the rules the
  SEC approved in February 2023[^1].
- **The European Union** settles on T+2 the trades in transferable securities executed on trading venues. Regulation
  (EU) 2025/2075 of October 8, 2025, which amends the central securities depositories regulation (CSDR), moves them to
  T+1 from October 11, 2027[^2].

[^1]: SEC, press release 2023-29, “SEC Finalizes Rules to Reduce Risks in Clearance and Settlement”, February 15,
    2023: “The compliance date for the final rules is May 28, 2024”.
[^2]: AMF, “Transition to T+1 settlement of transactions” (updated on April 23, 2026). The text of the regulation on
    EUR-Lex could not be read automatically when this lesson was prepared.

Business days are counted with a calendar, not by adding calendar days:

```python
import exchange_calendars as xcals

nyse = xcals.get_calendar("XNYS")
bme = xcals.get_calendar("XMAD")

for cal, n_dias, fechas in ((nyse, 1, ["2025-07-03", "2025-11-26",
                                       "2025-12-31"]),
                            (bme, 2, ["2025-04-16", "2025-12-23"])):
    for f in fechas:
        liq = cal.session_offset(f, n_dias)
        print(f"{cal.name}  trade {f} ({pd.Timestamp(f):%a})"
              f"  ->  T+{n_dias} {liq.date()} ({liq:%a})")
```
```output
XNYS  trade 2025-07-03 (Thu)  ->  T+1 2025-07-07 (Mon)
XNYS  trade 2025-11-26 (Wed)  ->  T+1 2025-11-28 (Fri)
XNYS  trade 2025-12-31 (Wed)  ->  T+1 2026-01-02 (Fri)
XMAD  trade 2025-04-16 (Wed)  ->  T+2 2025-04-22 (Tue)
XMAD  trade 2025-12-23 (Tue)  ->  T+2 2025-12-29 (Mon)
```

July 3, 2025 settles on Monday the 7th, because the NYSE is closed on the 4th; November 26, on Friday the 28th,
skipping Thanksgiving. In Madrid, a sale on Wednesday, April 16, 2025 settles on Tuesday the 22nd, because Good Friday
and Easter Monday are not business days. The exchange calendar is an approximation: the one that rules is that of the
depository and the payment system, which may differ from the exchange's on some day of the year (lesson 1.1.2).

For a system, settlement matters in three places. In a **cash account**, the proceeds of a sale cannot be used to buy
something else until it settles (or the broker advances them under conditions). **Dividends** are collected by whoever
is listed as holder on the record date, so the ex-date depends on the settlement cycle (lesson 1.2.1). And in a
**margin account**, it is the broker who puts up the missing cash when the purchase settles, and from then on charges
interest on it.

## Margin and leverage

A **margin account** makes it possible to buy with money lent by the broker, with the securities as collateral.
**Leverage** is exposure divided by own equity: with 50,000 USD of your own and 50,000 borrowed, a 100,000 position has
leverage 2. A 10% drop in the price becomes a 20% drop in equity.

In the US there are two minimum rules for stocks bought on margin:

- **Initial margin (Regulation T).** The broker can lend up to 50% of the purchase price: the client puts up at least
  half[^3].
- **Maintenance margin (FINRA Rule 4210).** Account equity must be at least 25% of the market value of the long
  securities[^4]. If it falls below, there is a **margin call**: post collateral or sell.

[^3]: 12 CFR 220.12 (Regulation T): “50 percent of the current market value of the security” for margin equity
    securities.
[^4]: FINRA Rule 4210 (c)(1): “25 percent of the current market value of all margin securities … ‘long’ in the
    account”. FINRA notes that the broker can liquidate the account at any time to cover a deficiency.

```mermaid
flowchart TB
  P[The price falls] --> E{Below 25%?}
  E -- no --> S[Position stays open]
  E -- yes --> M[Margin call]
  M --> A[Deposit cash]
  M --> V[Sell position]
```

With a loan $L$ per share and price $P$, equity per share is $P - L$. The call is triggered when equity falls to the
maintenance margin $m$ of the value:

$$
P - L = m\,P \quad\Longrightarrow\quad P^{*} = \frac{L}{1 - m}
$$

If the purchase was made at $P_0$ with the maximum Reg T loan, $L = (1 - m_i)\,P_0$ with $m_i = 0.5$, and this gives

$$
P^{*} = P_0\,\frac{1 - m_i}{1 - m} = P_0\,\frac{0.5}{0.75} = \tfrac{2}{3}\,P_0
$$

```python
def precio_llamada(p0, m_inicial=0.50, m_mant=0.25):
    prestamo = (1 - m_inicial) * p0
    return prestamo / (1 - m_mant)

p0 = op.loc[op["condicion"] == "subasta_cierre", "precio"].iloc[0]
acciones = 1_000
pstar = precio_llamada(p0)
print(f"purchase of {acciones} shares at {p0} USD")
print(f"loan: {(1 - 0.5) * p0 * acciones:,.0f} USD")
print(f"margin call at {pstar:.2f} USD ({pstar / p0 - 1:.1%})")
for mm in (0.30, 0.35, 0.40):
    print(f"  {mm:.0%} maintenance: call at "
          f"{precio_llamada(p0, m_mant=mm):.2f}")
```
```output
purchase of 1000 shares at 53.12 USD
loan: 26,560 USD
margin call at 35.41 USD (-33.3%)
  30% maintenance: call at 37.94
  35% maintenance: call at 40.86
  40% maintenance: call at 44.27
```

*Fig. — Equity of a 1,000-share NOVA purchase at 53.12 USD with a 50% loan against the required 25% maintenance.* Two lines as a function of price from 20 to 60 USD. Account equity, position value minus the 26,560 USD loan, is 26,560 USD at 53.12 and zero at 26.56. The required maintenance, 25% of the value, is flatter. They cross at 35.41 USD, with 8,853 USD of equity (highlighted): that is where the margin call comes, 33% below the purchase.

With the NOVA close of June 2, 2025, 53.12 USD, the call is triggered at 35.41: a drop of one third. It looks far
away, but with stricter requirements it gets closer: with a 40% maintenance, which a broker can impose on volatile
stocks, the call comes with a 16.7% drop. The figure plots account equity against the price and the required
maintenance: they cross at the call.

Three things the calculation does not say. The broker can sell **without notice** and at whatever price there is,
including a gap like the one in lesson 1.1.4: the call does not guarantee an exit at $P^{*}$. The broker's
requirements can be higher than the legal minimums, and change with volatility. And the loan costs interest every
day, which is subtracted from equity and brings the call closer. Leveraged products for retail investors in the EU
(CFDs, with ESMA leverage limits) are covered in lessons 1.2.4 and 1.2.7; futures margins, which work differently, in
1.2.3.

```python
prestamo = (1 - 0.5) * p0 * acciones
for dias in (5, 30, 365):
    interes = prestamo * 0.06 * dias / 360     # assumed rate, 360-day basis
    print(f"{dias:>3} days: {interes:8.2f} USD · "
          f"{1e4 * interes / (p0 * acciones):6.1f} bp of the position")
```
```output
  5 days:    22.13 USD ·    4.2 bp of the position
 30 days:   132.80 USD ·   25.0 bp of the position
365 days:  1615.73 USD ·  304.2 bp of the position
```

A year on margin at a 6% rate on half the position costs 3.04% of the position, 6.08% of own equity. It is a return
hurdle the strategy has to clear before earning anything from the leverage.

## Exercises

1. Calculate the volume-weighted average effective spread of the trades on the lit venues in the first half hour of
   the session (13:30 to 14:00 UTC) and in the rest of the day. Is it more expensive to trade at the start of the
   session?

**Solution.**

```python
apertura = lit["ts"] < "2025-06-02 14:00:00+00:00"
for nombre, g in (("first half hour", lit[apertura]),
                  ("rest of the day", lit[~apertura])):
    print(f"{nombre:<19} {media_pond(g, 'ef_pb'):.3f} bp"
          f" · {len(g)} trades")
```
```output
first half hour     2.065 bp · 6090 trades
rest of the day     2.067 bp · 36554 trades
```

In NOVA, no: 2.065 versus 2.067 basis points, practically the same. It matches the table of spreads by half hour in
lesson 1.1.3, in which the first half hour does not stand out (only 2.2% of snapshots with more than one tick) and the
one that does is the last. The first snapshot of the session had a two-tick spread, but it closes within seconds.
With real data the measurement has to be repeated for each stock: it is the way to decide with numbers at what time
it pays to execute.

2. Repeat the cost waterfall with an order of 5,000 shares and another of 40,000. Which component changes most?

**Solution.**

```python
for n in (5_000, 40_000):
    pagado = precio_medio_compra(f10, n)
    print(n, "shares · impact",
          round(1e4 * (pagado - ask10) / decision, 2), "bp")
```
```output
5000 shares · impact 0.0 bp
40000 shares · impact 3.08 bp
```

With 5,000 shares the impact is zero: in the 15:00:10 snapshot they fit in the first ask level. With 40,000 it rises
to 3.08 basis points. The delay, the half spread and the per-share commission do not depend on the order size: they
are the same basis points for 5,000 as for 40,000 shares. The impact does: it grows with the number of levels that
have to be walked. For small orders, the spread dominates; for large orders, the impact.

3. An account with 30,000 USD of its own buys 1,000 NOVA shares at 53.12 with the rest borrowed. What leverage does it
   have? At what price is the margin call triggered with the 25% maintenance? Does it meet the Reg T initial margin?

**Solution.**

The position is worth 53,120 USD and the loan is 23,120 USD. Leverage: 53,120 / 30,000 = 1.77. The loan per share is
23.12, so the call is triggered at 23.12 / 0.75 = 30.83 USD, 42% below the purchase. It meets Reg T: the client puts
up 56.5% of the price, more than the 50% minimum. With a smaller loan the call moves further away, because the own
cushion is larger.

## Self-assessment

1. A buy is executed at 52.76 when the prevailing midpoint is 52.755. What is its effective spread in basis points?

   - A. 1.90 basis points
   - B. 0.95 basis points
   - C. 0.5 cents
   - D. It cannot be calculated without the later quote

   *Answer A: 1.90 basis points.* The effective spread is twice the distance between the price paid and the midpoint, relative to the midpoint: 2 × (52.76 − 52.755) / 52.755 = 0.000190, that is, 1.90 basis points. It is multiplied by two to compare it with the quoted spread, which is a round trip.

2. In NOVA, the realized spread of the trades on the lit venues is positive at 1 second and negative at 1 minute. What does it mean?

   - A. That the data is wrong
   - B. That whoever provides liquidity earns the spread if they close right away, but loses if they hold the position: the aggressor flow anticipates the price
   - C. That commissions are negative
   - D. That the dark venue is more expensive

   *Answer B: That whoever provides liquidity earns the spread if they close right away, but loses if they hold the position: the aggressor flow anticipates the price.* The realized spread measures what the liquidity provider keeps after the price moves. If the price keeps going in the aggressor's direction, the provider has sold cheap or bought dear: that is adverse selection. The difference between effective and realized is the price impact.

3. A US stock is sold on Thursday, July 3, 2025. When does it settle?

   - A. On Friday, July 4
   - B. On Tuesday, July 8 (T+2)
   - C. The same day
   - D. On Monday, July 7, the next business day (T+1), because the 4th is a holiday

   *Answer D: On Monday, July 7, the next business day (T+1), because the 4th is a holiday.* Since May 28, 2024 the standard cycle in the US is T+1. On Friday, July 4, 2025 the NYSE was closed for Independence Day, so the next business day is Monday the 7th.

4. You buy stock at 53.12 USD with the maximum Reg T loan (50%) and the broker requires the FINRA minimum maintenance (25%). At what price is the margin call triggered?

   - A. At 39.84
   - B. At 26.56
   - C. At 35.41
   - D. At 13.28

   *Answer C: At 35.41.* The call is triggered when the account equity falls to 25% of the position's value. With a loan of 50% of the purchase price, that happens at P0 × (1 − 0.50) / (1 − 0.25) = 53.12 × 2/3 = 35.41 USD, a 33% drop.

5. Why can financing be the largest cost of a trade even though the daily rate looks small?

   - A. Because it is charged on every trade
   - B. Because it is paid every day the position stays open and on the borrowed amount, while spread and impact are paid once
   - C. Because it is an implicit cost
   - D. It cannot be

   *Answer B: Because it is paid every day the position stays open and on the borrowed amount, while spread and impact are paid once.* Spread, impact and commission are paid when entering and when exiting. The loan interest accrues over time: in the lesson's example, five days on margin at an assumed 6% annual rate cost 4.2 basis points, almost as much as all the execution costs combined (5.6).

## Key points

- Execution costs are measured against the decision price: delay, half spread, impact and commission. In the 20,000-share NOVA order they add up to 5.6 basis points, and the commission is only one of them.
- The effective spread measures what was paid against the prevailing midpoint; the realized spread, what the provider keeps after a few seconds. The difference is the impact, and its sign says whether the aggressor flow was informed.
- Impact grows with size faster than linearly once the order goes past the first levels: from 1 basis point with 100 shares to 3.6 with 30,000 in the NOVA book.
- The US settles on T+1 since May 28, 2024; the EU moves from T+2 to T+1 on October 11, 2027. Business days come from a calendar, not from adding days.
- With Reg T (50% initial) and FINRA 4210 (25% maintenance), a fully margined purchase receives a call if the price falls by a third. The broker can require more and liquidate without notice.

## Resources

### Research

- [Quantitative Models and Algorithmic Execution](https://pythonparatrading.com/en/quantitative-models-algorithmic-execution/) · Research-0009 · 11 min

### Documentation

- [SEC: SEC Finalizes Rules to Reduce Risks in Clearance and Settlement (press release 2023-29; T+1 since May 28, 2024)](https://www.sec.gov/news/press-release/2023-29) · sec.gov
- [AMF: Transition to T+1 settlement of transactions (Regulation (EU) 2025/2075, applicable from October 11, 2027)](https://www.amf-france.org/en/news-publications/depth/settlement-cycle-t1) · amf-france.org
- [eCFR: 12 CFR 220.12, Supplement: Margin requirements (Regulation T, 50%)](https://www.ecfr.gov/current/title-12/chapter-II/subchapter-A/part-220/section-220.12) · ecfr.gov
- [FINRA Rule 4210: Margin Requirements (25% maintenance on long positions)](https://www.finra.org/rules-guidance/rulebooks/finra-rules/4210) · finra.org
- [FINRA: Margin Regulation](https://www.finra.org/rules-guidance/key-topics/margin-accounts) · finra.org

### Data

- [Level 1 data: NOVA L1 quotes for June 2, 2025 (Parquet)](https://pythonparatrading.com/curso/datos/nivel-1/nova_cotizaciones.parquet) · Download · nova_cotizaciones.parquet

Previous lesson: [1.1.4 · Order types](https://pythonparatrading.com/en/python-trading-course/level-1/order-types-explained/)

Next lesson: [1.2.1 · Stocks: splits, dividends and corporate actions](https://pythonparatrading.com/en/python-trading-course/level-1/stocks-splits-dividends-corporate-actions/)
