Apply market tick changes atomically and resume their event history
This commit is contained in:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user