I want to use Chainlink to get the price of an asset at a given point in time in the past (which I will refer to as "expiry") in order to settle options.
To get a historical price, Chainlink requires to pass in a roundId as argument into the getRoundData function. In order to verify that the round implied by the given roundId includes the expiry time, my initial thought was checking inside the smart contract whether startedAt <= expiry && timestamp >= expiry for the received roundData.
In order to assess whether this is a feasible approach, I would like to better understand the concept of rounds in Chainlink:
- Can I assume that rounds always span adjacent time intervals, i.e. if say a round starts at unixTime t1 and ends at t2, can I assume that the next round will start at t2?
- getRoundData(roundId) returns startedAt and timestamp. Does the timeStamp represent the end of the given roundId?
- What exactly is the answeredInRound that I receive as output from getRoundData?
Any help is highly appreciated.