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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! Helper functions for creating order conditions with a fluent API.
//!
//! This module provides ergonomic helper functions that return partially-built
//! condition builders, enabling a fluent API for adding conditions to orders.
//!
//! # Example
//!
//! ```no_run
//! use ibapi::orders::builder::{price, time, margin};
//!
//! // Create conditions using helper functions
//! let price_cond = price(265598, "SMART").greater_than(150.0);
//! let time_cond = time().greater_than("20251230 14:30:00 US/Eastern");
//! let margin_cond = margin().less_than(30);
//! ```
use crate*;
use crateOrderCondition;
/// Create a price condition builder.
///
/// # Parameters
///
/// - `contract_id`: Contract identifier for the instrument to monitor
/// - `exchange`: Exchange where the price is monitored
///
/// # Example
///
/// ```no_run
/// use ibapi::orders::builder::price;
///
/// let condition = price(265598, "SMART")
/// .greater_than(150.0)
/// .build();
/// ```
/// Create a time condition builder.
///
/// # Example
///
/// ```no_run
/// use ibapi::orders::builder::time;
///
/// let condition = time()
/// .greater_than("20251230 14:30:00 US/Eastern")
/// .build();
/// ```
/// Create a margin condition builder.
///
/// # Example
///
/// ```no_run
/// use ibapi::orders::builder::margin;
///
/// let condition = margin()
/// .less_than(30)
/// .build();
/// ```
/// Create a volume condition builder.
///
/// # Parameters
///
/// - `contract_id`: Contract identifier for the instrument to monitor
/// - `exchange`: Exchange where volume is monitored
///
/// # Example
///
/// ```no_run
/// use ibapi::orders::builder::volume;
///
/// let condition = volume(76792991, "SMART")
/// .greater_than(50_000_000)
/// .build();
/// ```
/// Create an execution condition directly.
///
/// Unlike other condition types, execution conditions don't have a threshold,
/// so this function returns an `OrderCondition` directly rather than a builder.
///
/// # Parameters
///
/// - `symbol`: Symbol of the contract
/// - `security_type`: Security type (e.g., "STK", "OPT")
/// - `exchange`: Exchange where execution is monitored
///
/// # Example
///
/// ```no_run
/// use ibapi::orders::builder::execution;
///
/// let condition = execution("MSFT", "STK", "SMART");
/// ```
/// Create a percent change condition builder.
///
/// # Parameters
///
/// - `contract_id`: Contract identifier for the instrument to monitor
/// - `exchange`: Exchange where price change is monitored
///
/// # Example
///
/// ```no_run
/// use ibapi::orders::builder::percent_change;
///
/// let condition = percent_change(756733, "SMART")
/// .greater_than(2.0)
/// .build();
/// ```