pragma_common/
lib.rs

1// Web3 types
2pub mod web3;
3
4// Entries retrieved through different markets.
5// This is the data that we'll push in our internal Kafka.
6pub mod entries;
7
8#[cfg(feature = "starknet")]
9pub mod starknet;
10
11// Telemetry init through OTEL
12#[cfg(feature = "telemetry")]
13pub mod telemetry;
14
15// Trading types
16pub mod trading;
17pub use trading::Side;
18
19// Pair
20pub mod pair;
21pub use pair::{AssetSymbol, Pair, RawMarketName};
22
23// Exchange
24pub mod exchange;
25pub use exchange::{Exchange, MarginType};
26
27// Types of instrument supported, i.e spot, perp etc.
28pub mod instrument_type;
29pub use instrument_type::{InstrumentType, InstrumentTypeError};
30
31// Pragma Aggregations
32pub mod aggregation;
33pub use aggregation::AggregationMode;
34
35// An util to manage multiple tasks gracefully
36#[cfg(feature = "services")]
37pub mod services;
38
39// A structure allowing us to have multiple handles dependent on each others.
40#[cfg(feature = "task-group")]
41pub mod task_group;
42
43// Pragma Time Intervals
44pub mod interval;
45pub use interval::Interval;
46
47// Protobuf generated schema. Only related to `entries`.
48#[cfg(feature = "proto")]
49pub mod schema {
50    include!(concat!(env!("OUT_DIR"), "/pragma_common.rs"));
51}
52
53// Used to serialize a struct into a payload with protobuf.
54#[cfg(feature = "proto")]
55pub trait ProtoSerialize {
56    fn to_proto_bytes(&self) -> Vec<u8>;
57}
58
59// Used to deserialize a protobuf payload into a struct.
60#[cfg(feature = "proto")]
61pub trait ProtoDeserialize {
62    fn from_proto_bytes(bytes: &[u8]) -> Result<Self, prost::DecodeError>
63    where
64        Self: Sized;
65}