The target aggregator for the TWAP.
Ending unix timestamp to collect values up to
Optional
endingExecute the task to get the ending unix timestamp
Minimum number of samples in the history to calculate a valid result
Period, in seconds, the twap should account for
Weight samples by their propagation time
Static
createStatic
decodeDecodes a TwapTask message from the specified reader or buffer.
Reader or buffer to decode from
Optional
length: numberMessage length if known beforehand
TwapTask
If the payload is not a reader or valid buffer
If required fields are missing
Static
decodeStatic
encodeStatic
encodeStatic
fromStatic
getStatic
toCreates a plain object from a TwapTask message. Also converts values to other types if specified.
TwapTask
Optional
options: IConversionOptionsConversion options
Plain object
Static
verify
Takes a twap over a set period for a certain aggregator. Aggregators have an optional history buffer account storing the last N accepted results. The TwapTask will iterate over an aggregators history buffer and calculate the time weighted average of the samples within a given time period.
Input: None
Returns: The time weighted average of an aggregator over a given time period.
Example: The 1hr Twap of the SOL/USD Aggregator, requiring at least 60 samples.