advanced 25 min

Day 1 challenge: safe liquidity quotes

Add freshness, price-impact, and funded-liquidity checks to the Day 1 order-book client.

Prerequisites

Complete these before starting this module:

What you'll learn

  • Bind a quote to its ledger and creation time.
  • Reject stale and underfunded quotes with structured reasons.
  • Estimate price impact for a requested size.
  • Submit reviewable code and a validated Testnet hash.
Complete this module by mentor review. Jump to assessment

How the provided code works

The read-only helper gives you one sample quote to test your safety checks against, so you can run instantly without the network. Your job is to decide whether a quote is still safe to trade on:

  • reject it if it is too old (more than 20 seconds), and
  • reject it if the requested size is larger than the funded depth.

For a safe quote, you report its age, size, and a rough price-impact estimate. The console prints the decision as JSON.

Take-home challenge

A quote is only useful while the prices it was based on are still fresh. Extend your order-book client so every quote carries two facts: the validated ledger it was read from, and the time it was created. Then refuse to trade on a quote that is no longer safe.

Reject a quote in two cases, each with a clear machine-readable reason instead of a blank screen:

  • Too old: more than 20 seconds since it was created — return STALE_QUOTE.
  • Not enough liquidity: the requested size is larger than the funded depth — return INSUFFICIENT_FUNDED_LIQUIDITY.

For a safe quote, report the age, the requested size, the available funded size, and a rough price-impact estimate in basis points (1 basis point = 0.01%). Submit only public data and code; include one validated Testnet transaction hash in a comment — never a seed or a signed transaction. The mentors use these submissions to pick examples for the Day 2 debugging clinic.

Assignments

0 of 1 complete

Unlocks

Finishing this module opens up: