From 4a289bc3c42e15ffb9dc717c2d6a44d4acde3fc5 Mon Sep 17 00:00:00 2001 From: Tony Lee Date: Mon, 2 Dec 2024 17:10:55 -0500 Subject: [PATCH] bid q --- crates/sui-deepbook-indexer/src/server.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/sui-deepbook-indexer/src/server.rs b/crates/sui-deepbook-indexer/src/server.rs index b3b0cffdda84a4..afe69aad4f7696 100644 --- a/crates/sui-deepbook-indexer/src/server.rs +++ b/crates/sui-deepbook-indexer/src/server.rs @@ -472,6 +472,20 @@ async fn get_level2_ticks_from_mid( let ask_parsed_quantities: Vec = bcs::from_bytes(&ask_quantities).unwrap(); let mut result = HashMap::new(); + // Insert bid parsed prices + result.insert( + "bid_parsed_prices".to_string(), + Value::Array( + bid_parsed_prices + .into_iter() + .map(|quantity| { + let factor = 10u64.pow((9 - *base_decimals + *quote_decimals).try_into().unwrap()); + Value::from(quantity as f64 / factor as f64) + }) + .collect(), + ), + ); + // Insert bid parsed quantities result.insert( "bid_parsed_quantities".to_string(),