pub struct NewOrder { /* private fields */ }Expand description
Order to be placed.
An order at market is executed at once. A limit, a stop and a stop-limit order wait at
their price until the market reaches it, till they are cancelled or, when
good_till names a moment, till then.
Stop loss and take profit are given as prices or as distances from the price the order is executed at: the stop loss lies that far below the price of a buy and above the price of a sell, the take profit on the other side. The server takes only distances for an order at market.
Implementations§
Source§impl NewOrder
impl NewOrder
Sourcepub const fn market(
account: AccountId,
symbol: SymbolId,
side: TradeSide,
volume: Volume,
) -> Self
pub const fn market( account: AccountId, symbol: SymbolId, side: TradeSide, volume: Volume, ) -> Self
Orders the volume, in units of the symbol, at the price of the market.
Sourcepub const fn limit(
account: AccountId,
symbol: SymbolId,
side: TradeSide,
volume: Volume,
price: Price,
) -> Self
pub const fn limit( account: AccountId, symbol: SymbolId, side: TradeSide, volume: Volume, price: Price, ) -> Self
Orders the volume, in units of the symbol, at the given price or a better one.
Sourcepub const fn stop(
account: AccountId,
symbol: SymbolId,
side: TradeSide,
volume: Volume,
price: Price,
) -> Self
pub const fn stop( account: AccountId, symbol: SymbolId, side: TradeSide, volume: Volume, price: Price, ) -> Self
Orders the volume, in units of the symbol, at market once the given price is reached.
Sourcepub const fn stop_limit(
account: AccountId,
symbol: SymbolId,
side: TradeSide,
volume: Volume,
stop: Price,
slippage: u32,
) -> Self
pub const fn stop_limit( account: AccountId, symbol: SymbolId, side: TradeSide, volume: Volume, stop: Price, slippage: u32, ) -> Self
Orders the volume, in units of the symbol, once the given stop price is reached, at a price no further from it than the slippage, in points of the symbol.
The server models the limit of a stop-limit order as that distance and takes no limit
price for it. The server itself accepts any slippage up to the largest value of the
wire integer, so the bound is checked before the order is sent: the slippage is at
least one point and, taken as a distance in price, no larger than the stop price,
beyond which the limit of a sell order would not be a positive price. A slippage
outside that range yields ValueError::BelowMinimum or ValueError::AboveMaximum.
Sourcepub const fn good_till(self, expiry: Timestamp) -> Self
pub const fn good_till(self, expiry: Timestamp) -> Self
Keeps a pending order in force till the given moment and no longer.
An order at market does not wait, so one with an expiry is refused before it is sent.
Sourcepub fn label(self, label: Label) -> Self
pub fn label(self, label: Label) -> Self
Gives the order a label, which the position it opens keeps.
Sourcepub fn comment(self, comment: Comment) -> Self
pub fn comment(self, comment: Comment) -> Self
Gives the order a comment, which the position it opens keeps.
Sourcepub const fn stop_loss(self, price: Price) -> Self
pub const fn stop_loss(self, price: Price) -> Self
Sets a stop loss at the given price, in place of one set before.
An order at market with a stop loss given as a price is refused before it is sent.
Sourcepub const fn take_profit(self, price: Price) -> Self
pub const fn take_profit(self, price: Price) -> Self
Sets a take profit at the given price, in place of one set before.
An order at market with a take profit given as a price is refused before it is sent.
Sourcepub const fn stop_loss_distance(self, distance: Price) -> Self
pub const fn stop_loss_distance(self, distance: Price) -> Self
Sets a stop loss at the given distance from the price of execution, in place of one set before.
Sourcepub const fn take_profit_distance(self, distance: Price) -> Self
pub const fn take_profit_distance(self, distance: Price) -> Self
Sets a take profit at the given distance from the price of execution, in place of one set before.