Skip to content

Instantly share code, notes, and snippets.

@mgild
Created March 29, 2024 15:53
Show Gist options
  • Save mgild/bee12d9ce76a384b11dcb6f9b98c96d3 to your computer and use it in GitHub Desktop.
Save mgild/bee12d9ce76a384b11dcb6f9b98c96d3 to your computer and use it in GitHub Desktop.
use switchboard_solana::AggregatorHistoryBuffer;
use std::convert::TryInto;
let history_buffer = AggregatorHistoryBuffer::new(history_account_info)?;
let current_timestamp = Clock::get()?.unix_timestamp;
let one_hour_ago: f64 = history_buffer.lower_bound(current_timestamp - 3600).unwrap().try_into()?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment