use crate::Currency;
use serde::Serialize;
#[derive(Default, Debug, Clone, Serialize)]
pub struct Book {
pub taker_gets: Currency,
pub taker_pays: Currency,
pub taker: String,
pub snapshot: Option<bool>,
pub both: Option<bool>,
}
impl Book {
pub fn new(taker_gets: Currency, taker_pays: Currency, taker: &str) -> Self {
Self {
taker_gets,
taker_pays,
taker: taker.to_owned(),
snapshot: None,
both: None,
}
}
pub fn snapshot(self, snapshot: bool) -> Self {
Self {
snapshot: Some(snapshot),
..self
}
}
pub fn both(self, both: bool) -> Self {
Self {
both: Some(both),
..self
}
}
}