validWindowsDuration
initializePriceImpact
initializeNegPnlCumulVolMultiplier
initializePairFactors
setPriceImpactWindowsCount
setPriceImpactWindowsDuration
setNegPnlCumulVolMultiplier
setProtectionCloseFactorWhitelist
setPairDepths
setProtectionCloseFactors
setProtectionCloseFactorBlocks
setCumulativeFactors
setExemptOnOpen
setExemptAfterProtectionCloseFactor
addPriceImpactOpenInterest
getPriceImpactOi
getTradePriceImpact
getPairDepth
getOiWindowsSettings
getOiWindow
getOiWindows
getPairDepths
getPairFactors
getNegPnlCumulVolMultiplier
getProtectionCloseFactorWhitelist
_getSlot
_getStorage
_getMultiCollatDiamond
_transferPriceImpactOiForPairs
_prevPairOiWindows to current window of _newPairOiWindows for _pairsCount pairs.
Emits a {PriceImpactOiTransferredPairs} event._
Parameters
| Name | Type | Description |
|---|---|---|
| _pairsCount | uint256 | number of pairs |
| _prevPairOiWindows | mapping(uint256 => mapping(uint256 => struct IPriceImpact.PairOi)) | previous pair OI windows (previous windowsDuration mapping) |
| _newPairOiWindows | mapping(uint256 => mapping(uint256 => struct IPriceImpact.PairOi)) | new pair OI windows (new windowsDuration mapping) |
| _settings | IPriceImpact.OiWindowsSettings | current OI windows settings |
| _newWindowsDuration | uint48 | new windows duration |
_transferPriceImpactOiForPair
prevEarliestWindowId to prevCurrentWindowId windows of _prevPairOiWindows to _newPairOiWindow window.
Emits a {PriceImpactOiTransferredPair} event._
Parameters
| Name | Type | Description |
|---|---|---|
| _pairIndex | uint256 | index of the pair |
| _prevCurrentWindowId | uint256 | previous current window ID |
| _prevEarliestWindowId | uint256 | previous earliest active window ID |
| _prevPairOiWindows | mapping(uint256 => struct IPriceImpact.PairOi) | previous pair OI windows (previous windowsDuration mapping) |
| _newPairOiWindow | IPriceImpact.PairOi | new pair OI window (new windowsDuration mapping) |
_getWindowId
_timestamp given _settings.
Parameters
| Name | Type | Description |
|---|---|---|
| _timestamp | uint48 | timestamp |
| _settings | IPriceImpact.OiWindowsSettings | OI windows settings |
_getCurrentWindowId
_settings.
Parameters
| Name | Type | Description |
|---|---|---|
| _settings | IPriceImpact.OiWindowsSettings | OI windows settings |
_getEarliestActiveWindowId
_currentWindowId and _windowsCount.
Parameters
| Name | Type | Description |
|---|---|---|
| _currentWindowId | uint256 | current window id |
| _windowsCount | uint48 | active windows count |
_isWindowPotentiallyActive
_currentWindowId
Parameters
| Name | Type | Description |
|---|---|---|
| _windowId | uint256 | window id |
| _currentWindowId | uint256 | current window id |
_getTradePriceImpact
Parameters
| Name | Type | Description |
|---|---|---|
| _marketPrice | uint256 | market price (1e10 precision) |
| _long | bool | true for long, false for short |
| _startOpenInterestUsd | uint256 | existing open interest of pair on trade side in USD (1e18 precision) |
| _tradeOpenInterestUsd | uint256 | open interest of trade in USD (1e18 precision) |
| _onePercentDepthUsd | uint256 | one percent depth of pair in USD on trade side |
| _open | bool | true for open, false for close |
| _protectionCloseFactor | uint256 | protection close factor (1e10 precision) |
| _cumulativeFactor | uint256 | cumulative factor (1e10 precision) |
| _contractsVersion | enum ITradingStorage.ContractsVersion | trade contracts version |
