pub struct PositionQueryResponse {
Show 38 fields pub owner: Addr, pub id: PositionId, pub direction_to_base: DirectionToBase, pub leverage: LeverageToBase, pub counter_leverage: LeverageToBase, pub created_at: Timestamp, pub price_point_created_at: Option<Timestamp>, pub liquifunded_at: Timestamp, pub trading_fee_collateral: Collateral, pub trading_fee_usd: Usd, pub funding_fee_collateral: Signed<Collateral>, pub funding_fee_usd: Signed<Usd>, pub borrow_fee_collateral: Collateral, pub borrow_fee_usd: Usd, pub crank_fee_collateral: Collateral, pub crank_fee_usd: Usd, pub delta_neutrality_fee_collateral: Signed<Collateral>, pub delta_neutrality_fee_usd: Signed<Usd>, pub deposit_collateral: Signed<Collateral>, pub deposit_collateral_usd: Signed<Usd>, pub active_collateral: NonZero<Collateral>, pub active_collateral_usd: NonZero<Usd>, pub counter_collateral: NonZero<Collateral>, pub pnl_collateral: Signed<Collateral>, pub pnl_usd: Signed<Usd>, pub dnf_on_close_collateral: Signed<Collateral>, pub notional_size: Signed<Notional>, pub notional_size_in_collateral: Signed<Collateral>, pub position_size_base: Signed<Base>, pub position_size_usd: Signed<Usd>, pub liquidation_price_base: Option<PriceBaseInQuote>, pub liquidation_margin: LiquidationMargin, pub max_gains_in_quote: Option<MaxGainsInQuote>, pub entry_price_base: PriceBaseInQuote, pub next_liquifunding: Timestamp, pub stop_loss_override: Option<PriceBaseInQuote>, pub take_profit_trader: Option<TakeProfitTrader>, pub take_profit_total_base: Option<PriceBaseInQuote>,
}
Expand description

Query response representing current state of a position

Fields§

§owner: Addr

Owner

§id: PositionId

Unique ID

§direction_to_base: DirectionToBase

Direction

§leverage: LeverageToBase

Current leverage

This is impacted by fees and price exposure

§counter_leverage: LeverageToBase

Leverage of the counter collateral

§created_at: Timestamp

When the position was opened, block time

§price_point_created_at: Option<Timestamp>

Price point used for creating this position

§liquifunded_at: Timestamp

When the position was last liquifunded

§trading_fee_collateral: Collateral

The one-time fee paid when opening or updating a position

This value is the current balance, including all updates

§trading_fee_usd: Usd

USD expression of Self::trading_fee_collateral using cost-basis calculation.

§funding_fee_collateral: Signed<Collateral>

The ongoing fee paid (and earned!) between positions to incentivize keeping longs and shorts in balance which in turn reduces risk for LPs

This value is the current balance, not a historical record of each payment

§funding_fee_usd: Signed<Usd>

USD expression of Self::funding_fee_collateral using cost-basis calculation.

§borrow_fee_collateral: Collateral

The ongoing fee paid to LPs to lock up their deposit as counter-size collateral in this position

This value is the current balance, not a historical record of each payment

§borrow_fee_usd: Usd

USD expression of Self::borrow_fee_collateral using cost-basis calculation.

§crank_fee_collateral: Collateral

Cumulative amount of crank fees paid by the position

§crank_fee_usd: Usd

USD expression of Self::crank_fee_collateral using cost-basis calculation.

§delta_neutrality_fee_collateral: Signed<Collateral>

Aggregate delta neutrality fees paid or received through position opens and upates.

§delta_neutrality_fee_usd: Signed<Usd>

USD expression of Self::delta_neutrality_fee_collateral using cost-basis calculation.

§deposit_collateral: Signed<Collateral>§deposit_collateral_usd: Signed<Usd>

USD expression of Self::deposit_collateral using cost-basis calculation.

§active_collateral: NonZero<Collateral>§active_collateral_usd: NonZero<Usd>

Self::active_collateral converted to USD at the current exchange rate

§counter_collateral: NonZero<Collateral>§pnl_collateral: Signed<Collateral>

Unrealized PnL on this position, in terms of collateral.

§pnl_usd: Signed<Usd>

Unrealized PnL on this position, in USD, using cost-basis analysis.

§dnf_on_close_collateral: Signed<Collateral>

DNF that would be charged (positive) or received (negative) if position was closed now.

§notional_size: Signed<Notional>

Notional size of the position

§notional_size_in_collateral: Signed<Collateral>

Notional size converted to collateral at the current price

§position_size_base: Signed<Base>

The size of the position in terms of the base asset.

Note that this is not a simple conversion from notional size. Instead, this needs to account for the off-by-one leverage that occurs in collateral-is-base markets.

§position_size_usd: Signed<Usd>

Convert Self::position_size_base into USD at the current exchange rate.

§liquidation_price_base: Option<PriceBaseInQuote>

Price at which liquidation will occur

§liquidation_margin: LiquidationMargin

The liquidation margin set aside on this position

§max_gains_in_quote: Option<MaxGainsInQuote>
👎Deprecated: Use take_profit_trader instead

Maximum gains, in terms of quote, the trader can achieve

§entry_price_base: PriceBaseInQuote

Entry price

§next_liquifunding: Timestamp

When the next liquifunding is scheduled

§stop_loss_override: Option<PriceBaseInQuote>

Stop loss price set by the trader

§take_profit_trader: Option<TakeProfitTrader>

The take profit value set by the trader in a message. For historical reasons, this value can be optional if the user provided a max gains price.

§take_profit_total_base: Option<PriceBaseInQuote>

The most recently calculated price at which the trader will achieve maximum gains and take all counter collateral.

Trait Implementations§

source§

impl Clone for PositionQueryResponse

source§

fn clone(&self) -> PositionQueryResponse

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PositionQueryResponse

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for PositionQueryResponse

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl JsonSchema for PositionQueryResponse

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl PartialEq<PositionQueryResponse> for PositionQueryResponse

source§

fn eq(&self, other: &PositionQueryResponse) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for PositionQueryResponse

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for PositionQueryResponse

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for 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 more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> QueryResultExt for Twhere T: Serialize,

§

fn query_result(&self) -> Result<Binary, Error>

Convert the value to its JSON representation
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,