Twa
Functions
updateValue
Update the TWA (Time-Weighted Average) value in the State memory.
Parameters
Name | Type | Description |
---|---|---|
|
| The State memory to update. |
|
| The new value to set. |
|
| The lookback period to use for calculating the TWA. |
floor
Get the floored TWA value from the State memory.
Parameters
Name | Type | Description |
---|---|---|
|
| The State memory to read from. |
Returns
Name | Type | Description |
---|---|---|
|
| The floored TWA value as an int32. |
getTwa
Get the TWA value from the State memory, considering a lookback period.
Parameters
Name | Type | Description |
---|---|---|
|
| The State memory to read from. |
|
| The lookback period to use for calculating the TWA. |
Returns
Name | Type | Description |
---|---|---|
|
| The TWA value as an int256. |
getTwaFloor
Get the floored TWA value from the State memory, based on the lookback period.
Parameters
Name | Type | Description |
---|---|---|
|
| The State memory to read from. |
|
| The lookback period to use for calculating the TWA. |
Returns
Name | Type | Description |
---|---|---|
|
| The floored TWA value as an int32. |
Last updated