Quantitative Trading BasicsFoundations · Lesson 3
Course home
Quantitative Trading / Quotes, orders, and fills

← Lesson 2 · What Do You Own After You Buy?

Can you trade at that price?

Your screen shows 100 yuan. You click Buy and the order fills at 100.20 yuan. Both prices can be accurate. The last trade and the price someone is currently willing to sell at answer different questions.

For beginners30–40 minutes including practiceBasic arithmetic only
From a quote to a record of the trade
  1. QuoteWhat price is available?
    How many units are available?
  2. OrderWhat are your terms?
    Buy or sell, and how much?
  3. FillHow many units traded?
    At what price did each fill occur?

Lesson 1 separated observation from execution. Lesson 2 explained what you own once you buy. Now ask what happens between wanting to buy and getting a fill?

By the end of this lesson, you can

  1. Read a quoteLook to the ask when buying immediately and the bid when selling immediately.
  2. Check the orderDistinguish market and limit orders, and explain full fills, partial fills, and waiting.
  3. Verify the fillsCalculate the trade value, average fill price, and fees from actual fills.

This fictional market simulator has no connection to a trading account. Its prices, quantities, and fees are teaching assumptions. The time estimate has yet to be tested with learners.

Read both sides of a quote ↓
02
Concepts · About 5 minutes

If you want to buy, who is willing to sell?

Imagine a market for fictional Asset A. Buyers quote what they will pay and sellers quote what they will accept. The highest bid right now is 99.80 yuan and the lowest ask is 100.20 yuan.

Bid

99.80 yuan

A buyer is willing to pay this price.
An immediate sell starts on this side.

Ask

100.20 yuan

A seller is willing to accept this price.
An immediate buy starts on this side.

Bid–ask spread100.20 − 99.80 = 0.40 yuanThe best ask minus the best bid.

Midpoint(99.80 + 100.20) ÷ 2 = 100 yuanThe average of the best bid and ask. An order may never trade at this price.

The last trade price shows where the previous trade took place. Quotes show the prices and quantities buyers and sellers are offering now. SEC order guidance explains why a market order’s execution price can differ from the last trade price.

Trading can cost money even if prices stay put

If the quotes and sizes stay the same, buying one unit at 100.20 and selling it at 99.80 loses 0.40 yuan. That comes from crossing the spread, before fees.

Each quote covers a limited quantity. If only 2 units are available at the best ask and you want 4, check the next price level and its available quantity. Liquidity describes how much you can trade when you need to and what it costs to do so.

03
Concepts · About 4 minutes

An order tells the market your terms

Market order · Seek prompt execution

A market order tries to trade against available quotes without you specifying a fixed fill price. Large orders may fill at several prices. Check the market’s rules for price protection, unfilled quantities, and trading halts.

Limit order · Set a price boundary

A buy limit sets the highest price you’ll accept. A sell limit sets the lowest. You may have to wait for an eligible quote.

Suppose you’re willing to pay up to 101 yuan and someone offers to sell at 100.20 yuan. The order fills at 100.20 first under this lesson’s matching rules. A limit of 101 yuan leaves room for a better price.CME explains limit orders, price improvement, price protection, and time in force for different order types.

A limit order also needs a time in force. Specify whether any unfilled quantity stays open, is canceled immediately, or expires at a scheduled time. Even if the market touches your limit price, your order may fill only partially or remain open. The fill depends on available quantity and your place in the queue.

04
Interactive lab · About 10 minutes

Walk an order through the book

The order book below lists the current bids and asks and their quantities. Each side starts with the best price for you. Run the default market buy for 4 units, then buy the same quantity with a 100.20 yuan limit and compare the results.

Fictional Asset A · Fixed snapshot

Last trade 100.00 / Midpoint 100.00

Bids · Sell to these buyers

Highest bid first
Price (yuan)Units
99.803
99.604
99.405

Asks · Buy from these sellers

Lowest ask first
Price (yuan)Units
100.202
100.403
100.605

Each run starts with the same snapshot and the positions do not carry over. Assume sufficient cash and holdings, unchanged quotes, no competing orders, and no fees.

How the simulator handles unfilled units

The simulation uses only the three displayed price levels. It fills the eligible portion of a limit order and leaves the rest open until you click “Cancel unfilled units.” No new quotes appear. If a market order exceeds the available quantity, the simulation immediately cancels what remains.These rules are specific to the demo. Markets may differ in price protection, time in force, and matching.

Run three orders and explain what happened

  1. Buy 4 units at market. Why didn’t all 4 fill at 100.20?
  2. Buy 4 with a 100.20 limit. How many units fill? Do you still hold them after canceling the remainder?
  3. Set a 100.00 buy limit. Why is there no fill? Switch to a sell and identify which side of the book you should check.

The real order book can change between seeing a quote and getting your order to the market. Someone else can trade first or cancel a quote. This simulator shows what would happen under a fixed set of assumptions.SEC execution guidance explains that trades take time to execute and quotes apply only to limited quantities.

05
Worked calculations · About 4 minutes

Calculate actual trade value before measuring slippage

The default market buy for 4 units fills 2 at 100.20 and 2 at 100.40.

Purchase cost = 2 × 100.20 + 2 × 100.40 = 401.20 yuan

Average fill price = 401.20 ÷ 4 = 100.30 yuan

The average fill price is weighted by quantity. This time the two fills each contain 2 units. With unequal quantities, averaging the two prices directly gives the wrong result.

Slippage depends on your reference price. Compared with the midpoint of 100.00 at submission, the buy cost 0.30 yuan more per unit. Compared with the best ask of 100.20, it cost 0.10 yuan more. Record the reference time and price, the side, and the number of units filled.

Subtract fees separately and count the price difference once

Suppose you later sell all 4 units at 101 yuan with a 1 yuan fee on each side. Sale proceeds of 404 yuan − purchase cost of 401.20 yuan − total fees of 2 yuan = 0.80 yuan net profit.

The 401.20 yuan cost already uses the actual fill prices. Deducting slippage or the spread again would count the same execution difference twice.

This calculation gives the net profit on one round trip. Account returns also take idle cash, other positions, deposits, withdrawals, and fees into account. Later lessons bring these into a single ledger.

06
Independent practice · About 10 minutes

Calculate fills with a new order book

The new asks are 20 units at 50.10 yuan and 30 units at 50.20 yuan.

Buy 40 units. Assume quotes stay in place and there are no competing orders. Use these inputs regardless of the simulator settings above.

Check six judgments about orders and fills

0 / 6 questions checked

Complete the execution record

Place a limit order to buy 4 units at 100.20 yuan. Sellers offer only 2 units at 100.20, and all other asks are higher. The first 2 units fill. Cancellation of the remainder is then confirmed, with no more fills. Ignore fees.

Complete the questions below before trying the optional writing exercise. Use the fixed inputs here, even if you changed the experiment above. Enter numbers in the units shown and keep at least two decimal places where needed. Follow the specified precision for tables. You can check one answer at a time or all answers together.

1. Quantity actually bought
units
Reference answer (try the question first)
2. Total value of the fill
yuan
Reference answer (try the question first)
3. Quantity still working after cancellation is confirmed
units
Reference answer (try the question first)
4. How should you update your position after the cancellation?
Reference answer (try the question first)

Save your homework to export these results. Check again after changing an answer. Optional writing and self-assessment are ungraded. Save your work before refreshing.

Optional writing (ungraded)

Show the self-check criteria

Planned buy 4. Filled 2 at an average price of 100.20, for a trade value of 200.40. The other 2 units were canceled, leaving 0 open. The two filled units still count as holdings after the cancellation. This exercise excludes fees. This response is for self-review.

Includes the simulated fills, calculations, question results, and your written response. Export before refreshing or closing the page.

07
Recap

Write a trade record someone can verify

An order record should include side, planned quantity, order terms, time of submission, status, fill prices and quantities, fees, and any unfilled quantity.If the plan was to buy 40 units and only 20 filled, use the 20 actual fills in your research.

Submission, acceptance, fills, and cancellation confirmation are separate events. In a real system, after requesting cancellation, check for confirmation and any fills that happened in the meantime. This simulator cancels the remainder immediately.

Next lesson · How does the same price move change an account?

Lesson 4 covers direction, leverage, and margin. Once you can record the actual fill quantity and price, you can distinguish position notional from account equity and evaluate how much loss the account can bear.

Lesson 4 · Direction, Leverage, and Margin →

Course home →