drm_core/exchange/
config.rs1use std::time::Duration;
2
3#[derive(Debug, Clone)]
4pub struct ExchangeConfig {
5 pub timeout: Duration,
6 pub rate_limit_per_second: u32,
7 pub max_retries: u32,
8 pub retry_delay: Duration,
9 pub verbose: bool,
10}
11
12impl Default for ExchangeConfig {
13 fn default() -> Self {
14 Self {
15 timeout: Duration::from_secs(30),
16 rate_limit_per_second: 10,
17 max_retries: 3,
18 retry_delay: Duration::from_secs(1),
19 verbose: false,
20 }
21 }
22}
23
24impl ExchangeConfig {
25 pub fn new() -> Self {
26 Self::default()
27 }
28
29 pub fn with_timeout(mut self, timeout: Duration) -> Self {
30 self.timeout = timeout;
31 self
32 }
33
34 pub fn with_rate_limit(mut self, requests_per_second: u32) -> Self {
35 self.rate_limit_per_second = requests_per_second;
36 self
37 }
38
39 pub fn with_retries(mut self, max_retries: u32, delay: Duration) -> Self {
40 self.max_retries = max_retries;
41 self.retry_delay = delay;
42 self
43 }
44
45 pub fn with_verbose(mut self, verbose: bool) -> Self {
46 self.verbose = verbose;
47 self
48 }
49}
50
51#[derive(Debug, Clone)]
52pub struct FetchMarketsParams {
53 pub limit: Option<usize>,
54 pub active_only: bool,
55}
56
57impl Default for FetchMarketsParams {
58 fn default() -> Self {
59 Self {
60 limit: None,
61 active_only: true,
62 }
63 }
64}
65
66#[derive(Debug, Clone, Default)]
67pub struct FetchOrdersParams {
68 pub market_id: Option<String>,
69}