use super::Market;
use crate::{
Result,
model::{Book, Health, Info, Markets, TradeProof, Venue, Volume},
transport::{Call, ops},
types::{FillId, VenueId},
};
impl Market<'_> {
pub async fn venues(&self) -> Result<Vec<Venue>> {
self.inner.send(Call::new(&ops::GET_VENUES), self.auth).await
}
pub async fn book(&self, from: &VenueId, to: &VenueId) -> Result<Book> {
let call = Call::new(&ops::GET_BOOK).query("from", from).query("to", to);
self.inner.send(call, self.auth).await
}
pub async fn markets(&self) -> Result<Markets> {
self.inner.send(Call::new(&ops::GET_MARKETS), self.auth).await
}
pub async fn volume(&self, a: &VenueId, b: &VenueId) -> Result<Volume> {
let call = Call::new(&ops::GET_VOLUME).query("a", a).query("b", b);
self.inner.send(call, self.auth).await
}
pub async fn info(&self) -> Result<Info> {
self.inner.send(Call::new(&ops::GET_INFO), self.auth).await
}
pub async fn health(&self) -> Result<Health> {
self.inner.send(Call::new(&ops::GET_HEALTH), self.auth).await
}
pub async fn trade_proof(&self, id: FillId) -> Result<TradeProof> {
self.inner.send(Call::new(&ops::GET_TRADE_PROOF).segment(id), self.auth).await
}
}
#[cfg(test)]
mod tests;