IUpdatePositionSizeUtils
Interface for position size updates
PositionSizeUpdateInitiated
event PositionSizeUpdateInitiated(struct ITradingStorage.Id orderId, address trader, uint256 pairIndex, uint256 index, bool isIncrease, uint256 collateralDelta, uint256 leverageDelta)
Parameters
orderId
struct ITradingStorage.Id
request order id
trader
address
address of the trader
pairIndex
uint256
index of the pair
index
uint256
index of user trades
isIncrease
bool
true if increase position size, false if decrease
collateralDelta
uint256
collateral delta (collateral precision)
leverageDelta
uint256
leverage delta (1e3)
PositionSizeIncreaseExecuted
event PositionSizeIncreaseExecuted(struct ITradingStorage.Id orderId, enum ITradingCallbacks.CancelReason cancelReason, uint8 collateralIndex, address trader, uint256 pairIndex, uint256 index, bool long, uint256 oraclePrice, uint256 collateralPriceUsd, uint256 collateralDelta, uint256 leverageDelta, struct IUpdatePositionSize.IncreasePositionSizeValues values)
Parameters
orderId
struct ITradingStorage.Id
request order id
cancelReason
enum ITradingCallbacks.CancelReason
cancel reason if canceled or none if executed
collateralIndex
uint8
collateral index
trader
address
address of trader
pairIndex
uint256
index of pair
index
uint256
index of trade
long
bool
true for long, false for short
oraclePrice
uint256
oracle price (1e10)
collateralPriceUsd
uint256
collateral price in USD (1e8)
collateralDelta
uint256
collateral delta (collateral precision)
leverageDelta
uint256
leverage delta (1e3)
values
struct IUpdatePositionSize.IncreasePositionSizeValues
important values (new open price, new leverage, new collateral, etc.)
PositionSizeDecreaseExecuted
event PositionSizeDecreaseExecuted(struct ITradingStorage.Id orderId, enum ITradingCallbacks.CancelReason cancelReason, uint8 collateralIndex, address trader, uint256 pairIndex, uint256 index, bool long, uint256 oraclePrice, uint256 collateralPriceUsd, uint256 collateralDelta, uint256 leverageDelta, struct IUpdatePositionSize.DecreasePositionSizeValues values)
Parameters
orderId
struct ITradingStorage.Id
request order id
cancelReason
enum ITradingCallbacks.CancelReason
cancel reason if canceled or none if executed
collateralIndex
uint8
collateral index
trader
address
address of trader
pairIndex
uint256
index of pair
index
uint256
index of trade
long
bool
true for long, false for short
oraclePrice
uint256
oracle price (1e10)
collateralPriceUsd
uint256
collateral price in USD (1e8)
collateralDelta
uint256
collateral delta (collateral precision)
leverageDelta
uint256
leverage delta (1e3)
values
struct IUpdatePositionSize.DecreasePositionSizeValues
important values (pnl, new leverage, new collateral, etc.)
InvalidIncreasePositionSizeInput
error InvalidIncreasePositionSizeInput()
InvalidDecreasePositionSizeInput
error InvalidDecreasePositionSizeInput()
NewPositionSizeSmaller
error NewPositionSizeSmaller()
Was this helpful?