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
107
108
109
110
111
112
113
//! DCE API Client Library
//!
//! A Rust client library for the Dalian Commodity Exchange (DCE) API.
//!
//! # Overview
//!
//! This library provides access to:
//! - **News**: Articles and announcements
//! - **Common**: Trade dates and variety (commodity) information
//! - **Market**: Quotes and market data (day, night, week, month)
//! - **Delivery**: Delivery data, warehouse receipts, costs
//! - **Member**: Member trading rankings
//! - **Trade**: Trading parameters and contract information
//! - **Settlement**: Settlement parameters
//!
//! # Quick Start
//!
//! ```no_run
//! use dceapi::{Client, Config};
//!
//! #[tokio::main]
//! async fn main() -> dceapi::Result<()> {
//! // Create client with credentials
//! let config = Config::new()
//! .with_api_key("your-api-key")
//! .with_secret("your-secret");
//!
//! let client = Client::new(config)?;
//!
//! // Get current trade date
//! let trade_date = client.common.get_curr_trade_date(None).await?;
//! println!("Current trade date: {}", trade_date.date);
//!
//! // Get variety list
//! let varieties = client.common.get_variety_list(None).await?;
//! for v in varieties {
//! println!("Variety: {} ({})", v.name, v.code);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! # Using Environment Variables
//!
//! You can also create a client from environment variables:
//!
//! ```no_run
//! use dceapi::Client;
//!
//! # async fn example() -> dceapi::Result<()> {
//! // Set DCE_API_KEY and DCE_SECRET environment variables
//! let client = Client::from_env()?;
//! # Ok(())
//! # }
//! ```
//!
//! # Error Handling
//!
//! All API methods return `Result<T, Error>`. The error types include:
//! - `Error::Api` - API returned an error response
//! - `Error::Auth` - Authentication failed
//! - `Error::Network` - Network or HTTP error
//! - `Error::Validation` - Invalid request parameters
//! - `Error::Parse` - Failed to parse response
//!
//! # Request Options
//!
//! Most methods accept optional `RequestOptions` to override defaults:
//!
//! ```no_run
//! use dceapi::{Client, Config, RequestOptions};
//!
//! # async fn example() -> dceapi::Result<()> {
//! # let client = Client::new(Config::new().with_api_key("k").with_secret("s"))?;
//! let opts = RequestOptions::new()
//! .with_trade_type(2) // Options instead of futures
//! .with_lang("en"); // English language
//!
//! let varieties = client.common.get_variety_list(Some(opts)).await?;
//! # Ok(())
//! # }
//! ```
// Re-export main types
pub use Client;
pub use ;
pub use ;
pub use RequestOptions;
pub use TokenManager;
// Re-export all models
pub use *;
// Re-export services for direct access
pub use ;
// Re-export news helper
pub use is_valid_column_id;