general: snapshot

This commit is contained in:
k
2024-07-20 23:13:41 +02:00
parent d8a5b4a2e6
commit a145b35ad1
100 changed files with 5402 additions and 2967 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ use serde_json::Value;
use crate::{
datasets::OHLC,
io::{Json, IMPORTS_FOLDER_PATH},
structs::WNaiveDate,
structs::Date,
utils::{log, retry},
};
@@ -150,7 +150,7 @@ impl Binance {
)
}
pub fn fetch_daily_prices() -> color_eyre::Result<BTreeMap<WNaiveDate, OHLC>> {
pub fn fetch_daily_prices() -> color_eyre::Result<BTreeMap<Date, OHLC>> {
log("binance: fetch 1d");
retry(
@@ -168,7 +168,7 @@ impl Binance {
// [timestamp, open, high, low, close, volume, ...]
let array = value.as_array().unwrap();
let date = WNaiveDate::from_timestamp(
let date = Date::from_timestamp(
array.first().unwrap().as_u64().unwrap() as u32 / 1000,
);
+4 -5
View File
@@ -5,7 +5,7 @@ use serde_json::Value;
use crate::{
datasets::OHLC,
structs::WNaiveDate,
structs::Date,
utils::{log, retry},
};
@@ -66,7 +66,7 @@ impl Kraken {
)
}
pub fn fetch_daily_prices() -> color_eyre::Result<BTreeMap<WNaiveDate, OHLC>> {
pub fn fetch_daily_prices() -> color_eyre::Result<BTreeMap<Date, OHLC>> {
log("fetch kraken daily");
retry(
@@ -91,9 +91,8 @@ impl Kraken {
.map(|value| {
let array = value.as_array().unwrap();
let date = WNaiveDate::from_timestamp(
array.first().unwrap().as_u64().unwrap() as u32,
);
let date =
Date::from_timestamp(array.first().unwrap().as_u64().unwrap() as u32);
let get_f32 = |index: usize| {
array