global: snapshot

This commit is contained in:
nym21
2026-01-15 23:34:43 +01:00
parent b0d933a7ab
commit 967d2c7f35
67 changed files with 6854 additions and 5210 deletions

View File

@@ -43,6 +43,18 @@ export function createMarketSection(ctx) {
unit: Unit.usd,
colors: [colors.cyan, colors.purple],
}),
line({
metric: price.oracle.phaseDailyDollars.median,
name: "Oracle2 median",
unit: Unit.usd,
color: colors.blue,
}),
line({
metric: price.oracle.phaseDailyDollars.average,
name: "Oracle2 average",
unit: Unit.usd,
color: colors.yellow,
}),
],
}),
},

View File

@@ -87,7 +87,7 @@ function useMetricEndpoint(endpoint) {
* @param {number} [to]
* @returns {RangeState<T>}
*/
function range(from = -10000, to) {
function range(from, to) {
const key = `${from}-${to ?? ""}`;
const existing = ranges.get(key);
if (existing) return existing;
@@ -111,13 +111,11 @@ function useMetricEndpoint(endpoint) {
* @param {number} [start=-10000]
* @param {number} [end]
*/
async fetch(start = -10000, end) {
async fetch(start, end) {
const r = range(start, end);
r.loading.set(true);
try {
const result = await endpoint
.slice(start, end)
.fetch(r.response.set);
const result = await endpoint.slice(start, end).fetch(r.response.set);
return result;
} finally {
r.loading.set(false);