general: snapshot

This commit is contained in:
k
2024-06-30 17:01:15 +02:00
parent 9905eff383
commit b7e8cbea20
68 changed files with 1725 additions and 1535 deletions

View File

@@ -70,7 +70,7 @@ impl CointimeDataset {
active_supply: BiMap::new_bin(1, &f("active_supply")),
active_supply_3m_net_change: BiMap::new_bin(1, &f("active_supply_3m_net_change")),
active_supply_net_change: BiMap::new_bin(1, &f("active_supply_net_change")),
activity_to_vaultedness_ratio: BiMap::new_bin(1, &f("activity_to_vaultedness_ratio")),
activity_to_vaultedness_ratio: BiMap::new_bin(2, &f("activity_to_vaultedness_ratio")),
coinblocks_created: BiMap::new_bin(1, &f("coinblocks_created")),
coinblocks_destroyed: BiMap::new_bin(1, &f("coinblocks_destroyed")),
coinblocks_stored: BiMap::new_bin(1, &f("coinblocks_stored")),
@@ -106,7 +106,7 @@ impl CointimeDataset {
producerness: BiMap::new_bin(1, &f("producerness")),
thermo_cap: BiMap::new_bin(1, &f("thermo_cap")),
thermo_cap_to_investor_cap_ratio: BiMap::new_bin(
1,
2,
&f("thermo_cap_to_investor_cap_ratio"),
),
total_cointime_value_created: BiMap::new_bin(1, &f("total_cointime_value_created")),
@@ -215,7 +215,7 @@ impl CointimeDataset {
&|liveliness| 1.0 - liveliness,
);
self.activity_to_vaultedness_ratio.multi_insert_divide(
self.activity_to_vaultedness_ratio.multi_insert_percentage(
heights,
dates,
&mut self.liveliness,
@@ -332,12 +332,8 @@ impl CointimeDataset {
self.investor_cap
.multi_insert_subtract(heights, dates, realized_cap, &mut self.thermo_cap);
self.thermo_cap_to_investor_cap_ratio.multi_insert_divide(
heights,
dates,
&mut self.thermo_cap,
&mut self.investor_cap,
);
self.thermo_cap_to_investor_cap_ratio
.multi_insert_percentage(heights, dates, &mut self.thermo_cap, &mut self.investor_cap);
// TODO:
// const activeSupplyChangeFromIssuance90dChange = createNetChangeLazyDataset(

View File

@@ -38,7 +38,7 @@ impl RealizedSubDataset {
negative_realized_loss: BiMap::new_bin(2, &f("negative_realized_loss")),
net_realized_profit_and_loss: BiMap::new_bin(1, &f("net_realized_profit_and_loss")),
net_realized_profit_and_loss_to_market_cap_ratio: BiMap::new_bin(
1,
2,
&f("net_realized_profit_and_loss_to_market_cap_ratio"),
),
cumulative_realized_profit: BiMap::new_bin(1, &f("cumulative_realized_profit")),
@@ -107,7 +107,7 @@ impl RealizedSubDataset {
);
self.net_realized_profit_and_loss_to_market_cap_ratio
.multi_insert_divide(
.multi_insert_percentage(
heights,
dates,
&mut self.net_realized_profit_and_loss,

View File

@@ -40,7 +40,7 @@ impl UnrealizedSubDataset {
negative_unrealized_loss: BiMap::new_bin(1, &f("negative_unrealized_loss")),
net_unrealized_profit_and_loss: BiMap::new_bin(1, &f("net_unrealized_profit_and_loss")),
net_unrealized_profit_and_loss_to_market_cap_ratio: BiMap::new_bin(
1,
2,
&f("net_unrealized_profit_and_loss_to_market_cap_ratio"),
),
supply_in_profit_to_own_supply_ratio: BiMap::new_bin(
@@ -136,7 +136,7 @@ impl UnrealizedSubDataset {
);
self.net_unrealized_profit_and_loss_to_market_cap_ratio
.multi_insert_divide(
.multi_insert_percentage(
heights,
dates,
&mut self.net_unrealized_profit_and_loss,

View File

@@ -273,20 +273,30 @@ where
std::any::type_name::<T>()
}
// fn reset(&mut self) -> color_eyre::Result<()> {
// fs::remove_dir(&self.path_all)?;
// self.initial_last_height = None;
// self.initial_first_unsafe_height = None;
// self.imported.clear();
// self.to_insert.clear();
// Ok(())
// }
fn pre_export(&mut self) {
self.to_insert.iter_mut().for_each(|(chunk_start, map)| {
let to_insert = &mut self.to_insert;
to_insert.iter_mut().for_each(|(chunk_start, map)| {
if let Some((key, _)) = map.first_key_value() {
if *key > 0 && !self.imported.contains_key(chunk_start) {
// Had to copy paste many lines from functions as calling a function from self isn't allowed because of the &mut
let dir_content = Self::_read_dir(&self.path_all, &self.serialization);
let path = dir_content.get(chunk_start).unwrap_or_else(|| {
dbg!(&self.path_all, chunk_start, &dir_content);
panic!();
});
let serialized = self
.serialization
.import::<SerializedHeightMap<T>>(path.to_str().unwrap())
.unwrap();
self.imported.insert(*chunk_start, serialized);
}
}
let serialized = self
.imported
.entry(*chunk_start)
@@ -301,7 +311,10 @@ where
|(chunk_height, value)| match serialized.map.len().cmp(&chunk_height) {
Ordering::Greater => serialized.map[chunk_height] = value,
Ordering::Equal => serialized.map.push(value),
Ordering::Less => panic!(),
Ordering::Less => {
dbg!(&self.path_all, &serialized.map, chunk_height, value);
panic!()
}
},
);
});