pub struct PriceBaseInQuote(/* private fields */);
Expand description
The price of the currency pair, given as quote / base
, e.g. “20,000 USD per BTC”.
Implementations§
§impl PriceBaseInQuote
impl PriceBaseInQuote
pub fn into_notional_price(self, market_type: MarketType) -> Price
pub fn into_notional_price(self, market_type: MarketType) -> Price
Convert to the internal price representation used by our system, as collateral / notional
.
pub fn into_price_key(self, market_type: MarketType) -> PriceKey
pub fn into_price_key(self, market_type: MarketType) -> PriceKey
Convert into a PriceKey representation.
pub fn try_from_number(
raw: Signed<Decimal256>
) -> Result<PriceBaseInQuote, Error>
pub fn try_from_number( raw: Signed<Decimal256> ) -> Result<PriceBaseInQuote, Error>
Try to convert a signed decimal into a price.
pub fn into_number(&self) -> Signed<Decimal256>
pub fn into_number(&self) -> Signed<Decimal256>
Convert into a signed decimal.
pub fn into_non_zero(&self) -> NonZero<Decimal256>
pub fn into_non_zero(&self) -> NonZero<Decimal256>
Convert into a non-zero decimal.
pub fn from_non_zero(raw: NonZero<Decimal256>) -> PriceBaseInQuote
pub fn from_non_zero(raw: NonZero<Decimal256>) -> PriceBaseInQuote
Convert from a non-zero decimal.
pub fn try_into_usd(&self, market_id: &MarketId) -> Option<PriceCollateralInUsd>
pub fn try_into_usd(&self, market_id: &MarketId) -> Option<PriceCollateralInUsd>
Derive the USD price from base and market type. This is only possible when one of the assets is USD.
Trait Implementations§
§impl Clone for PriceBaseInQuote
impl Clone for PriceBaseInQuote
§fn clone(&self) -> PriceBaseInQuote
fn clone(&self) -> PriceBaseInQuote
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 PriceBaseInQuote
impl Debug for PriceBaseInQuote
§impl<'de> Deserialize<'de> for PriceBaseInQuote
impl<'de> Deserialize<'de> for PriceBaseInQuote
§fn deserialize<__D>(
__deserializer: __D
) -> Result<PriceBaseInQuote, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<PriceBaseInQuote, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Display for PriceBaseInQuote
impl Display for PriceBaseInQuote
§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 PriceBaseInQuote
impl FromStr for PriceBaseInQuote
§impl JsonSchema for PriceBaseInQuote
impl JsonSchema for PriceBaseInQuote
§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. 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 PriceBaseInQuote
impl PartialEq for PriceBaseInQuote
§fn eq(&self, other: &PriceBaseInQuote) -> bool
fn eq(&self, other: &PriceBaseInQuote) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl Serialize for PriceBaseInQuote
impl Serialize for PriceBaseInQuote
§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 PriceBaseInQuote
impl TryFrom<&str> for PriceBaseInQuote
§impl TryFrom<Price> for PriceBaseInQuote
impl TryFrom<Price> for PriceBaseInQuote
§fn try_from(
value: Price
) -> Result<PriceBaseInQuote, <PriceBaseInQuote as TryFrom<Price>>::Error>
fn try_from( value: Price ) -> Result<PriceBaseInQuote, <PriceBaseInQuote as TryFrom<Price>>::Error>
Performs the conversion.
impl Copy for PriceBaseInQuote
impl Eq for PriceBaseInQuote
impl StructuralEq for PriceBaseInQuote
impl StructuralPartialEq for PriceBaseInQuote
Auto Trait Implementations§
impl RefUnwindSafe for PriceBaseInQuote
impl Send for PriceBaseInQuote
impl Sync for PriceBaseInQuote
impl Unpin for PriceBaseInQuote
impl UnwindSafe for PriceBaseInQuote
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