use crate::instrument::InstrumentData;
use crate::{
exchange::{
gateio::{perpetual::trade::GateioFuturesTrades, Gateio},
ExchangeId, ExchangeServer, StreamSelector,
},
subscription::trade::PublicTrades,
transformer::stateless::StatelessTransformer,
ExchangeWsStream,
};
pub const WEBSOCKET_BASE_URL_GATEIO_FUTURES_USD: &str = "wss://fx-ws.gateio.ws/v4/ws/delivery/usdt";
pub type GateioFuturesUsd = Gateio<GateioServerFuturesUsd>;
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct GateioServerFuturesUsd;
impl ExchangeServer for GateioServerFuturesUsd {
const ID: ExchangeId = ExchangeId::GateioFuturesUsd;
fn websocket_url() -> &'static str {
WEBSOCKET_BASE_URL_GATEIO_FUTURES_USD
}
}
impl<Instrument> StreamSelector<Instrument, PublicTrades> for GateioFuturesUsd
where
Instrument: InstrumentData,
{
type Stream = ExchangeWsStream<
StatelessTransformer<Self, Instrument::Id, PublicTrades, GateioFuturesTrades>,
>;
}
pub const WEBSOCKET_BASE_URL_GATEIO_FUTURES_BTC: &str = "wss://fx-ws.gateio.ws/v4/ws/delivery/btc";
pub type GateioFuturesBtc = Gateio<GateioServerFuturesBtc>;
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
pub struct GateioServerFuturesBtc;
impl ExchangeServer for GateioServerFuturesBtc {
const ID: ExchangeId = ExchangeId::GateioFuturesBtc;
fn websocket_url() -> &'static str {
WEBSOCKET_BASE_URL_GATEIO_FUTURES_BTC
}
}
impl<Instrument> StreamSelector<Instrument, PublicTrades> for GateioFuturesBtc
where
Instrument: InstrumentData,
{
type Stream = ExchangeWsStream<
StatelessTransformer<Self, Instrument::Id, PublicTrades, GateioFuturesTrades>,
>;
}