eversal_lib/esi/market/
model.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub enum MarketOrderType {
6  Buy,
7  Sell,
8  All,
9}
10
11impl ToString for MarketOrderType {
12  fn to_string(&self) -> String {
13    match self {
14      MarketOrderType::Buy => "buy".to_string(),
15      MarketOrderType::Sell => "sell".to_string(),
16      MarketOrderType::All => "all".to_string(),
17    }
18  }
19}
20
21#[derive(Debug, Serialize, Deserialize)]
22pub struct CharacterMarketOrder {
23  pub duration: i32,
24  pub escrow: Option<f32>,
25  pub is_buy_order: Option<bool>,
26  pub is_corporation: bool,
27  pub issued: DateTime<Utc>,
28  pub location_id: i64,
29  pub min_volume: Option<i32>,
30  pub order_id: i64,
31  pub price: f32,
32  pub range: String,
33  pub region_id: i32,
34  pub state: Option<String>, // "cancelled" or "expired", required on history endpoint
35  pub type_id: i32,
36  pub volume_remain: f32,
37  pub volume_total: f32,
38}
39
40#[derive(Debug, Serialize, Deserialize)]
41pub struct CorporationMarketOrder {
42  pub duration: i32,
43  pub escrow: Option<f32>,
44  pub is_buy_order: Option<bool>,
45  pub issued: DateTime<Utc>,
46  pub location_id: i64,
47  pub min_volume: Option<i32>,
48  pub order_id: i64,
49  pub price: f32,
50  pub range: String,
51  pub region_id: i32,
52  pub state: Option<String>, // "cancelled" or "expired", required on history endpoint
53  pub type_id: i32,
54  pub volume_remain: f32,
55  pub volume_total: f32,
56  pub wallet_division: i32,
57}
58
59#[derive(Debug, Serialize, Deserialize)]
60pub struct MarketOrder {
61  pub duration: i32,
62  pub is_buy_order: bool,
63  pub issued: DateTime<Utc>,
64  pub location_id: i64,
65  pub min_volume: i32,
66  pub order_id: i64,
67  pub price: f32,
68  pub range: String,
69  pub system_id: i32,
70  pub type_id: i32,
71  pub volume_remain: f32,
72  pub volume_total: f32,
73}
74
75#[derive(Debug, Serialize, Deserialize)]
76pub struct MarketHistory {
77  pub average: f32,
78  pub date: String,
79  pub highest: f32,
80  pub lowest: f32,
81  pub order_count: i32,
82  pub volume: i64,
83}
84
85#[derive(Debug, Serialize, Deserialize)]
86pub struct MarketGroup {
87  pub description: String,
88  pub market_group_id: i32,
89  pub name: String,
90  pub parent_group_id: Option<i32>,
91  pub types: Vec<i32>,
92}
93
94#[derive(Debug, Serialize, Deserialize)]
95pub struct MarketPrice {
96  pub adjusted_price: Option<f32>,
97  pub average_price: Option<f32>,
98  pub type_id: i32,
99}