filter active orders based on pair
This commit is contained in:
parent
fbdb481aa0
commit
7230b7c67d
@ -1,4 +1,5 @@
|
|||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
|
use std::error::Error;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -10,6 +11,7 @@ use bitfinex::ticker::TradingPairTicker;
|
|||||||
use futures_retry::{FutureRetry, RetryPolicy, StreamRetryExt};
|
use futures_retry::{FutureRetry, RetryPolicy, StreamRetryExt};
|
||||||
use futures_util::task::FutureObj;
|
use futures_util::task::FutureObj;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
use tokio::macros::support::Future;
|
||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
|
|
||||||
use crate::currency::SymbolPair;
|
use crate::currency::SymbolPair;
|
||||||
@ -18,8 +20,6 @@ use crate::models::{
|
|||||||
PriceTicker, TradingPlatform,
|
PriceTicker, TradingPlatform,
|
||||||
};
|
};
|
||||||
use crate::BoxError;
|
use crate::BoxError;
|
||||||
use std::error::Error;
|
|
||||||
use tokio::macros::support::Future;
|
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||||
pub enum Exchange {
|
pub enum Exchange {
|
||||||
@ -83,7 +83,13 @@ impl Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn active_orders(&self, pair: &SymbolPair) -> Result<Vec<ActiveOrder>, BoxError> {
|
pub async fn active_orders(&self, pair: &SymbolPair) -> Result<Vec<ActiveOrder>, BoxError> {
|
||||||
self.inner.active_orders(pair).await
|
Ok(self
|
||||||
|
.inner
|
||||||
|
.active_orders(pair)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.filter(|x| &x.symbol == pair)
|
||||||
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn submit_order(&self, order: &OrderForm) -> Result<ActiveOrder, BoxError> {
|
pub async fn submit_order(&self, order: &OrderForm) -> Result<ActiveOrder, BoxError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user