Back
Challenge 6 - Market Sell Against Bids
MediumOrderbookMarket Orders6 / 12

Challenge 6: Market Sell Against Bids

A market sell consumes the highest available bids first.

Task

Implement market_sell.

Rules

  • Assume bids are already sorted high-to-low.
  • Fill until the sell quantity is satisfied or bids run out.
  • Quote received at a level is filled_at_level * price.

Example

Selling 6 base units:

  • take 2 at 99 = 198
  • take 4 at 98 = 392

Return:

6 590
LanguageRust
Loading editor...
Run works without login. Submit requires sign-in so completion can be saved.
Run cases to compare your output against each configured input. Submit saves progress only when every case passes.
    Challenge 6 - Market Sell Against Bids · ORDERBOOK Exercise | learn.sol