diff --git a/src/processing/api.rs b/src/processing/api.rs index e633490..e8c2346 100644 --- a/src/processing/api.rs +++ b/src/processing/api.rs @@ -22,7 +22,7 @@ pub async fn process_data_by_pair(pair: String) -> Result<(), MonitoringError> { let config = get_config(None).await; let network_env = &config.network_str(); - let result = query_pragma_api(&pair, network_env).await?; + let result = query_pragma_api(&pair, network_env, "median", "1min").await?; log::info!("Processing data for pair: {}", pair); @@ -56,7 +56,7 @@ pub async fn process_sequencer_data() -> Result<(), MonitoringError> { let config = get_config(None).await; let network_env = config.network_str(); - let result = query_pragma_api(&pair, network_env).await?; + let result = query_pragma_api(&pair, network_env, "twap", "15min").await?; log::info!("Processing sequencer data"); diff --git a/src/processing/common.rs b/src/processing/common.rs index 8aa5853..f4cd134 100644 --- a/src/processing/common.rs +++ b/src/processing/common.rs @@ -118,15 +118,19 @@ pub struct PragmaDataDTO { pub async fn query_pragma_api( pair: &str, network_env: &str, + aggregation: &str, + interval: &str, ) -> Result { let request_url = match network_env { "Testnet" => format!( - "https://api.dev.pragma.build/node/v1/data/{pair}?aggregation=median&interval=1min&routing=true", + "https://api.dev.pragma.build/node/v1/data/{pair}?aggregation={aggregation}&interval={interval}&routing=true", pair = pair, ), "Mainnet" => format!( - "https://api.prod.pragma.build/node/v1/data/{pair}?aggregation=median&interval=1min&routing=true", + "https://api.prod.pragma.build/node/v1/data/{pair}?aggregation={aggregation}&interval={interval}&routing=true", pair = pair, + aggregation = aggregation, + interval = interval, ), _ => panic!("Invalid network env"), };