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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//! Fee-related types.
use serde::{Deserialize, Serialize};
/// Fee tier for the user, determined by notional (USD) volume.
#[derive(Debug, Clone, Deserialize)]
pub struct FeeTier {
/// Current fee tier for the user.
pub pricing_tier: String,
/// Lower bound (inclusive) of pricing tier in notional volume.
pub usd_from: String,
/// Upper bound (exclusive) of pricing tier in notional volume.
pub usd_to: String,
/// Taker fee rate, applied if the order takes liquidity.
pub taker_fee_rate: String,
/// Maker fee rate, applied if the order creates liquidity.
pub maker_fee_rate: String,
/// AOP (Advanced Order Placement) lower bound.
#[serde(default)]
pub aop_from: Option<String>,
/// AOP upper bound.
#[serde(default)]
pub aop_to: Option<String>,
}
/// Margin rate information.
#[derive(Debug, Clone, Deserialize)]
pub struct MarginRate {
/// The margin rate value.
pub value: String,
}
/// Goods and Services Tax information.
#[derive(Debug, Clone, Deserialize)]
pub struct GoodsAndServicesTax {
/// The GST rate.
pub rate: String,
/// The GST type (e.g., "INCLUSIVE", "EXCLUSIVE").
#[serde(rename = "type")]
pub gst_type: String,
}
/// Transaction summary containing fee information.
#[derive(Debug, Clone, Deserialize)]
pub struct TransactionSummary {
/// Total volume across assets, denoted in USD.
pub total_volume: f64,
/// Total fees across assets, denoted in USD.
pub total_fees: f64,
/// Fee tier information.
pub fee_tier: FeeTier,
/// Margin rate (if applicable).
pub margin_rate: Option<MarginRate>,
/// Goods and Services Tax (if applicable).
pub goods_and_services_tax: Option<GoodsAndServicesTax>,
/// Advanced Trade volume (non-inclusive of Pro) across assets, denoted in USD.
pub advanced_trade_only_volume: f64,
/// Advanced Trade fees (non-inclusive of Pro) across assets, denoted in USD.
pub advanced_trade_only_fees: f64,
/// Coinbase Pro volume across assets, denoted in USD.
pub coinbase_pro_volume: f64,
/// Coinbase Pro fees across assets, denoted in USD.
pub coinbase_pro_fees: f64,
/// Total balance (optional).
#[serde(default)]
pub total_balance: Option<String>,
}
/// Parameters for getting transaction summary.
#[derive(Debug, Clone, Default, Serialize)]
pub struct TransactionSummaryParams {
/// Product type filter (e.g., "SPOT", "FUTURE").
#[serde(skip_serializing_if = "Option::is_none")]
pub product_type: Option<String>,
/// Contract expiry type filter.
#[serde(skip_serializing_if = "Option::is_none")]
pub contract_expiry_type: Option<String>,
/// Product venue filter.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_venue: Option<String>,
}
impl TransactionSummaryParams {
/// Create new transaction summary parameters.
pub fn new() -> Self {
Self::default()
}
/// Set the product type filter.
pub fn product_type(mut self, product_type: impl Into<String>) -> Self {
self.product_type = Some(product_type.into());
self
}
/// Set the contract expiry type filter.
pub fn contract_expiry_type(mut self, contract_expiry_type: impl Into<String>) -> Self {
self.contract_expiry_type = Some(contract_expiry_type.into());
self
}
/// Set the product venue filter.
pub fn product_venue(mut self, product_venue: impl Into<String>) -> Self {
self.product_venue = Some(product_venue.into());
self
}
}