pub struct PriceConditionBuilder { /* private fields */ }Expand description
Builder for PriceCondition.
§Example
use ibapi::orders::conditions::{PriceCondition, TriggerMethod};
let condition = PriceCondition::builder(12345, "NASDAQ")
.greater_than(150.0)
.trigger_method(TriggerMethod::Last)
.conjunction(false)
.build();Implementations§
Source§impl PriceConditionBuilder
impl PriceConditionBuilder
Sourcepub fn new(contract_id: i32, exchange: impl Into<String>) -> Self
pub fn new(contract_id: i32, exchange: impl Into<String>) -> Self
Create a new price condition builder.
§Parameters
contract_id: Contract identifier for the instrument to monitorexchange: Exchange where the price is monitored
Sourcepub fn greater_than(self, price: f64) -> Self
pub fn greater_than(self, price: f64) -> Self
Set trigger when price is greater than the specified value.
Sourcepub fn less_than(self, price: f64) -> Self
pub fn less_than(self, price: f64) -> Self
Set trigger when price is less than the specified value.
Sourcepub fn trigger_method(self, method: TriggerMethod) -> Self
pub fn trigger_method(self, method: TriggerMethod) -> Self
Set the trigger method for price evaluation.
§Example
use ibapi::orders::conditions::{PriceCondition, TriggerMethod};
let condition = PriceCondition::builder(12345, "NASDAQ")
.greater_than(150.0)
.trigger_method(TriggerMethod::Last)
.build();Sourcepub fn conjunction(self, is_conjunction: bool) -> Self
pub fn conjunction(self, is_conjunction: bool) -> Self
Set whether this is an AND (conjunction) or OR (disjunction) condition.
Default is true (AND).
Sourcepub fn build(self) -> PriceCondition
pub fn build(self) -> PriceCondition
Build the price condition.
Trait Implementations§
Source§impl Clone for PriceConditionBuilder
impl Clone for PriceConditionBuilder
Source§fn clone(&self) -> PriceConditionBuilder
fn clone(&self) -> PriceConditionBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PriceConditionBuilder
impl Debug for PriceConditionBuilder
Source§impl From<PriceConditionBuilder> for OrderCondition
impl From<PriceConditionBuilder> for OrderCondition
Source§fn from(builder: PriceConditionBuilder) -> Self
fn from(builder: PriceConditionBuilder) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PriceConditionBuilder
impl RefUnwindSafe for PriceConditionBuilder
impl Send for PriceConditionBuilder
impl Sync for PriceConditionBuilder
impl Unpin for PriceConditionBuilder
impl UnsafeUnpin for PriceConditionBuilder
impl UnwindSafe for PriceConditionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more