lamarge 0.5.1

Client for the LaMarge API: sign-in, takes, transfers, withdrawals and market making, each request checked before it is signed.
Documentation
//! Fill reads: current fills and fill history.

use futures_core::Stream;

use super::{
    Fills, PageRequest,
    page::{every, history},
};
use crate::{
    Result,
    model::{Fill, FillHistoryRow, Page},
    transport::{Call, ops},
};

impl Fills<'_> {
    /// Nonfinal fills plus the latest 50 final ones, newest first: a session's taker and maker
    /// fills, or a quoter identity's maker fills. Over 1000 the server answers
    /// `SNAPSHOT_TOO_LARGE`: page with [`history`](Self::history).
    pub async fn list(&self) -> Result<Vec<Fill>> {
        self.inner.send(Call::new(&ops::GET_FILLS), self.auth).await
    }

    /// One page of fill history, newest first.
    pub async fn history(&self, page: &PageRequest) -> Result<Page<FillHistoryRow>> {
        history(self.inner, self.auth, &ops::GET_FILL_HISTORY, page).await
    }

    /// Every fill, newest first, reading pages of `page_size` (clamped to `1..=500`) as
    /// consumed. The stream owns what it needs, so it outlives the handle.
    pub fn history_stream(
        &self,
        page_size: u16,
    ) -> impl Stream<Item = Result<FillHistoryRow>> + Send + Unpin + 'static {
        every(self.inner, self.auth, PageRequest::first(page_size), || {
            Call::new(&ops::GET_FILL_HISTORY)
        })
    }
}

#[cfg(test)]
mod tests;