pub struct TwapAlgorithm { /* private fields */ }Expand description
TWAP (Time-Weighted Average Price) execution algorithm.
This algorithm spreads an order over a specified time duration by breaking it into smaller slices executed at regular intervals. This helps minimize market impact and achieve a more representative average price.
Implementations§
Source§impl TwapAlgorithm
impl TwapAlgorithm
Sourcepub fn new(
signal: Signal,
total_quantity: Quantity,
duration: Duration,
num_slices: u32,
) -> Result<Self>
pub fn new( signal: Signal, total_quantity: Quantity, duration: Duration, num_slices: u32, ) -> Result<Self>
Create a new TWAP algorithm instance.
§Arguments
signal- The parent signal that triggered this algorithmtotal_quantity- Total quantity to be executedduration- Time period over which to spread the executionnum_slices- Number of smaller orders to break the total into
Trait Implementations§
Source§impl ExecutionAlgorithm for TwapAlgorithm
impl ExecutionAlgorithm for TwapAlgorithm
Source§fn status(&self) -> AlgoStatus
fn status(&self) -> AlgoStatus
Returns the current status of the algorithm.
Source§fn start(&mut self) -> Result<Vec<ChildOrderRequest>>
fn start(&mut self) -> Result<Vec<ChildOrderRequest>>
Start the algorithm and return any initial child orders.
Source§fn on_child_order_placed(&mut self, order: &Order)
fn on_child_order_placed(&mut self, order: &Order)
Called when a child order has been successfully placed.
Source§fn on_fill(&mut self, fill: &Fill) -> Result<Vec<ChildOrderRequest>>
fn on_fill(&mut self, fill: &Fill) -> Result<Vec<ChildOrderRequest>>
Called when a fill is received for one of this algorithm’s child orders.
Source§fn on_tick(&mut self, _tick: &Tick) -> Result<Vec<ChildOrderRequest>>
fn on_tick(&mut self, _tick: &Tick) -> Result<Vec<ChildOrderRequest>>
Called when market tick data is received (mainly for VWAP algorithms).
Source§fn on_timer(&mut self) -> Result<Vec<ChildOrderRequest>>
fn on_timer(&mut self) -> Result<Vec<ChildOrderRequest>>
Called when a timer event occurs (mainly for TWAP algorithms).
Auto Trait Implementations§
impl Freeze for TwapAlgorithm
impl RefUnwindSafe for TwapAlgorithm
impl Send for TwapAlgorithm
impl Sync for TwapAlgorithm
impl Unpin for TwapAlgorithm
impl UnwindSafe for TwapAlgorithm
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