mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: MASSIVE snapshot
This commit is contained in:
@@ -73,7 +73,8 @@ impl Binance {
|
||||
default_retry(|_| {
|
||||
let url = Self::url("interval=1m&limit=1000");
|
||||
info!("Fetching {url} ...");
|
||||
let json: Value = serde_json::from_slice(minreq::get(url).send()?.as_bytes())?;
|
||||
let json: Value =
|
||||
serde_json::from_slice(minreq::get(url).with_timeout(30).send()?.as_bytes())?;
|
||||
Self::parse_ohlc_array(&json)
|
||||
})
|
||||
}
|
||||
@@ -95,7 +96,8 @@ impl Binance {
|
||||
default_retry(|_| {
|
||||
let url = Self::url("interval=1d");
|
||||
info!("Fetching {url} ...");
|
||||
let json: Value = serde_json::from_slice(minreq::get(url).send()?.as_bytes())?;
|
||||
let json: Value =
|
||||
serde_json::from_slice(minreq::get(url).with_timeout(30).send()?.as_bytes())?;
|
||||
Self::parse_date_ohlc_array(&json)
|
||||
})
|
||||
}
|
||||
@@ -205,6 +207,7 @@ impl Binance {
|
||||
|
||||
pub fn ping() -> Result<()> {
|
||||
minreq::get("https://api.binance.com/api/v3/ping")
|
||||
.with_timeout(10)
|
||||
.send()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ impl BRK {
|
||||
);
|
||||
info!("Fetching {url} ...");
|
||||
|
||||
let body: Value = serde_json::from_slice(minreq::get(url).send()?.as_bytes())?;
|
||||
let body: Value =
|
||||
serde_json::from_slice(minreq::get(url).with_timeout(30).send()?.as_bytes())?;
|
||||
|
||||
body.as_array()
|
||||
.ok_or(Error::Parse("Expected JSON array".into()))?
|
||||
@@ -86,7 +87,8 @@ impl BRK {
|
||||
);
|
||||
info!("Fetching {url}...");
|
||||
|
||||
let body: Value = serde_json::from_slice(minreq::get(url).send()?.as_bytes())?;
|
||||
let body: Value =
|
||||
serde_json::from_slice(minreq::get(url).with_timeout(30).send()?.as_bytes())?;
|
||||
|
||||
body.as_array()
|
||||
.ok_or(Error::Parse("Expected JSON array".into()))?
|
||||
@@ -120,6 +122,7 @@ impl BRK {
|
||||
|
||||
pub fn ping() -> Result<()> {
|
||||
minreq::get(API_URL)
|
||||
.with_timeout(10)
|
||||
.send()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ impl Kraken {
|
||||
default_retry(|_| {
|
||||
let url = Self::url(1);
|
||||
info!("Fetching {url} ...");
|
||||
let json: Value = serde_json::from_slice(minreq::get(url).send()?.as_bytes())?;
|
||||
let json: Value =
|
||||
serde_json::from_slice(minreq::get(url).with_timeout(30).send()?.as_bytes())?;
|
||||
Self::parse_ohlc_response(&json)
|
||||
})
|
||||
}
|
||||
@@ -60,7 +61,8 @@ impl Kraken {
|
||||
default_retry(|_| {
|
||||
let url = Self::url(1440);
|
||||
info!("Fetching {url} ...");
|
||||
let json: Value = serde_json::from_slice(minreq::get(url).send()?.as_bytes())?;
|
||||
let json: Value =
|
||||
serde_json::from_slice(minreq::get(url).with_timeout(30).send()?.as_bytes())?;
|
||||
Self::parse_date_ohlc_response(&json)
|
||||
})
|
||||
}
|
||||
@@ -96,6 +98,7 @@ impl Kraken {
|
||||
|
||||
pub fn ping() -> Result<()> {
|
||||
minreq::get("https://api.kraken.com/0/public/Time")
|
||||
.with_timeout(10)
|
||||
.send()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user