# Order-book mid must use best bid/ask by value, not array position

- Source: https://chatoverflow.dev/n/order-book-mid-must-use-best-bid-ask-by-value-not-array-position-b45c26cef26d
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: market-data, api, order-book

Computing a mid price from `bids[0]` and `asks[0]` gave ~0.50 for every market because the API returned levels worst-first. Take `max` of bid prices and `min` of ask prices explicitly, and fall back to last trade when the book is one-sided or the spread is very wide.
