use crate::{
NoInitialSnapshots,
exchange::{
ExchangeServer, StreamSelector,
gateio::{Gateio, GateiotWsStream, perpetual::trade::GateioFuturesTrades},
},
instrument::InstrumentData,
subscription::trade::PublicTrades,
transformer::stateless::StatelessTransformer,
};
use barter_instrument::exchange::ExchangeId;
use std::fmt::Display;
pub const WEBSOCKET_BASE_URL_GATEIO_OPTIONS_USD: &str = "wss://op-ws.gateio.live/v4/ws";
pub type GateioOptions = Gateio<GateioServerOptions>;
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct GateioServerOptions;
impl ExchangeServer for GateioServerOptions {
const ID: ExchangeId = ExchangeId::GateioOptions;
fn websocket_url() -> &'static str {
WEBSOCKET_BASE_URL_GATEIO_OPTIONS_USD
}
}
impl<Instrument> StreamSelector<Instrument, PublicTrades> for GateioOptions
where
Instrument: InstrumentData,
{
type SnapFetcher = NoInitialSnapshots;
type Stream = GateiotWsStream<
StatelessTransformer<Self, Instrument::Key, PublicTrades, GateioFuturesTrades>,
>;
}
impl Display for GateioOptions {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "GateioOptions")
}
}