hyperliquid_rs/types/
order.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::trade::Side;
4
5#[derive(Debug, Clone, Deserialize)]
6pub struct OrderInfo {
7    pub coin: String,
8    pub side: Side,
9    pub limit_px: String,
10    pub sz: String,
11    pub filled_sz: String,
12    pub avg_fill_px: String,
13    pub order_type: OrderType,
14    pub reduce_only: bool,
15    pub timestamp: u64,
16    pub oid: u64,
17    pub status: OrderStatus,
18}
19
20#[derive(Debug, Clone, Deserialize)]
21pub enum OrderStatus {
22    Open,
23    Filled,
24    Cancelled,
25    Rejected,
26}
27
28#[derive(Debug, Clone, Serialize)]
29pub struct OrderRequest {
30    pub coin: String,
31    pub is_buy: bool,
32    pub sz: String,
33    pub limit_px: String,
34    pub order_type: OrderType,
35    pub reduce_only: bool,
36    pub cloid: Option<String>,
37}
38
39#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
40#[serde(rename_all = "camelCase")]
41pub enum OrderType {
42    Limit,
43    Market,
44}
45
46#[derive(Debug, Clone, Deserialize)]
47pub struct OrderStatusResponse {
48    pub error: Option<String>,
49    pub status: String,
50    pub order_id: Option<u64>,
51}