barter_data_sniper/exchange/gateio/perpetual/
mod.rs1use self::trade::GateioFuturesTrades;
2use super::Gateio;
3use crate::{
4 exchange::{ExchangeServer, StreamSelector},
5 instrument::InstrumentData,
6 subscription::trade::PublicTrades,
7 transformer::stateless::StatelessTransformer,
8 ExchangeWsStream, NoInitialSnapshots,
9};
10use barter_instrument_copy::exchange::ExchangeId;
11
12pub mod trade;
14
15pub const WEBSOCKET_BASE_URL_GATEIO_PERPETUALS_USD: &str = "wss://fx-ws.gateio.ws/v4/ws/usdt";
19
20pub type GateioPerpetualsUsd = Gateio<GateioServerPerpetualsUsd>;
22
23#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
25pub struct GateioServerPerpetualsUsd;
26
27impl ExchangeServer for GateioServerPerpetualsUsd {
28 const ID: ExchangeId = ExchangeId::GateioPerpetualsUsd;
29
30 fn websocket_url() -> &'static str {
31 WEBSOCKET_BASE_URL_GATEIO_PERPETUALS_USD
32 }
33}
34
35impl<Instrument> StreamSelector<Instrument, PublicTrades> for GateioPerpetualsUsd
36where
37 Instrument: InstrumentData,
38{
39 type SnapFetcher = NoInitialSnapshots;
40 type Stream = ExchangeWsStream<
41 StatelessTransformer<Self, Instrument::Key, PublicTrades, GateioFuturesTrades>,
42 >;
43}
44
45pub const WEBSOCKET_BASE_URL_GATEIO_PERPETUALS_BTC: &str = "wss://fx-ws.gateio.ws/v4/ws/btc";
49
50pub type GateioPerpetualsBtc = Gateio<GateioServerPerpetualsBtc>;
52
53#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
55pub struct GateioServerPerpetualsBtc;
56
57impl ExchangeServer for GateioServerPerpetualsBtc {
58 const ID: ExchangeId = ExchangeId::GateioPerpetualsBtc;
59
60 fn websocket_url() -> &'static str {
61 WEBSOCKET_BASE_URL_GATEIO_PERPETUALS_BTC
62 }
63}
64
65impl<Instrument> StreamSelector<Instrument, PublicTrades> for GateioPerpetualsBtc
66where
67 Instrument: InstrumentData,
68{
69 type SnapFetcher = NoInitialSnapshots;
70 type Stream = ExchangeWsStream<
71 StatelessTransformer<Self, Instrument::Key, PublicTrades, GateioFuturesTrades>,
72 >;
73}