brk-client 0.3.0-beta.3 → 0.3.0-beta.4
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/index.js +213 -96
- 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
|
-
*
|
|
328
|
+
* URPD cohort identifier. Use `GET /api/urpd` to list available cohorts.
|
|
329
329
|
*
|
|
330
|
-
* @typedef {("all"|"sth"|"lth"|"
|
|
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 {
|
|
368
|
-
* @property {CostBasisValue=} value
|
|
354
|
+
* @property {UrpdAggregation=} bucket
|
|
355
|
+
* @property {CostBasisValue=} value
|
|
369
356
|
*/
|
|
370
357
|
/**
|
|
371
|
-
* Value type for cost
|
|
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 {
|
|
2150
|
+
* @property {_1m1w1y24hPattern8} sellSideRiskRatio
|
|
2113
2151
|
* @property {AdjustedRatioValuePattern} sopr
|
|
2114
2152
|
*/
|
|
2115
2153
|
|
|
@@ -2821,7 +2859,7 @@ function createCentsNegativeToUsdPattern2(client, acc) {
|
|
|
2821
2859
|
|
|
2822
2860
|
/**
|
|
2823
2861
|
* @typedef {Object} DeltaDominanceHalfInTotalPattern2
|
|
2824
|
-
* @property {
|
|
2862
|
+
* @property {AbsoluteRatePattern3} delta
|
|
2825
2863
|
* @property {BpsPercentRatioPattern2} dominance
|
|
2826
2864
|
* @property {BtcCentsSatsUsdPattern} half
|
|
2827
2865
|
* @property {BtcCentsSatsShareUsdPattern} inLoss
|
|
@@ -2837,7 +2875,7 @@ function createCentsNegativeToUsdPattern2(client, acc) {
|
|
|
2837
2875
|
*/
|
|
2838
2876
|
function createDeltaDominanceHalfInTotalPattern2(client, acc) {
|
|
2839
2877
|
return {
|
|
2840
|
-
delta:
|
|
2878
|
+
delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
|
|
2841
2879
|
dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')),
|
|
2842
2880
|
half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')),
|
|
2843
2881
|
inLoss: createBtcCentsSatsShareUsdPattern(client, _m(acc, 'in_loss')),
|
|
@@ -2848,7 +2886,7 @@ function createDeltaDominanceHalfInTotalPattern2(client, acc) {
|
|
|
2848
2886
|
|
|
2849
2887
|
/**
|
|
2850
2888
|
* @typedef {Object} DeltaDominanceHalfInTotalPattern
|
|
2851
|
-
* @property {
|
|
2889
|
+
* @property {AbsoluteRatePattern3} delta
|
|
2852
2890
|
* @property {BpsPercentRatioPattern2} dominance
|
|
2853
2891
|
* @property {BtcCentsSatsUsdPattern} half
|
|
2854
2892
|
* @property {BtcCentsSatsUsdPattern} inLoss
|
|
@@ -2864,7 +2902,7 @@ function createDeltaDominanceHalfInTotalPattern2(client, acc) {
|
|
|
2864
2902
|
*/
|
|
2865
2903
|
function createDeltaDominanceHalfInTotalPattern(client, acc) {
|
|
2866
2904
|
return {
|
|
2867
|
-
delta:
|
|
2905
|
+
delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
|
|
2868
2906
|
dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')),
|
|
2869
2907
|
half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')),
|
|
2870
2908
|
inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')),
|
|
@@ -3052,7 +3090,7 @@ function createBpsCentsRatioSatsUsdPattern(client, acc) {
|
|
|
3052
3090
|
* @typedef {Object} BtcCentsDeltaSatsUsdPattern
|
|
3053
3091
|
* @property {SeriesPattern1<Bitcoin>} btc
|
|
3054
3092
|
* @property {SeriesPattern1<Cents>} cents
|
|
3055
|
-
* @property {
|
|
3093
|
+
* @property {AbsoluteRatePattern3} delta
|
|
3056
3094
|
* @property {SeriesPattern1<Sats>} sats
|
|
3057
3095
|
* @property {SeriesPattern1<Dollars>} usd
|
|
3058
3096
|
*/
|
|
@@ -3067,7 +3105,7 @@ function createBtcCentsDeltaSatsUsdPattern(client, acc) {
|
|
|
3067
3105
|
return {
|
|
3068
3106
|
btc: createSeriesPattern1(client, acc),
|
|
3069
3107
|
cents: createSeriesPattern1(client, _m(acc, 'cents')),
|
|
3070
|
-
delta:
|
|
3108
|
+
delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
|
|
3071
3109
|
sats: createSeriesPattern1(client, _m(acc, 'sats')),
|
|
3072
3110
|
usd: createSeriesPattern1(client, _m(acc, 'usd')),
|
|
3073
3111
|
};
|
|
@@ -3206,7 +3244,7 @@ function create_1m1w1y24hPattern2(client, acc) {
|
|
|
3206
3244
|
}
|
|
3207
3245
|
|
|
3208
3246
|
/**
|
|
3209
|
-
* @typedef {Object}
|
|
3247
|
+
* @typedef {Object} _1m1w1y24hPattern8
|
|
3210
3248
|
* @property {BpsPercentRatioPattern4} _1m
|
|
3211
3249
|
* @property {BpsPercentRatioPattern4} _1w
|
|
3212
3250
|
* @property {BpsPercentRatioPattern4} _1y
|
|
@@ -3214,12 +3252,12 @@ function create_1m1w1y24hPattern2(client, acc) {
|
|
|
3214
3252
|
*/
|
|
3215
3253
|
|
|
3216
3254
|
/**
|
|
3217
|
-
* Create a
|
|
3255
|
+
* Create a _1m1w1y24hPattern8 pattern node
|
|
3218
3256
|
* @param {BrkClientBase} client
|
|
3219
3257
|
* @param {string} acc - Accumulated series name
|
|
3220
|
-
* @returns {
|
|
3258
|
+
* @returns {_1m1w1y24hPattern8}
|
|
3221
3259
|
*/
|
|
3222
|
-
function
|
|
3260
|
+
function create_1m1w1y24hPattern8(client, acc) {
|
|
3223
3261
|
return {
|
|
3224
3262
|
_1m: createBpsPercentRatioPattern4(client, _m(acc, '1m')),
|
|
3225
3263
|
_1w: createBpsPercentRatioPattern4(client, _m(acc, '1w')),
|
|
@@ -3274,6 +3312,29 @@ function create_1m1w1y24hPattern3(client, acc) {
|
|
|
3274
3312
|
};
|
|
3275
3313
|
}
|
|
3276
3314
|
|
|
3315
|
+
/**
|
|
3316
|
+
* @typedef {Object} _1m1w1y24hPattern7
|
|
3317
|
+
* @property {BtcSatsPattern} _1m
|
|
3318
|
+
* @property {BtcSatsPattern} _1w
|
|
3319
|
+
* @property {BtcSatsPattern} _1y
|
|
3320
|
+
* @property {BtcSatsPattern} _24h
|
|
3321
|
+
*/
|
|
3322
|
+
|
|
3323
|
+
/**
|
|
3324
|
+
* Create a _1m1w1y24hPattern7 pattern node
|
|
3325
|
+
* @param {BrkClientBase} client
|
|
3326
|
+
* @param {string} acc - Accumulated series name
|
|
3327
|
+
* @returns {_1m1w1y24hPattern7}
|
|
3328
|
+
*/
|
|
3329
|
+
function create_1m1w1y24hPattern7(client, acc) {
|
|
3330
|
+
return {
|
|
3331
|
+
_1m: createBtcSatsPattern(client, _m(acc, '1m')),
|
|
3332
|
+
_1w: createBtcSatsPattern(client, _m(acc, '1w')),
|
|
3333
|
+
_1y: createBtcSatsPattern(client, _m(acc, '1y')),
|
|
3334
|
+
_24h: createBtcSatsPattern(client, _m(acc, '24h')),
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3277
3338
|
/**
|
|
3278
3339
|
* @typedef {Object} _1m1w1y2wPattern
|
|
3279
3340
|
* @property {CentsSatsUsdPattern} _1m
|
|
@@ -3953,7 +4014,7 @@ function createCumulativeRollingSumPattern(client, acc) {
|
|
|
3953
4014
|
|
|
3954
4015
|
/**
|
|
3955
4016
|
* @typedef {Object} DeltaDominanceTotalPattern
|
|
3956
|
-
* @property {
|
|
4017
|
+
* @property {AbsoluteRatePattern3} delta
|
|
3957
4018
|
* @property {BpsPercentRatioPattern2} dominance
|
|
3958
4019
|
* @property {BtcCentsSatsUsdPattern} total
|
|
3959
4020
|
*/
|
|
@@ -3966,7 +4027,7 @@ function createCumulativeRollingSumPattern(client, acc) {
|
|
|
3966
4027
|
*/
|
|
3967
4028
|
function createDeltaDominanceTotalPattern(client, acc) {
|
|
3968
4029
|
return {
|
|
3969
|
-
delta:
|
|
4030
|
+
delta: createAbsoluteRatePattern3(client, _m(acc, 'delta')),
|
|
3970
4031
|
dominance: createBpsPercentRatioPattern2(client, _m(acc, 'dominance')),
|
|
3971
4032
|
total: createBtcCentsSatsUsdPattern(client, acc),
|
|
3972
4033
|
};
|
|
@@ -4139,6 +4200,25 @@ function createAbsoluteRatePattern2(client, acc) {
|
|
|
4139
4200
|
};
|
|
4140
4201
|
}
|
|
4141
4202
|
|
|
4203
|
+
/**
|
|
4204
|
+
* @typedef {Object} AbsoluteRatePattern3
|
|
4205
|
+
* @property {_1m1w1y24hPattern7} absolute
|
|
4206
|
+
* @property {_1m1w1y24hPattern2} rate
|
|
4207
|
+
*/
|
|
4208
|
+
|
|
4209
|
+
/**
|
|
4210
|
+
* Create a AbsoluteRatePattern3 pattern node
|
|
4211
|
+
* @param {BrkClientBase} client
|
|
4212
|
+
* @param {string} acc - Accumulated series name
|
|
4213
|
+
* @returns {AbsoluteRatePattern3}
|
|
4214
|
+
*/
|
|
4215
|
+
function createAbsoluteRatePattern3(client, acc) {
|
|
4216
|
+
return {
|
|
4217
|
+
absolute: create_1m1w1y24hPattern7(client, acc),
|
|
4218
|
+
rate: create_1m1w1y24hPattern2(client, acc),
|
|
4219
|
+
};
|
|
4220
|
+
}
|
|
4221
|
+
|
|
4142
4222
|
/**
|
|
4143
4223
|
* @typedef {Object} AddrUtxoPattern
|
|
4144
4224
|
* @property {BtcCentsSatsUsdPattern} addr
|
|
@@ -4311,6 +4391,25 @@ function createBpsRatioPattern(client, acc) {
|
|
|
4311
4391
|
};
|
|
4312
4392
|
}
|
|
4313
4393
|
|
|
4394
|
+
/**
|
|
4395
|
+
* @typedef {Object} BtcSatsPattern
|
|
4396
|
+
* @property {SeriesPattern1<Bitcoin>} btc
|
|
4397
|
+
* @property {SeriesPattern1<SatsSigned>} sats
|
|
4398
|
+
*/
|
|
4399
|
+
|
|
4400
|
+
/**
|
|
4401
|
+
* Create a BtcSatsPattern pattern node
|
|
4402
|
+
* @param {BrkClientBase} client
|
|
4403
|
+
* @param {string} acc - Accumulated series name
|
|
4404
|
+
* @returns {BtcSatsPattern}
|
|
4405
|
+
*/
|
|
4406
|
+
function createBtcSatsPattern(client, acc) {
|
|
4407
|
+
return {
|
|
4408
|
+
btc: createSeriesPattern1(client, acc),
|
|
4409
|
+
sats: createSeriesPattern1(client, _m(acc, 'sats')),
|
|
4410
|
+
};
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4314
4413
|
/**
|
|
4315
4414
|
* @typedef {Object} CentsUsdPattern3
|
|
4316
4415
|
* @property {SeriesPattern1<Cents>} cents
|
|
@@ -6259,7 +6358,7 @@ function createTransferPattern(client, acc) {
|
|
|
6259
6358
|
* @property {BlockChangeCumulativeDeltaSumPattern} netPnl
|
|
6260
6359
|
* @property {SeriesTree_Cohorts_Utxo_All_Realized_Sopr} sopr
|
|
6261
6360
|
* @property {BlockCumulativeSumPattern} grossPnl
|
|
6262
|
-
* @property {
|
|
6361
|
+
* @property {_1m1w1y24hPattern8} sellSideRiskRatio
|
|
6263
6362
|
* @property {BlockCumulativeSumPattern} peakRegret
|
|
6264
6363
|
* @property {PricePattern} capitalized
|
|
6265
6364
|
* @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
|
|
@@ -6451,7 +6550,7 @@ function createTransferPattern(client, acc) {
|
|
|
6451
6550
|
* @property {BlockChangeCumulativeDeltaSumPattern} netPnl
|
|
6452
6551
|
* @property {AdjustedRatioValuePattern} sopr
|
|
6453
6552
|
* @property {BlockCumulativeSumPattern} grossPnl
|
|
6454
|
-
* @property {
|
|
6553
|
+
* @property {_1m1w1y24hPattern8} sellSideRiskRatio
|
|
6455
6554
|
* @property {BlockCumulativeSumPattern} peakRegret
|
|
6456
6555
|
* @property {PricePattern} capitalized
|
|
6457
6556
|
* @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
|
|
@@ -6574,7 +6673,7 @@ function createTransferPattern(client, acc) {
|
|
|
6574
6673
|
* @property {BlockChangeCumulativeDeltaSumPattern} netPnl
|
|
6575
6674
|
* @property {SeriesTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr
|
|
6576
6675
|
* @property {BlockCumulativeSumPattern} grossPnl
|
|
6577
|
-
* @property {
|
|
6676
|
+
* @property {_1m1w1y24hPattern8} sellSideRiskRatio
|
|
6578
6677
|
* @property {BlockCumulativeSumPattern} peakRegret
|
|
6579
6678
|
* @property {PricePattern} capitalized
|
|
6580
6679
|
* @property {_1m1w1y24hPattern<StoredF64>} profitToLossRatio
|
|
@@ -7007,7 +7106,7 @@ function createTransferPattern(client, acc) {
|
|
|
7007
7106
|
* @extends BrkClientBase
|
|
7008
7107
|
*/
|
|
7009
7108
|
class BrkClient extends BrkClientBase {
|
|
7010
|
-
VERSION = "v0.3.0-beta.
|
|
7109
|
+
VERSION = "v0.3.0-beta.4";
|
|
7011
7110
|
|
|
7012
7111
|
INDEXES = /** @type {const} */ ([
|
|
7013
7112
|
"minute10",
|
|
@@ -9409,7 +9508,7 @@ class BrkClient extends BrkClientBase {
|
|
|
9409
9508
|
},
|
|
9410
9509
|
},
|
|
9411
9510
|
grossPnl: createBlockCumulativeSumPattern(this, 'realized_gross_pnl'),
|
|
9412
|
-
sellSideRiskRatio:
|
|
9511
|
+
sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'sell_side_risk_ratio'),
|
|
9413
9512
|
peakRegret: createBlockCumulativeSumPattern(this, 'realized_peak_regret'),
|
|
9414
9513
|
capitalized: createPricePattern(this, 'capitalized_price'),
|
|
9415
9514
|
profitToLossRatio: create_1m1w1y24hPattern(this, 'realized_profit_to_loss_ratio'),
|
|
@@ -9546,7 +9645,7 @@ class BrkClient extends BrkClientBase {
|
|
|
9546
9645
|
netPnl: createBlockChangeCumulativeDeltaSumPattern(this, 'sth_net'),
|
|
9547
9646
|
sopr: createAdjustedRatioValuePattern(this, 'sth'),
|
|
9548
9647
|
grossPnl: createBlockCumulativeSumPattern(this, 'sth_realized_gross_pnl'),
|
|
9549
|
-
sellSideRiskRatio:
|
|
9648
|
+
sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'sth_sell_side_risk_ratio'),
|
|
9550
9649
|
peakRegret: createBlockCumulativeSumPattern(this, 'sth_realized_peak_regret'),
|
|
9551
9650
|
capitalized: createPricePattern(this, 'sth_capitalized_price'),
|
|
9552
9651
|
profitToLossRatio: create_1m1w1y24hPattern(this, 'sth_realized_profit_to_loss_ratio'),
|
|
@@ -9649,7 +9748,7 @@ class BrkClient extends BrkClientBase {
|
|
|
9649
9748
|
ratio: create_1m1w1y24hPattern(this, 'lth_sopr'),
|
|
9650
9749
|
},
|
|
9651
9750
|
grossPnl: createBlockCumulativeSumPattern(this, 'lth_realized_gross_pnl'),
|
|
9652
|
-
sellSideRiskRatio:
|
|
9751
|
+
sellSideRiskRatio: create_1m1w1y24hPattern8(this, 'lth_sell_side_risk_ratio'),
|
|
9653
9752
|
peakRegret: createBlockCumulativeSumPattern(this, 'lth_realized_peak_regret'),
|
|
9654
9753
|
capitalized: createPricePattern(this, 'lth_capitalized_price'),
|
|
9655
9754
|
profitToLossRatio: create_1m1w1y24hPattern(this, 'lth_realized_profit_to_loss_ratio'),
|
|
@@ -10403,63 +10502,6 @@ class BrkClient extends BrkClientBase {
|
|
|
10403
10502
|
return this.getJson(path, { signal, onUpdate });
|
|
10404
10503
|
}
|
|
10405
10504
|
|
|
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
10505
|
/**
|
|
10464
10506
|
* Series count
|
|
10465
10507
|
*
|
|
@@ -10842,6 +10884,81 @@ class BrkClient extends BrkClientBase {
|
|
|
10842
10884
|
return this.getJson(path, { signal, onUpdate });
|
|
10843
10885
|
}
|
|
10844
10886
|
|
|
10887
|
+
/**
|
|
10888
|
+
* Available URPD cohorts
|
|
10889
|
+
*
|
|
10890
|
+
* Cohorts for which URPD data is available. Returns names like `all`, `sth`, `lth`, `utxos_under_1h_old`.
|
|
10891
|
+
*
|
|
10892
|
+
* Endpoint: `GET /api/urpd`
|
|
10893
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Cohort[]) => void }} [options]
|
|
10894
|
+
* @returns {Promise<Cohort[]>}
|
|
10895
|
+
*/
|
|
10896
|
+
async listUrpdCohorts({ signal, onUpdate } = {}) {
|
|
10897
|
+
const path = `/api/urpd`;
|
|
10898
|
+
return this.getJson(path, { signal, onUpdate });
|
|
10899
|
+
}
|
|
10900
|
+
|
|
10901
|
+
/**
|
|
10902
|
+
* Latest URPD
|
|
10903
|
+
*
|
|
10904
|
+
* URPD for the most recent available date in the cohort. The response's `date` field echoes which date was served.
|
|
10905
|
+
*
|
|
10906
|
+
* See the URPD tag description for the response shape and `agg` options.
|
|
10907
|
+
*
|
|
10908
|
+
* Endpoint: `GET /api/urpd/{cohort}`
|
|
10909
|
+
*
|
|
10910
|
+
* @param {Cohort} cohort
|
|
10911
|
+
* @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
|
|
10912
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Urpd) => void }} [options]
|
|
10913
|
+
* @returns {Promise<Urpd>}
|
|
10914
|
+
*/
|
|
10915
|
+
async getUrpd(cohort, agg, { signal, onUpdate } = {}) {
|
|
10916
|
+
const params = new URLSearchParams();
|
|
10917
|
+
if (agg !== undefined) params.set('agg', String(agg));
|
|
10918
|
+
const query = params.toString();
|
|
10919
|
+
const path = `/api/urpd/${cohort}${query ? '?' + query : ''}`;
|
|
10920
|
+
return this.getJson(path, { signal, onUpdate });
|
|
10921
|
+
}
|
|
10922
|
+
|
|
10923
|
+
/**
|
|
10924
|
+
* Available URPD dates
|
|
10925
|
+
*
|
|
10926
|
+
* Dates for which a URPD snapshot is available for the cohort. One entry per UTC day, sorted ascending.
|
|
10927
|
+
*
|
|
10928
|
+
* Endpoint: `GET /api/urpd/{cohort}/dates`
|
|
10929
|
+
*
|
|
10930
|
+
* @param {Cohort} cohort
|
|
10931
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Date[]) => void }} [options]
|
|
10932
|
+
* @returns {Promise<Date[]>}
|
|
10933
|
+
*/
|
|
10934
|
+
async listUrpdDates(cohort, { signal, onUpdate } = {}) {
|
|
10935
|
+
const path = `/api/urpd/${cohort}/dates`;
|
|
10936
|
+
return this.getJson(path, { signal, onUpdate });
|
|
10937
|
+
}
|
|
10938
|
+
|
|
10939
|
+
/**
|
|
10940
|
+
* URPD at date
|
|
10941
|
+
*
|
|
10942
|
+
* 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 }`.
|
|
10943
|
+
*
|
|
10944
|
+
* See the URPD tag description for unit conventions and `agg` options.
|
|
10945
|
+
*
|
|
10946
|
+
* Endpoint: `GET /api/urpd/{cohort}/{date}`
|
|
10947
|
+
*
|
|
10948
|
+
* @param {Cohort} cohort
|
|
10949
|
+
* @param {string} date
|
|
10950
|
+
* @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
|
|
10951
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Urpd) => void }} [options]
|
|
10952
|
+
* @returns {Promise<Urpd>}
|
|
10953
|
+
*/
|
|
10954
|
+
async getUrpdAt(cohort, date, agg, { signal, onUpdate } = {}) {
|
|
10955
|
+
const params = new URLSearchParams();
|
|
10956
|
+
if (agg !== undefined) params.set('agg', String(agg));
|
|
10957
|
+
const query = params.toString();
|
|
10958
|
+
const path = `/api/urpd/${cohort}/${date}${query ? '?' + query : ''}`;
|
|
10959
|
+
return this.getJson(path, { signal, onUpdate });
|
|
10960
|
+
}
|
|
10961
|
+
|
|
10845
10962
|
/**
|
|
10846
10963
|
* Block (v1)
|
|
10847
10964
|
*
|
package/package.json
CHANGED