mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-17 05:58:11 -07:00
global: snapshot
This commit is contained in:
+431
-219
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,8 @@ Python client for the [Bitcoin Research Kit](https://github.com/bitcoinresearchk
|
||||
|
||||
```bash
|
||||
pip install brk-client
|
||||
# or
|
||||
uv add brk-client
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
@@ -15,7 +17,8 @@ pip install brk-client
|
||||
```python
|
||||
from brk_client import BrkClient
|
||||
|
||||
client = BrkClient("http://localhost:3110")
|
||||
# Use the free public API or your own instance
|
||||
client = BrkClient("https://bitview.space")
|
||||
|
||||
# Blockchain data (mempool.space compatible)
|
||||
block = client.get_block_by_height(800000)
|
||||
@@ -25,14 +28,24 @@ address = client.get_address("bc1q...")
|
||||
# Metrics API - typed, chainable
|
||||
prices = client.metrics.price.usd.split.close \
|
||||
.by.dateindex() \
|
||||
.range(-30) # Last 30 days
|
||||
.tail(30) \
|
||||
.fetch() # Last 30 items
|
||||
|
||||
# Generic metric fetching
|
||||
data = client.get_metric("price_close", "dateindex", -30)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```python
|
||||
# Range methods
|
||||
.head(n) # First n items
|
||||
.tail(n) # Last n items
|
||||
.fetch() # Execute the request
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
```python
|
||||
client = BrkClient("http://localhost:3110", timeout=60.0)
|
||||
client = BrkClient("https://bitview.space", timeout=60.0)
|
||||
```
|
||||
|
||||
+4921
-2758
File diff suppressed because it is too large
Load Diff
@@ -1,4 +0,0 @@
|
||||
uv run pytest tests/basic.py -s
|
||||
uvx pydoc-markdown > DOCS.md
|
||||
uv build
|
||||
uvx uv-publish
|
||||
@@ -20,8 +20,10 @@ def get_all_metrics(obj, path=""):
|
||||
metrics = []
|
||||
|
||||
for attr_name in dir(obj):
|
||||
# Skip dunder methods and internal attributes like _client
|
||||
if attr_name.startswith("__") or attr_name == "_client":
|
||||
# Skip dunder methods and internal attributes (_letter), but allow _digit (e.g., _10y, _2017)
|
||||
if attr_name.startswith("__"):
|
||||
continue
|
||||
if attr_name.startswith("_") and len(attr_name) > 1 and attr_name[1].isalpha():
|
||||
continue
|
||||
|
||||
try:
|
||||
Reference in New Issue
Block a user