We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a98d36f commit b59caa6Copy full SHA for b59caa6
1 file changed
src/client.rs
@@ -139,15 +139,18 @@ impl MempoolClient {
139
pub async fn historical_price(
140
&self,
141
currency: Currency,
142
- timestamp: u64,
+ timestamp: Option<u64>,
143
) -> Result<HistoricalPrice, Error> {
144
let mut url: Url = self.url.join("/api/v1/historical-price")?;
145
146
- // Set query string
147
- let query: String = format!("currency={}×tamp={timestamp}", currency.as_str());
+ let mut query: String = format!("currency={}", currency.as_str());
+
148
+ if let Some(timestamp) = timestamp {
149
+ query.push_str(&format!("×tamp={timestamp}"));
150
+ }
151
152
url.set_query(Some(&query));
153
- // Get response
154
self.get_response(url).await
155
}
156
0 commit comments