Quantitative Finance · Book 2 · Markets

Markets II: Rates, FX and Credit

Markets II: Rates, FX and Credit · Markets

27Getting Access: FX

On 15 January 2015 the Swiss National Bank stopped capping the franc, and the franc jumped (chapter 18). By the BIS’s account, the moves jolted the prime-brokerage industry, the banks that stand behind their clients’ trades, and the prime brokers reassessed the business: they kept their largest clients, the big principal trading firms, and shed retail aggregators, smaller hedge funds and some high-frequency traders, raising capital requirements, tightening admission and raising fees; FX volume through prime brokers fell by 22% between 2013 and 2016. A new fund whose strategy trades a billion dollars a day must first find someone to stand behind its trades, and then live within the limits that person sets. This chapter explains how: prime-broker credit and give-up lines, the limits and the gate that enforces them, becoming a liquidity provider, and the disclosures and reviews on both sides.

27.1 Prime-broker credit and give-up lines

A fund cannot trade FX with dozens of dealers, each of which would have to assess its credit, sign documentation and set a limit. An FX prime broker (chapter 14) does it once: the fund trades with any dealer that accepts the prime broker’s name, and each trade is given up to the prime broker, which becomes the dealer’s counterparty and books an offsetting trade with the fund.

Definition 27.1 (Give-up line, designation notice)

A give-up line is a prime broker’s agreement to accept the trades that a client executes with a given executing dealer, within limits. A designation notice is the prime broker’s notice to an executing dealer that designates the client as a party authorised to trade on its behalf, and sets the trade types, maximum tenors, currencies and limits of that authority.

The standard documents were published by the Foreign Exchange Committee in New York in 2005: in the Master FX Give-Up Agreement, the prime broker authorises each designated party, by a notice in a standard form, to trade with the dealer on its behalf; the authority is limited to the types, tenors, currencies and offices in the notice and to two limits, and the prime broker is not liable for a trade that takes a limit above its level, or further above it, without its consent (Figure 27.1). The client’s cost is the prime broker’s fees, per million traded and for the credit it extends, and the prime broker’s right to cut the limits when it wants.

A give-up line. The fund executes with any dealer that accepts its prime broker’s name; each trade is given up to the prime broker, which faces the dealer and books an offsetting trade with the fund. The prime broker’s notice tells each dealer what the fund may trade on its behalf and within which limits. Schematic.
Figure 27.1. A give-up line. The fund executes with any dealer that accepts its prime broker’s name; each trade is given up to the prime broker, which faces the dealer and books an offsetting trade with the fund. The prime broker’s notice tells each dealer what the fund may trade on its behalf and within which limits. Schematic.

Definition 27.2 (Prime-of-prime)

Prime-of-prime is an arrangement in which a client is prime-brokered by a non-dealer bank or firm that is itself prime-brokered by an FX dealing bank.

After 2015 the clients the banks shed turned to prime-of-prime providers, which take their credit and bundle it into their own relationship with a bank (Figure 27.2). It adds a layer, and its costs and limits, but it is often the only way in for a small firm. The New York committee published in 2014 sample certifications and best practices for such intermediated arrangements, in which the intermediary certifies its relationships to the prime brokers and dealers.

Prime-of-prime: a client too small for a bank’s prime brokerage is prime-brokered by a non-dealer firm, which is itself prime-brokered by a dealing bank and reaches venues and dealers under its name. Schematic.
Figure 27.2. Prime-of-prime: a client too small for a bank’s prime brokerage is prime-brokered by a non-dealer firm, which is itself prime-brokered by a dealing bank and reaches venues and dealers under its name. Schematic.

27.2 Limits: net open position and settlement

Definition 27.3 (Net open position limit, settlement limit)

A net open position limit caps the client’s net currency exposure through the prime broker, measured in one currency across all currencies. A settlement limit caps, for each value date, the amount the prime broker will have to settle on the client’s trades.

The Master Agreement defines both in dollar values: the net open position aggregates, by a method set in the schedule, the net dollar value of each currency across the designated party’s trades; the net daily settlement amount of a value date is the sum of the dollar values of the currencies with a net amount owed to the prime broker that day. This chapter’s gate takes the net open position as the sum of the net long dollar values, which equals the sum of the net shorts when every currency, the dollar included, is counted, and the settlement amount as the sum of the currencies to be received on the value date.

Example 27.4 (Two trades through the gate)

Prime broker A allows EURUSD and USDJPY up to seven days, a net open position of USD 100 million and settlement of USD 500 million per value date. The fund buys EUR 50 million at 1.10 for spot: it is long EUR worth USD 55 million and short USD 55 million, a net open position of 55 million and a settlement amount of 55 million. It then buys USD 20 million against yen: the dollar short shrinks to 35 million and a yen short of 20 million appears; the longs are still the 55 million of euros, and so is the settlement amount. A further purchase of EUR 95 million would take the position to 159.5 million and is rejected; a sale of euros would be accepted even if the limit had been cut below the position, because it reduces it.

A limit is only as good as its enforcement. The fund’s own gate must check every order before it leaves, in the order path, against what each prime broker’s notice allows: a dealer that accepts a trade beyond the limit may find the prime broker refusing it, leaving the fund facing the dealer directly or not at all. The build of this chapter is that gate, written in C++20 and Rust for the order path and in Python for analysis (Figure 27.3).

A simulated day of 240 orders routed by the gate to the cheapest prime broker whose limits allow them: the net open position at each, in per cent of its limit. A fills first, from order 107 the flow that adds to the position spills to B, and then to C, whose position ends the day at 76% of its limit. No order is rejected. Illustrative; data: the chapter’s tutorial, seeded.
Figure 27.3. A simulated day of 240 orders routed by the gate to the cheapest prime broker whose limits allow them: the net open position at each, in per cent of its limit. A fills first, from order 107 the flow that adds to the position spills to B, and then to C, whose position ends the day at 76% of its limit. No order is rejected. Illustrative; data: the chapter’s tutorial, seeded.

27.3 Becoming a liquidity provider

A fund that quotes, rather than only takes prices, must also be accepted as a liquidity provider: on a venue, which lets it stream prices into the venue’s book; or directly to clients, through a single-dealer platform or an aggregator.

Definition 27.5 (Liquidity-provider review)

A liquidity-provider review is the periodic assessment, by a venue or a client, of a liquidity provider’s quoting: how often its prices are hit and filled, its reject rate and hold times under last look, and the mark-outs of the trades done with it.

The metrics are those of chapter 15, seen from the other side. A liquidity provider that rejects too often, holds requests too long, or whose fills are systematically followed by moves against its clients may be ranked down in aggregators’ routing or removed from a venue’s stream; one that shows firm, well-used prices can expect more flow. It needs its own credit to do this: every trade it makes as a maker is still given up to its prime broker and counts against the same limits.

27.4 Brokerage, disclosures and reviews

The FX Global Code asks market participants to disclose how they trade, and in August 2021 the Global Foreign Exchange Committee published standard disclosure cover sheets for liquidity providers and for trading platforms, with a guidance paper on last look. A liquidity provider’s cover sheet states in one place whether it acts as principal or agent, whether it shares data from client interactions, whether it pre-hedges, whether and how it uses last look (symmetrically or not, the maximum and minimum window, and whether it trades during the window), and where to find its policies on aggregation, discretion, time-stamping, stop-loss orders, partial fills, reference prices, mark-ups and the internal sharing of confidential information. A fund reads these before it chooses whom to trade with, and must write its own if it becomes a liquidity provider.

As of September 2026 — FX access documents

Master FX Give-Up Agreement: published by the Foreign Exchange Committee in 2005, with a standard notice form. FX Global Code: last updated in December 2024, with a December 2024 liquidity-provider disclosure cover sheet; cover sheets first published in August 2021.

27.5 Tutorial: a pre-trade limit gate

Goal. Implement a pre-trade check that enforces each prime broker’s allowed pairs, tenors, net open position and settlement limits, route each order to the cheapest prime broker that accepts it, and plan the allocation of a day’s flow. End state: Figures 27.3 and 27.4, Example 27.4 and the numbers of the weekend problem.

  1. The gate, in C++20: the check, which leaves the book unchanged, and the update once the trade is done.

    class Book {
    public:
        explicit Book(Limits l) : limits(std::move(l)) {}
        Limits limits;
        Usd net;
        std::map<int, Usd> settle;
    
        double nop() const { return positive_sum(net); }
        double settlement(int day) const {
            auto it = settle.find(day);
            return it == settle.end() ? 0.0 : positive_sum(it->second);
        }
    
        Decision check(const Order& o, const Usd& usd_per) const {
            if (!limits.pairs.contains(o.pair)) return Decision::pair;
            if (o.value_day > limits.max_tenor) return Decision::tenor;
            Usd n = net, f;
            if (auto it = settle.find(o.value_day); it != settle.end()) f = it->second;
            for (const auto& [c, v] : legs(o, usd_per)) { n[c] += v; f[c] += v; }
            const double new_nop = positive_sum(n), new_set = positive_sum(f);
            if (new_nop > limits.nop_limit && new_nop > nop()) return Decision::nop;
            if (new_set > limits.settle_limit && new_set > settlement(o.value_day)) return Decision::settlement;
            return Decision::ok;
        }
    
        void apply(const Order& o, const Usd& usd_per) {
            Usd& day = settle[o.value_day];
            for (const auto& [c, v] : legs(o, usd_per)) { net[c] += v; day[c] += v; }
        }
    };
    Listing 27.1. The prime-broker book and its pre-trade check, C++20. code/firm/pblimits/cpp/firm_pblimits.hpp
  2. The router and the limits file, in Python.

    def route(books: list[Book], order: Order, usd_per: dict[str, float]) -> tuple[str | None, list[str]]:
        """Give the order up to the cheapest prime broker that accepts it; return it and every reason."""
        reasons = []
        for b in sorted(books, key=lambda x: x.limits.fee_per_m):
            r = check(b, order, usd_per)
            reasons.append(f"{b.limits.pb}:{r}")
            if r == "ok":
                apply(b, order, usd_per)
                return b.limits.pb, reasons
        return None, reasons
    
    
    def read_limits(path: str) -> list[Limits]:
        """Read the limits file shared with the C++ and Rust gates: pb,fee_per_m,nop_limit,settle_limit,
        max_tenor,pairs (pairs separated by ';')."""
        with open(path) as f:
            return [Limits(r["pb"], float(r["fee_per_m"]), float(r["nop_limit"]), float(r["settle_limit"]),
                           int(r["max_tenor"]), frozenset(r["pairs"].split(";"))) for r in csv.DictReader(f)]
    Listing 27.2. Routing to the cheapest prime broker with room, and reading the limits. code/firm/pblimits/firm_pblimits.py
  3. Run access_demo.plan(), access_demo.brute_force(), access_demo.day_of_orders() and fig_access.py; build and test the C++ and Rust gates.

What to change next. Add a maximum order size per pair to each notice; then make the router prefer, among the prime brokers that accept an order, the one whose overnight charge is lowest when the order adds to the position, and measure the cost saved.

27.6 Build: the prime-broker limit gate

Purpose. Every order the miniature firm sends in FX passes this gate before it leaves: it must fit a prime broker’s notice, and is given up to the cheapest one that accepts it.

Interface. C++20 firm::pblimits::Book with check(order, usd_per), apply, nop(), settlement(day), and route(books, order, usd_per); the same in Rust; Python Book, check, apply, route and read_limits(path) for the shared limits file code/firm/pblimits/limits.csv.

Rules. Dollar values at given rates; net open position the sum of net longs; settlement the sum of net receipts per value date; reject if a pair or tenor is not allowed, or if a limit is exceeded or further exceeded; route by increasing fee.

Acceptance tests. The same in the three languages: the net open position and settlement of two trades; rejection above the limit and acceptance of a reducing trade after a cut; the settlement limit per value date; pair and tenor rejections; routing to the cheapest broker with room.

Stretch. Limits per executing dealer as well as per prime broker; a lock-free book for concurrent order threads (One Quant Book 13); end-of-day moves of positions between prime brokers; limits on options by their delta and premium.

Sources and further reading

  • Foreign Exchange Committee, Master FX Give-Up Agreement (2005); FXC and FMLG, market practice memoranda of May 2013 and July 2014 on prime-broker notices and intermediated arrangements.
  • M. Moore, A. Schrimpf and V. Sushko, “Downsized FX markets: causes and implications”, BIS Quarterly Review, December 2016.
  • Global Foreign Exchange Committee, press release of 18 August 2021 and disclosure cover sheets; a published liquidity-provider cover sheet.

27.7 Exercises

Exercise 27.1 ★

A fund’s book is long EUR worth USD 40 million, short USD 25 million and short JPY worth USD 15 million. What is its net open position, and why do the longs equal the shorts?

Solution

Solution of Exercise 27.1.

USD 40 million, the sum of the longs. Every trade is long one currency and short another of the same dollar value, so, counting the dollar as a currency, the net longs and net shorts always add up to the same amount: here 25+15=4025 + 15 = 40.

Exercise 27.2 ★

What does a designation notice tell an executing dealer?

Solution

Solution of Exercise 27.2.

That the client is authorised to trade on the prime broker’s behalf with that dealer, which trade types, currencies and maximum tenors are allowed, through which offices, and the net open position and settlement limits beyond which the prime broker will not accept the trades.

Exercise 27.3 ★

Why did prime brokers shed smaller clients after 2015, and where did those clients go?

Solution

Solution of Exercise 27.3.

The 2015 franc shock showed the risk in the business when its profitability was already low and post-crisis rules raised its cost; prime brokers kept large, profitable clients and dropped retail aggregators, smaller hedge funds and some high-frequency firms, many of which went to prime-of-prime providers.

Exercise 27.4 ★★

For the same value date the fund buys EUR 100 million and sells EUR 60 million against dollars at 1.10. What is the settlement amount, and what would it be if the two trades were at different prime brokers?

Solution

Solution of Exercise 27.4.

At one prime broker the trades net: the fund receives EUR 40 million, worth USD 44 million, and pays dollars, so the settlement amount is 44 million. At two brokers they do not: one must receive EUR worth 110 million, the other USD 66 million, 176 million in all.

Exercise 27.5 ★★

Why does the gate accept a trade that reduces a position already above its limit?

Solution

Solution of Exercise 27.5.

Because it lowers the prime broker’s exposure: refusing it would keep the position above the limit. The Master Agreement’s test is whether a trade causes a limit to be exceeded or further exceeded.

Exercise 27.6 ★★

Which numbers would a venue look at to review the fund as a liquidity provider?

Solution

Solution of Exercise 27.6.

The share of its quotes that are hit and filled, its reject rate and hold times under last look, the mark-outs of trades done against it, the stability of its prices and sizes, and whether its practices match its disclosure cover sheet.

Exercise 27.7 ★★★

Coding. Cut prime broker A’s net open position limit to USD 50 million and run the day of orders again. How much more flow goes to C, and where does the day’s position end?

Solution

Solution of Exercise 27.7.

C receives USD 485 million of flow instead of 435, 50 million more, and the day’s position ends with 279 million at C instead of 229, 12 million at A and 120 million at B; no order is rejected.

Exercise 27.8 ★★★

Find the flaw. “Our strategy trades only liquid majors; one prime broker is enough.” Correct it.

Solution

Solution of Exercise 27.8.

Liquidity is not the constraint; credit is. One prime broker’s limits cap the fund’s position and settlement, it can cut them or exit the business in a shock, as after 2015, and it sees all the fund’s flow and can price accordingly. Several prime brokers give capacity, a fallback and competition, at the cost of more documentation and of positions spread across them.

27.8 Problem: Three Prime Brokers

Problem 27.1

Weekend problem — keeping every limit at least cost

A fund’s day, in USD millions: 1 000 of flow in EURUSD and USDJPY, 150 in GBPUSD and 50 in USDMXN, and an overnight net open position of 300, of which 30 in pesos. Three prime brokers’ notices, from limits.csv: A charges 3 dollars per million traded, allows EURUSD and USDJPY up to 7 days, a net open position of 100 and settlement of 500; B charges 5, adds GBPUSD, up to 30 days, 150 and 600; C charges 8, adds USDMXN, up to a year, 300 and 1 000. Overnight positions cost 30, 20 and 50 dollars per million per day at A, B and C. For planning, take the settlement amount at a broker to be the whole flow given up there, without netting.

Part I — The notices.

  1. Which brokers can take each part of the flow?
  2. Compute the net open position after buying EUR 50 million at 1.10 and then USD 20 million against yen.
  3. At B, after buying EUR 500 million for spot, can the fund buy 50 million more for the same value date? For the next day?
  4. A’s limit is cut to 50 million while the fund is long 99 million: which orders still pass?
  5. Why does the notice limit tenors?

Part II — The plan.

  1. Allocate the flow at least cost within the settlement limits.
  2. Allocate the overnight position at least cost within the net open position limits.
  3. What does the plan cost per day, and per year of 250 days?
  4. What would it cost to do everything at C, the only broker that takes every currency?
  5. Check the plan against a search over all splits in steps of 10 million.

Part III — The day.

  1. Route a simulated day of 240 orders to the cheapest broker with room: when does A’s position first reach its limit?
  2. How many orders are rejected?
  3. Where does the day’s position end, and why at the most expensive broker?
  4. Why can the router’s settlement amounts be far below the flow it sends to a broker?
  5. How would you bring the router closer to the plan?

Part IV — Judgement.

  1. What happens to the fund if B cuts its limits by half after a shock?
  2. Why is a prime-of-prime arrangement an alternative, and what does it add?
  3. What would you disclose, and read, before becoming a liquidity provider?
  4. State the named result: the allocation of flow and position that keeps every limit at least cost, and that cost.
  5. In one sentence: what does a fund need before its first FX trade?
Solution

Solution of Problem 27.1.

1. EURUSD and USDJPY: A, B or C; GBPUSD: B or C; USDMXN: C only. 2. USD 55 million both times: the second trade shrinks the dollar short and adds a yen short. 3. Not for the same value date: settlement would reach 605 million, above 600; yes for the next day. 4. Only those that reduce the position; any order that adds to it is rejected until the position is below 50 million. 5. Because the prime broker’s exposure grows with the tenor: longer trades are harder to price, hedge and close out if the client fails. 6. Pesos to C (50); sterling to B (150); the majors to A up to its 500, then B up to its 600 (450 more), and the last 50 to C: A 500, B 600, C 100. 7. Pesos to C (30); the rest to B (150), A (100) and C (20): A 100, B 150, C 50. 8. Fees USD 5 300 and overnight charges USD 8 500: 13 800 a day, USD 3.45 million a year. 9. USD 24 600 a day: 9 600 of fees and 15 000 of charges. 10. The search finds the same minimum, 13 800: with one price per broker and no interaction between the limits, filling the most constrained needs first from the cheapest broker is optimal. 11. At order 107. 12. None. 13. USD 51 million at A, 150 at B (full) and 229 at C: the router sends each order to the cheapest fee, and once A and B are full the position builds at C, which charges most for holding it. 14. Because the gate nets receipts and payments per value date: buys and sells in the same currency offset, so the settlement amount is far below the gross flow. 15. Route orders that add to the overnight position by overnight charge as well as fee, reduce positions at C first, and plan the day’s split in advance. 16. Its capacity at B falls to 75 million of position and 300 of settlement: the plan must move flow and position to C at higher cost, or the fund must trade less. 17. It gives access when no bank will take the fund directly, but adds a layer of fees, a second set of limits and the intermediary’s own credit risk. 18. Its capacity, data use, pre-hedging and last-look practice, window lengths and whether it trades in the window, in the standard cover sheet; and the same from each liquidity provider it will face. 19. Named result: three prime brokers: flow A 500, B 600, C 100 and overnight position A 100, B 150, C 50 (USD millions) keep every limit at USD 13 800 a day, against 24 600 with everything at C. 20. A prime broker’s credit and a gate that keeps every order inside its limits.

Daily cost of the weekend problem’s fund under four plans: everything at C; the flow allocated at least fee cost with the position at C; the position allocated at least charge with the flow at C; and both allocated. The best plan costs USD 13 800 a day against 24 600. Illustrative; data: the chapter’s tutorial.
Figure 27.4. Daily cost of the weekend problem’s fund under four plans: everything at C; the flow allocated at least fee cost with the position at C; the position allocated at least charge with the flow at C; and both allocated. The best plan costs USD 13 800 a day against 24 600. Illustrative; data: the chapter’s tutorial.

27.9 Interview questions

Interview question 27.1 ★ trader, developer

What does an FX prime broker do for a fund, and what does a give-up mean?

Solution

Solution of Interview question 27.1.

It lets the fund trade with many dealers under the prime broker’s credit: the fund executes with a dealer, the trade is given up to the prime broker, which becomes the dealer’s counterparty, and the prime broker books an offsetting trade with the fund, within limits set in its notice to each dealer.

What the interviewer is looking for: credit intermediation and the three-party structure.

Interview question 27.2 ★ risk, developer

What are a net open position limit and a settlement limit, and how do you compute them?

Solution

Solution of Interview question 27.2.

The net open position is the net currency exposure in dollars, here the sum of net long dollar values across currencies; the settlement limit caps the amount to be settled on each value date, here the sum of the currencies to be received. Compute both from the book of trades at current rates, per prime broker and per value date.

What the interviewer is looking for: netting by currency and by value date.

Interview question 27.3 ★★ developer

Where in the order path should the limit check sit, and what must it do when it cannot decide in time?

Solution

Solution of Interview question 27.3.

In the order path, after the strategy and before the order leaves, with its state kept in memory and updated on each fill; it must be deterministic and fast, and when it cannot decide in time, because state is stale or a limit feed is missing, it must reject: failing closed.

What the interviewer is looking for: placement and fail-closed.

Interview question 27.4 ★★ trader, risk

How would you allocate a fund’s flow across several prime brokers?

Solution

Solution of Interview question 27.4.

Estimate the flow and position by currency; list what each prime broker allows and its limits and prices; solve for the cheapest allocation that respects every limit, filling constrained flows first; keep headroom for stress and for limit cuts; route in real time with a gate that also considers overnight charges.

What the interviewer is looking for: constraints, costs, headroom.

Interview question 27.5 ★★ trader

What should a fund ask a liquidity provider before trading with it?

Solution

Solution of Interview question 27.5.

Its disclosure cover sheet: whether it acts as principal, whether it uses last look and how (symmetry, window, trading during the window), whether it pre-hedges, how it uses client data; then evidence from its own trades with it: fills, rejects, hold times and mark-outs.

What the interviewer is looking for: disclosures and measured behaviour.

Interview question 27.6 ★★★ developer

Design a limit gate that checks 100 000 orders a second across ten prime brokers with a worst-case latency of five microseconds.

Solution

Solution of Interview question 27.6.

Keep each prime broker’s state in fixed arrays indexed by currency and value date, preallocated; compute an order’s effect on the two measures incrementally from its two legs; partition by prime broker or by strategy to avoid contention, or use one thread per partition with lock-free queues; no allocation or system calls on the path; measure tail latency and test against the reference implementation.

What the interviewer is looking for: incremental updates, no allocation, partitioning, tail latency.

Terms defined in this chapter

See all 2333 terms in the glossary