Library · Trading Mechanics

How a Trade Works

A trade starts as an order, becomes a fill when it is matched with another trader's order, lives as an open position, and ends when that position is closed.

  • Beginner
  • 5 min read
  • Updated
Watch in 60 seconds

How a trade works

0:53 · captioned

1/4One short sequence

  1. OrderAn instruction is sent
  2. FillMatched with the other side
  3. Open positionValue moves with price
  4. CloseAn opposite order ends it
  • Order, fill, open position, close

The life of one trade: an order, a fill, an open position and a close, and why the result is only final at the last step.

0:00 / 0:53

Transcript
  1. One short sequence
  2. Every chart, indicator and trading style eventually comes down to the same short sequence.
  3. An order is sent, it is matched, a position exists for a while, and then it is closed.
  4. An order is only a request
  5. An order is an instruction: buy or sell, how much, and on what terms.
  6. When it is matched with an order on the opposite side, that is a fill.
  7. A common mistake is treating the order as the trade. An order can fill completely, partly, or not at all.
  8. While the position is open
  9. After the fill, the value of what is held moves with the price.
  10. Any gain or loss at this stage is unrealized: it exists only on paper.
  11. Final only at the close
  12. A position ends with an order in the opposite direction. Only then is the result final.
  13. These are mechanics only. They say nothing about whether any trade is worth taking.

Educational explainer with hypothetical data. Not financial advice.

Why it matters

Every chart, indicator and trading style eventually comes down to the same short sequence of events: an order is sent, it is matched, a position exists for a while, and then it is closed. Fees, slippage, profit, loss and liquidation each happen at a specific point in that sequence.

This page is the map for the Trading Mechanics shelf. Each stage has its own page. The aim here is to see how the stages connect.

How it works

The life of one trade
  1. OrderAn instruction: side, size, terms.
  2. MatchThe exchange finds the other side.
  3. FillThe trade executes at a price.
  4. Open positionValue now moves with price.
  5. CloseAn opposite order ends it.
Costs and surprises are attached to specific stages: the fill, the time the position is open, and the close.

A trade is a process with stages, and each stage can turn out differently from what was expected.

  1. Order. An order is an instruction sent to an exchange or broker: buy or sell, how much, and on what terms. The terms are set by the order type.
  2. Match. The exchange looks for an order on the opposite side in its order book. A buyer needs a seller, and both must accept the same price.
  3. Fill. When two orders are matched, a trade takes place. This is called a fill or an execution. An order can be filled completely, partly, or not at all.
  4. Open position. After the fill the trader has exposure: the value of what they hold now changes with the price. Any gain or loss at this stage is unrealized, which means it exists only on paper.
  5. Close. A position ends with an order in the opposite direction. Only then is the result final. See realized and unrealized P&L.

In plain words

Think of buying a second-hand bicycle through a marketplace. You post an offer (the order). A seller accepts it (the fill). You own the bicycle while its resale value drifts up and down (the open position). One day you sell it to someone else (the close). Only at that last step do you know how the whole thing worked out.

One trade on a spot market

A long position (hypothetical)
Buy (open long)Sell (close)
A long on a spot market: one buy order opens the position and one sell order closes it. Everything between the two markers is unrealized. Hypothetical data for illustration.

On a spot market the trader pays in full and receives the asset itself. The open position is simply the holding. Closing means selling it.

Two fills are needed for one complete trade, an opening fill and a closing fill. This is called a round trip, and costs are usually charged on both legs.

Stage What can differ from the plan
Order Wrong side, size or type. Exchanges execute what was sent, not what was meant.
Fill A worse price than the one on screen (the spread and slippage), a partial fill, or no fill.
Open position Price moves in either direction for as long as the position exists.
Close The same fill uncertainty again, plus a second trading fee.

The same sequence on derivatives

Spot vs perpetual futures
AspectSpotPerpetuals
What you holdThe asset itselfA contract tracking the price
LeverageNone by defaultBuilt in, often high, and it multiplies losses
Short sellingNot directlyPossible by selling first. A rising price increases the loss, and liquidation can follow
Ongoing costNoneFunding payments
LiquidationNone, if bought without borrowingYes, if margin runs out. On some venues the loss can exceed the margin
ExpiryNoneNone

On a derivatives market such as perpetual futures, the five stages are the same, but what is held is different. The trader does not own the asset. They hold a contract that tracks its price, backed by a deposit called margin.

Three things change as a result:

  • A position can be opened in either direction. Selling first creates a short, which gains if price falls. A short loses more as price rises, and there is no ceiling on how high price can go.
  • The position can be larger than the deposit. This is leverage, and it multiplies losses as well as gains.
  • There is an extra way for the trade to end. If losses use up the margin, the exchange closes the position itself, an event called liquidation.

Going deeper

Who is on the other side? Every fill has a buyer and a seller. The counterparty may be another trader, or a market maker whose business is quoting both sides.

Trade versus position. One position can be built from several fills and closed in several pieces. The exchange tracks an average entry price across them. See entry and exit.

A hypothetical spot trade from start to finishHypothetical illustration

An account holds 1,000 in cash. The asset trades at 100.

  1. Order. A buy order for 5 units is sent.
  2. Fill. It is matched with a seller at 100. The account now holds 500 in cash and 5 units worth 500.
  3. Open position. Price rises to 108. The 5 units are worth 540. The position shows an unrealized gain of 8%, and nothing is locked in.
  4. Close. A sell order for 5 units fills at 108. The account holds 1,040 in cash and no units.

The position gained 8%. The account gained 4%, because only half of it was in the trade. Had price fallen to 92 instead, the same steps would have produced an 8% loss on the position and a 4% loss on the account. Fees and the spread are left out to keep the arithmetic visible. Both would reduce the result.

What it does NOT mean

  • Sending an order does not mean a trade happened. An order is a request. Until it is filled, nothing has been bought or sold.
  • The price on the chart is not a price anyone is owed. It is the last traded price. The next fill depends on the orders waiting at that moment.
  • An open gain is not a result. Until the position is closed, the number can shrink, disappear or turn into a loss.

Common mistakes

  1. Treating the order as the trade. Limit orders can sit unfilled, and market orders can fill at a different price than expected.
  2. Counting costs once. A round trip has two fills, so the spread and fees apply on the way in and on the way out.
  3. Mixing up position size and account size. A percentage move on the position is not the same percentage on the account.
  4. Forgetting that derivatives add an extra ending. A leveraged position can be closed by the exchange before the trader acts.

Risks and limitations

  • Fill prices are uncertain in fast or thin markets, at both the open and the close.
  • Exchanges can pause, lag or fail, which can delay orders at the moment they matter most.
  • Assets held on an exchange depend on that exchange remaining solvent and secure.
  • This page describes mechanics only. Knowing how a trade works says nothing about whether any trade is worth taking.

Key takeaway

A trade is a sequence: order, match, fill, open position, close. Each cost and each risk belongs to one of those stages, and the result is only final at the last one.

Sources and further reading

  • Trading and Exchanges: Market Microstructure for Practitioners, Larry Harris (2003). Standard reference on orders, matching and how exchanges work
  • Market Centers: Buying and Selling Stock (opens in a new tab), U.S. Securities and Exchange Commission. How a broker routes an order to a market center (exchange, market maker or electronic network) where it is executed