Expose the current committed tick size by outcome ID

This commit is contained in:
2026-12-03 09:32:49 +08:00
parent b523a8890f
commit 81595a89ee
10 changed files with 149 additions and 4 deletions
+19
View File
@@ -2285,6 +2285,14 @@ fn configured_ticks_bind_order_amounts_execution_and_opening_price() {
e.execute(json!({"op":"list","id":"invalid","market":"legacy","rules":"r"}))
.unwrap();
assert!(e.execute(json!({"op":"assets","market":"legacy"})).unwrap()["tick_size"].is_null());
assert_eq!(
json!(e.minimum_tick_size("eb:NO:legacy").unwrap()),
json!(0.01)
);
assert!(e
.minimum_tick_size("eb:YES:no-such-market")
.unwrap()
.is_none());
e.execute(json!({"op":"order","id":"old","market":"legacy","outcome":"YES","account":"bob","side":"buy","price":0,"qty":1})).unwrap();
}
@@ -2293,11 +2301,18 @@ fn replayed_tick_changes_preserve_valid_orders_and_release_only_residuals() {
let dir = tempdir().unwrap();
let path = dir.path().join("tick-changes.db");
let mut e = Exchange::open(&path).unwrap();
let reader = Exchange::open(&path).unwrap();
let mut original = Value::Null;
let mut cursor = Value::Null;
for line in include_str!("../../../docs/examples/tick-changes.jsonl").lines() {
let cmd: Value = serde_json::from_str(line).unwrap();
let response = e.execute(cmd.clone()).unwrap();
if let Some(step) = cmd.get("new_tick_size").or(cmd.get("tick_size")) {
for token in ["eb:YES:cup", "eb:NO:cup"] {
let current = reader.minimum_tick_size(token).unwrap().unwrap();
assert_eq!(current.to_string(), step.as_str().unwrap());
}
}
match cmd["op"].as_str().unwrap() {
"tick_size_change" if cmd["id"] == "finer" => {
assert_eq!(response["canceled"], json!([]))
@@ -2325,6 +2340,10 @@ fn replayed_tick_changes_preserve_valid_orders_and_release_only_residuals() {
}
drop(e);
let mut e = Exchange::open(path).unwrap();
assert_eq!(
json!(e.minimum_tick_size("eb:YES:cup").unwrap()),
json!(0.1)
);
let before = state(&mut e);
let position = before["positions"]
.as_array()