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
use crate::http::{Credentials, Method, request::Request};
/// # Get a price-triggered order
///
/// Retrieve details of a specific price-triggered order (auto order/conditional order) by order ID.
///
/// ## Order Status Values:
/// - "open": Waiting to trigger
/// - "cancelled": Manually cancelled
/// - "finish": Successfully executed
/// - "failed": Failed to execute
/// - "expired": Expired
///
/// ## Response includes:
/// - Order ID and creation time
/// - Trigger condition (price and rule)
/// - Order details (currency pair, side, amount, price)
/// - Current status and execution details
/// - Account information
///
/// [Gate API Documentation](https://www.gate.com/docs/developers/apiv4/#get-a-price-triggered-order)
pub struct GetPriceOrder {
/// Order ID of the price-triggered order to retrieve
pub order_id: String,
/// API credentials for authentication
pub credentials: Option<Credentials>,
}
impl GetPriceOrder {
/// Creates a new GetPriceOrder request with the specified order ID
pub fn new(order_id: &str) -> Self {
Self {
order_id: order_id.to_owned(),
credentials: None,
}
}
/// Sets the API credentials for authentication
pub fn credentials(mut self, creds: Credentials) -> Self {
self.credentials = Some(creds);
self
}
}
impl From<GetPriceOrder> for Request {
fn from(request: GetPriceOrder) -> Request {
let params = Vec::new();
Request {
method: Method::Get,
path: format!("/api/v4/spot/price_orders/{}", request.order_id).into(),
params,
payload: "".to_string(),
x_gate_exp_time: None,
credentials: request.credentials,
sign: true,
}
}
}