Skip to main content
_GNSPriceImpact facet internal library This is a library to help manage a price impact decay algorithm . When a trade is placed, OI is added to the window corresponding to time of open. When a trade is removed, OI is removed from the window corresponding to time of open. When calculating price impact, only the most recent X windows are taken into account._

validWindowsDuration

Validates new windowsDuration value

initializePriceImpact

Check IPriceImpactUtils interface for documentation

initializeNegPnlCumulVolMultiplier

Check IPriceImpactUtils interface for documentation

initializePairFactors

Check IPriceImpactUtils interface for documentation

setPriceImpactWindowsCount

Check IPriceImpactUtils interface for documentation

setPriceImpactWindowsDuration

Check IPriceImpactUtils interface for documentation

setNegPnlCumulVolMultiplier

Check IPriceImpactUtils interface for documentation

setProtectionCloseFactorWhitelist

Check IPriceImpactUtils interface for documentation

setPairDepths

Check IPriceImpactUtils interface for documentation

setProtectionCloseFactors

Check IPriceImpactUtils interface for documentation

setProtectionCloseFactorBlocks

Check IPriceImpactUtils interface for documentation

setCumulativeFactors

Check IPriceImpactUtils interface for documentation

setExemptOnOpen

Check IPriceImpactUtils interface for documentation

setExemptAfterProtectionCloseFactor

Check IPriceImpactUtils interface for documentation

addPriceImpactOpenInterest

Check IPriceImpactUtils interface for documentation

getPriceImpactOi

Check IPriceImpactUtils interface for documentation

getTradePriceImpact

Check IPriceImpactUtils interface for documentation

getPairDepth

Check IPriceImpactUtils interface for documentation

getOiWindowsSettings

Check IPriceImpactUtils interface for documentation

getOiWindow

Check IPriceImpactUtils interface for documentation

getOiWindows

Check IPriceImpactUtils interface for documentation

getPairDepths

Check IPriceImpactUtils interface for documentation

getPairFactors

Check IPriceImpactUtils interface for documentation

getNegPnlCumulVolMultiplier

Check IPriceImpactUtils interface for documentation

getProtectionCloseFactorWhitelist

Check IPriceImpactUtils interface for documentation

_getSlot

Returns storage slot to use when fetching storage relevant to library

_getStorage

Returns storage pointer for storage struct in diamond contract, at defined slot

_getMultiCollatDiamond

Returns current address as multi-collateral diamond interface to call other facets functions.

_transferPriceImpactOiForPairs

_Transfers total long / short OI from last ‘_settings.windowsCount’ windows of _prevPairOiWindows to current window of _newPairOiWindows for _pairsCount pairs. Emits a {PriceImpactOiTransferredPairs} event._

Parameters

_transferPriceImpactOiForPair

_Transfers total long / short OI from prevEarliestWindowId to prevCurrentWindowId windows of _prevPairOiWindows to _newPairOiWindow window. Emits a {PriceImpactOiTransferredPair} event._

Parameters

_getWindowId

Returns window id at _timestamp given _settings.

Parameters

_getCurrentWindowId

Returns window id at current timestamp given _settings.

Parameters

_getEarliestActiveWindowId

Returns earliest active window id given _currentWindowId and _windowsCount.

Parameters

_isWindowPotentiallyActive

_Returns whether ‘windowId’ can be potentially active id given _currentWindowId

Parameters

_getTradePriceImpact

Returns trade price impact % and opening price after impact.

Parameters