Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fractional size with tick by tick data #206

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading