use async_trait::async_trait;
use crate::core::types::{
AccountType, ExchangeResult, FundingRate, Position,
PositionModification, PositionQuery,
OpenInterest, MarkPrice, ClosedPnlRecord, LongShortRatio,
};
use super::ExchangeIdentity;
#[async_trait]
pub trait Positions: ExchangeIdentity {
async fn get_positions(&self, query: PositionQuery) -> ExchangeResult<Vec<Position>>;
async fn get_funding_rate(
&self,
symbol: &str,
account_type: AccountType,
) -> ExchangeResult<FundingRate>;
async fn modify_position(&self, req: PositionModification) -> ExchangeResult<()>;
async fn get_open_interest(
&self,
symbol: &str,
account_type: AccountType,
) -> ExchangeResult<OpenInterest> {
let _ = (symbol, account_type);
Err(crate::core::types::ExchangeError::UnsupportedOperation(
"get_open_interest not implemented".into(),
))
}
async fn get_funding_rate_history(
&self,
symbol: &str,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> ExchangeResult<Vec<FundingRate>> {
let _ = (symbol, start_time, end_time, limit);
Err(crate::core::types::ExchangeError::UnsupportedOperation(
"get_funding_rate_history not implemented".into(),
))
}
async fn get_mark_price(
&self,
symbol: &str,
) -> ExchangeResult<MarkPrice> {
let _ = symbol;
Err(crate::core::types::ExchangeError::UnsupportedOperation(
"get_mark_price not implemented".into(),
))
}
async fn get_closed_pnl(
&self,
symbol: Option<&str>,
start_time: Option<u64>,
end_time: Option<u64>,
limit: Option<u32>,
) -> ExchangeResult<Vec<ClosedPnlRecord>> {
let _ = (symbol, start_time, end_time, limit);
Err(crate::core::types::ExchangeError::UnsupportedOperation(
"get_closed_pnl not implemented".into(),
))
}
async fn get_long_short_ratio(
&self,
symbol: &str,
account_type: AccountType,
) -> ExchangeResult<LongShortRatio> {
let _ = (symbol, account_type);
Err(crate::core::types::ExchangeError::UnsupportedOperation(
"get_long_short_ratio not implemented".into(),
))
}
}