general: snapshot

This commit is contained in:
k
2024-07-25 14:43:20 +02:00
parent 0f8d7d5fe2
commit d3d5e7f8d7
27 changed files with 254 additions and 323 deletions
+6 -4
View File
@@ -1,6 +1,6 @@
#![allow(dead_code)]
use std::{collections::BTreeMap, path::Path};
use std::{collections::BTreeMap, fs, path::Path};
use color_eyre::eyre::ContextCompat;
use itertools::Itertools;
@@ -8,7 +8,7 @@ use serde_json::Value;
use crate::{
datasets::OHLC,
io::{Json, IMPORTS_FOLDER_PATH},
io::{Json, INPUTS_FOLDER_PATH},
structs::Date,
utils::{log, retry},
};
@@ -19,7 +19,9 @@ impl Binance {
pub fn read_har_file() -> color_eyre::Result<BTreeMap<u32, OHLC>> {
log("binance: read har file");
let path_binance_har = Path::new(IMPORTS_FOLDER_PATH).join("binance.har");
fs::create_dir_all(INPUTS_FOLDER_PATH)?;
let path_binance_har = Path::new(INPUTS_FOLDER_PATH).join("binance.har");
let json: BTreeMap<String, Value> =
Json::import(path_binance_har.to_str().unwrap()).unwrap_or_default();
@@ -195,7 +197,7 @@ impl Binance {
.collect::<BTreeMap<_, _>>())
},
10,
5,
10,
)
}
}
+2 -2
View File
@@ -62,7 +62,7 @@ impl Kraken {
.collect::<BTreeMap<_, _>>())
},
10,
5,
10,
)
}
@@ -117,7 +117,7 @@ impl Kraken {
.collect::<BTreeMap<_, _>>())
},
10,
5,
10,
)
}
}
+5 -5
View File
@@ -21,11 +21,11 @@ const RETRIES: usize = 10;
impl Satonomics {
fn get_base_url(try_index: usize) -> &'static str {
if try_index < RETRIES / 2 {
SATONOMICS_OFFICIAL_URL
} else {
SATONOMICS_OFFICIAL_BACKUP_URL
}
// if try_index < RETRIES / 2 {
SATONOMICS_OFFICIAL_URL
// } else {
// SATONOMICS_OFFICIAL_BACKUP_URL
// }
}
pub fn fetch_height_prices(chunk_id: HeightMapChunkId) -> color_eyre::Result<Vec<OHLC>> {