global: snapshot

This commit is contained in:
nym21
2026-01-12 22:43:56 +01:00
parent b675b70067
commit 5ffb66c0dc
39 changed files with 8207 additions and 11957 deletions

View File

@@ -36,29 +36,30 @@ def test_fetch_csv_metric():
def test_fetch_typed_metric():
client = BrkClient("http://localhost:3110")
a = client.metrics.constants.constant_0.by.dateindex().from_(-10).json()
# Using new idiomatic API: tail(10).fetch() or [-10:].fetch()
a = client.metrics.constants.constant_0.by.dateindex().tail(10).fetch()
print(a)
b = client.metrics.outputs.count.utxo_count.by.height().from_(-10).json()
b = client.metrics.outputs.count.utxo_count.by.height().tail(10).fetch()
print(b)
c = client.metrics.price.usd.split.close.by.dateindex().from_(-10).json()
c = client.metrics.price.usd.split.close.by.dateindex().tail(10).fetch()
print(c)
d = (
client.metrics.market.dca.period_lump_sum_stack._10y.dollars.by.dateindex()
.from_(-10)
.json()
.tail(10)
.fetch()
)
print(d)
e = (
client.metrics.market.dca.class_average_price._2017.by.dateindex()
.from_(-10)
.json()
.tail(10)
.fetch()
)
print(e)
f = (
client.metrics.distribution.address_cohorts.amount_range._10k_sats_to_100k_sats.activity.sent.dollars.cumulative.by.dateindex()
.from_(-10)
.json()
.tail(10)
.fetch()
)
print(f)
g = client.metrics.price.usd.ohlc.by.dateindex().from_(-10).json()
g = client.metrics.price.usd.ohlc.by.dateindex().tail(10).fetch()
print(g)

View File

@@ -41,7 +41,7 @@ def test_all_endpoints():
"""Test fetching last 3 values from all metric endpoints."""
client = BrkClient("http://localhost:3110")
metrics = get_all_metrics(client.tree)
metrics = get_all_metrics(client.metrics)
print(f"\nFound {len(metrics)} metrics")
success = 0
@@ -53,7 +53,8 @@ def test_all_endpoints():
try:
by = metric.by
endpoint = getattr(by, idx_name)()
res = endpoint.range(-3)
# Use the new idiomatic API: tail(3).fetch() or [-3:].fetch()
res = endpoint.tail(3).fetch()
count = len(res["data"])
if count != 3:
failed += 1