MCPcopy Index your code
hub / github.com/ccxt/ccxt / toMap

Method toMap

java/lib/src/main/java/io/github/ccxt/ws/WsOrderBook.java:129–138  ·  view source on GitHub ↗

Map view of the orderbook; asks/bids are snapshot copies so callers can iterate without racing the WsClient thread that keeps applying deltas to the live sides. Synchronized so the scalar fields (timestamp/datetime/nonce/symbol) are read atomically as a group — pairs with Helpers.addElementToObje

()

Source from the content-addressed store, hash-verified

127 * branch, which takes the same monitor when an exchange handler does e.g.
128 * `addElementToObject(orderbook, "timestamp", ts)` and then `... "datetime", iso`. */
129 public synchronized Map<String, Object> toMap() {
130 Map<String, Object> result = new HashMap<>();
131 result.put("symbol", this.symbol);
132 result.put("asks", this.asks.snapshot());
133 result.put("bids", this.bids.snapshot());
134 result.put("timestamp", this.timestamp);
135 result.put("datetime", this.datetime);
136 result.put("nonce", this.nonce);
137 return result;
138 }
139
140 // ─── Variants ───
141

Callers

nothing calls this directly

Calls 1

snapshotMethod · 0.45

Tested by

no test coverage detected