pub struct PositionChangedEvent {
pub final_position: Option<Position>,
pub position_notional: String,
pub transaction_fee: Option<Coin>,
pub realized_pnl: String,
pub bad_debt: Option<Coin>,
pub funding_payment: String,
pub block_height: i64,
pub margin_to_user: String,
pub change_reason: String,
pub exchanged_size: String,
pub exchanged_notional: String,
}
Expand description
Emitted when a position changes.
Fields§
§final_position: Option<Position>
§position_notional: String
Position notional (in quote units) after the change. In general, ‘notional = baseAmount * priceQuotePerBase’, where size is the baseAmount.
transaction_fee: Option<Coin>
Transaction fee paid. A “taker” fee.
realized_pnl: String
realize profits and losses after the change
bad_debt: Option<Coin>
Amount of bad debt cleared by the PerpEF during the change. Bad debt is negative net margin past the liquidation point of a position.
funding_payment: String
A funding payment made or received by the trader on the current position. ‘fundingPayment’ is positive if ‘owner’ is the sender and negative if ‘owner’ is the receiver of the payment. Its magnitude is abs(size * fundingRate). Funding payments act to converge the mark price and index price (average price on major exchanges).
block_height: i64
The block number at which this position was changed.
margin_to_user: String
margin_to_user is the amount of collateral received by the trader during the position change. A positve value indicates that the trader received funds, while a negative value indicates that the trader spent funds.
change_reason: String
change_reason describes the reason for why the position resulted in a change. Change type can take the following values:
- CHANGE_REASON_UNSPECIFIED: Unspecified change reason.
- CHANGE_REASON_ADD_MARGIN: Margin was added to the position.
- CHANGE_REASON_REMOVE_MARGIN: Margin was removed from the position.
- CHANGE_REASON_OPEN_POSITION: A new position was opened.
- CHANGE_REASON_CLOSE_POSITION: An existing position was closed.
exchanged_size: String
exchanged_size represent the change in size for an existing position after the change. A positive value indicates that the position size increased, while a negative value indicates that the position size decreased.
exchanged_notional: String
exchanged_notional represent the change in notional for an existing position after the change. A positive value indicates that the position notional increased, while a negative value indicates that the position notional decreased.
Trait Implementations§
Source§impl Clone for PositionChangedEvent
impl Clone for PositionChangedEvent
Source§fn clone(&self) -> PositionChangedEvent
fn clone(&self) -> PositionChangedEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PositionChangedEvent
impl Debug for PositionChangedEvent
Source§impl Default for PositionChangedEvent
impl Default for PositionChangedEvent
Source§impl Message for PositionChangedEvent
impl Message for PositionChangedEvent
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.Source§impl PartialEq for PositionChangedEvent
impl PartialEq for PositionChangedEvent
impl StructuralPartialEq for PositionChangedEvent
Auto Trait Implementations§
impl Freeze for PositionChangedEvent
impl RefUnwindSafe for PositionChangedEvent
impl Send for PositionChangedEvent
impl Sync for PositionChangedEvent
impl Unpin for PositionChangedEvent
impl UnwindSafe for PositionChangedEvent
Blanket Implementations§
Source§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§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 moreSource§impl<M> NibiruProstMsg for Mwhere
M: Message,
impl<M> NibiruProstMsg for Mwhere
M: Message,
fn to_binary(&self) -> Binary
Source§fn try_into_stargate_msg(&self, type_url: &str) -> CosmosMsg
fn try_into_stargate_msg(&self, type_url: &str) -> CosmosMsg
Name.type_url()
function. This method attempts
to downcast the message to prost::Name, and if successful, constructs a
CosmosMsg::Stargate
object corresponding to the type.