use async_trait::async_trait;
use crate::core::types::{
AccountType, ExchangeResult, Kline, MarketDataCapabilities, OrderBook, Price,
SymbolInfo, SymbolInput, Ticker,
};
use super::ExchangeIdentity;
#[async_trait]
pub trait MarketData: ExchangeIdentity {
async fn get_price(
&self,
symbol: SymbolInput<'_>,
account_type: AccountType,
) -> ExchangeResult<Price>;
async fn get_orderbook(
&self,
symbol: SymbolInput<'_>,
depth: Option<u16>,
account_type: AccountType,
) -> ExchangeResult<OrderBook>;
async fn get_klines(
&self,
symbol: SymbolInput<'_>,
interval: &str,
limit: Option<u16>,
account_type: AccountType,
end_time: Option<i64>,
) -> ExchangeResult<Vec<Kline>>;
async fn get_ticker(
&self,
symbol: SymbolInput<'_>,
account_type: AccountType,
) -> ExchangeResult<Ticker>;
async fn ping(&self) -> ExchangeResult<()>;
async fn get_exchange_info(&self, account_type: AccountType) -> ExchangeResult<Vec<SymbolInfo>> {
let _ = account_type;
Err(crate::core::types::ExchangeError::UnsupportedOperation(
"get_exchange_info not implemented for this connector".to_string(),
))
}
fn market_data_capabilities(&self, account_type: AccountType) -> MarketDataCapabilities {
let _ = account_type;
MarketDataCapabilities::permissive()
}
}