Apply market tick changes atomically and resume their event history

This commit is contained in:
2026-12-03 06:40:56 +08:00
parent 2269752b9e
commit 53b36cce82
12 changed files with 309 additions and 2 deletions
+6 -1
View File
@@ -8,7 +8,7 @@ use std::num::NonZeroU32;
pub(crate) struct TickSize(pub i64);
impl TickSize {
pub fn configure(tx: &Transaction, market: &str, value: &str) -> Result<()> {
pub(crate) fn parse(value: &str) -> Result<Self> {
let micros = match value.trim_end_matches('0') {
"0.1" => 100_000,
"0.01" => 10_000,
@@ -18,6 +18,11 @@ impl TickSize {
"0.0001" => 100,
_ => anyhow::bail!("unsupported tick_size"),
};
Ok(Self(micros))
}
pub fn configure(tx: &Transaction, market: &str, value: &str) -> Result<()> {
let micros = Self::parse(value)?.0;
tx.execute(
"INSERT INTO market_tick_sizes(market,step_micros) VALUES(?,?)",
params![market, micros],