initializePriceImpact
Parameters
| Name | Type | Description |
|---|---|---|
| _windowsDuration | uint48 | windows duration (seconds) |
| _windowsCount | uint48 | windows count |
initializeNegPnlCumulVolMultiplier
Parameters
| Name | Type | Description |
|---|---|---|
| _negPnlCumulVolMultiplier | uint40 | new value (1e10) |
initializePairFactors
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndices | uint16[] | pair indices to initialize |
| _protectionCloseFactors | uint40[] | protection close factors (1e10) |
| _protectionCloseFactorBlocks | uint32[] | protection close factor blocks |
| _cumulativeFactors | uint40[] | cumulative factors (1e10) |
setPriceImpactWindowsCount
Parameters
| Name | Type | Description |
|---|---|---|
| _newWindowsCount | uint48 | new windows count |
setPriceImpactWindowsDuration
Parameters
| Name | Type | Description |
|---|---|---|
| _newWindowsDuration | uint48 | new windows duration (seconds) |
setNegPnlCumulVolMultiplier
Parameters
| Name | Type | Description |
|---|---|---|
| _negPnlCumulVolMultiplier | uint40 | new value (1e10) |
setProtectionCloseFactorWhitelist
Parameters
| Name | Type | Description |
|---|---|---|
| _traders | address[] | traders addresses |
| _whitelisted | bool[] | values |
setPairDepths
Parameters
| Name | Type | Description |
|---|---|---|
| _indices | uint256[] | indices of pairs |
| _depthsAboveUsd | uint128[] | depths above the price in USD |
| _depthsBelowUsd | uint128[] | depths below the price in USD |
setProtectionCloseFactors
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndices | uint16[] | pair indices to update |
| _protectionCloseFactors | uint40[] | new protection close factors (1e10) |
setProtectionCloseFactorBlocks
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndices | uint16[] | pair indices to update |
| _protectionCloseFactorBlocks | uint32[] | new protection close factor blocks |
setCumulativeFactors
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndices | uint16[] | pair indices to update |
| _cumulativeFactors | uint40[] | new cumulative factors (1e10) |
setExemptOnOpen
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndices | uint16[] | pair indices to update |
| _exemptOnOpen | bool[] | new values |
setExemptAfterProtectionCloseFactor
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndices | uint16[] | pair indices to update |
| _exemptAfterProtectionCloseFactor | bool[] | new values |
addPriceImpactOpenInterest
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | trader address |
| _index | uint32 | trade index |
| _oiDeltaCollateral | uint256 | open interest to add (collateral precision) |
| _open | bool | whether it corresponds to opening or closing a trade |
| _isPnlPositive | bool | whether it corresponds to a positive pnl trade (only relevant when _open = false) |
getPriceImpactOi
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndex | uint256 | index of pair |
| _long | bool | true for long, false for short |
getTradePriceImpact
Parameters
| Name | Type | Description |
|---|---|---|
| _trader | address | trader address (to check if whitelisted from protection close factor) |
| _marketPrice | uint256 | market price (1e10 precision) |
| _pairIndex | uint256 | index of pair |
| _long | bool | true for long, false for short |
| _tradeOpenInterestUsd | uint256 | open interest of trade in USD (1e18 precision) |
| _isPnlPositive | bool | true if positive pnl, false if negative pnl (only relevant when _open = false) |
| _open | bool | true on open, false on close |
| _lastPosIncreaseBlock | uint256 | block when trade position size was last increased (only relevant when _open = false) |
| _contractsVersion | enum ITradingStorage.ContractsVersion | trade contracts version |
getPairDepth
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndex | uint256 | index of pair |
getOiWindowsSettings
getOiWindow
Parameters
| Name | Type | Description |
|---|---|---|
| _windowsDuration | uint48 | windows duration (seconds) |
| _pairIndex | uint256 | index of pair |
| _windowId | uint256 | id of window |
getOiWindows
Parameters
| Name | Type | Description |
|---|---|---|
| _windowsDuration | uint48 | windows duration (seconds) |
| _pairIndex | uint256 | index of pair |
| _windowIds | uint256[] | ids of windows |
getPairDepths
Parameters
| Name | Type | Description |
|---|---|---|
| _indices | uint256[] | indices of pairs |
getPairFactors
Parameters
| Name | Type | Description |
|---|---|---|
| _indices | uint256[] | indices of pairs |
getNegPnlCumulVolMultiplier
getProtectionCloseFactorWhitelist
OiWindowsSettingsInitialized
Parameters
| Name | Type | Description |
|---|---|---|
| windowsDuration | uint48 | duration of each window (seconds) |
| windowsCount | uint48 | number of windows |
PriceImpactWindowsCountUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| windowsCount | uint48 | new number of windows |
PriceImpactWindowsDurationUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| windowsDuration | uint48 | new duration of each window (seconds) |
NegPnlCumulVolMultiplierUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| negPnlCumulVolMultiplier | uint40 | new value (1e10) |
ProtectionCloseFactorWhitelistUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| trader | address | trader address |
| whitelisted | bool | true if whitelisted, false if unwhitelisted |
ProtectionCloseFactorUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| protectionCloseFactor | uint40 | new protection close factor (1e10) |
ProtectionCloseFactorBlocksUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| protectionCloseFactorBlocks | uint32 | new protection close factor blocks |
CumulativeFactorUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| cumulativeFactor | uint40 | new cumulative factor (1e10) |
ExemptOnOpenUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| exemptOnOpen | bool | whether the pair is exempt of price impact on open |
ExemptAfterProtectionCloseFactorUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| exemptAfterProtectionCloseFactor | bool | whether the pair is exempt of price impact on close once protection close factor has expired |
PriceImpactOpenInterestAdded
Parameters
| Name | Type | Description |
|---|---|---|
| oiWindowUpdate | struct IPriceImpact.OiWindowUpdate | OI window update details (windowsDuration, pairIndex, windowId, etc.) |
PriceImpactOiTransferredPairs
Parameters
| Name | Type | Description |
|---|---|---|
| pairsCount | uint256 | number of pairs |
| prevCurrentWindowId | uint256 | previous current window ID corresponding to previous window duration |
| prevEarliestWindowId | uint256 | previous earliest window ID corresponding to previous window duration |
| newCurrentWindowId | uint256 | new current window ID corresponding to new window duration |
PriceImpactOiTransferredPair
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| totalPairOi | struct IPriceImpact.PairOi | total USD long/short OI of the pair (1e18 precision) |
OnePercentDepthUpdated
Parameters
| Name | Type | Description |
|---|---|---|
| pairIndex | uint256 | index of the pair |
| valueAboveUsd | uint128 | new USD depth above the price |
| valueBelowUsd | uint128 | new USD depth below the price |
