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>
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
impl Clone for PositionQueryResponse
source§fn clone(&self) -> PositionQueryResponse
fn clone(&self) -> PositionQueryResponse
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PositionQueryResponse
impl Debug for PositionQueryResponse
source§impl<'de> Deserialize<'de> for PositionQueryResponse
impl<'de> Deserialize<'de> for PositionQueryResponse
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 PositionQueryResponse
impl JsonSchema for PositionQueryResponse
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 PositionQueryResponse
impl PartialEq for PositionQueryResponse
source§fn eq(&self, other: &PositionQueryResponse) -> bool
fn eq(&self, other: &PositionQueryResponse) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for PositionQueryResponse
impl Serialize for PositionQueryResponse
impl StructuralPartialEq for PositionQueryResponse
Auto Trait Implementations§
impl Freeze for PositionQueryResponse
impl RefUnwindSafe for PositionQueryResponse
impl Send for PositionQueryResponse
impl Sync for PositionQueryResponse
impl Unpin for PositionQueryResponse
impl UnwindSafe for PositionQueryResponse
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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