mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 14:49:58 -07:00
global: MASSIVE snapshot
This commit is contained in:
@@ -6,41 +6,40 @@ console.log("Testing idiomatic API...\n");
|
||||
|
||||
// Test getter access (property)
|
||||
console.log("1. Getter access (.by.dateindex):");
|
||||
const all = await client.metrics.price.usd.split.close.by.dateindex;
|
||||
const all = await client.metrics.prices.usd.split.close.by.day1;
|
||||
console.log(` Total: ${all.total}, Got: ${all.data.length} items\n`);
|
||||
|
||||
// Test dynamic access (bracket notation)
|
||||
console.log("2. Dynamic access (.by['dateindex']):");
|
||||
const allDynamic = await client.metrics.price.usd.split.close.by["dateindex"];
|
||||
const allDynamic = await client.metrics.prices.usd.split.close.by.day1;
|
||||
console.log(
|
||||
` Total: ${allDynamic.total}, Got: ${allDynamic.data.length} items\n`,
|
||||
);
|
||||
|
||||
// Test fetch all (explicit .fetch())
|
||||
console.log("3. Explicit .fetch():");
|
||||
const allExplicit =
|
||||
await client.metrics.price.usd.split.close.by.dateindex.fetch();
|
||||
const allExplicit = await client.metrics.prices.usd.split.close.by.day1.fetch();
|
||||
console.log(
|
||||
` Total: ${allExplicit.total}, Got: ${allExplicit.data.length} items\n`,
|
||||
);
|
||||
|
||||
// Test first(n)
|
||||
console.log("4. First 5 items (.first(5)):");
|
||||
const first5 = await client.metrics.price.usd.split.close.by.dateindex.first(5);
|
||||
const first5 = await client.metrics.prices.usd.split.close.by.day1.first(5);
|
||||
console.log(
|
||||
` Total: ${first5.total}, Start: ${first5.start}, End: ${first5.end}, Got: ${first5.data.length} items\n`,
|
||||
);
|
||||
|
||||
// Test last(n)
|
||||
console.log("5. Last 5 items (.last(5)):");
|
||||
const last5 = await client.metrics.price.usd.split.close.by.dateindex.last(5);
|
||||
const last5 = await client.metrics.prices.usd.split.close.by.day1.last(5);
|
||||
console.log(
|
||||
` Total: ${last5.total}, Start: ${last5.start}, End: ${last5.end}, Got: ${last5.data.length} items\n`,
|
||||
);
|
||||
|
||||
// Test slice(start, end)
|
||||
console.log("6. Slice 10-20 (.slice(10, 20)):");
|
||||
const sliced = await client.metrics.price.usd.split.close.by.dateindex.slice(
|
||||
const sliced = await client.metrics.prices.usd.split.close.by.day1.slice(
|
||||
10,
|
||||
20,
|
||||
);
|
||||
@@ -50,14 +49,14 @@ console.log(
|
||||
|
||||
// Test get(index) - single item
|
||||
console.log("7. Single item (.get(100)):");
|
||||
const single = await client.metrics.price.usd.split.close.by.dateindex.get(100);
|
||||
const single = await client.metrics.prices.usd.split.close.by.day1.get(100);
|
||||
console.log(
|
||||
` Total: ${single.total}, Start: ${single.start}, End: ${single.end}, Got: ${single.data.length} item(s)\n`,
|
||||
);
|
||||
|
||||
// Test skip(n).take(m) chaining
|
||||
console.log("8. Skip and take (.skip(100).take(10)):");
|
||||
const skipTake = await client.metrics.price.usd.split.close.by.dateindex
|
||||
const skipTake = await client.metrics.prices.usd.split.close.by.day1
|
||||
.skip(100)
|
||||
.take(10);
|
||||
console.log(
|
||||
@@ -66,7 +65,7 @@ console.log(
|
||||
|
||||
// Test fetchCsv
|
||||
console.log("9. Fetch as CSV (.last(3).fetchCsv()):");
|
||||
const csv = await client.metrics.price.usd.split.close.by.dateindex
|
||||
const csv = await client.metrics.prices.usd.split.close.by.day1
|
||||
.last(3)
|
||||
.fetchCsv();
|
||||
console.log(` CSV preview: ${csv.substring(0, 100)}...\n`);
|
||||
|
||||
Reference in New Issue
Block a user