brk-client 0.3.0-beta.3 → 0.3.0-beta.5

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.
Files changed (2) hide show
  1. package/index.js +397 -144
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -325,9 +325,9 @@ Matches mempool.space/bitcoin-cli behavior.
325
325
  * @typedef {Dollars} Close
326
326
  */
327
327
  /**
328
- * Cohort identifier for cost basis distribution.
328
+ * URPD cohort identifier. Use `GET /api/urpd` to list available cohorts.
329
329
  *
330
- * @typedef {("all"|"sth"|"lth"|"under_1h_old"|"1h_to_1d_old"|"1d_to_1w_old"|"1w_to_1m_old"|"1m_to_2m_old"|"2m_to_3m_old"|"3m_to_4m_old"|"4m_to_5m_old"|"5m_to_6m_old"|"6m_to_1y_old"|"1y_to_2y_old"|"2y_to_3y_old"|"3y_to_4y_old"|"4y_to_5y_old"|"5y_to_6y_old"|"6y_to_7y_old"|"7y_to_8y_old"|"8y_to_10y_old"|"10y_to_12y_old"|"12y_to_15y_old"|"over_15y_old")} Cohort
330
+ * @typedef {("all"|"sth"|"lth"|"utxos_under_1h_old"|"utxos_1h_to_1d_old"|"utxos_1d_to_1w_old"|"utxos_1w_to_1m_old"|"utxos_1m_to_2m_old"|"utxos_2m_to_3m_old"|"utxos_3m_to_4m_old"|"utxos_4m_to_5m_old"|"utxos_5m_to_6m_old"|"utxos_6m_to_1y_old"|"utxos_1y_to_2y_old"|"utxos_2y_to_3y_old"|"utxos_3y_to_4y_old"|"utxos_4y_to_5y_old"|"utxos_5y_to_6y_old"|"utxos_6y_to_7y_old"|"utxos_7y_to_8y_old"|"utxos_8y_to_10y_old"|"utxos_10y_to_12y_old"|"utxos_12y_to_15y_old"|"utxos_over_15y_old")} Cohort
331
331
  */
332
332
  /**
333
333
  * Coinbase scriptSig tag for pool identification.
@@ -341,35 +341,21 @@ Matches mempool.space/bitcoin-cli behavior.
341
341
  * @typedef {string} CoinbaseTag
342
342
  */
343
343
  /**
344
- * Bucket type for cost basis aggregation.
345
- * Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
346
- * log10/log50/log100/log200 (logarithmic with 10/50/100/200 buckets per decade).
347
- *
348
- * @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200")} CostBasisBucket
349
- */
350
- /**
351
- * Path parameters for cost basis dates endpoint.
352
- *
353
344
  * @typedef {Object} CostBasisCohortParam
354
345
  * @property {Cohort} cohort
355
346
  */
356
347
  /**
357
- * Path parameters for cost basis distribution endpoint.
358
- *
359
348
  * @typedef {Object} CostBasisParams
360
349
  * @property {Cohort} cohort
361
350
  * @property {string} date
362
351
  */
363
352
  /**
364
- * Query parameters for cost basis distribution endpoint.
365
- *
366
353
  * @typedef {Object} CostBasisQuery
367
- * @property {CostBasisBucket=} bucket - Bucket type for aggregation. Default: raw (no aggregation).
368
- * @property {CostBasisValue=} value - Value type to return. Default: supply.
354
+ * @property {UrpdAggregation=} bucket
355
+ * @property {CostBasisValue=} value
369
356
  */
370
357
  /**
371
- * Value type for cost basis distribution.
372
- * Options: supply (BTC), realized (USD, price × supply), unrealized (USD, spot × supply).
358
+ * Value type for the deprecated cost-basis distribution output.
373
359
  *
374
360
  * @typedef {("supply"|"realized"|"unrealized")} CostBasisValue
375
361
  */
@@ -1159,6 +1145,58 @@ Matches mempool.space/bitcoin-cli behavior.
1159
1145
  /** @typedef {number[]} U8x33 */
1160
1146
  /** @typedef {number[]} U8x65 */
1161
1147
  /** @typedef {TypeIndex} UnknownOutputIndex */
1148
+ /**
1149
+ * UTXO Realized Price Distribution for a cohort on a specific date.
1150
+ *
1151
+ * Supply is grouped by the close price at which each UTXO was last moved.
1152
+ * Each bucket exposes three values derived from the same `(price_floor, supply)`
1153
+ * pairs: supply in BTC, realized cap contribution in USD (`price_floor * supply`),
1154
+ * and unrealized P&L against that date's close in USD
1155
+ * (`(close - price_floor) * supply`, can be negative).
1156
+ *
1157
+ * @typedef {Object} Urpd
1158
+ * @property {Cohort} cohort
1159
+ * @property {Date} date
1160
+ * @property {UrpdAggregation} aggregation - Aggregation strategy applied to the buckets.
1161
+ * @property {Dollars} close - Close price on `date`, in USD. Anchor for `unrealized_pnl`.
1162
+ * @property {Bitcoin} totalSupply - Sum of `supply` across all buckets, in BTC.
1163
+ * @property {UrpdBucket[]} buckets
1164
+ */
1165
+ /**
1166
+ * Aggregation strategy for URPD buckets.
1167
+ * Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
1168
+ * log10/log50/log100/log200 (logarithmic with 10/50/100/200 buckets per decade).
1169
+ *
1170
+ * @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200")} UrpdAggregation
1171
+ */
1172
+ /**
1173
+ * A single bucket in a URPD snapshot.
1174
+ *
1175
+ * @typedef {Object} UrpdBucket
1176
+ * @property {Dollars} priceFloor - Inclusive lower bound of the bucket, in USD.
1177
+ * @property {Bitcoin} supply - Supply held with a last-move price inside this bucket, in BTC.
1178
+ * @property {Dollars} realizedCap - Realized cap contribution in USD: `price_floor * supply`.
1179
+ * @property {Dollars} unrealizedPnl - Unrealized P&L in USD against the close on the snapshot date: `(close - price_floor) * supply`. Can be negative.
1180
+ */
1181
+ /**
1182
+ * Path parameters for per-cohort URPD endpoints.
1183
+ *
1184
+ * @typedef {Object} UrpdCohortParam
1185
+ * @property {Cohort} cohort
1186
+ */
1187
+ /**
1188
+ * Path parameters for `/api/urpd/{cohort}/{date}`.
1189
+ *
1190
+ * @typedef {Object} UrpdParams
1191
+ * @property {Cohort} cohort
1192
+ * @property {string} date
1193
+ */
1194
+ /**
1195
+ * Query parameters for URPD endpoints.
1196
+ *
1197
+ * @typedef {Object} UrpdQuery
1198
+ * @property {UrpdAggregation=} agg - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
1199
+ */
1162
1200
  /**
1163
1201
  * Unspent transaction output
1164
1202
  *
@@ -2109,7 +2147,7 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) {
2109
2147
  * @property {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} price
2110
2148
  * @property {BlockCumulativeSumPattern} profit
2111
2149
  * @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
2112
- * @property {_1m1w1y24hPattern7} sellSideRiskRatio
2150
+ * @property {_1m1w1y24hPattern8} sellSideRiskRatio
2113
2151
  * @property {AdjustedRatioValuePattern} sopr
2114
2152
  */
2115
2153
 
@@ -2265,6 +2303,20 @@ function createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(c
2265
2303
  };
2266
2304
  }
2267
2305
 
2306
+ /**
2307
+ * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshSharePattern
2308
+ * @property {BtcCentsSatsUsdPattern} all
2309
+ * @property {BtcCentsSatsUsdPattern} p2a
2310
+ * @property {BtcCentsSatsUsdPattern} p2pk33
2311
+ * @property {BtcCentsSatsUsdPattern} p2pk65
2312
+ * @property {BtcCentsSatsUsdPattern} p2pkh
2313
+ * @property {BtcCentsSatsUsdPattern} p2sh
2314
+ * @property {BtcCentsSatsUsdPattern} p2tr
2315
+ * @property {BtcCentsSatsUsdPattern} p2wpkh
2316
+ * @property {BtcCentsSatsUsdPattern} p2wsh
2317
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share
2318
+ */
2319
+
2268
2320
  /**
2269
2321
  * @typedef {Object} IndexPct0Pct1Pct2Pct5Pct95Pct98Pct99ScorePattern
2270
2322
  * @property {SeriesPattern1<StoredI8>} index
@@ -2333,6 +2385,39 @@ function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(client, acc) {
2333
2385
  };
2334
2386
  }
2335
2387
 
2388
+ /**
2389
+ * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5
2390
+ * @property {BpsPercentRatioPattern2} all
2391
+ * @property {BpsPercentRatioPattern2} p2a
2392
+ * @property {BpsPercentRatioPattern2} p2pk33
2393
+ * @property {BpsPercentRatioPattern2} p2pk65
2394
+ * @property {BpsPercentRatioPattern2} p2pkh
2395
+ * @property {BpsPercentRatioPattern2} p2sh
2396
+ * @property {BpsPercentRatioPattern2} p2tr
2397
+ * @property {BpsPercentRatioPattern2} p2wpkh
2398
+ * @property {BpsPercentRatioPattern2} p2wsh
2399
+ */
2400
+
2401
+ /**
2402
+ * Create a AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5 pattern node
2403
+ * @param {BrkClientBase} client
2404
+ * @param {string} acc - Accumulated series name
2405
+ * @returns {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5}
2406
+ */
2407
+ function createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(client, acc) {
2408
+ return {
2409
+ all: createBpsPercentRatioPattern2(client, acc),
2410
+ p2a: createBpsPercentRatioPattern2(client, _p('p2a', acc)),
2411
+ p2pk33: createBpsPercentRatioPattern2(client, _p('p2pk33', acc)),
2412
+ p2pk65: createBpsPercentRatioPattern2(client, _p('p2pk65', acc)),
2413
+ p2pkh: createBpsPercentRatioPattern2(client, _p('p2pkh', acc)),
2414
+ p2sh: createBpsPercentRatioPattern2(client, _p('p2sh', acc)),
2415
+ p2tr: createBpsPercentRatioPattern2(client, _p('p2tr', acc)),
2416
+ p2wpkh: createBpsPercentRatioPattern2(client, _p('p2wpkh', acc)),
2417
+ p2wsh: createBpsPercentRatioPattern2(client, _p('p2wsh', acc)),
2418
+ };
2419
+ }
2420
+
2336
2421
  /**
2337
2422
  * @typedef {Object} AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4
2338
2423
  * @property {SeriesPattern1<StoredU64>} all
@@ -2566,6 +2651,17 @@ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) {
2566
2651
  };
2567
2652
  }
2568
2653
 
2654
+ /**
2655
+ * @typedef {Object} ActiveInputOutputSpendablePattern
2656
+ * @property {_1m1w1y24hBlockPattern} activeReusedAddrCount
2657
+ * @property {_1m1w1y24hBlockPattern2} activeReusedAddrShare
2658
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} inputFromReusedAddrCount
2659
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} inputFromReusedAddrShare
2660
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} outputToReusedAddrCount
2661
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} outputToReusedAddrShare
2662
+ * @property {_1m1w1y24hBpsPercentRatioPattern} spendableOutputToReusedAddrShare
2663
+ */
2664
+
2569
2665
  /**
2570
2666
  * @typedef {Object} CapLossMvrvNetPriceProfitSoprPattern
2571
2667
  * @property {CentsDeltaUsdPattern} cap
@@ -2821,7 +2917,7 @@ function createCentsNegativeToUsdPattern2(client, acc) {
2821
2917
 
2822
2918
  /**
2823
2919
  * @typedef {Object} DeltaDominanceHalfInTotalPattern2
2824
- * @property {AbsoluteRatePattern} delta
2920
+ * @property {AbsoluteRatePattern3} delta
2825
2921
  * @property {BpsPercentRatioPattern2} dominance
2826
2922
  * @property {BtcCentsSatsUsdPattern} half
2827
2923
  * @property {BtcCentsSatsShareUsdPattern} inLoss
@@ -2837,7 +2933,7 @@ function createCentsNegativeToUsdPattern2(client, acc) {
2837
2933
  */
2838
2934
  function createDeltaDominanceHalfInTotalPattern2(client, acc) {
2839
2935
  return {
2840
- delta: createAbsoluteRatePattern(client, _m(acc, 'delta')),
2936
+ delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
2841
2937
  dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')),
2842
2938
  half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')),
2843
2939
  inLoss: createBtcCentsSatsShareUsdPattern(client, _m(acc, 'in_loss')),
@@ -2848,7 +2944,7 @@ function createDeltaDominanceHalfInTotalPattern2(client, acc) {
2848
2944
 
2849
2945
  /**
2850
2946
  * @typedef {Object} DeltaDominanceHalfInTotalPattern
2851
- * @property {AbsoluteRatePattern} delta
2947
+ * @property {AbsoluteRatePattern3} delta
2852
2948
  * @property {BpsPercentRatioPattern2} dominance
2853
2949
  * @property {BtcCentsSatsUsdPattern} half
2854
2950
  * @property {BtcCentsSatsUsdPattern} inLoss
@@ -2864,7 +2960,7 @@ function createDeltaDominanceHalfInTotalPattern2(client, acc) {
2864
2960
  */
2865
2961
  function createDeltaDominanceHalfInTotalPattern(client, acc) {
2866
2962
  return {
2867
- delta: createAbsoluteRatePattern(client, _m(acc, 'delta')),
2963
+ delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
2868
2964
  dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')),
2869
2965
  half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')),
2870
2966
  inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')),
@@ -2873,6 +2969,31 @@ function createDeltaDominanceHalfInTotalPattern(client, acc) {
2873
2969
  };
2874
2970
  }
2875
2971
 
2972
+ /**
2973
+ * @typedef {Object} _1m1w1y24hBlockPattern2
2974
+ * @property {SeriesPattern1<StoredF32>} _1m
2975
+ * @property {SeriesPattern1<StoredF32>} _1w
2976
+ * @property {SeriesPattern1<StoredF32>} _1y
2977
+ * @property {SeriesPattern1<StoredF32>} _24h
2978
+ * @property {SeriesPattern18<StoredF32>} block
2979
+ */
2980
+
2981
+ /**
2982
+ * Create a _1m1w1y24hBlockPattern2 pattern node
2983
+ * @param {BrkClientBase} client
2984
+ * @param {string} acc - Accumulated series name
2985
+ * @returns {_1m1w1y24hBlockPattern2}
2986
+ */
2987
+ function create_1m1w1y24hBlockPattern2(client, acc) {
2988
+ return {
2989
+ _1m: createSeriesPattern1(client, _m(acc, 'average_1m')),
2990
+ _1w: createSeriesPattern1(client, _m(acc, 'average_1w')),
2991
+ _1y: createSeriesPattern1(client, _m(acc, 'average_1y')),
2992
+ _24h: createSeriesPattern1(client, _m(acc, 'average_24h')),
2993
+ block: createSeriesPattern18(client, acc),
2994
+ };
2995
+ }
2996
+
2876
2997
  /**
2877
2998
  * @typedef {Object} _1m1w1y24hBlockPattern
2878
2999
  * @property {SeriesPattern1<StoredF32>} _1m
@@ -3052,7 +3173,7 @@ function createBpsCentsRatioSatsUsdPattern(client, acc) {
3052
3173
  * @typedef {Object} BtcCentsDeltaSatsUsdPattern
3053
3174
  * @property {SeriesPattern1<Bitcoin>} btc
3054
3175
  * @property {SeriesPattern1<Cents>} cents
3055
- * @property {AbsoluteRatePattern} delta
3176
+ * @property {AbsoluteRatePattern3} delta
3056
3177
  * @property {SeriesPattern1<Sats>} sats
3057
3178
  * @property {SeriesPattern1<Dollars>} usd
3058
3179
  */
@@ -3067,7 +3188,7 @@ function createBtcCentsDeltaSatsUsdPattern(client, acc) {
3067
3188
  return {
3068
3189
  btc: createSeriesPattern1(client, acc),
3069
3190
  cents: createSeriesPattern1(client, _m(acc, 'cents')),
3070
- delta: createAbsoluteRatePattern(client, _m(acc, 'delta')),
3191
+ delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
3071
3192
  sats: createSeriesPattern1(client, _m(acc, 'sats')),
3072
3193
  usd: createSeriesPattern1(client, _m(acc, 'usd')),
3073
3194
  };
@@ -3206,7 +3327,7 @@ function create_1m1w1y24hPattern2(client, acc) {
3206
3327
  }
3207
3328
 
3208
3329
  /**
3209
- * @typedef {Object} _1m1w1y24hPattern7
3330
+ * @typedef {Object} _1m1w1y24hPattern8
3210
3331
  * @property {BpsPercentRatioPattern4} _1m
3211
3332
  * @property {BpsPercentRatioPattern4} _1w
3212
3333
  * @property {BpsPercentRatioPattern4} _1y
@@ -3214,12 +3335,12 @@ function create_1m1w1y24hPattern2(client, acc) {
3214
3335
  */
3215
3336
 
3216
3337
  /**
3217
- * Create a _1m1w1y24hPattern7 pattern node
3338
+ * Create a _1m1w1y24hPattern8 pattern node
3218
3339
  * @param {BrkClientBase} client
3219
3340
  * @param {string} acc - Accumulated series name
3220
- * @returns {_1m1w1y24hPattern7}
3341
+ * @returns {_1m1w1y24hPattern8}
3221
3342
  */
3222
- function create_1m1w1y24hPattern7(client, acc) {
3343
+ function create_1m1w1y24hPattern8(client, acc) {
3223
3344
  return {
3224
3345
  _1m: createBpsPercentRatioPattern4(client, _m(acc, '1m')),
3225
3346
  _1w: createBpsPercentRatioPattern4(client, _m(acc, '1w')),
@@ -3274,6 +3395,29 @@ function create_1m1w1y24hPattern3(client, acc) {
3274
3395
  };
3275
3396
  }
3276
3397
 
3398
+ /**
3399
+ * @typedef {Object} _1m1w1y24hPattern7
3400
+ * @property {BtcSatsPattern} _1m
3401
+ * @property {BtcSatsPattern} _1w
3402
+ * @property {BtcSatsPattern} _1y
3403
+ * @property {BtcSatsPattern} _24h
3404
+ */
3405
+
3406
+ /**
3407
+ * Create a _1m1w1y24hPattern7 pattern node
3408
+ * @param {BrkClientBase} client
3409
+ * @param {string} acc - Accumulated series name
3410
+ * @returns {_1m1w1y24hPattern7}
3411
+ */
3412
+ function create_1m1w1y24hPattern7(client, acc) {
3413
+ return {
3414
+ _1m: createBtcSatsPattern(client, _m(acc, '1m')),
3415
+ _1w: createBtcSatsPattern(client, _m(acc, '1w')),
3416
+ _1y: createBtcSatsPattern(client, _m(acc, '1y')),
3417
+ _24h: createBtcSatsPattern(client, _m(acc, '24h')),
3418
+ };
3419
+ }
3420
+
3277
3421
  /**
3278
3422
  * @typedef {Object} _1m1w1y2wPattern
3279
3423
  * @property {CentsSatsUsdPattern} _1m
@@ -3930,6 +4074,13 @@ function createCentsSatsUsdPattern(client, acc) {
3930
4074
  };
3931
4075
  }
3932
4076
 
4077
+ /**
4078
+ * @typedef {Object} CountEventsSupplyPattern
4079
+ * @property {FundedTotalPattern} count
4080
+ * @property {ActiveInputOutputSpendablePattern} events
4081
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshSharePattern} supply
4082
+ */
4083
+
3933
4084
  /**
3934
4085
  * @typedef {Object} CumulativeRollingSumPattern
3935
4086
  * @property {SeriesPattern1<StoredU64>} cumulative
@@ -3953,7 +4104,7 @@ function createCumulativeRollingSumPattern(client, acc) {
3953
4104
 
3954
4105
  /**
3955
4106
  * @typedef {Object} DeltaDominanceTotalPattern
3956
- * @property {AbsoluteRatePattern} delta
4107
+ * @property {AbsoluteRatePattern3} delta
3957
4108
  * @property {BpsPercentRatioPattern2} dominance
3958
4109
  * @property {BtcCentsSatsUsdPattern} total
3959
4110
  */
@@ -3966,7 +4117,7 @@ function createCumulativeRollingSumPattern(client, acc) {
3966
4117
  */
3967
4118
  function createDeltaDominanceTotalPattern(client, acc) {
3968
4119
  return {
3969
- delta: createAbsoluteRatePattern(client, _m(acc, 'delta')),
4120
+ delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
3970
4121
  dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')),
3971
4122
  total: createBtcCentsSatsUsdPattern(client, acc),
3972
4123
  };
@@ -4139,6 +4290,25 @@ function createAbsoluteRatePattern2(client, acc) {
4139
4290
  };
4140
4291
  }
4141
4292
 
4293
+ /**
4294
+ * @typedef {Object} AbsoluteRatePattern3
4295
+ * @property {_1m1w1y24hPattern7} absolute
4296
+ * @property {_1m1w1y24hPattern2} rate
4297
+ */
4298
+
4299
+ /**
4300
+ * Create a AbsoluteRatePattern3 pattern node
4301
+ * @param {BrkClientBase} client
4302
+ * @param {string} acc - Accumulated series name
4303
+ * @returns {AbsoluteRatePattern3}
4304
+ */
4305
+ function createAbsoluteRatePattern3(client, acc) {
4306
+ return {
4307
+ absolute: create_1m1w1y24hPattern7(client, acc),
4308
+ rate: create_1m1w1y24hPattern2(client, acc),
4309
+ };
4310
+ }
4311
+
4142
4312
  /**
4143
4313
  * @typedef {Object} AddrUtxoPattern
4144
4314
  * @property {BtcCentsSatsUsdPattern} addr
@@ -4311,6 +4481,25 @@ function createBpsRatioPattern(client, acc) {
4311
4481
  };
4312
4482
  }
4313
4483
 
4484
+ /**
4485
+ * @typedef {Object} BtcSatsPattern
4486
+ * @property {SeriesPattern1<Bitcoin>} btc
4487
+ * @property {SeriesPattern1<SatsSigned>} sats
4488
+ */
4489
+
4490
+ /**
4491
+ * Create a BtcSatsPattern pattern node
4492
+ * @param {BrkClientBase} client
4493
+ * @param {string} acc - Accumulated series name
4494
+ * @returns {BtcSatsPattern}
4495
+ */
4496
+ function createBtcSatsPattern(client, acc) {
4497
+ return {
4498
+ btc: createSeriesPattern1(client, acc),
4499
+ sats: createSeriesPattern1(client, _m(acc, 'sats')),
4500
+ };
4501
+ }
4502
+
4314
4503
  /**
4315
4504
  * @typedef {Object} CentsUsdPattern3
4316
4505
  * @property {SeriesPattern1<Cents>} cents
@@ -5014,6 +5203,7 @@ function createTransferPattern(client, acc) {
5014
5203
  * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern4} total
5015
5204
  * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} new
5016
5205
  * @property {SeriesTree_Addrs_Reused} reused
5206
+ * @property {SeriesTree_Addrs_Respent} respent
5017
5207
  * @property {SeriesTree_Addrs_Exposed} exposed
5018
5208
  * @property {SeriesTree_Addrs_Delta} delta
5019
5209
  * @property {SeriesTree_Addrs_AvgAmount} avgAmount
@@ -5125,6 +5315,7 @@ function createTransferPattern(client, acc) {
5125
5315
  * @typedef {Object} SeriesTree_Addrs_Reused
5126
5316
  * @property {FundedTotalPattern} count
5127
5317
  * @property {SeriesTree_Addrs_Reused_Events} events
5318
+ * @property {SeriesTree_Addrs_Reused_Supply} supply
5128
5319
  */
5129
5320
 
5130
5321
  /**
@@ -5135,26 +5326,43 @@ function createTransferPattern(client, acc) {
5135
5326
  * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} inputFromReusedAddrCount
5136
5327
  * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} inputFromReusedAddrShare
5137
5328
  * @property {_1m1w1y24hBlockPattern} activeReusedAddrCount
5138
- * @property {SeriesTree_Addrs_Reused_Events_ActiveReusedAddrShare} activeReusedAddrShare
5329
+ * @property {_1m1w1y24hBlockPattern2} activeReusedAddrShare
5139
5330
  */
5140
5331
 
5141
5332
  /**
5142
- * @typedef {Object} SeriesTree_Addrs_Reused_Events_ActiveReusedAddrShare
5143
- * @property {SeriesPattern18<StoredF32>} block
5144
- * @property {SeriesPattern1<StoredF32>} _24h
5145
- * @property {SeriesPattern1<StoredF32>} _1w
5146
- * @property {SeriesPattern1<StoredF32>} _1m
5147
- * @property {SeriesPattern1<StoredF32>} _1y
5333
+ * @typedef {Object} SeriesTree_Addrs_Reused_Supply
5334
+ * @property {BtcCentsSatsUsdPattern} all
5335
+ * @property {BtcCentsSatsUsdPattern} p2pk65
5336
+ * @property {BtcCentsSatsUsdPattern} p2pk33
5337
+ * @property {BtcCentsSatsUsdPattern} p2pkh
5338
+ * @property {BtcCentsSatsUsdPattern} p2sh
5339
+ * @property {BtcCentsSatsUsdPattern} p2wpkh
5340
+ * @property {BtcCentsSatsUsdPattern} p2wsh
5341
+ * @property {BtcCentsSatsUsdPattern} p2tr
5342
+ * @property {BtcCentsSatsUsdPattern} p2a
5343
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share
5148
5344
  */
5149
5345
 
5150
5346
  /**
5151
- * @typedef {Object} SeriesTree_Addrs_Exposed
5347
+ * @typedef {Object} SeriesTree_Addrs_Respent
5152
5348
  * @property {FundedTotalPattern} count
5153
- * @property {SeriesTree_Addrs_Exposed_Supply} supply
5349
+ * @property {SeriesTree_Addrs_Respent_Events} events
5350
+ * @property {SeriesTree_Addrs_Respent_Supply} supply
5154
5351
  */
5155
5352
 
5156
5353
  /**
5157
- * @typedef {Object} SeriesTree_Addrs_Exposed_Supply
5354
+ * @typedef {Object} SeriesTree_Addrs_Respent_Events
5355
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} outputToReusedAddrCount
5356
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} outputToReusedAddrShare
5357
+ * @property {_1m1w1y24hBpsPercentRatioPattern} spendableOutputToReusedAddrShare
5358
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6} inputFromReusedAddrCount
5359
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7} inputFromReusedAddrShare
5360
+ * @property {_1m1w1y24hBlockPattern} activeReusedAddrCount
5361
+ * @property {_1m1w1y24hBlockPattern2} activeReusedAddrShare
5362
+ */
5363
+
5364
+ /**
5365
+ * @typedef {Object} SeriesTree_Addrs_Respent_Supply
5158
5366
  * @property {BtcCentsSatsUsdPattern} all
5159
5367
  * @property {BtcCentsSatsUsdPattern} p2pk65
5160
5368
  * @property {BtcCentsSatsUsdPattern} p2pk33
@@ -5164,20 +5372,27 @@ function createTransferPattern(client, acc) {
5164
5372
  * @property {BtcCentsSatsUsdPattern} p2wsh
5165
5373
  * @property {BtcCentsSatsUsdPattern} p2tr
5166
5374
  * @property {BtcCentsSatsUsdPattern} p2a
5167
- * @property {SeriesTree_Addrs_Exposed_Supply_Share} share
5375
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share
5168
5376
  */
5169
5377
 
5170
5378
  /**
5171
- * @typedef {Object} SeriesTree_Addrs_Exposed_Supply_Share
5172
- * @property {BpsPercentRatioPattern2} all
5173
- * @property {BpsPercentRatioPattern2} p2pk65
5174
- * @property {BpsPercentRatioPattern2} p2pk33
5175
- * @property {BpsPercentRatioPattern2} p2pkh
5176
- * @property {BpsPercentRatioPattern2} p2sh
5177
- * @property {BpsPercentRatioPattern2} p2wpkh
5178
- * @property {BpsPercentRatioPattern2} p2wsh
5179
- * @property {BpsPercentRatioPattern2} p2tr
5180
- * @property {BpsPercentRatioPattern2} p2a
5379
+ * @typedef {Object} SeriesTree_Addrs_Exposed
5380
+ * @property {FundedTotalPattern} count
5381
+ * @property {SeriesTree_Addrs_Exposed_Supply} supply
5382
+ */
5383
+
5384
+ /**
5385
+ * @typedef {Object} SeriesTree_Addrs_Exposed_Supply
5386
+ * @property {BtcCentsSatsUsdPattern} all
5387
+ * @property {BtcCentsSatsUsdPattern} p2pk65
5388
+ * @property {BtcCentsSatsUsdPattern} p2pk33
5389
+ * @property {BtcCentsSatsUsdPattern} p2pkh
5390
+ * @property {BtcCentsSatsUsdPattern} p2sh
5391
+ * @property {BtcCentsSatsUsdPattern} p2wpkh
5392
+ * @property {BtcCentsSatsUsdPattern} p2wsh
5393
+ * @property {BtcCentsSatsUsdPattern} p2tr
5394
+ * @property {BtcCentsSatsUsdPattern} p2a
5395
+ * @property {AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5} share
5181
5396
  */
5182
5397
 
5183
5398
  /**
@@ -6259,7 +6474,7 @@ function createTransferPattern(client, acc) {
6259
6474
  * @property {BlockChangeCumulativeDeltaSumPattern} netPnl
6260
6475
  * @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr} sopr
6261
6476
  * @property {BlockCumulativeSumPattern} grossPnl
6262
- * @property {_1m1w1y24hPattern7} sellSideRiskRatio
6477
+ * @property {_1m1w1y24hPattern8} sellSideRiskRatio
6263
6478
  * @property {BlockCumulativeSumPattern} peakRegret
6264
6479
  * @property {PricePattern} capitalized
6265
6480
  * @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
@@ -6451,7 +6666,7 @@ function createTransferPattern(client, acc) {
6451
6666
  * @property {BlockChangeCumulativeDeltaSumPattern} netPnl
6452
6667
  * @property {AdjustedRatioValuePattern} sopr
6453
6668
  * @property {BlockCumulativeSumPattern} grossPnl
6454
- * @property {_1m1w1y24hPattern7} sellSideRiskRatio
6669
+ * @property {_1m1w1y24hPattern8} sellSideRiskRatio
6455
6670
  * @property {BlockCumulativeSumPattern} peakRegret
6456
6671
  * @property {PricePattern} capitalized
6457
6672
  * @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
@@ -6574,7 +6789,7 @@ function createTransferPattern(client, acc) {
6574
6789
  * @property {BlockChangeCumulativeDeltaSumPattern} netPnl
6575
6790
  * @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr
6576
6791
  * @property {BlockCumulativeSumPattern} grossPnl
6577
- * @property {_1m1w1y24hPattern7} sellSideRiskRatio
6792
+ * @property {_1m1w1y24hPattern8} sellSideRiskRatio
6578
6793
  * @property {BlockCumulativeSumPattern} peakRegret
6579
6794
  * @property {PricePattern} capitalized
6580
6795
  * @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
@@ -7007,7 +7222,7 @@ function createTransferPattern(client, acc) {
7007
7222
  * @extends BrkClientBase
7008
7223
  */
7009
7224
  class BrkClient extends BrkClientBase {
7010
- VERSION = "v0.3.0-beta.3";
7225
+ VERSION = "v0.3.0-beta.5";
7011
7226
 
7012
7227
  INDEXES = /** @type {const} */ ([
7013
7228
  "minute10",
@@ -8532,38 +8747,58 @@ class BrkClient extends BrkClientBase {
8532
8747
  inputFromReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'input_from_reused_addr_count'),
8533
8748
  inputFromReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'input_from_reused_addr_share'),
8534
8749
  activeReusedAddrCount: create_1m1w1y24hBlockPattern(this, 'active_reused_addr_count'),
8535
- activeReusedAddrShare: {
8536
- block: createSeriesPattern18(this, 'active_reused_addr_share'),
8537
- _24h: createSeriesPattern1(this, 'active_reused_addr_share_average_24h'),
8538
- _1w: createSeriesPattern1(this, 'active_reused_addr_share_average_1w'),
8539
- _1m: createSeriesPattern1(this, 'active_reused_addr_share_average_1m'),
8540
- _1y: createSeriesPattern1(this, 'active_reused_addr_share_average_1y'),
8541
- },
8750
+ activeReusedAddrShare: create_1m1w1y24hBlockPattern2(this, 'active_reused_addr_share'),
8751
+ },
8752
+ supply: {
8753
+ all: createBtcCentsSatsUsdPattern(this, 'reused_addr_supply'),
8754
+ p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_reused_addr_supply'),
8755
+ p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_reused_addr_supply'),
8756
+ p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_reused_addr_supply'),
8757
+ p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_reused_addr_supply'),
8758
+ p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_reused_addr_supply'),
8759
+ p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_reused_addr_supply'),
8760
+ p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_reused_addr_supply'),
8761
+ p2a: createBtcCentsSatsUsdPattern(this, 'p2a_reused_addr_supply'),
8762
+ share: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(this, 'reused_addr_supply_share'),
8763
+ },
8764
+ },
8765
+ respent: {
8766
+ count: createFundedTotalPattern(this, 'respent_addr_count'),
8767
+ events: {
8768
+ outputToReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'output_to_respent_addr_count'),
8769
+ outputToReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'output_to_respent_addr_share'),
8770
+ spendableOutputToReusedAddrShare: create_1m1w1y24hBpsPercentRatioPattern(this, 'spendable_output_to_respent_addr_share'),
8771
+ inputFromReusedAddrCount: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern6(this, 'input_from_respent_addr_count'),
8772
+ inputFromReusedAddrShare: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern7(this, 'input_from_respent_addr_share'),
8773
+ activeReusedAddrCount: create_1m1w1y24hBlockPattern(this, 'active_respent_addr_count'),
8774
+ activeReusedAddrShare: create_1m1w1y24hBlockPattern2(this, 'active_respent_addr_share'),
8775
+ },
8776
+ supply: {
8777
+ all: createBtcCentsSatsUsdPattern(this, 'respent_addr_supply'),
8778
+ p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_respent_addr_supply'),
8779
+ p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_respent_addr_supply'),
8780
+ p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_respent_addr_supply'),
8781
+ p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_respent_addr_supply'),
8782
+ p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_respent_addr_supply'),
8783
+ p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_respent_addr_supply'),
8784
+ p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_respent_addr_supply'),
8785
+ p2a: createBtcCentsSatsUsdPattern(this, 'p2a_respent_addr_supply'),
8786
+ share: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(this, 'respent_addr_supply_share'),
8542
8787
  },
8543
8788
  },
8544
8789
  exposed: {
8545
8790
  count: createFundedTotalPattern(this, 'exposed_addr_count'),
8546
8791
  supply: {
8547
- all: createBtcCentsSatsUsdPattern(this, 'exposed_supply'),
8548
- p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_exposed_supply'),
8549
- p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_exposed_supply'),
8550
- p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_exposed_supply'),
8551
- p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_exposed_supply'),
8552
- p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_exposed_supply'),
8553
- p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_exposed_supply'),
8554
- p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_exposed_supply'),
8555
- p2a: createBtcCentsSatsUsdPattern(this, 'p2a_exposed_supply'),
8556
- share: {
8557
- all: createBpsPercentRatioPattern2(this, 'exposed_supply_share'),
8558
- p2pk65: createBpsPercentRatioPattern2(this, 'p2pk65_exposed_supply_share'),
8559
- p2pk33: createBpsPercentRatioPattern2(this, 'p2pk33_exposed_supply_share'),
8560
- p2pkh: createBpsPercentRatioPattern2(this, 'p2pkh_exposed_supply_share'),
8561
- p2sh: createBpsPercentRatioPattern2(this, 'p2sh_exposed_supply_share'),
8562
- p2wpkh: createBpsPercentRatioPattern2(this, 'p2wpkh_exposed_supply_share'),
8563
- p2wsh: createBpsPercentRatioPattern2(this, 'p2wsh_exposed_supply_share'),
8564
- p2tr: createBpsPercentRatioPattern2(this, 'p2tr_exposed_supply_share'),
8565
- p2a: createBpsPercentRatioPattern2(this, 'p2a_exposed_supply_share'),
8566
- },
8792
+ all: createBtcCentsSatsUsdPattern(this, 'exposed_addr_supply'),
8793
+ p2pk65: createBtcCentsSatsUsdPattern(this, 'p2pk65_exposed_addr_supply'),
8794
+ p2pk33: createBtcCentsSatsUsdPattern(this, 'p2pk33_exposed_addr_supply'),
8795
+ p2pkh: createBtcCentsSatsUsdPattern(this, 'p2pkh_exposed_addr_supply'),
8796
+ p2sh: createBtcCentsSatsUsdPattern(this, 'p2sh_exposed_addr_supply'),
8797
+ p2wpkh: createBtcCentsSatsUsdPattern(this, 'p2wpkh_exposed_addr_supply'),
8798
+ p2wsh: createBtcCentsSatsUsdPattern(this, 'p2wsh_exposed_addr_supply'),
8799
+ p2tr: createBtcCentsSatsUsdPattern(this, 'p2tr_exposed_addr_supply'),
8800
+ p2a: createBtcCentsSatsUsdPattern(this, 'p2a_exposed_addr_supply'),
8801
+ share: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern5(this, 'exposed_addr_supply_share'),
8567
8802
  },
8568
8803
  },
8569
8804
  delta: {
@@ -9409,7 +9644,7 @@ class BrkClient extends BrkClientBase {
9409
9644
  },
9410
9645
  },
9411
9646
  grossPnl: createBlockCumulativeSumPattern(this, 'realized_gross_pnl'),
9412
- sellSideRiskRatio: create_1m1w1y24hPattern7(this, 'sell_side_risk_ratio'),
9647
+ sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'sell_side_risk_ratio'),
9413
9648
  peakRegret: createBlockCumulativeSumPattern(this, 'realized_peak_regret'),
9414
9649
  capitalized: createPricePattern(this, 'capitalized_price'),
9415
9650
  profitToLossRatio: create_1m1w1y24hPattern(this, 'realized_profit_to_loss_ratio'),
@@ -9546,7 +9781,7 @@ class BrkClient extends BrkClientBase {
9546
9781
  netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'sth_net'),
9547
9782
  sopr: createAdjustedRatioValuePattern(this, 'sth'),
9548
9783
  grossPnl: createBlockCumulativeSumPattern(this, 'sth_realized_gross_pnl'),
9549
- sellSideRiskRatio: create_1m1w1y24hPattern7(this, 'sth_sell_side_risk_ratio'),
9784
+ sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'sth_sell_side_risk_ratio'),
9550
9785
  peakRegret: createBlockCumulativeSumPattern(this, 'sth_realized_peak_regret'),
9551
9786
  capitalized: createPricePattern(this, 'sth_capitalized_price'),
9552
9787
  profitToLossRatio: create_1m1w1y24hPattern(this, 'sth_realized_profit_to_loss_ratio'),
@@ -9649,7 +9884,7 @@ class BrkClient extends BrkClientBase {
9649
9884
  ratio: create_1m1w1y24hPattern(this, 'lth_sopr'),
9650
9885
  },
9651
9886
  grossPnl: createBlockCumulativeSumPattern(this, 'lth_realized_gross_pnl'),
9652
- sellSideRiskRatio: create_1m1w1y24hPattern7(this, 'lth_sell_side_risk_ratio'),
9887
+ sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'lth_sell_side_risk_ratio'),
9653
9888
  peakRegret: createBlockCumulativeSumPattern(this, 'lth_realized_peak_regret'),
9654
9889
  capitalized: createPricePattern(this, 'lth_capitalized_price'),
9655
9890
  profitToLossRatio: create_1m1w1y24hPattern(this, 'lth_realized_profit_to_loss_ratio'),
@@ -10403,63 +10638,6 @@ class BrkClient extends BrkClientBase {
10403
10638
  return this.getJson(path, { signal, onUpdate });
10404
10639
  }
10405
10640
 
10406
- /**
10407
- * Available cost basis cohorts
10408
- *
10409
- * List available cohorts for cost basis distribution.
10410
- *
10411
- * Endpoint: `GET /api/series/cost-basis`
10412
- * @param {{ signal?: AbortSignal, onUpdate?: (value: string[]) => void }} [options]
10413
- * @returns {Promise<string[]>}
10414
- */
10415
- async getCostBasisCohorts({ signal, onUpdate } = {}) {
10416
- const path = `/api/series/cost-basis`;
10417
- return this.getJson(path, { signal, onUpdate });
10418
- }
10419
-
10420
- /**
10421
- * Available cost basis dates
10422
- *
10423
- * List available dates for a cohort's cost basis distribution.
10424
- *
10425
- * Endpoint: `GET /api/series/cost-basis/{cohort}/dates`
10426
- *
10427
- * @param {Cohort} cohort
10428
- * @param {{ signal?: AbortSignal, onUpdate?: (value: Date[]) => void }} [options]
10429
- * @returns {Promise<Date[]>}
10430
- */
10431
- async getCostBasisDates(cohort, { signal, onUpdate } = {}) {
10432
- const path = `/api/series/cost-basis/${cohort}/dates`;
10433
- return this.getJson(path, { signal, onUpdate });
10434
- }
10435
-
10436
- /**
10437
- * Cost basis distribution
10438
- *
10439
- * Get the cost basis distribution for a cohort on a specific date.
10440
- *
10441
- * Query params:
10442
- * - `bucket`: raw (default), lin200, lin500, lin1000, log10, log50, log100
10443
- * - `value`: supply (default, in BTC), realized (USD), unrealized (USD)
10444
- *
10445
- * Endpoint: `GET /api/series/cost-basis/{cohort}/{date}`
10446
- *
10447
- * @param {Cohort} cohort
10448
- * @param {string} date
10449
- * @param {CostBasisBucket=} [bucket] - Bucket type for aggregation. Default: raw (no aggregation).
10450
- * @param {CostBasisValue=} [value] - Value type to return. Default: supply.
10451
- * @param {{ signal?: AbortSignal, onUpdate?: (value: Object) => void }} [options]
10452
- * @returns {Promise<Object>}
10453
- */
10454
- async getCostBasis(cohort, date, bucket, value, { signal, onUpdate } = {}) {
10455
- const params = new URLSearchParams();
10456
- if (bucket !== undefined) params.set('bucket', String(bucket));
10457
- if (value !== undefined) params.set('value', String(value));
10458
- const query = params.toString();
10459
- const path = `/api/series/cost-basis/${cohort}/${date}${query ? '?' + query : ''}`;
10460
- return this.getJson(path, { signal, onUpdate });
10461
- }
10462
-
10463
10641
  /**
10464
10642
  * Series count
10465
10643
  *
@@ -10842,6 +11020,81 @@ class BrkClient extends BrkClientBase {
10842
11020
  return this.getJson(path, { signal, onUpdate });
10843
11021
  }
10844
11022
 
11023
+ /**
11024
+ * Available URPD cohorts
11025
+ *
11026
+ * Cohorts for which URPD data is available. Returns names like `all`, `sth`, `lth`, `utxos_under_1h_old`.
11027
+ *
11028
+ * Endpoint: `GET /api/urpd`
11029
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Cohort[]) => void }} [options]
11030
+ * @returns {Promise<Cohort[]>}
11031
+ */
11032
+ async listUrpdCohorts({ signal, onUpdate } = {}) {
11033
+ const path = `/api/urpd`;
11034
+ return this.getJson(path, { signal, onUpdate });
11035
+ }
11036
+
11037
+ /**
11038
+ * Latest URPD
11039
+ *
11040
+ * URPD for the most recent available date in the cohort. The response's `date` field echoes which date was served.
11041
+ *
11042
+ * See the URPD tag description for the response shape and `agg` options.
11043
+ *
11044
+ * Endpoint: `GET /api/urpd/{cohort}`
11045
+ *
11046
+ * @param {Cohort} cohort
11047
+ * @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
11048
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Urpd) => void }} [options]
11049
+ * @returns {Promise<Urpd>}
11050
+ */
11051
+ async getUrpd(cohort, agg, { signal, onUpdate } = {}) {
11052
+ const params = new URLSearchParams();
11053
+ if (agg !== undefined) params.set('agg', String(agg));
11054
+ const query = params.toString();
11055
+ const path = `/api/urpd/${cohort}${query ? '?' + query : ''}`;
11056
+ return this.getJson(path, { signal, onUpdate });
11057
+ }
11058
+
11059
+ /**
11060
+ * Available URPD dates
11061
+ *
11062
+ * Dates for which a URPD snapshot is available for the cohort. One entry per UTC day, sorted ascending.
11063
+ *
11064
+ * Endpoint: `GET /api/urpd/{cohort}/dates`
11065
+ *
11066
+ * @param {Cohort} cohort
11067
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Date[]) => void }} [options]
11068
+ * @returns {Promise<Date[]>}
11069
+ */
11070
+ async listUrpdDates(cohort, { signal, onUpdate } = {}) {
11071
+ const path = `/api/urpd/${cohort}/dates`;
11072
+ return this.getJson(path, { signal, onUpdate });
11073
+ }
11074
+
11075
+ /**
11076
+ * URPD at date
11077
+ *
11078
+ * URPD for a (cohort, date) pair. Returns `{ cohort, date, aggregation, close, total_supply, buckets }` where each bucket is `{ price_floor, supply, realized_cap, unrealized_pnl }`.
11079
+ *
11080
+ * See the URPD tag description for unit conventions and `agg` options.
11081
+ *
11082
+ * Endpoint: `GET /api/urpd/{cohort}/{date}`
11083
+ *
11084
+ * @param {Cohort} cohort
11085
+ * @param {string} date
11086
+ * @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
11087
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Urpd) => void }} [options]
11088
+ * @returns {Promise<Urpd>}
11089
+ */
11090
+ async getUrpdAt(cohort, date, agg, { signal, onUpdate } = {}) {
11091
+ const params = new URLSearchParams();
11092
+ if (agg !== undefined) params.set('agg', String(agg));
11093
+ const query = params.toString();
11094
+ const path = `/api/urpd/${cohort}/${date}${query ? '?' + query : ''}`;
11095
+ return this.getJson(path, { signal, onUpdate });
11096
+ }
11097
+
10845
11098
  /**
10846
11099
  * Block (v1)
10847
11100
  *
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "url": "git+https://github.com/bitcoinresearchkit/brk.git"
41
41
  },
42
42
  "type": "module",
43
- "version": "0.3.0-beta.3"
43
+ "version": "0.3.0-beta.5"
44
44
  }