pub enum TakeProfitTrader {
Finite(NonZero<Decimal256>),
PosInfinity,
}
Expand description
The take profit price for a position, as supplied by client messsages (in terms of BaseInQuote).
Infinite take profit price is possible. However, this is an error in the case of short positions or collateral-is-quote markets.
Variants§
Implementations§
§impl TakeProfitTrader
impl TakeProfitTrader
pub fn as_finite(&self) -> Option<NonZero<Decimal256>>
pub fn as_finite(&self) -> Option<NonZero<Decimal256>>
helper to extract the inner value if it is finite
pub fn into_notional(&self, market_type: MarketType) -> Option<Price>
pub fn into_notional(&self, market_type: MarketType) -> Option<Price>
Convert to the internal price representation used by our system, as collateral / notional
.
Trait Implementations§
§impl Clone for TakeProfitTrader
impl Clone for TakeProfitTrader
§fn clone(&self) -> TakeProfitTrader
fn clone(&self) -> TakeProfitTrader
Returns a copy 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 more§impl Debug for TakeProfitTrader
impl Debug for TakeProfitTrader
§impl<'de> Deserialize<'de> for TakeProfitTrader
impl<'de> Deserialize<'de> for TakeProfitTrader
§fn deserialize<D>(
deserializer: D
) -> Result<TakeProfitTrader, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<TakeProfitTrader, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for TakeProfitTrader
impl Display for TakeProfitTrader
§impl From<PriceBaseInQuote> for TakeProfitTrader
impl From<PriceBaseInQuote> for TakeProfitTrader
§fn from(val: PriceBaseInQuote) -> TakeProfitTrader
fn from(val: PriceBaseInQuote) -> TakeProfitTrader
Converts to this type from the input type.
§impl FromStr for TakeProfitTrader
impl FromStr for TakeProfitTrader
§impl JsonSchema for TakeProfitTrader
impl JsonSchema for TakeProfitTrader
§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
§fn json_schema(_gen: &mut SchemaGenerator) -> Schema
fn json_schema(_gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read more§impl PartialEq for TakeProfitTrader
impl PartialEq for TakeProfitTrader
§fn eq(&self, other: &TakeProfitTrader) -> bool
fn eq(&self, other: &TakeProfitTrader) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl Serialize for TakeProfitTrader
impl Serialize for TakeProfitTrader
§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl TryFrom<&str> for TakeProfitTrader
impl TryFrom<&str> for TakeProfitTrader
impl Copy for TakeProfitTrader
impl Eq for TakeProfitTrader
impl StructuralEq for TakeProfitTrader
impl StructuralPartialEq for TakeProfitTrader
Auto Trait Implementations§
impl RefUnwindSafe for TakeProfitTrader
impl Send for TakeProfitTrader
impl Sync for TakeProfitTrader
impl Unpin for TakeProfitTrader
impl UnwindSafe for TakeProfitTrader
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>,
Casts
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
Mutably borrows from an owned value. Read more
§impl<T> QueryResultExt for Twhere
T: Serialize,
impl<T> QueryResultExt for Twhere T: Serialize,
§fn query_result(&self) -> Result<Binary, Error>
fn query_result(&self) -> Result<Binary, Error>
Convert the value to its JSON representation