oracle: v4

This commit is contained in:
nym21
2026-06-04 15:38:01 +02:00
parent f41874f438
commit a3f3c54675
313 changed files with 1980 additions and 996 deletions
+1 -1
View File
@@ -271,7 +271,7 @@ impl Query {
.block
.sats
.collect_range_at(begin, end);
let prices = computer.prices.spot.usd.height.collect_range_at(begin, end);
let prices = computer.price.spot.usd.height.collect_range_at(begin, end);
let output_volumes = computer
.mining
.rewards
@@ -13,7 +13,7 @@ impl Query {
pub fn block_fees(&self, time_period: TimePeriod) -> Result<Vec<BlockFeesEntry>> {
let bw = BlockWindow::new(self, time_period)?;
let fees: Vec<Sats> = bw.read(&self.computer().mining.rewards.fees.block.sats)?;
let prices: Vec<Cents> = bw.read(&self.computer().prices.spot.cents.height)?;
let prices: Vec<Cents> = bw.read(&self.computer().price.spot.cents.height)?;
Ok(bw
.buckets
@@ -13,7 +13,7 @@ impl Query {
pub fn block_rewards(&self, time_period: TimePeriod) -> Result<Vec<BlockRewardsEntry>> {
let bw = BlockWindow::new(self, time_period)?;
let rewards: Vec<Sats> = bw.read(&self.computer().mining.rewards.coinbase.block.sats)?;
let prices: Vec<Cents> = bw.read(&self.computer().prices.spot.cents.height)?;
let prices: Vec<Cents> = bw.read(&self.computer().price.spot.cents.height)?;
Ok(bw
.buckets
+5 -5
View File
@@ -1,10 +1,10 @@
use std::{ops::Range, sync::Arc};
use brk_computer::prices::Vecs as PricesVecs;
use brk_computer::price::Vecs as PricesVecs;
use brk_error::{Error, Result};
use brk_indexer::Lengths;
use brk_oracle::{
cents_to_bin, sats_to_bin, Config, HistogramEma, HistogramEmaCompact, HistogramRaw, Oracle,
Config, HistogramEma, HistogramEmaCompact, HistogramRaw, Oracle, cents_to_bin, sats_to_bin,
};
use brk_types::{Day1, Dollars, TxOutIndex};
use vecdb::{AnyVec, ReadableVec, VecIndex};
@@ -127,7 +127,7 @@ impl Query {
let last = self
.computer()
.prices
.price
.spot
.cents
.height
@@ -169,7 +169,7 @@ impl Query {
fn seed_bin_at(&self, height: usize) -> Result<f64> {
let cents = self
.computer()
.prices
.price
.spot
.cents
.height
@@ -180,7 +180,7 @@ impl Query {
fn histogram_bound(&self, safe: &Lengths) -> usize {
self.computer()
.prices
.price
.spot
.cents
.height
+2 -2
View File
@@ -23,7 +23,7 @@ impl Query {
return Ok(vec![]);
}
let h4 = Hour4::from_timestamp(target);
let cents = self.computer().prices.spot.cents.hour4.collect_one(h4);
let cents = self.computer().price.spot.cents.hour4.collect_one(h4);
Ok(vec![HistoricalPriceEntry {
time: h4.to_timestamp(),
usd: Dollars::from(cents.flatten().unwrap_or_default()),
@@ -33,7 +33,7 @@ impl Query {
fn all_prices(&self) -> Result<Vec<HistoricalPriceEntry>> {
let computer = self.computer();
Ok(computer
.prices
.price
.spot
.cents
.hour4
+1 -1
View File
@@ -81,7 +81,7 @@ impl Query {
let day1 = Day1::try_from(date)?;
let close = self
.computer()
.prices
.price
.split
.close
.cents