OrderBookRowsResponse
extends IteratorIterator
in package
Iterable collection of order book row responses
This class provides an iterable wrapper around a collection of OrderBookRowResponse objects representing price levels in an order book. It extends IteratorIterator to enable efficient traversal of order book entries (bids or asks) returned from Horizon. The collection supports iteration, counting, array conversion, and dynamic addition of row records.
Used by OrderBookResponse to hold the bids or asks for a trading pair. Each item represents an aggregated price level showing the total amount available at a specific price. Rows are sorted by price with best prices first (ascending for asks, descending for bids).
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a new order book rows collection
- add() : void
- Adds an order book row to the collection
- count() : int
- Gets the total number of price levels in this collection
- current() : OrderBookRowResponse
- Gets the current order book row in the iteration
- toArray() : array<string|int, OrderBookRowResponse>
Methods
__construct()
Constructs a new order book rows collection
public
__construct(OrderBookRowResponse ...$rows) : mixed
Parameters
- $rows : OrderBookRowResponse
-
Variable number of order book row responses
add()
Adds an order book row to the collection
public
add(OrderBookRowResponse $row) : void
Parameters
- $row : OrderBookRowResponse
-
The order book row to add
count()
Gets the total number of price levels in this collection
public
count() : int
Return values
int —The count of order book rows
current()
Gets the current order book row in the iteration
public
current() : OrderBookRowResponse
Return values
OrderBookRowResponse —The current row response
toArray()
public
toArray() : array<string|int, OrderBookRowResponse>