pub enum DeferredExecItem {
Show 13 variants
OpenPosition {
slippage_assert: Option<SlippageAssert>,
leverage: LeverageToBase,
direction: DirectionToBase,
max_gains: Option<MaxGainsInQuote>,
stop_loss_override: Option<PriceBaseInQuote>,
take_profit: Option<TakeProfitTrader>,
amount: NonZero<Collateral>,
crank_fee: Collateral,
crank_fee_usd: Usd,
},
UpdatePositionAddCollateralImpactLeverage {
id: PositionId,
amount: NonZero<Collateral>,
},
UpdatePositionAddCollateralImpactSize {
id: PositionId,
slippage_assert: Option<SlippageAssert>,
amount: NonZero<Collateral>,
},
UpdatePositionRemoveCollateralImpactLeverage {
id: PositionId,
amount: NonZero<Collateral>,
},
UpdatePositionRemoveCollateralImpactSize {
id: PositionId,
amount: NonZero<Collateral>,
slippage_assert: Option<SlippageAssert>,
},
UpdatePositionLeverage {
id: PositionId,
leverage: LeverageToBase,
slippage_assert: Option<SlippageAssert>,
},
UpdatePositionMaxGains {
id: PositionId,
max_gains: MaxGainsInQuote,
},
UpdatePositionTakeProfitPrice {
id: PositionId,
price: TakeProfitTrader,
},
UpdatePositionStopLossPrice {
id: PositionId,
stop_loss: StopLoss,
},
ClosePosition {
id: PositionId,
slippage_assert: Option<SlippageAssert>,
},
SetTriggerOrder {
id: PositionId,
stop_loss_override: Option<PriceBaseInQuote>,
take_profit: Option<TakeProfitTrader>,
},
PlaceLimitOrder {
trigger_price: PriceBaseInQuote,
leverage: LeverageToBase,
direction: DirectionToBase,
max_gains: Option<MaxGainsInQuote>,
stop_loss_override: Option<PriceBaseInQuote>,
take_profit: Option<TakeProfitTrader>,
amount: NonZero<Collateral>,
crank_fee: Collateral,
crank_fee_usd: Usd,
},
CancelLimitOrder {
order_id: OrderId,
},
}
Expand description
A deferred execution work item
Variants§
OpenPosition
Fields
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
leverage: LeverageToBase
Leverage of new position
direction: DirectionToBase
Direction of new position
max_gains: Option<MaxGainsInQuote>
Maximum gains of new position
stop_loss_override: Option<PriceBaseInQuote>
Stop loss price of new position
take_profit: Option<TakeProfitTrader>
Take profit price of new position
amount: NonZero<Collateral>
The amount of collateral provided
crank_fee: Collateral
Crank fee already charged
Note that this field only exists for variants where there isn’t a position or order to charge the fee against. In those cases, the position/order itself is immediately updated to reflect the new charge.
Open a new position
UpdatePositionAddCollateralImpactLeverage
Fields
id: PositionId
ID of position to update
amount: NonZero<Collateral>
The amount of collateral provided
Add collateral to a position, causing leverage to decrease
The amount of collateral to add must be attached as funds
UpdatePositionAddCollateralImpactSize
Fields
id: PositionId
ID of position to update
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
amount: NonZero<Collateral>
The amount of collateral provided
Add collateral to a position, causing notional size to increase
The amount of collateral to add must be attached as funds
UpdatePositionRemoveCollateralImpactLeverage
Fields
id: PositionId
ID of position to update
amount: NonZero<Collateral>
Amount of funds to remove from the position
Remove collateral from a position, causing leverage to increase
UpdatePositionRemoveCollateralImpactSize
Fields
id: PositionId
ID of position to update
amount: NonZero<Collateral>
Amount of funds to remove from the position
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
Remove collateral from a position, causing notional size to decrease
UpdatePositionLeverage
Fields
id: PositionId
ID of position to update
leverage: LeverageToBase
New leverage of the position
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
Modify the leverage of the position
This will impact the notional size of the position
UpdatePositionMaxGains
Fields
id: PositionId
ID of position to update
max_gains: MaxGainsInQuote
New max gains of the position
Modify the max gains of a position
UpdatePositionTakeProfitPrice
Fields
id: PositionId
ID of position to update
price: TakeProfitTrader
New take profit price of the position
Modify the take profit price of a position
UpdatePositionStopLossPrice
Fields
id: PositionId
ID of position to update
Modify the stop loss price of a position
ClosePosition
Fields
id: PositionId
ID of position to close
slippage_assert: Option<SlippageAssert>
Assertion that the price has not moved too far
Close a position
SetTriggerOrder
Fields
id: PositionId
ID of position to modify
stop_loss_override: Option<PriceBaseInQuote>
New stop loss price of the position Passing None will remove the override.
take_profit: Option<TakeProfitTrader>
New take_profit price of the position Passing None will bypass changing this
Set a stop loss or take profit override.
PlaceLimitOrder
Fields
trigger_price: PriceBaseInQuote
Price when the order should trigger
leverage: LeverageToBase
Leverage of new position
direction: DirectionToBase
Direction of new position
max_gains: Option<MaxGainsInQuote>
Maximum gains of new position
stop_loss_override: Option<PriceBaseInQuote>
Stop loss price of new position
take_profit: Option<TakeProfitTrader>
Take profit price of new position
amount: NonZero<Collateral>
The amount of collateral provided
crank_fee: Collateral
Crank fee already charged
Set a limit order to open a position when the price of the asset hits the specified trigger price.
CancelLimitOrder
Cancel an open limit order
Implementations§
source§impl DeferredExecItem
impl DeferredExecItem
sourcepub fn target(&self) -> DeferredExecTarget
pub fn target(&self) -> DeferredExecTarget
What entity in the system is targetted by this item.
sourcepub fn deposited_amount(&self) -> Collateral
pub fn deposited_amount(&self) -> Collateral
How much collateral was deposited with this item.
Trait Implementations§
source§impl Clone for DeferredExecItem
impl Clone for DeferredExecItem
source§fn clone(&self) -> DeferredExecItem
fn clone(&self) -> DeferredExecItem
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DeferredExecItem
impl Debug for DeferredExecItem
source§impl<'de> Deserialize<'de> for DeferredExecItem
impl<'de> Deserialize<'de> for DeferredExecItem
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>,
source§impl JsonSchema for DeferredExecItem
impl JsonSchema for DeferredExecItem
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl PartialEq for DeferredExecItem
impl PartialEq for DeferredExecItem
source§fn eq(&self, other: &DeferredExecItem) -> bool
fn eq(&self, other: &DeferredExecItem) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for DeferredExecItem
impl Serialize for DeferredExecItem
impl StructuralPartialEq for DeferredExecItem
Auto Trait Implementations§
impl RefUnwindSafe for DeferredExecItem
impl Send for DeferredExecItem
impl Sync for DeferredExecItem
impl Unpin for DeferredExecItem
impl UnwindSafe for DeferredExecItem
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more