IAccountBalance
Last updated
Last updated
Modify trader account balance
Only used by ClearingHouse
contract
Parameters:
Name | Type | Description |
---|---|---|
Return Values:
Name | Type | Description |
---|---|---|
Modify trader owedRealizedPnl
Only used by ClearingHouse
contract
Parameters:
Settle owedRealizedPnl
Only used by Vault.withdraw()
Parameters:
Return Values:
Modify trader owedRealizedPnl
Only used by ClearingHouse
contract
Parameters:
Settle account balance and deregister base token
Only used by ClearingHouse
contract
Parameters:
Every time a trader's position value is checked, the base token list of this trader will be traversed; thus, this list should be kept as short as possible
Only used by ClearingHouse
contract
Parameters:
Deregister baseToken from trader accountInfo
Only used by ClearingHouse
contract, this function is expensive, due to for loop
Parameters:
Update trader Twap premium info
Only used by ClearingHouse
contract
Parameters:
Settle trader's PnL in closed market
Only used by ClearingHouse
Parameters:
Return Values:
Get ClearingHouseConfig
address
Return Values:
Get OrderBook
address
Return Values:
Get Vault
address
Return Values:
Get trader registered baseTokens
Parameters:
Return Values:
Get trader account info
Parameters:
Return Values:
Get taker cost of trader's baseToken
Parameters:
Return Values:
Get total cost of trader's baseToken
Parameters:
Return Values:
Get total debt value of trader
Total debt value will relate to Vault.getFreeCollateral()
Parameters:
Return Values:
Get margin requirement to check whether trader will be able to liquidate
This is different from Vault._getTotalMarginRequirement()
, which is for freeCollateral calculation
Parameters:
Return Values:
Get owedRealizedPnl, unrealizedPnl and pending fee
Parameters:
Return Values:
Check trader has open order in open/closed market.
Parameters:
Return Values:
Get trader base amount
base amount = takerPositionSize - orderBaseDebt
Parameters:
Return Values:
Get trader quote amount
quote amount = takerOpenNotional - orderQuoteDebt
Parameters:
Return Values:
Get taker position size of trader's baseToken market
This will only has taker position, can get maker impermanent position through getTotalPositionSize
Parameters:
Return Values:
Get total position size of trader's baseToken market
total position size = taker position size + maker impermanent position size
Parameters:
Return Values:
Get total position value of trader's baseToken market
A negative returned value is only be used when calculating pnl, we use mark price to calc position value
Parameters:
Return Values:
Get all market position abs value of trader
Parameters:
Return Values:
Get liquidatable position size of trader's baseToken market
Parameters:
Return Values:
Get mark price of baseToken market
Mark price is the median of three prices as below.
If the parameters to calculate mark price are not set, returns index twap instead for backward compatible If the market is paused, returns index twap instead, that will be the index twap while pausing market
Parameters:
Return Values:
Parameters:
Emit whenever a trader's owedRealizedPnl
is updated
Parameters:
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
trader
address
The address of the trader
baseToken
address
The address of the baseToken
base
int256
Modified amount of base
quote
int256
Modified amount of quote
takerPositionSize
int256
Taker position size after modified
takerOpenNotional
int256
Taker open notional after modified
trader
address
The address of the trader
amount
int256
Modified amount of owedRealizedPnl
trader
address
The address of the trader
pnl
int256
Settled owedRealizedPnl
trader
address
The address of the trader
baseToken
address
The address of the baseToken
amount
int256
Settled quote amount
trader
address
The address of the trader
baseToken
address
The address of the baseToken
takerBase
int256
Modified amount of taker base
takerQuote
int256
Modified amount of taker quote
realizedPnl
int256
Amount of pnl realized
makerFee
int256
Amount of maker fee collected from pool
trader
address
The address of the trader
baseToken
address
The address of the trader's base token
trader
address
The address of the trader
baseToken
address
The address of the trader's base token
trader
address
The address of trader
baseToken
address
The address of baseToken
lastTwPremiumGrowthGlobalX96
int256
The last Twap Premium
trader
address
The address of the trader
baseToken
address
The address of the trader's base token
positionNotional
int256
Taker's position notional settled with closed price
openNotional
int256
Taker's open notional
realizedPnl
int256
Settled realized pnl
closedPrice
uint256
The closed price of the closed market
clearingHouseConfig
address
The address of ClearingHouseConfig
orderBook
address
The address of OrderBook
vault
address
The address of Vault
trader
address
The address of trader
baseTokens
address[]
The array of baseToken address
trader
address
The address of trader
baseToken
address
The address of baseToken
traderAccountInfo
struct AccountMarket.Info
The baseToken account info of trader
trader
address
The address of trader
baseToken
address
The address of baseToken
openNotional
int256
The taker cost of trader's baseToken
trader
address
The address of trader
baseToken
address
The address of baseToken
totalOpenNotional
int256
the amount of quote token paid for a position when opening
trader
address
The address of trader
totalDebtValue
uint256
The debt value of trader
trader
address
The address of trader
marginRequirementForLiquidation
int256
It is compared with ClearingHouse.getAccountValue
which is also an int
trader
address
The address of trader
owedRealizedPnl
int256
the pnl realized already but stored temporarily in AccountBalance
unrealizedPnl
int256
the pnl not yet realized
pendingFee
uint256
the pending fee of maker earned
trader
address
The address of trader
True
bool
of false
trader
address
The address of trader
baseToken
address
The address of baseToken
baseAmount
int256
The base amount of trader's baseToken market
trader
address
The address of trader
baseToken
address
The address of baseToken
quoteAmount
int256
The quote amount of trader's baseToken market
trader
address
The address of trader
baseToken
address
The address of baseToken
takerPositionSize
int256
The taker position size of trader's baseToken market
trader
address
The address of trader
baseToken
address
The address of baseToken
totalPositionSize
int256
The total position size of trader's baseToken market
trader
address
The address of trader
baseToken
address
The address of baseToken
totalPositionValue
int256
Total position value of trader's baseToken market
trader
address
The address of trader
totalAbsPositionValue
uint256
Sum up positions value of every market
trader
address
The address of trader
baseToken
address
The address of baseToken
accountValue
int256
The account value of trader
liquidatablePositionSize
int256
The liquidatable position size of trader's baseToken market
baseToken
address
The address of baseToken
price
uint256
The mark price of baseToken market
vault
address
The address of the vault contract
trader
address
The address of the trader
amount
int256
The amount changed