Skip to content

Commit

Permalink
support fractional size (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
wboayue authored Dec 26, 2024
1 parent ca6054c commit a894b52
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/market_data/realtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ pub struct BidAsk {
/// tick-by-tick real-time tick ask price
pub ask_price: f64,
/// tick-by-tick real-time tick bid size
pub bid_size: i64,
pub bid_size: f64,
/// tick-by-tick real-time tick ask size
pub ask_size: i64,
pub ask_size: f64,
/// tick-by-tick real-time bid/ask tick attribs (bit 0 - bid past low, bit 1 - ask past high)
pub bid_ask_attribute: BidAskAttribute,
}
Expand Down
4 changes: 2 additions & 2 deletions src/market_data/realtime/decoders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ pub(super) fn decode_bid_ask_tick(message: &mut ResponseMessage) -> Result<BidAs
let date = message.next_date_time()?;
let bid_price = message.next_double()?;
let ask_price = message.next_double()?;
let bid_size = message.next_long()?;
let ask_size = message.next_long()?;
let bid_size = message.next_double()?;
let ask_size = message.next_double()?;
let mask = message.next_int()?;

Ok(BidAsk {
Expand Down
4 changes: 2 additions & 2 deletions src/market_data/realtime/decoders/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ mod bid_ask_tests {
assert_eq!(bid_ask.time, OffsetDateTime::from_unix_timestamp(1678745793).unwrap(), "Wrong timestamp");
assert_eq!(bid_ask.bid_price, 3895.50, "Wrong bid price");
assert_eq!(bid_ask.ask_price, 3896.00, "Wrong ask price");
assert_eq!(bid_ask.bid_size, 9, "Wrong bid size");
assert_eq!(bid_ask.ask_size, 11, "Wrong ask size");
assert_eq!(bid_ask.bid_size, 9.0, "Wrong bid size");
assert_eq!(bid_ask.ask_size, 11.0, "Wrong ask size");
assert_eq!(bid_ask.bid_ask_attribute.bid_past_low, true, "Wrong bid past low flag");
assert_eq!(bid_ask.bid_ask_attribute.ask_past_high, true, "Wrong ask past high flag");
}
Expand Down
4 changes: 2 additions & 2 deletions src/market_data/realtime/tests/tick_data_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ fn test_tick_by_tick_bid_ask() {
let tick = &received_ticks[0];
assert_eq!(tick.bid_price, 3895.50, "Wrong bid price");
assert_eq!(tick.ask_price, 3896.00, "Wrong ask price");
assert_eq!(tick.bid_size, 9, "Wrong bid size");
assert_eq!(tick.ask_size, 11, "Wrong ask size");
assert_eq!(tick.bid_size, 9.0, "Wrong bid size");
assert_eq!(tick.ask_size, 11.0, "Wrong ask size");

// Verify request message
let request_messages = client.message_bus.request_messages();
Expand Down

0 comments on commit a894b52

Please sign in to comment.