Skip to main content

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// Contracts
24pub mod contract;
25pub use contract::{
26    Contract, FuturesContract, FuturesContractBuilder, FuturesContractParseError, FuturesMonth,
27    FuturesRoot,
28};
29
30// Exchange
31pub mod exchange;
32pub use exchange::{Exchange, MarginType};
33
34// Types of instrument supported, i.e spot, perp etc.
35pub mod instrument_type;
36pub use instrument_type::{InstrumentType, InstrumentTypeError};
37
38// Pragma Aggregations
39pub mod aggregation;
40pub use aggregation::AggregationMode;
41
42// An util to manage multiple tasks gracefully
43#[cfg(feature = "services")]
44pub mod services;
45
46// A structure allowing us to have multiple handles dependent on each others.
47#[cfg(feature = "task-group")]
48pub mod task_group;
49
50// Pragma Time Intervals
51pub mod interval;
52pub use interval::Interval;
53
54// Protobuf generated schema. Only related to `entries`.
55#[cfg(feature = "proto")]
56pub mod schema {
57    include!(concat!(env!("OUT_DIR"), "/pragma_common.rs"));
58}
59
60// Used to serialize a struct into a payload with protobuf.
61#[cfg(feature = "proto")]
62pub trait ProtoSerialize {
63    fn to_proto_bytes(&self) -> Vec<u8>;
64}
65
66// Used to deserialize a protobuf payload into a struct.
67#[cfg(feature = "proto")]
68pub trait ProtoDeserialize {
69    fn from_proto_bytes(bytes: &[u8]) -> Result<Self, prost::DecodeError>
70    where
71        Self: Sized;
72}