1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use crate::{
subscription::{trade::PublicTrades, Subscription},
Identifier,
};
use barter_integration::model::InstrumentKind;
use serde::Serialize;
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize)]
pub struct GateioChannel(pub &'static str);
impl GateioChannel {
pub const SPOT_TRADES: Self = Self("spot.trades");
pub const FUTURE_PERPETUAL_TRADES: Self = Self("futures.trades");
}
impl<Server> Identifier<GateioChannel> for Subscription<Server, PublicTrades> {
fn id(&self) -> GateioChannel {
match self.instrument.kind {
InstrumentKind::Spot => GateioChannel::SPOT_TRADES,
InstrumentKind::FuturePerpetual => GateioChannel::FUTURE_PERPETUAL_TRADES,
}
}
}
impl AsRef<str> for GateioChannel {
fn as_ref(&self) -> &str {
self.0
}
}