pub enum StrategyAction {
Buy {
symbol: String,
quantity_lots: u32,
price: Option<Decimal>,
},
Sell {
symbol: String,
quantity_lots: u32,
price: Option<Decimal>,
},
Cancel {
order_id: String,
},
ModifyPrice {
order_id: String,
new_price: Decimal,
},
Hold,
}Expand description
An action the strategy wants to take.
Variants§
Buy
Place a new buy order.
Fields
Sell
Place a new sell order.
Fields
Cancel
Cancel an existing order.
ModifyPrice
Modify an existing order’s price.
Hold
Do nothing.
Implementations§
Source§impl StrategyAction
impl StrategyAction
Sourcepub fn market_buy(symbol: impl Into<String>, quantity_lots: u32) -> Self
pub fn market_buy(symbol: impl Into<String>, quantity_lots: u32) -> Self
Creates a market buy action.
Sourcepub fn limit_buy(
symbol: impl Into<String>,
quantity_lots: u32,
price: Decimal,
) -> Self
pub fn limit_buy( symbol: impl Into<String>, quantity_lots: u32, price: Decimal, ) -> Self
Creates a limit buy action.
Sourcepub fn market_sell(symbol: impl Into<String>, quantity_lots: u32) -> Self
pub fn market_sell(symbol: impl Into<String>, quantity_lots: u32) -> Self
Creates a market sell action.
Trait Implementations§
Source§impl Clone for StrategyAction
impl Clone for StrategyAction
Source§impl Debug for StrategyAction
impl Debug for StrategyAction
Source§impl<'de> Deserialize<'de> for StrategyAction
impl<'de> Deserialize<'de> for StrategyAction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for StrategyAction
impl Freeze for StrategyAction
impl Move for StrategyAction
impl RefUnwindSafe for StrategyAction
impl Send for StrategyAction
impl Sync for StrategyAction
impl Unpin for StrategyAction
impl UnsafeUnpin for StrategyAction
impl UnwindSafe for StrategyAction
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