brk-client 0.1.0-alpha.3 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -20
- package/index.js +441 -325
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ import { BrkClient } from 'brk-client';
|
|
|
17
17
|
|
|
18
18
|
// Use the free public API or your own instance
|
|
19
19
|
const client = new BrkClient('https://bitview.space');
|
|
20
|
+
// or: `const client = new BrkClient({ baseUrl: 'https://bitview.space', timeout: 10000 });`
|
|
20
21
|
|
|
21
22
|
// Blockchain data (mempool.space compatible)
|
|
22
23
|
const block = await client.getBlockByHeight(800000);
|
|
@@ -31,23 +32,3 @@ const prices = await client.metrics.price.usd.split.close
|
|
|
31
32
|
// Generic metric fetching
|
|
32
33
|
const data = await client.getMetric('price_close', 'dateindex', -30);
|
|
33
34
|
```
|
|
34
|
-
|
|
35
|
-
## API
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
// Range methods
|
|
39
|
-
.first(n) // First n items
|
|
40
|
-
.last(n) // Last n items
|
|
41
|
-
.slice(start, end)
|
|
42
|
-
.get(index) // Single item
|
|
43
|
-
.skip(n).take(m) // Pagination
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Configuration
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
const client = new BrkClient({
|
|
50
|
-
baseUrl: 'https://bitview.space',
|
|
51
|
-
timeout: 10000 // ms
|
|
52
|
-
});
|
|
53
|
-
```
|
package/index.js
CHANGED
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
* Aggregation dimension for querying metrics. Includes time-based (date, week, month, year),
|
|
309
309
|
* block-based (height, txindex), and address/output type indexes.
|
|
310
310
|
*
|
|
311
|
-
* @typedef {("dateindex"|"decadeindex"|"difficultyepoch"|"emptyoutputindex"|"halvingepoch"|"height"|"txinindex"|"monthindex"|"opreturnindex"|"txoutindex"|"p2aaddressindex"|"p2msoutputindex"|"p2pk33addressindex"|"p2pk65addressindex"|"p2pkhaddressindex"|"p2shaddressindex"|"p2traddressindex"|"p2wpkhaddressindex"|"p2wshaddressindex"|"quarterindex"|"semesterindex"|"txindex"|"unknownoutputindex"|"weekindex"|"yearindex"|"loadedaddressindex"|"emptyaddressindex")} Index
|
|
311
|
+
* @typedef {("dateindex"|"decadeindex"|"difficultyepoch"|"emptyoutputindex"|"halvingepoch"|"height"|"txinindex"|"monthindex"|"opreturnindex"|"txoutindex"|"p2aaddressindex"|"p2msoutputindex"|"p2pk33addressindex"|"p2pk65addressindex"|"p2pkhaddressindex"|"p2shaddressindex"|"p2traddressindex"|"p2wpkhaddressindex"|"p2wshaddressindex"|"quarterindex"|"semesterindex"|"txindex"|"unknownoutputindex"|"weekindex"|"yearindex"|"loadedaddressindex"|"emptyaddressindex"|"pairoutputindex")} Index
|
|
312
312
|
*/
|
|
313
313
|
/**
|
|
314
314
|
* Information about an available index and its query aliases
|
|
@@ -455,6 +455,8 @@
|
|
|
455
455
|
*
|
|
456
456
|
* @typedef {Cents} Open
|
|
457
457
|
*/
|
|
458
|
+
/** @typedef {number[]} OracleBins */
|
|
459
|
+
/** @typedef {number[]} OracleBinsV2 */
|
|
458
460
|
/** @typedef {number} OutPoint */
|
|
459
461
|
/**
|
|
460
462
|
* Type (P2PKH, P2WPKH, P2SH, P2TR, etc.)
|
|
@@ -492,6 +494,14 @@
|
|
|
492
494
|
* @typedef {Object} Pagination
|
|
493
495
|
* @property {?number=} page - Pagination index
|
|
494
496
|
*/
|
|
497
|
+
/**
|
|
498
|
+
* Index for 2-output transactions (oracle pair candidates)
|
|
499
|
+
*
|
|
500
|
+
* This indexes all transactions with exactly 2 outputs, which are
|
|
501
|
+
* candidates for the UTXOracle algorithm (payment + change pattern).
|
|
502
|
+
*
|
|
503
|
+
* @typedef {number} PairOutputIndex
|
|
504
|
+
*/
|
|
495
505
|
/**
|
|
496
506
|
* Block counts for different time periods
|
|
497
507
|
*
|
|
@@ -1092,6 +1102,7 @@ const _i29 = /** @type {const} */ (["weekindex"]);
|
|
|
1092
1102
|
const _i30 = /** @type {const} */ (["yearindex"]);
|
|
1093
1103
|
const _i31 = /** @type {const} */ (["loadedaddressindex"]);
|
|
1094
1104
|
const _i32 = /** @type {const} */ (["emptyaddressindex"]);
|
|
1105
|
+
const _i33 = /** @type {const} */ (["pairoutputindex"]);
|
|
1095
1106
|
|
|
1096
1107
|
/**
|
|
1097
1108
|
* Generic metric pattern factory.
|
|
@@ -1214,6 +1225,9 @@ function createMetricPattern31(client, name) { return _mp(client, name, _i31); }
|
|
|
1214
1225
|
/** @template T @typedef {{ name: string, by: { readonly emptyaddressindex: MetricEndpointBuilder<T> }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder<T>|undefined }} MetricPattern32 */
|
|
1215
1226
|
/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern32<T>} */
|
|
1216
1227
|
function createMetricPattern32(client, name) { return _mp(client, name, _i32); }
|
|
1228
|
+
/** @template T @typedef {{ name: string, by: { readonly pairoutputindex: MetricEndpointBuilder<T> }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder<T>|undefined }} MetricPattern33 */
|
|
1229
|
+
/** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern33<T>} */
|
|
1230
|
+
function createMetricPattern33(client, name) { return _mp(client, name, _i33); }
|
|
1217
1231
|
|
|
1218
1232
|
// Reusable structural pattern factories
|
|
1219
1233
|
|
|
@@ -1631,59 +1645,6 @@ function createPrice111dSmaPattern(client, acc) {
|
|
|
1631
1645
|
};
|
|
1632
1646
|
}
|
|
1633
1647
|
|
|
1634
|
-
/**
|
|
1635
|
-
* @typedef {Object} ActivePriceRatioPattern
|
|
1636
|
-
* @property {MetricPattern4<StoredF32>} ratio
|
|
1637
|
-
* @property {MetricPattern4<StoredF32>} ratio1mSma
|
|
1638
|
-
* @property {MetricPattern4<StoredF32>} ratio1wSma
|
|
1639
|
-
* @property {Ratio1ySdPattern} ratio1ySd
|
|
1640
|
-
* @property {Ratio1ySdPattern} ratio2ySd
|
|
1641
|
-
* @property {Ratio1ySdPattern} ratio4ySd
|
|
1642
|
-
* @property {MetricPattern4<StoredF32>} ratioPct1
|
|
1643
|
-
* @property {MetricPattern4<Dollars>} ratioPct1Usd
|
|
1644
|
-
* @property {MetricPattern4<StoredF32>} ratioPct2
|
|
1645
|
-
* @property {MetricPattern4<Dollars>} ratioPct2Usd
|
|
1646
|
-
* @property {MetricPattern4<StoredF32>} ratioPct5
|
|
1647
|
-
* @property {MetricPattern4<Dollars>} ratioPct5Usd
|
|
1648
|
-
* @property {MetricPattern4<StoredF32>} ratioPct95
|
|
1649
|
-
* @property {MetricPattern4<Dollars>} ratioPct95Usd
|
|
1650
|
-
* @property {MetricPattern4<StoredF32>} ratioPct98
|
|
1651
|
-
* @property {MetricPattern4<Dollars>} ratioPct98Usd
|
|
1652
|
-
* @property {MetricPattern4<StoredF32>} ratioPct99
|
|
1653
|
-
* @property {MetricPattern4<Dollars>} ratioPct99Usd
|
|
1654
|
-
* @property {Ratio1ySdPattern} ratioSd
|
|
1655
|
-
*/
|
|
1656
|
-
|
|
1657
|
-
/**
|
|
1658
|
-
* Create a ActivePriceRatioPattern pattern node
|
|
1659
|
-
* @param {BrkClientBase} client
|
|
1660
|
-
* @param {string} acc - Accumulated metric name
|
|
1661
|
-
* @returns {ActivePriceRatioPattern}
|
|
1662
|
-
*/
|
|
1663
|
-
function createActivePriceRatioPattern(client, acc) {
|
|
1664
|
-
return {
|
|
1665
|
-
ratio: createMetricPattern4(client, acc),
|
|
1666
|
-
ratio1mSma: createMetricPattern4(client, _m(acc, '1m_sma')),
|
|
1667
|
-
ratio1wSma: createMetricPattern4(client, _m(acc, '1w_sma')),
|
|
1668
|
-
ratio1ySd: createRatio1ySdPattern(client, _m(acc, '1y')),
|
|
1669
|
-
ratio2ySd: createRatio1ySdPattern(client, _m(acc, '2y')),
|
|
1670
|
-
ratio4ySd: createRatio1ySdPattern(client, _m(acc, '4y')),
|
|
1671
|
-
ratioPct1: createMetricPattern4(client, _m(acc, 'pct1')),
|
|
1672
|
-
ratioPct1Usd: createMetricPattern4(client, _m(acc, 'pct1_usd')),
|
|
1673
|
-
ratioPct2: createMetricPattern4(client, _m(acc, 'pct2')),
|
|
1674
|
-
ratioPct2Usd: createMetricPattern4(client, _m(acc, 'pct2_usd')),
|
|
1675
|
-
ratioPct5: createMetricPattern4(client, _m(acc, 'pct5')),
|
|
1676
|
-
ratioPct5Usd: createMetricPattern4(client, _m(acc, 'pct5_usd')),
|
|
1677
|
-
ratioPct95: createMetricPattern4(client, _m(acc, 'pct95')),
|
|
1678
|
-
ratioPct95Usd: createMetricPattern4(client, _m(acc, 'pct95_usd')),
|
|
1679
|
-
ratioPct98: createMetricPattern4(client, _m(acc, 'pct98')),
|
|
1680
|
-
ratioPct98Usd: createMetricPattern4(client, _m(acc, 'pct98_usd')),
|
|
1681
|
-
ratioPct99: createMetricPattern4(client, _m(acc, 'pct99')),
|
|
1682
|
-
ratioPct99Usd: createMetricPattern4(client, _m(acc, 'pct99_usd')),
|
|
1683
|
-
ratioSd: createRatio1ySdPattern(client, acc),
|
|
1684
|
-
};
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
1648
|
/**
|
|
1688
1649
|
* @typedef {Object} PercentilesPattern
|
|
1689
1650
|
* @property {MetricPattern4<Dollars>} pct05
|
|
@@ -1737,6 +1698,59 @@ function createPercentilesPattern(client, acc) {
|
|
|
1737
1698
|
};
|
|
1738
1699
|
}
|
|
1739
1700
|
|
|
1701
|
+
/**
|
|
1702
|
+
* @typedef {Object} ActivePriceRatioPattern
|
|
1703
|
+
* @property {MetricPattern4<StoredF32>} ratio
|
|
1704
|
+
* @property {MetricPattern4<StoredF32>} ratio1mSma
|
|
1705
|
+
* @property {MetricPattern4<StoredF32>} ratio1wSma
|
|
1706
|
+
* @property {Ratio1ySdPattern} ratio1ySd
|
|
1707
|
+
* @property {Ratio1ySdPattern} ratio2ySd
|
|
1708
|
+
* @property {Ratio1ySdPattern} ratio4ySd
|
|
1709
|
+
* @property {MetricPattern4<StoredF32>} ratioPct1
|
|
1710
|
+
* @property {MetricPattern4<Dollars>} ratioPct1Usd
|
|
1711
|
+
* @property {MetricPattern4<StoredF32>} ratioPct2
|
|
1712
|
+
* @property {MetricPattern4<Dollars>} ratioPct2Usd
|
|
1713
|
+
* @property {MetricPattern4<StoredF32>} ratioPct5
|
|
1714
|
+
* @property {MetricPattern4<Dollars>} ratioPct5Usd
|
|
1715
|
+
* @property {MetricPattern4<StoredF32>} ratioPct95
|
|
1716
|
+
* @property {MetricPattern4<Dollars>} ratioPct95Usd
|
|
1717
|
+
* @property {MetricPattern4<StoredF32>} ratioPct98
|
|
1718
|
+
* @property {MetricPattern4<Dollars>} ratioPct98Usd
|
|
1719
|
+
* @property {MetricPattern4<StoredF32>} ratioPct99
|
|
1720
|
+
* @property {MetricPattern4<Dollars>} ratioPct99Usd
|
|
1721
|
+
* @property {Ratio1ySdPattern} ratioSd
|
|
1722
|
+
*/
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* Create a ActivePriceRatioPattern pattern node
|
|
1726
|
+
* @param {BrkClientBase} client
|
|
1727
|
+
* @param {string} acc - Accumulated metric name
|
|
1728
|
+
* @returns {ActivePriceRatioPattern}
|
|
1729
|
+
*/
|
|
1730
|
+
function createActivePriceRatioPattern(client, acc) {
|
|
1731
|
+
return {
|
|
1732
|
+
ratio: createMetricPattern4(client, acc),
|
|
1733
|
+
ratio1mSma: createMetricPattern4(client, _m(acc, '1m_sma')),
|
|
1734
|
+
ratio1wSma: createMetricPattern4(client, _m(acc, '1w_sma')),
|
|
1735
|
+
ratio1ySd: createRatio1ySdPattern(client, _m(acc, '1y')),
|
|
1736
|
+
ratio2ySd: createRatio1ySdPattern(client, _m(acc, '2y')),
|
|
1737
|
+
ratio4ySd: createRatio1ySdPattern(client, _m(acc, '4y')),
|
|
1738
|
+
ratioPct1: createMetricPattern4(client, _m(acc, 'pct1')),
|
|
1739
|
+
ratioPct1Usd: createMetricPattern4(client, _m(acc, 'pct1_usd')),
|
|
1740
|
+
ratioPct2: createMetricPattern4(client, _m(acc, 'pct2')),
|
|
1741
|
+
ratioPct2Usd: createMetricPattern4(client, _m(acc, 'pct2_usd')),
|
|
1742
|
+
ratioPct5: createMetricPattern4(client, _m(acc, 'pct5')),
|
|
1743
|
+
ratioPct5Usd: createMetricPattern4(client, _m(acc, 'pct5_usd')),
|
|
1744
|
+
ratioPct95: createMetricPattern4(client, _m(acc, 'pct95')),
|
|
1745
|
+
ratioPct95Usd: createMetricPattern4(client, _m(acc, 'pct95_usd')),
|
|
1746
|
+
ratioPct98: createMetricPattern4(client, _m(acc, 'pct98')),
|
|
1747
|
+
ratioPct98Usd: createMetricPattern4(client, _m(acc, 'pct98_usd')),
|
|
1748
|
+
ratioPct99: createMetricPattern4(client, _m(acc, 'pct99')),
|
|
1749
|
+
ratioPct99Usd: createMetricPattern4(client, _m(acc, 'pct99_usd')),
|
|
1750
|
+
ratioSd: createRatio1ySdPattern(client, acc),
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1740
1754
|
/**
|
|
1741
1755
|
* @typedef {Object} RelativePattern5
|
|
1742
1756
|
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToMarketCap
|
|
@@ -1991,45 +2005,6 @@ function createBitcoinPattern(client, acc) {
|
|
|
1991
2005
|
};
|
|
1992
2006
|
}
|
|
1993
2007
|
|
|
1994
|
-
/**
|
|
1995
|
-
* @template T
|
|
1996
|
-
* @typedef {Object} ClassAveragePricePattern
|
|
1997
|
-
* @property {MetricPattern4<T>} _2015
|
|
1998
|
-
* @property {MetricPattern4<T>} _2016
|
|
1999
|
-
* @property {MetricPattern4<T>} _2017
|
|
2000
|
-
* @property {MetricPattern4<T>} _2018
|
|
2001
|
-
* @property {MetricPattern4<T>} _2019
|
|
2002
|
-
* @property {MetricPattern4<T>} _2020
|
|
2003
|
-
* @property {MetricPattern4<T>} _2021
|
|
2004
|
-
* @property {MetricPattern4<T>} _2022
|
|
2005
|
-
* @property {MetricPattern4<T>} _2023
|
|
2006
|
-
* @property {MetricPattern4<T>} _2024
|
|
2007
|
-
* @property {MetricPattern4<T>} _2025
|
|
2008
|
-
*/
|
|
2009
|
-
|
|
2010
|
-
/**
|
|
2011
|
-
* Create a ClassAveragePricePattern pattern node
|
|
2012
|
-
* @template T
|
|
2013
|
-
* @param {BrkClientBase} client
|
|
2014
|
-
* @param {string} acc - Accumulated metric name
|
|
2015
|
-
* @returns {ClassAveragePricePattern<T>}
|
|
2016
|
-
*/
|
|
2017
|
-
function createClassAveragePricePattern(client, acc) {
|
|
2018
|
-
return {
|
|
2019
|
-
_2015: createMetricPattern4(client, _m(acc, '2015_returns')),
|
|
2020
|
-
_2016: createMetricPattern4(client, _m(acc, '2016_returns')),
|
|
2021
|
-
_2017: createMetricPattern4(client, _m(acc, '2017_returns')),
|
|
2022
|
-
_2018: createMetricPattern4(client, _m(acc, '2018_returns')),
|
|
2023
|
-
_2019: createMetricPattern4(client, _m(acc, '2019_returns')),
|
|
2024
|
-
_2020: createMetricPattern4(client, _m(acc, '2020_returns')),
|
|
2025
|
-
_2021: createMetricPattern4(client, _m(acc, '2021_returns')),
|
|
2026
|
-
_2022: createMetricPattern4(client, _m(acc, '2022_returns')),
|
|
2027
|
-
_2023: createMetricPattern4(client, _m(acc, '2023_returns')),
|
|
2028
|
-
_2024: createMetricPattern4(client, _m(acc, '2024_returns')),
|
|
2029
|
-
_2025: createMetricPattern4(client, _m(acc, '2025_returns')),
|
|
2030
|
-
};
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
2008
|
/**
|
|
2034
2009
|
* @template T
|
|
2035
2010
|
* @typedef {Object} DollarsPattern
|
|
@@ -2070,37 +2045,41 @@ function createDollarsPattern(client, acc) {
|
|
|
2070
2045
|
}
|
|
2071
2046
|
|
|
2072
2047
|
/**
|
|
2073
|
-
* @
|
|
2074
|
-
* @
|
|
2075
|
-
* @property {
|
|
2076
|
-
* @property {
|
|
2077
|
-
* @property {
|
|
2078
|
-
* @property {
|
|
2079
|
-
* @property {
|
|
2080
|
-
* @property {
|
|
2081
|
-
* @property {
|
|
2082
|
-
* @property {
|
|
2083
|
-
* @property {
|
|
2048
|
+
* @template T
|
|
2049
|
+
* @typedef {Object} ClassAveragePricePattern
|
|
2050
|
+
* @property {MetricPattern4<T>} _2015
|
|
2051
|
+
* @property {MetricPattern4<T>} _2016
|
|
2052
|
+
* @property {MetricPattern4<T>} _2017
|
|
2053
|
+
* @property {MetricPattern4<T>} _2018
|
|
2054
|
+
* @property {MetricPattern4<T>} _2019
|
|
2055
|
+
* @property {MetricPattern4<T>} _2020
|
|
2056
|
+
* @property {MetricPattern4<T>} _2021
|
|
2057
|
+
* @property {MetricPattern4<T>} _2022
|
|
2058
|
+
* @property {MetricPattern4<T>} _2023
|
|
2059
|
+
* @property {MetricPattern4<T>} _2024
|
|
2060
|
+
* @property {MetricPattern4<T>} _2025
|
|
2084
2061
|
*/
|
|
2085
2062
|
|
|
2086
2063
|
/**
|
|
2087
|
-
* Create a
|
|
2064
|
+
* Create a ClassAveragePricePattern pattern node
|
|
2065
|
+
* @template T
|
|
2088
2066
|
* @param {BrkClientBase} client
|
|
2089
2067
|
* @param {string} acc - Accumulated metric name
|
|
2090
|
-
* @returns {
|
|
2068
|
+
* @returns {ClassAveragePricePattern<T>}
|
|
2091
2069
|
*/
|
|
2092
|
-
function
|
|
2070
|
+
function createClassAveragePricePattern(client, acc) {
|
|
2093
2071
|
return {
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2072
|
+
_2015: createMetricPattern4(client, _m(acc, '2015_returns')),
|
|
2073
|
+
_2016: createMetricPattern4(client, _m(acc, '2016_returns')),
|
|
2074
|
+
_2017: createMetricPattern4(client, _m(acc, '2017_returns')),
|
|
2075
|
+
_2018: createMetricPattern4(client, _m(acc, '2018_returns')),
|
|
2076
|
+
_2019: createMetricPattern4(client, _m(acc, '2019_returns')),
|
|
2077
|
+
_2020: createMetricPattern4(client, _m(acc, '2020_returns')),
|
|
2078
|
+
_2021: createMetricPattern4(client, _m(acc, '2021_returns')),
|
|
2079
|
+
_2022: createMetricPattern4(client, _m(acc, '2022_returns')),
|
|
2080
|
+
_2023: createMetricPattern4(client, _m(acc, '2023_returns')),
|
|
2081
|
+
_2024: createMetricPattern4(client, _m(acc, '2024_returns')),
|
|
2082
|
+
_2025: createMetricPattern4(client, _m(acc, '2025_returns')),
|
|
2104
2083
|
};
|
|
2105
2084
|
}
|
|
2106
2085
|
|
|
@@ -2139,6 +2118,41 @@ function createRelativePattern(client, acc) {
|
|
|
2139
2118
|
};
|
|
2140
2119
|
}
|
|
2141
2120
|
|
|
2121
|
+
/**
|
|
2122
|
+
* @typedef {Object} RelativePattern2
|
|
2123
|
+
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToOwnMarketCap
|
|
2124
|
+
* @property {MetricPattern1<StoredF32>} negUnrealizedLossRelToOwnTotalUnrealizedPnl
|
|
2125
|
+
* @property {MetricPattern1<StoredF32>} netUnrealizedPnlRelToOwnMarketCap
|
|
2126
|
+
* @property {MetricPattern1<StoredF32>} netUnrealizedPnlRelToOwnTotalUnrealizedPnl
|
|
2127
|
+
* @property {MetricPattern1<StoredF64>} supplyInLossRelToOwnSupply
|
|
2128
|
+
* @property {MetricPattern1<StoredF64>} supplyInProfitRelToOwnSupply
|
|
2129
|
+
* @property {MetricPattern1<StoredF32>} unrealizedLossRelToOwnMarketCap
|
|
2130
|
+
* @property {MetricPattern1<StoredF32>} unrealizedLossRelToOwnTotalUnrealizedPnl
|
|
2131
|
+
* @property {MetricPattern1<StoredF32>} unrealizedProfitRelToOwnMarketCap
|
|
2132
|
+
* @property {MetricPattern1<StoredF32>} unrealizedProfitRelToOwnTotalUnrealizedPnl
|
|
2133
|
+
*/
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* Create a RelativePattern2 pattern node
|
|
2137
|
+
* @param {BrkClientBase} client
|
|
2138
|
+
* @param {string} acc - Accumulated metric name
|
|
2139
|
+
* @returns {RelativePattern2}
|
|
2140
|
+
*/
|
|
2141
|
+
function createRelativePattern2(client, acc) {
|
|
2142
|
+
return {
|
|
2143
|
+
negUnrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_market_cap')),
|
|
2144
|
+
negUnrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss_rel_to_own_total_unrealized_pnl')),
|
|
2145
|
+
netUnrealizedPnlRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_market_cap')),
|
|
2146
|
+
netUnrealizedPnlRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl_rel_to_own_total_unrealized_pnl')),
|
|
2147
|
+
supplyInLossRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_loss_rel_to_own_supply')),
|
|
2148
|
+
supplyInProfitRelToOwnSupply: createMetricPattern1(client, _m(acc, 'supply_in_profit_rel_to_own_supply')),
|
|
2149
|
+
unrealizedLossRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_market_cap')),
|
|
2150
|
+
unrealizedLossRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_loss_rel_to_own_total_unrealized_pnl')),
|
|
2151
|
+
unrealizedProfitRelToOwnMarketCap: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_market_cap')),
|
|
2152
|
+
unrealizedProfitRelToOwnTotalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'unrealized_profit_rel_to_own_total_unrealized_pnl')),
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2142
2156
|
/**
|
|
2143
2157
|
* @template T
|
|
2144
2158
|
* @typedef {Object} CountPattern2
|
|
@@ -2209,41 +2223,6 @@ function createAddrCountPattern(client, acc) {
|
|
|
2209
2223
|
};
|
|
2210
2224
|
}
|
|
2211
2225
|
|
|
2212
|
-
/**
|
|
2213
|
-
* @template T
|
|
2214
|
-
* @typedef {Object} FullnessPattern
|
|
2215
|
-
* @property {MetricPattern2<T>} average
|
|
2216
|
-
* @property {MetricPattern11<T>} base
|
|
2217
|
-
* @property {MetricPattern2<T>} max
|
|
2218
|
-
* @property {MetricPattern6<T>} median
|
|
2219
|
-
* @property {MetricPattern2<T>} min
|
|
2220
|
-
* @property {MetricPattern6<T>} pct10
|
|
2221
|
-
* @property {MetricPattern6<T>} pct25
|
|
2222
|
-
* @property {MetricPattern6<T>} pct75
|
|
2223
|
-
* @property {MetricPattern6<T>} pct90
|
|
2224
|
-
*/
|
|
2225
|
-
|
|
2226
|
-
/**
|
|
2227
|
-
* Create a FullnessPattern pattern node
|
|
2228
|
-
* @template T
|
|
2229
|
-
* @param {BrkClientBase} client
|
|
2230
|
-
* @param {string} acc - Accumulated metric name
|
|
2231
|
-
* @returns {FullnessPattern<T>}
|
|
2232
|
-
*/
|
|
2233
|
-
function createFullnessPattern(client, acc) {
|
|
2234
|
-
return {
|
|
2235
|
-
average: createMetricPattern2(client, _m(acc, 'average')),
|
|
2236
|
-
base: createMetricPattern11(client, acc),
|
|
2237
|
-
max: createMetricPattern2(client, _m(acc, 'max')),
|
|
2238
|
-
median: createMetricPattern6(client, _m(acc, 'median')),
|
|
2239
|
-
min: createMetricPattern2(client, _m(acc, 'min')),
|
|
2240
|
-
pct10: createMetricPattern6(client, _m(acc, 'pct10')),
|
|
2241
|
-
pct25: createMetricPattern6(client, _m(acc, 'pct25')),
|
|
2242
|
-
pct75: createMetricPattern6(client, _m(acc, 'pct75')),
|
|
2243
|
-
pct90: createMetricPattern6(client, _m(acc, 'pct90')),
|
|
2244
|
-
};
|
|
2245
|
-
}
|
|
2246
|
-
|
|
2247
2226
|
/**
|
|
2248
2227
|
* @template T
|
|
2249
2228
|
* @typedef {Object} FeeRatePattern
|
|
@@ -2279,6 +2258,41 @@ function createFeeRatePattern(client, acc) {
|
|
|
2279
2258
|
};
|
|
2280
2259
|
}
|
|
2281
2260
|
|
|
2261
|
+
/**
|
|
2262
|
+
* @template T
|
|
2263
|
+
* @typedef {Object} FullnessPattern
|
|
2264
|
+
* @property {MetricPattern2<T>} average
|
|
2265
|
+
* @property {MetricPattern11<T>} base
|
|
2266
|
+
* @property {MetricPattern2<T>} max
|
|
2267
|
+
* @property {MetricPattern6<T>} median
|
|
2268
|
+
* @property {MetricPattern2<T>} min
|
|
2269
|
+
* @property {MetricPattern6<T>} pct10
|
|
2270
|
+
* @property {MetricPattern6<T>} pct25
|
|
2271
|
+
* @property {MetricPattern6<T>} pct75
|
|
2272
|
+
* @property {MetricPattern6<T>} pct90
|
|
2273
|
+
*/
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* Create a FullnessPattern pattern node
|
|
2277
|
+
* @template T
|
|
2278
|
+
* @param {BrkClientBase} client
|
|
2279
|
+
* @param {string} acc - Accumulated metric name
|
|
2280
|
+
* @returns {FullnessPattern<T>}
|
|
2281
|
+
*/
|
|
2282
|
+
function createFullnessPattern(client, acc) {
|
|
2283
|
+
return {
|
|
2284
|
+
average: createMetricPattern2(client, _m(acc, 'average')),
|
|
2285
|
+
base: createMetricPattern11(client, acc),
|
|
2286
|
+
max: createMetricPattern2(client, _m(acc, 'max')),
|
|
2287
|
+
median: createMetricPattern6(client, _m(acc, 'median')),
|
|
2288
|
+
min: createMetricPattern2(client, _m(acc, 'min')),
|
|
2289
|
+
pct10: createMetricPattern6(client, _m(acc, 'pct10')),
|
|
2290
|
+
pct25: createMetricPattern6(client, _m(acc, 'pct25')),
|
|
2291
|
+
pct75: createMetricPattern6(client, _m(acc, 'pct75')),
|
|
2292
|
+
pct90: createMetricPattern6(client, _m(acc, 'pct90')),
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2282
2296
|
/**
|
|
2283
2297
|
* @typedef {Object} _0satsPattern
|
|
2284
2298
|
* @property {ActivityPattern2} activity
|
|
@@ -2311,31 +2325,35 @@ function create_0satsPattern(client, acc) {
|
|
|
2311
2325
|
}
|
|
2312
2326
|
|
|
2313
2327
|
/**
|
|
2314
|
-
* @
|
|
2315
|
-
* @
|
|
2316
|
-
* @property {
|
|
2317
|
-
* @property {
|
|
2318
|
-
* @property {
|
|
2319
|
-
* @property {
|
|
2320
|
-
* @property {
|
|
2321
|
-
* @property {
|
|
2328
|
+
* @template T
|
|
2329
|
+
* @typedef {Object} PhaseDailyCentsPattern
|
|
2330
|
+
* @property {MetricPattern6<T>} average
|
|
2331
|
+
* @property {MetricPattern6<T>} max
|
|
2332
|
+
* @property {MetricPattern6<T>} median
|
|
2333
|
+
* @property {MetricPattern6<T>} min
|
|
2334
|
+
* @property {MetricPattern6<T>} pct10
|
|
2335
|
+
* @property {MetricPattern6<T>} pct25
|
|
2336
|
+
* @property {MetricPattern6<T>} pct75
|
|
2337
|
+
* @property {MetricPattern6<T>} pct90
|
|
2322
2338
|
*/
|
|
2323
2339
|
|
|
2324
2340
|
/**
|
|
2325
|
-
* Create a
|
|
2341
|
+
* Create a PhaseDailyCentsPattern pattern node
|
|
2342
|
+
* @template T
|
|
2326
2343
|
* @param {BrkClientBase} client
|
|
2327
2344
|
* @param {string} acc - Accumulated metric name
|
|
2328
|
-
* @returns {
|
|
2345
|
+
* @returns {PhaseDailyCentsPattern<T>}
|
|
2329
2346
|
*/
|
|
2330
|
-
function
|
|
2347
|
+
function createPhaseDailyCentsPattern(client, acc) {
|
|
2331
2348
|
return {
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2349
|
+
average: createMetricPattern6(client, _m(acc, 'average')),
|
|
2350
|
+
max: createMetricPattern6(client, _m(acc, 'max')),
|
|
2351
|
+
median: createMetricPattern6(client, _m(acc, 'median')),
|
|
2352
|
+
min: createMetricPattern6(client, _m(acc, 'min')),
|
|
2353
|
+
pct10: createMetricPattern6(client, _m(acc, 'pct10')),
|
|
2354
|
+
pct25: createMetricPattern6(client, _m(acc, 'pct25')),
|
|
2355
|
+
pct75: createMetricPattern6(client, _m(acc, 'pct75')),
|
|
2356
|
+
pct90: createMetricPattern6(client, _m(acc, 'pct90')),
|
|
2339
2357
|
};
|
|
2340
2358
|
}
|
|
2341
2359
|
|
|
@@ -2369,31 +2387,60 @@ function createPeriodCagrPattern(client, acc) {
|
|
|
2369
2387
|
}
|
|
2370
2388
|
|
|
2371
2389
|
/**
|
|
2372
|
-
* @typedef {Object}
|
|
2373
|
-
* @property {
|
|
2374
|
-
* @property {
|
|
2375
|
-
* @property {
|
|
2376
|
-
* @property {
|
|
2377
|
-
* @property {
|
|
2378
|
-
* @property {
|
|
2379
|
-
* @property {
|
|
2390
|
+
* @typedef {Object} _0satsPattern2
|
|
2391
|
+
* @property {ActivityPattern2} activity
|
|
2392
|
+
* @property {CostBasisPattern} costBasis
|
|
2393
|
+
* @property {OutputsPattern} outputs
|
|
2394
|
+
* @property {RealizedPattern} realized
|
|
2395
|
+
* @property {RelativePattern4} relative
|
|
2396
|
+
* @property {SupplyPattern2} supply
|
|
2397
|
+
* @property {UnrealizedPattern} unrealized
|
|
2380
2398
|
*/
|
|
2381
2399
|
|
|
2382
2400
|
/**
|
|
2383
|
-
* Create a
|
|
2401
|
+
* Create a _0satsPattern2 pattern node
|
|
2384
2402
|
* @param {BrkClientBase} client
|
|
2385
2403
|
* @param {string} acc - Accumulated metric name
|
|
2386
|
-
* @returns {
|
|
2404
|
+
* @returns {_0satsPattern2}
|
|
2387
2405
|
*/
|
|
2388
|
-
function
|
|
2406
|
+
function create_0satsPattern2(client, acc) {
|
|
2389
2407
|
return {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2408
|
+
activity: createActivityPattern2(client, acc),
|
|
2409
|
+
costBasis: createCostBasisPattern(client, acc),
|
|
2410
|
+
outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
|
|
2411
|
+
realized: createRealizedPattern(client, acc),
|
|
2412
|
+
relative: createRelativePattern4(client, _m(acc, 'supply_in')),
|
|
2413
|
+
supply: createSupplyPattern2(client, _m(acc, 'supply')),
|
|
2414
|
+
unrealized: createUnrealizedPattern(client, acc),
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
/**
|
|
2419
|
+
* @typedef {Object} _10yPattern
|
|
2420
|
+
* @property {ActivityPattern2} activity
|
|
2421
|
+
* @property {CostBasisPattern} costBasis
|
|
2422
|
+
* @property {OutputsPattern} outputs
|
|
2423
|
+
* @property {RealizedPattern4} realized
|
|
2424
|
+
* @property {RelativePattern} relative
|
|
2425
|
+
* @property {SupplyPattern2} supply
|
|
2426
|
+
* @property {UnrealizedPattern} unrealized
|
|
2427
|
+
*/
|
|
2428
|
+
|
|
2429
|
+
/**
|
|
2430
|
+
* Create a _10yPattern pattern node
|
|
2431
|
+
* @param {BrkClientBase} client
|
|
2432
|
+
* @param {string} acc - Accumulated metric name
|
|
2433
|
+
* @returns {_10yPattern}
|
|
2434
|
+
*/
|
|
2435
|
+
function create_10yPattern(client, acc) {
|
|
2436
|
+
return {
|
|
2437
|
+
activity: createActivityPattern2(client, acc),
|
|
2438
|
+
costBasis: createCostBasisPattern(client, acc),
|
|
2439
|
+
outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
|
|
2440
|
+
realized: createRealizedPattern4(client, acc),
|
|
2441
|
+
relative: createRelativePattern(client, acc),
|
|
2442
|
+
supply: createSupplyPattern2(client, _m(acc, 'supply')),
|
|
2443
|
+
unrealized: createUnrealizedPattern(client, acc),
|
|
2397
2444
|
};
|
|
2398
2445
|
}
|
|
2399
2446
|
|
|
@@ -2427,60 +2474,60 @@ function create_10yTo12yPattern(client, acc) {
|
|
|
2427
2474
|
}
|
|
2428
2475
|
|
|
2429
2476
|
/**
|
|
2430
|
-
* @typedef {Object}
|
|
2477
|
+
* @typedef {Object} _100btcPattern
|
|
2431
2478
|
* @property {ActivityPattern2} activity
|
|
2432
2479
|
* @property {CostBasisPattern} costBasis
|
|
2433
2480
|
* @property {OutputsPattern} outputs
|
|
2434
2481
|
* @property {RealizedPattern} realized
|
|
2435
|
-
* @property {
|
|
2482
|
+
* @property {RelativePattern} relative
|
|
2436
2483
|
* @property {SupplyPattern2} supply
|
|
2437
2484
|
* @property {UnrealizedPattern} unrealized
|
|
2438
2485
|
*/
|
|
2439
2486
|
|
|
2440
2487
|
/**
|
|
2441
|
-
* Create a
|
|
2488
|
+
* Create a _100btcPattern pattern node
|
|
2442
2489
|
* @param {BrkClientBase} client
|
|
2443
2490
|
* @param {string} acc - Accumulated metric name
|
|
2444
|
-
* @returns {
|
|
2491
|
+
* @returns {_100btcPattern}
|
|
2445
2492
|
*/
|
|
2446
|
-
function
|
|
2493
|
+
function create_100btcPattern(client, acc) {
|
|
2447
2494
|
return {
|
|
2448
2495
|
activity: createActivityPattern2(client, acc),
|
|
2449
2496
|
costBasis: createCostBasisPattern(client, acc),
|
|
2450
2497
|
outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
|
|
2451
2498
|
realized: createRealizedPattern(client, acc),
|
|
2452
|
-
relative:
|
|
2499
|
+
relative: createRelativePattern(client, acc),
|
|
2453
2500
|
supply: createSupplyPattern2(client, _m(acc, 'supply')),
|
|
2454
2501
|
unrealized: createUnrealizedPattern(client, acc),
|
|
2455
2502
|
};
|
|
2456
2503
|
}
|
|
2457
2504
|
|
|
2458
2505
|
/**
|
|
2459
|
-
* @typedef {Object}
|
|
2460
|
-
* @property {
|
|
2461
|
-
* @property {
|
|
2462
|
-
* @property {
|
|
2463
|
-
* @property {
|
|
2464
|
-
* @property {
|
|
2465
|
-
* @property {
|
|
2466
|
-
* @property {
|
|
2506
|
+
* @typedef {Object} UnrealizedPattern
|
|
2507
|
+
* @property {MetricPattern1<Dollars>} negUnrealizedLoss
|
|
2508
|
+
* @property {MetricPattern1<Dollars>} netUnrealizedPnl
|
|
2509
|
+
* @property {ActiveSupplyPattern} supplyInLoss
|
|
2510
|
+
* @property {ActiveSupplyPattern} supplyInProfit
|
|
2511
|
+
* @property {MetricPattern1<Dollars>} totalUnrealizedPnl
|
|
2512
|
+
* @property {MetricPattern1<Dollars>} unrealizedLoss
|
|
2513
|
+
* @property {MetricPattern1<Dollars>} unrealizedProfit
|
|
2467
2514
|
*/
|
|
2468
2515
|
|
|
2469
2516
|
/**
|
|
2470
|
-
* Create a
|
|
2517
|
+
* Create a UnrealizedPattern pattern node
|
|
2471
2518
|
* @param {BrkClientBase} client
|
|
2472
2519
|
* @param {string} acc - Accumulated metric name
|
|
2473
|
-
* @returns {
|
|
2520
|
+
* @returns {UnrealizedPattern}
|
|
2474
2521
|
*/
|
|
2475
|
-
function
|
|
2522
|
+
function createUnrealizedPattern(client, acc) {
|
|
2476
2523
|
return {
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2524
|
+
negUnrealizedLoss: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')),
|
|
2525
|
+
netUnrealizedPnl: createMetricPattern1(client, _m(acc, 'net_unrealized_pnl')),
|
|
2526
|
+
supplyInLoss: createActiveSupplyPattern(client, _m(acc, 'supply_in_loss')),
|
|
2527
|
+
supplyInProfit: createActiveSupplyPattern(client, _m(acc, 'supply_in_profit')),
|
|
2528
|
+
totalUnrealizedPnl: createMetricPattern1(client, _m(acc, 'total_unrealized_pnl')),
|
|
2529
|
+
unrealizedLoss: createMetricPattern1(client, _m(acc, 'unrealized_loss')),
|
|
2530
|
+
unrealizedProfit: createMetricPattern1(client, _m(acc, 'unrealized_profit')),
|
|
2484
2531
|
};
|
|
2485
2532
|
}
|
|
2486
2533
|
|
|
@@ -2535,23 +2582,23 @@ function createSplitPattern2(client, acc) {
|
|
|
2535
2582
|
}
|
|
2536
2583
|
|
|
2537
2584
|
/**
|
|
2538
|
-
* @typedef {Object}
|
|
2539
|
-
* @property {
|
|
2540
|
-
* @property {
|
|
2541
|
-
* @property {
|
|
2585
|
+
* @typedef {Object} CostBasisPattern2
|
|
2586
|
+
* @property {MetricPattern1<Dollars>} max
|
|
2587
|
+
* @property {MetricPattern1<Dollars>} min
|
|
2588
|
+
* @property {PercentilesPattern} percentiles
|
|
2542
2589
|
*/
|
|
2543
2590
|
|
|
2544
2591
|
/**
|
|
2545
|
-
* Create a
|
|
2592
|
+
* Create a CostBasisPattern2 pattern node
|
|
2546
2593
|
* @param {BrkClientBase} client
|
|
2547
2594
|
* @param {string} acc - Accumulated metric name
|
|
2548
|
-
* @returns {
|
|
2595
|
+
* @returns {CostBasisPattern2}
|
|
2549
2596
|
*/
|
|
2550
|
-
function
|
|
2597
|
+
function createCostBasisPattern2(client, acc) {
|
|
2551
2598
|
return {
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2599
|
+
max: createMetricPattern1(client, _m(acc, 'max_cost_basis')),
|
|
2600
|
+
min: createMetricPattern1(client, _m(acc, 'min_cost_basis')),
|
|
2601
|
+
percentiles: createPercentilesPattern(client, _m(acc, 'cost_basis')),
|
|
2555
2602
|
};
|
|
2556
2603
|
}
|
|
2557
2604
|
|
|
@@ -2577,107 +2624,126 @@ function createCoinbasePattern(client, acc) {
|
|
|
2577
2624
|
}
|
|
2578
2625
|
|
|
2579
2626
|
/**
|
|
2580
|
-
* @typedef {Object}
|
|
2581
|
-
* @property {
|
|
2627
|
+
* @typedef {Object} ActiveSupplyPattern
|
|
2628
|
+
* @property {MetricPattern1<Bitcoin>} bitcoin
|
|
2629
|
+
* @property {MetricPattern1<Dollars>} dollars
|
|
2630
|
+
* @property {MetricPattern1<Sats>} sats
|
|
2631
|
+
*/
|
|
2632
|
+
|
|
2633
|
+
/**
|
|
2634
|
+
* Create a ActiveSupplyPattern pattern node
|
|
2635
|
+
* @param {BrkClientBase} client
|
|
2636
|
+
* @param {string} acc - Accumulated metric name
|
|
2637
|
+
* @returns {ActiveSupplyPattern}
|
|
2638
|
+
*/
|
|
2639
|
+
function createActiveSupplyPattern(client, acc) {
|
|
2640
|
+
return {
|
|
2641
|
+
bitcoin: createMetricPattern1(client, _m(acc, 'btc')),
|
|
2642
|
+
dollars: createMetricPattern1(client, _m(acc, 'usd')),
|
|
2643
|
+
sats: createMetricPattern1(client, acc),
|
|
2644
|
+
};
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
/**
|
|
2648
|
+
* @typedef {Object} UnclaimedRewardsPattern
|
|
2649
|
+
* @property {BitcoinPattern2<Bitcoin>} bitcoin
|
|
2582
2650
|
* @property {BlockCountPattern<Dollars>} dollars
|
|
2583
2651
|
* @property {BlockCountPattern<Sats>} sats
|
|
2584
2652
|
*/
|
|
2585
2653
|
|
|
2586
2654
|
/**
|
|
2587
|
-
* Create a
|
|
2655
|
+
* Create a UnclaimedRewardsPattern pattern node
|
|
2588
2656
|
* @param {BrkClientBase} client
|
|
2589
2657
|
* @param {string} acc - Accumulated metric name
|
|
2590
|
-
* @returns {
|
|
2658
|
+
* @returns {UnclaimedRewardsPattern}
|
|
2591
2659
|
*/
|
|
2592
|
-
function
|
|
2660
|
+
function createUnclaimedRewardsPattern(client, acc) {
|
|
2593
2661
|
return {
|
|
2594
|
-
bitcoin:
|
|
2662
|
+
bitcoin: createBitcoinPattern2(client, _m(acc, 'btc')),
|
|
2595
2663
|
dollars: createBlockCountPattern(client, _m(acc, 'usd')),
|
|
2596
2664
|
sats: createBlockCountPattern(client, acc),
|
|
2597
2665
|
};
|
|
2598
2666
|
}
|
|
2599
2667
|
|
|
2600
2668
|
/**
|
|
2601
|
-
* @typedef {Object}
|
|
2602
|
-
* @property {
|
|
2603
|
-
* @property {
|
|
2604
|
-
* @property {
|
|
2669
|
+
* @typedef {Object} CoinbasePattern2
|
|
2670
|
+
* @property {BlockCountPattern<Bitcoin>} bitcoin
|
|
2671
|
+
* @property {BlockCountPattern<Dollars>} dollars
|
|
2672
|
+
* @property {BlockCountPattern<Sats>} sats
|
|
2605
2673
|
*/
|
|
2606
2674
|
|
|
2607
2675
|
/**
|
|
2608
|
-
* Create a
|
|
2676
|
+
* Create a CoinbasePattern2 pattern node
|
|
2609
2677
|
* @param {BrkClientBase} client
|
|
2610
2678
|
* @param {string} acc - Accumulated metric name
|
|
2611
|
-
* @returns {
|
|
2679
|
+
* @returns {CoinbasePattern2}
|
|
2612
2680
|
*/
|
|
2613
|
-
function
|
|
2681
|
+
function createCoinbasePattern2(client, acc) {
|
|
2614
2682
|
return {
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2683
|
+
bitcoin: createBlockCountPattern(client, _m(acc, 'btc')),
|
|
2684
|
+
dollars: createBlockCountPattern(client, _m(acc, 'usd')),
|
|
2685
|
+
sats: createBlockCountPattern(client, acc),
|
|
2618
2686
|
};
|
|
2619
2687
|
}
|
|
2620
2688
|
|
|
2621
2689
|
/**
|
|
2622
|
-
* @typedef {Object}
|
|
2623
|
-
* @property {
|
|
2624
|
-
* @property {
|
|
2625
|
-
* @property {
|
|
2690
|
+
* @typedef {Object} _2015Pattern
|
|
2691
|
+
* @property {MetricPattern4<Bitcoin>} bitcoin
|
|
2692
|
+
* @property {MetricPattern4<Dollars>} dollars
|
|
2693
|
+
* @property {MetricPattern4<Sats>} sats
|
|
2626
2694
|
*/
|
|
2627
2695
|
|
|
2628
2696
|
/**
|
|
2629
|
-
* Create a
|
|
2697
|
+
* Create a _2015Pattern pattern node
|
|
2630
2698
|
* @param {BrkClientBase} client
|
|
2631
2699
|
* @param {string} acc - Accumulated metric name
|
|
2632
|
-
* @returns {
|
|
2700
|
+
* @returns {_2015Pattern}
|
|
2633
2701
|
*/
|
|
2634
|
-
function
|
|
2702
|
+
function create_2015Pattern(client, acc) {
|
|
2635
2703
|
return {
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2704
|
+
bitcoin: createMetricPattern4(client, _m(acc, 'btc')),
|
|
2705
|
+
dollars: createMetricPattern4(client, _m(acc, 'usd')),
|
|
2706
|
+
sats: createMetricPattern4(client, acc),
|
|
2639
2707
|
};
|
|
2640
2708
|
}
|
|
2641
2709
|
|
|
2642
2710
|
/**
|
|
2643
|
-
* @typedef {Object}
|
|
2644
|
-
* @property {
|
|
2645
|
-
* @property {
|
|
2646
|
-
* @property {
|
|
2711
|
+
* @typedef {Object} SegwitAdoptionPattern
|
|
2712
|
+
* @property {MetricPattern11<StoredF32>} base
|
|
2713
|
+
* @property {MetricPattern2<StoredF32>} cumulative
|
|
2714
|
+
* @property {MetricPattern2<StoredF32>} sum
|
|
2647
2715
|
*/
|
|
2648
2716
|
|
|
2649
2717
|
/**
|
|
2650
|
-
* Create a
|
|
2718
|
+
* Create a SegwitAdoptionPattern pattern node
|
|
2651
2719
|
* @param {BrkClientBase} client
|
|
2652
2720
|
* @param {string} acc - Accumulated metric name
|
|
2653
|
-
* @returns {
|
|
2721
|
+
* @returns {SegwitAdoptionPattern}
|
|
2654
2722
|
*/
|
|
2655
|
-
function
|
|
2723
|
+
function createSegwitAdoptionPattern(client, acc) {
|
|
2656
2724
|
return {
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2725
|
+
base: createMetricPattern11(client, acc),
|
|
2726
|
+
cumulative: createMetricPattern2(client, _m(acc, 'cumulative')),
|
|
2727
|
+
sum: createMetricPattern2(client, _m(acc, 'sum')),
|
|
2660
2728
|
};
|
|
2661
2729
|
}
|
|
2662
2730
|
|
|
2663
2731
|
/**
|
|
2664
|
-
* @typedef {Object}
|
|
2665
|
-
* @property {
|
|
2666
|
-
* @property {
|
|
2667
|
-
* @property {BlockCountPattern<Sats>} sats
|
|
2732
|
+
* @typedef {Object} _1dReturns1mSdPattern
|
|
2733
|
+
* @property {MetricPattern4<StoredF32>} sd
|
|
2734
|
+
* @property {MetricPattern4<StoredF32>} sma
|
|
2668
2735
|
*/
|
|
2669
2736
|
|
|
2670
2737
|
/**
|
|
2671
|
-
* Create a
|
|
2738
|
+
* Create a _1dReturns1mSdPattern pattern node
|
|
2672
2739
|
* @param {BrkClientBase} client
|
|
2673
2740
|
* @param {string} acc - Accumulated metric name
|
|
2674
|
-
* @returns {
|
|
2741
|
+
* @returns {_1dReturns1mSdPattern}
|
|
2675
2742
|
*/
|
|
2676
|
-
function
|
|
2743
|
+
function create_1dReturns1mSdPattern(client, acc) {
|
|
2677
2744
|
return {
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
sats: createBlockCountPattern(client, acc),
|
|
2745
|
+
sd: createMetricPattern4(client, _m(acc, 'sd')),
|
|
2746
|
+
sma: createMetricPattern4(client, _m(acc, 'sma')),
|
|
2681
2747
|
};
|
|
2682
2748
|
}
|
|
2683
2749
|
|
|
@@ -2700,25 +2766,6 @@ function createCostBasisPattern(client, acc) {
|
|
|
2700
2766
|
};
|
|
2701
2767
|
}
|
|
2702
2768
|
|
|
2703
|
-
/**
|
|
2704
|
-
* @typedef {Object} SupplyPattern2
|
|
2705
|
-
* @property {ActiveSupplyPattern} halved
|
|
2706
|
-
* @property {ActiveSupplyPattern} total
|
|
2707
|
-
*/
|
|
2708
|
-
|
|
2709
|
-
/**
|
|
2710
|
-
* Create a SupplyPattern2 pattern node
|
|
2711
|
-
* @param {BrkClientBase} client
|
|
2712
|
-
* @param {string} acc - Accumulated metric name
|
|
2713
|
-
* @returns {SupplyPattern2}
|
|
2714
|
-
*/
|
|
2715
|
-
function createSupplyPattern2(client, acc) {
|
|
2716
|
-
return {
|
|
2717
|
-
halved: createActiveSupplyPattern(client, _m(acc, 'halved')),
|
|
2718
|
-
total: createActiveSupplyPattern(client, acc),
|
|
2719
|
-
};
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
2769
|
/**
|
|
2723
2770
|
* @typedef {Object} RelativePattern4
|
|
2724
2771
|
* @property {MetricPattern1<StoredF64>} supplyInLossRelToOwnSupply
|
|
@@ -2739,42 +2786,21 @@ function createRelativePattern4(client, acc) {
|
|
|
2739
2786
|
}
|
|
2740
2787
|
|
|
2741
2788
|
/**
|
|
2742
|
-
* @typedef {Object}
|
|
2743
|
-
* @property {
|
|
2744
|
-
* @property {
|
|
2745
|
-
*/
|
|
2746
|
-
|
|
2747
|
-
/**
|
|
2748
|
-
* Create a _1dReturns1mSdPattern pattern node
|
|
2749
|
-
* @param {BrkClientBase} client
|
|
2750
|
-
* @param {string} acc - Accumulated metric name
|
|
2751
|
-
* @returns {_1dReturns1mSdPattern}
|
|
2752
|
-
*/
|
|
2753
|
-
function create_1dReturns1mSdPattern(client, acc) {
|
|
2754
|
-
return {
|
|
2755
|
-
sd: createMetricPattern4(client, _m(acc, 'sd')),
|
|
2756
|
-
sma: createMetricPattern4(client, _m(acc, 'sma')),
|
|
2757
|
-
};
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
/**
|
|
2761
|
-
* @template T
|
|
2762
|
-
* @typedef {Object} BlockCountPattern
|
|
2763
|
-
* @property {MetricPattern1<T>} cumulative
|
|
2764
|
-
* @property {MetricPattern1<T>} sum
|
|
2789
|
+
* @typedef {Object} SupplyPattern2
|
|
2790
|
+
* @property {ActiveSupplyPattern} halved
|
|
2791
|
+
* @property {ActiveSupplyPattern} total
|
|
2765
2792
|
*/
|
|
2766
2793
|
|
|
2767
2794
|
/**
|
|
2768
|
-
* Create a
|
|
2769
|
-
* @template T
|
|
2795
|
+
* Create a SupplyPattern2 pattern node
|
|
2770
2796
|
* @param {BrkClientBase} client
|
|
2771
2797
|
* @param {string} acc - Accumulated metric name
|
|
2772
|
-
* @returns {
|
|
2798
|
+
* @returns {SupplyPattern2}
|
|
2773
2799
|
*/
|
|
2774
|
-
function
|
|
2800
|
+
function createSupplyPattern2(client, acc) {
|
|
2775
2801
|
return {
|
|
2776
|
-
|
|
2777
|
-
|
|
2802
|
+
halved: createActiveSupplyPattern(client, _m(acc, 'halved')),
|
|
2803
|
+
total: createActiveSupplyPattern(client, acc),
|
|
2778
2804
|
};
|
|
2779
2805
|
}
|
|
2780
2806
|
|
|
@@ -2821,19 +2847,23 @@ function createSatsPattern(client, acc) {
|
|
|
2821
2847
|
}
|
|
2822
2848
|
|
|
2823
2849
|
/**
|
|
2824
|
-
* @
|
|
2825
|
-
* @
|
|
2850
|
+
* @template T
|
|
2851
|
+
* @typedef {Object} BlockCountPattern
|
|
2852
|
+
* @property {MetricPattern1<T>} cumulative
|
|
2853
|
+
* @property {MetricPattern1<T>} sum
|
|
2826
2854
|
*/
|
|
2827
2855
|
|
|
2828
2856
|
/**
|
|
2829
|
-
* Create a
|
|
2857
|
+
* Create a BlockCountPattern pattern node
|
|
2858
|
+
* @template T
|
|
2830
2859
|
* @param {BrkClientBase} client
|
|
2831
2860
|
* @param {string} acc - Accumulated metric name
|
|
2832
|
-
* @returns {
|
|
2861
|
+
* @returns {BlockCountPattern<T>}
|
|
2833
2862
|
*/
|
|
2834
|
-
function
|
|
2863
|
+
function createBlockCountPattern(client, acc) {
|
|
2835
2864
|
return {
|
|
2836
|
-
|
|
2865
|
+
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
|
|
2866
|
+
sum: createMetricPattern1(client, acc),
|
|
2837
2867
|
};
|
|
2838
2868
|
}
|
|
2839
2869
|
|
|
@@ -2854,6 +2884,23 @@ function createOutputsPattern(client, acc) {
|
|
|
2854
2884
|
};
|
|
2855
2885
|
}
|
|
2856
2886
|
|
|
2887
|
+
/**
|
|
2888
|
+
* @typedef {Object} RealizedPriceExtraPattern
|
|
2889
|
+
* @property {MetricPattern4<StoredF32>} ratio
|
|
2890
|
+
*/
|
|
2891
|
+
|
|
2892
|
+
/**
|
|
2893
|
+
* Create a RealizedPriceExtraPattern pattern node
|
|
2894
|
+
* @param {BrkClientBase} client
|
|
2895
|
+
* @param {string} acc - Accumulated metric name
|
|
2896
|
+
* @returns {RealizedPriceExtraPattern}
|
|
2897
|
+
*/
|
|
2898
|
+
function createRealizedPriceExtraPattern(client, acc) {
|
|
2899
|
+
return {
|
|
2900
|
+
ratio: createMetricPattern4(client, acc),
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2857
2904
|
// Catalog tree typedefs
|
|
2858
2905
|
|
|
2859
2906
|
/**
|
|
@@ -4029,8 +4076,30 @@ function createOutputsPattern(client, acc) {
|
|
|
4029
4076
|
|
|
4030
4077
|
/**
|
|
4031
4078
|
* @typedef {Object} MetricsTree_Price_Oracle
|
|
4079
|
+
* @property {MetricPattern11<PairOutputIndex>} heightToFirstPairoutputindex
|
|
4032
4080
|
* @property {MetricPattern6<OHLCCents>} ohlcCents
|
|
4033
4081
|
* @property {MetricPattern6<OHLCDollars>} ohlcDollars
|
|
4082
|
+
* @property {MetricPattern33<Sats>} output0Value
|
|
4083
|
+
* @property {MetricPattern33<Sats>} output1Value
|
|
4084
|
+
* @property {MetricPattern33<TxIndex>} pairoutputindexToTxindex
|
|
4085
|
+
* @property {PhaseDailyCentsPattern<Cents>} phaseDailyCents
|
|
4086
|
+
* @property {PhaseDailyCentsPattern<Dollars>} phaseDailyDollars
|
|
4087
|
+
* @property {MetricPattern11<OracleBins>} phaseHistogram
|
|
4088
|
+
* @property {MetricPattern11<Cents>} phasePriceCents
|
|
4089
|
+
* @property {PhaseDailyCentsPattern<Cents>} phaseV2DailyCents
|
|
4090
|
+
* @property {PhaseDailyCentsPattern<Dollars>} phaseV2DailyDollars
|
|
4091
|
+
* @property {MetricPattern11<OracleBinsV2>} phaseV2Histogram
|
|
4092
|
+
* @property {PhaseDailyCentsPattern<Cents>} phaseV2PeakDailyCents
|
|
4093
|
+
* @property {PhaseDailyCentsPattern<Dollars>} phaseV2PeakDailyDollars
|
|
4094
|
+
* @property {MetricPattern11<Cents>} phaseV2PeakPriceCents
|
|
4095
|
+
* @property {MetricPattern11<Cents>} phaseV2PriceCents
|
|
4096
|
+
* @property {PhaseDailyCentsPattern<Cents>} phaseV3DailyCents
|
|
4097
|
+
* @property {PhaseDailyCentsPattern<Dollars>} phaseV3DailyDollars
|
|
4098
|
+
* @property {MetricPattern11<OracleBinsV2>} phaseV3Histogram
|
|
4099
|
+
* @property {PhaseDailyCentsPattern<Cents>} phaseV3PeakDailyCents
|
|
4100
|
+
* @property {PhaseDailyCentsPattern<Dollars>} phaseV3PeakDailyDollars
|
|
4101
|
+
* @property {MetricPattern11<Cents>} phaseV3PeakPriceCents
|
|
4102
|
+
* @property {MetricPattern11<Cents>} phaseV3PriceCents
|
|
4034
4103
|
* @property {MetricPattern11<Cents>} priceCents
|
|
4035
4104
|
* @property {MetricPattern6<StoredU32>} txCount
|
|
4036
4105
|
*/
|
|
@@ -4190,7 +4259,7 @@ function createOutputsPattern(client, acc) {
|
|
|
4190
4259
|
* @extends BrkClientBase
|
|
4191
4260
|
*/
|
|
4192
4261
|
class BrkClient extends BrkClientBase {
|
|
4193
|
-
VERSION = "v0.1.0-alpha.
|
|
4262
|
+
VERSION = "v0.1.0-alpha.3";
|
|
4194
4263
|
|
|
4195
4264
|
INDEXES = /** @type {const} */ ([
|
|
4196
4265
|
"dateindex",
|
|
@@ -4219,7 +4288,8 @@ class BrkClient extends BrkClientBase {
|
|
|
4219
4288
|
"weekindex",
|
|
4220
4289
|
"yearindex",
|
|
4221
4290
|
"loadedaddressindex",
|
|
4222
|
-
"emptyaddressindex"
|
|
4291
|
+
"emptyaddressindex",
|
|
4292
|
+
"pairoutputindex"
|
|
4223
4293
|
]);
|
|
4224
4294
|
|
|
4225
4295
|
POOL_ID_TO_POOL_NAME = /** @type {const} */ ({
|
|
@@ -5582,7 +5652,7 @@ class BrkClient extends BrkClientBase {
|
|
|
5582
5652
|
identity: createMetricPattern10(this, 'halvingepoch'),
|
|
5583
5653
|
},
|
|
5584
5654
|
height: {
|
|
5585
|
-
dateindex: createMetricPattern11(this, '
|
|
5655
|
+
dateindex: createMetricPattern11(this, 'dateindex'),
|
|
5586
5656
|
difficultyepoch: createMetricPattern11(this, 'difficultyepoch'),
|
|
5587
5657
|
halvingepoch: createMetricPattern11(this, 'halvingepoch'),
|
|
5588
5658
|
identity: createMetricPattern11(this, 'height'),
|
|
@@ -5990,8 +6060,30 @@ class BrkClient extends BrkClientBase {
|
|
|
5990
6060
|
},
|
|
5991
6061
|
},
|
|
5992
6062
|
oracle: {
|
|
6063
|
+
heightToFirstPairoutputindex: createMetricPattern11(this, 'height_to_first_pairoutputindex'),
|
|
5993
6064
|
ohlcCents: createMetricPattern6(this, 'oracle_ohlc_cents'),
|
|
5994
6065
|
ohlcDollars: createMetricPattern6(this, 'oracle_ohlc'),
|
|
6066
|
+
output0Value: createMetricPattern33(this, 'pair_output0_value'),
|
|
6067
|
+
output1Value: createMetricPattern33(this, 'pair_output1_value'),
|
|
6068
|
+
pairoutputindexToTxindex: createMetricPattern33(this, 'pairoutputindex_to_txindex'),
|
|
6069
|
+
phaseDailyCents: createPhaseDailyCentsPattern(this, 'phase_daily'),
|
|
6070
|
+
phaseDailyDollars: createPhaseDailyCentsPattern(this, 'phase_daily_dollars'),
|
|
6071
|
+
phaseHistogram: createMetricPattern11(this, 'phase_histogram'),
|
|
6072
|
+
phasePriceCents: createMetricPattern11(this, 'phase_price_cents'),
|
|
6073
|
+
phaseV2DailyCents: createPhaseDailyCentsPattern(this, 'phase_v2_daily'),
|
|
6074
|
+
phaseV2DailyDollars: createPhaseDailyCentsPattern(this, 'phase_v2_daily_dollars'),
|
|
6075
|
+
phaseV2Histogram: createMetricPattern11(this, 'phase_v2_histogram'),
|
|
6076
|
+
phaseV2PeakDailyCents: createPhaseDailyCentsPattern(this, 'phase_v2_peak_daily'),
|
|
6077
|
+
phaseV2PeakDailyDollars: createPhaseDailyCentsPattern(this, 'phase_v2_peak_daily_dollars'),
|
|
6078
|
+
phaseV2PeakPriceCents: createMetricPattern11(this, 'phase_v2_peak_price_cents'),
|
|
6079
|
+
phaseV2PriceCents: createMetricPattern11(this, 'phase_v2_price_cents'),
|
|
6080
|
+
phaseV3DailyCents: createPhaseDailyCentsPattern(this, 'phase_v3_daily'),
|
|
6081
|
+
phaseV3DailyDollars: createPhaseDailyCentsPattern(this, 'phase_v3_daily_dollars'),
|
|
6082
|
+
phaseV3Histogram: createMetricPattern11(this, 'phase_v3_histogram'),
|
|
6083
|
+
phaseV3PeakDailyCents: createPhaseDailyCentsPattern(this, 'phase_v3_peak_daily'),
|
|
6084
|
+
phaseV3PeakDailyDollars: createPhaseDailyCentsPattern(this, 'phase_v3_peak_daily_dollars'),
|
|
6085
|
+
phaseV3PeakPriceCents: createMetricPattern11(this, 'phase_v3_peak_price_cents'),
|
|
6086
|
+
phaseV3PriceCents: createMetricPattern11(this, 'phase_v3_price_cents'),
|
|
5995
6087
|
priceCents: createMetricPattern11(this, 'oracle_price_cents'),
|
|
5996
6088
|
txCount: createMetricPattern6(this, 'oracle_tx_count'),
|
|
5997
6089
|
},
|
|
@@ -6120,6 +6212,18 @@ class BrkClient extends BrkClientBase {
|
|
|
6120
6212
|
return _endpoint(this, metric, index);
|
|
6121
6213
|
}
|
|
6122
6214
|
|
|
6215
|
+
/**
|
|
6216
|
+
* Compact OpenAPI specification
|
|
6217
|
+
*
|
|
6218
|
+
* Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`.
|
|
6219
|
+
*
|
|
6220
|
+
* Endpoint: `GET /api.json`
|
|
6221
|
+
* @returns {Promise<*>}
|
|
6222
|
+
*/
|
|
6223
|
+
async getApi() {
|
|
6224
|
+
return this.getJson(`/api.json`);
|
|
6225
|
+
}
|
|
6226
|
+
|
|
6123
6227
|
/**
|
|
6124
6228
|
* Address information
|
|
6125
6229
|
*
|
|
@@ -6910,6 +7014,18 @@ class BrkClient extends BrkClientBase {
|
|
|
6910
7014
|
return this.getJson(`/health`);
|
|
6911
7015
|
}
|
|
6912
7016
|
|
|
7017
|
+
/**
|
|
7018
|
+
* OpenAPI specification
|
|
7019
|
+
*
|
|
7020
|
+
* Full OpenAPI 3.1 specification for this API.
|
|
7021
|
+
*
|
|
7022
|
+
* Endpoint: `GET /openapi.json`
|
|
7023
|
+
* @returns {Promise<*>}
|
|
7024
|
+
*/
|
|
7025
|
+
async getOpenapi() {
|
|
7026
|
+
return this.getJson(`/openapi.json`);
|
|
7027
|
+
}
|
|
7028
|
+
|
|
6913
7029
|
/**
|
|
6914
7030
|
* API version
|
|
6915
7031
|
*
|
package/package.json
CHANGED