oxarchive 0.5.2__tar.gz → 0.5.4__tar.gz
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.
- {oxarchive-0.5.2 → oxarchive-0.5.4}/PKG-INFO +49 -9
- {oxarchive-0.5.2 → oxarchive-0.5.4}/README.md +48 -8
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/__init__.py +3 -1
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/trades.py +9 -5
- {oxarchive-0.5.2 → oxarchive-0.5.4}/pyproject.toml +1 -1
- {oxarchive-0.5.2 → oxarchive-0.5.4}/.gitignore +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/client.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/exchanges.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/http.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/__init__.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/candles.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/funding.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/instruments.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/liquidations.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/openinterest.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/resources/orderbook.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/types.py +0 -0
- {oxarchive-0.5.2 → oxarchive-0.5.4}/oxarchive/websocket.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oxarchive
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: Official Python SDK for 0xarchive - Hyperliquid Historical Data API
|
|
5
5
|
Project-URL: Homepage, https://0xarchive.io
|
|
6
6
|
Project-URL: Documentation, https://0xarchive.io/docs/sdks
|
|
@@ -211,9 +211,6 @@ history = client.lighter.orderbook.history(
|
|
|
211
211
|
The trades API uses cursor-based pagination for efficient retrieval of large datasets.
|
|
212
212
|
|
|
213
213
|
```python
|
|
214
|
-
# Get recent trades
|
|
215
|
-
recent = client.hyperliquid.trades.recent("BTC", limit=100)
|
|
216
|
-
|
|
217
214
|
# Get trade history with cursor-based pagination
|
|
218
215
|
result = client.hyperliquid.trades.list("ETH", start="2024-01-01", end="2024-01-02", limit=1000)
|
|
219
216
|
trades = result.data
|
|
@@ -232,9 +229,12 @@ while result.next_cursor:
|
|
|
232
229
|
# Filter by side
|
|
233
230
|
buys = client.hyperliquid.trades.list("BTC", start=..., end=..., side="buy")
|
|
234
231
|
|
|
232
|
+
# Get recent trades (Lighter only - has real-time data)
|
|
233
|
+
recent = client.lighter.trades.recent("BTC", limit=100)
|
|
234
|
+
|
|
235
235
|
# Async versions
|
|
236
|
-
recent = await client.hyperliquid.trades.arecent("BTC")
|
|
237
236
|
result = await client.hyperliquid.trades.alist("ETH", start=..., end=...)
|
|
237
|
+
recent = await client.lighter.trades.arecent("BTC", limit=100)
|
|
238
238
|
```
|
|
239
239
|
|
|
240
240
|
### Instruments
|
|
@@ -317,6 +317,44 @@ current = await client.hyperliquid.open_interest.acurrent("BTC")
|
|
|
317
317
|
history = await client.hyperliquid.open_interest.ahistory("ETH", start=..., end=...)
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
+
### Liquidations (Hyperliquid only)
|
|
321
|
+
|
|
322
|
+
Get historical liquidation events. Data available from May 2025 onwards.
|
|
323
|
+
|
|
324
|
+
```python
|
|
325
|
+
# Get liquidation history for a coin
|
|
326
|
+
liquidations = client.hyperliquid.liquidations.history(
|
|
327
|
+
"BTC",
|
|
328
|
+
start="2025-06-01",
|
|
329
|
+
end="2025-06-02",
|
|
330
|
+
limit=100
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
# Paginate through all results
|
|
334
|
+
all_liquidations = list(liquidations.data)
|
|
335
|
+
while liquidations.next_cursor:
|
|
336
|
+
liquidations = client.hyperliquid.liquidations.history(
|
|
337
|
+
"BTC",
|
|
338
|
+
start="2025-06-01",
|
|
339
|
+
end="2025-06-02",
|
|
340
|
+
cursor=liquidations.next_cursor,
|
|
341
|
+
limit=1000
|
|
342
|
+
)
|
|
343
|
+
all_liquidations.extend(liquidations.data)
|
|
344
|
+
|
|
345
|
+
# Get liquidations for a specific user
|
|
346
|
+
user_liquidations = client.hyperliquid.liquidations.by_user(
|
|
347
|
+
"0x1234...",
|
|
348
|
+
start="2025-06-01",
|
|
349
|
+
end="2025-06-07",
|
|
350
|
+
coin="BTC" # optional filter
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
# Async versions
|
|
354
|
+
liquidations = await client.hyperliquid.liquidations.ahistory("BTC", start=..., end=...)
|
|
355
|
+
user_liquidations = await client.hyperliquid.liquidations.aby_user("0x...", start=..., end=...)
|
|
356
|
+
```
|
|
357
|
+
|
|
320
358
|
### Candles (OHLCV)
|
|
321
359
|
|
|
322
360
|
Get historical OHLCV candle data aggregated from trades.
|
|
@@ -636,14 +674,16 @@ Full type hint support with Pydantic models:
|
|
|
636
674
|
|
|
637
675
|
```python
|
|
638
676
|
from oxarchive import Client, LighterGranularity
|
|
639
|
-
from oxarchive.types import OrderBook, Trade, Instrument, LighterInstrument, FundingRate, OpenInterest
|
|
677
|
+
from oxarchive.types import OrderBook, Trade, Instrument, LighterInstrument, FundingRate, OpenInterest, Candle, Liquidation
|
|
640
678
|
from oxarchive.resources.trades import CursorResponse
|
|
641
679
|
|
|
642
680
|
client = Client(api_key="ox_your_api_key")
|
|
643
681
|
|
|
644
|
-
orderbook: OrderBook = client.orderbook.get("BTC")
|
|
645
|
-
|
|
646
|
-
|
|
682
|
+
orderbook: OrderBook = client.hyperliquid.orderbook.get("BTC")
|
|
683
|
+
result: CursorResponse = client.hyperliquid.trades.list("BTC", start=..., end=...)
|
|
684
|
+
|
|
685
|
+
# Lighter has real-time data, so recent() is available
|
|
686
|
+
recent: list[Trade] = client.lighter.trades.recent("BTC")
|
|
647
687
|
|
|
648
688
|
# Lighter granularity type hint
|
|
649
689
|
granularity: LighterGranularity = "10s"
|
|
@@ -174,9 +174,6 @@ history = client.lighter.orderbook.history(
|
|
|
174
174
|
The trades API uses cursor-based pagination for efficient retrieval of large datasets.
|
|
175
175
|
|
|
176
176
|
```python
|
|
177
|
-
# Get recent trades
|
|
178
|
-
recent = client.hyperliquid.trades.recent("BTC", limit=100)
|
|
179
|
-
|
|
180
177
|
# Get trade history with cursor-based pagination
|
|
181
178
|
result = client.hyperliquid.trades.list("ETH", start="2024-01-01", end="2024-01-02", limit=1000)
|
|
182
179
|
trades = result.data
|
|
@@ -195,9 +192,12 @@ while result.next_cursor:
|
|
|
195
192
|
# Filter by side
|
|
196
193
|
buys = client.hyperliquid.trades.list("BTC", start=..., end=..., side="buy")
|
|
197
194
|
|
|
195
|
+
# Get recent trades (Lighter only - has real-time data)
|
|
196
|
+
recent = client.lighter.trades.recent("BTC", limit=100)
|
|
197
|
+
|
|
198
198
|
# Async versions
|
|
199
|
-
recent = await client.hyperliquid.trades.arecent("BTC")
|
|
200
199
|
result = await client.hyperliquid.trades.alist("ETH", start=..., end=...)
|
|
200
|
+
recent = await client.lighter.trades.arecent("BTC", limit=100)
|
|
201
201
|
```
|
|
202
202
|
|
|
203
203
|
### Instruments
|
|
@@ -280,6 +280,44 @@ current = await client.hyperliquid.open_interest.acurrent("BTC")
|
|
|
280
280
|
history = await client.hyperliquid.open_interest.ahistory("ETH", start=..., end=...)
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
+
### Liquidations (Hyperliquid only)
|
|
284
|
+
|
|
285
|
+
Get historical liquidation events. Data available from May 2025 onwards.
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
# Get liquidation history for a coin
|
|
289
|
+
liquidations = client.hyperliquid.liquidations.history(
|
|
290
|
+
"BTC",
|
|
291
|
+
start="2025-06-01",
|
|
292
|
+
end="2025-06-02",
|
|
293
|
+
limit=100
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
# Paginate through all results
|
|
297
|
+
all_liquidations = list(liquidations.data)
|
|
298
|
+
while liquidations.next_cursor:
|
|
299
|
+
liquidations = client.hyperliquid.liquidations.history(
|
|
300
|
+
"BTC",
|
|
301
|
+
start="2025-06-01",
|
|
302
|
+
end="2025-06-02",
|
|
303
|
+
cursor=liquidations.next_cursor,
|
|
304
|
+
limit=1000
|
|
305
|
+
)
|
|
306
|
+
all_liquidations.extend(liquidations.data)
|
|
307
|
+
|
|
308
|
+
# Get liquidations for a specific user
|
|
309
|
+
user_liquidations = client.hyperliquid.liquidations.by_user(
|
|
310
|
+
"0x1234...",
|
|
311
|
+
start="2025-06-01",
|
|
312
|
+
end="2025-06-07",
|
|
313
|
+
coin="BTC" # optional filter
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
# Async versions
|
|
317
|
+
liquidations = await client.hyperliquid.liquidations.ahistory("BTC", start=..., end=...)
|
|
318
|
+
user_liquidations = await client.hyperliquid.liquidations.aby_user("0x...", start=..., end=...)
|
|
319
|
+
```
|
|
320
|
+
|
|
283
321
|
### Candles (OHLCV)
|
|
284
322
|
|
|
285
323
|
Get historical OHLCV candle data aggregated from trades.
|
|
@@ -599,14 +637,16 @@ Full type hint support with Pydantic models:
|
|
|
599
637
|
|
|
600
638
|
```python
|
|
601
639
|
from oxarchive import Client, LighterGranularity
|
|
602
|
-
from oxarchive.types import OrderBook, Trade, Instrument, LighterInstrument, FundingRate, OpenInterest
|
|
640
|
+
from oxarchive.types import OrderBook, Trade, Instrument, LighterInstrument, FundingRate, OpenInterest, Candle, Liquidation
|
|
603
641
|
from oxarchive.resources.trades import CursorResponse
|
|
604
642
|
|
|
605
643
|
client = Client(api_key="ox_your_api_key")
|
|
606
644
|
|
|
607
|
-
orderbook: OrderBook = client.orderbook.get("BTC")
|
|
608
|
-
|
|
609
|
-
|
|
645
|
+
orderbook: OrderBook = client.hyperliquid.orderbook.get("BTC")
|
|
646
|
+
result: CursorResponse = client.hyperliquid.trades.list("BTC", start=..., end=...)
|
|
647
|
+
|
|
648
|
+
# Lighter has real-time data, so recent() is available
|
|
649
|
+
recent: list[Trade] = client.lighter.trades.recent("BTC")
|
|
610
650
|
|
|
611
651
|
# Lighter granularity type hint
|
|
612
652
|
granularity: LighterGranularity = "10s"
|
|
@@ -31,6 +31,7 @@ from .types import (
|
|
|
31
31
|
LighterInstrument,
|
|
32
32
|
FundingRate,
|
|
33
33
|
OpenInterest,
|
|
34
|
+
Liquidation,
|
|
34
35
|
Candle,
|
|
35
36
|
CandleInterval,
|
|
36
37
|
OxArchiveError,
|
|
@@ -67,7 +68,7 @@ except ImportError:
|
|
|
67
68
|
OxArchiveWs = None # type: ignore
|
|
68
69
|
WsOptions = None # type: ignore
|
|
69
70
|
|
|
70
|
-
__version__ = "0.5.
|
|
71
|
+
__version__ = "0.5.4"
|
|
71
72
|
|
|
72
73
|
__all__ = [
|
|
73
74
|
# Client
|
|
@@ -86,6 +87,7 @@ __all__ = [
|
|
|
86
87
|
"LighterGranularity",
|
|
87
88
|
"FundingRate",
|
|
88
89
|
"OpenInterest",
|
|
90
|
+
"Liquidation",
|
|
89
91
|
"Candle",
|
|
90
92
|
"CandleInterval",
|
|
91
93
|
"OxArchiveError",
|
|
@@ -14,17 +14,17 @@ class TradesResource:
|
|
|
14
14
|
Trades API resource.
|
|
15
15
|
|
|
16
16
|
Example:
|
|
17
|
-
>>> # Get recent trades
|
|
18
|
-
>>> trades = client.trades.recent("BTC")
|
|
19
|
-
>>>
|
|
20
17
|
>>> # Get trade history with cursor-based pagination (recommended)
|
|
21
|
-
>>> result = client.trades.list("BTC", start="2024-01-01", end="2024-01-02")
|
|
18
|
+
>>> result = client.hyperliquid.trades.list("BTC", start="2024-01-01", end="2024-01-02")
|
|
22
19
|
>>> trades = result.data
|
|
23
20
|
>>>
|
|
24
21
|
>>> # Get all pages
|
|
25
22
|
>>> while result.next_cursor:
|
|
26
|
-
... result = client.trades.list("BTC", start="2024-01-01", end="2024-01-02", cursor=result.next_cursor)
|
|
23
|
+
... result = client.hyperliquid.trades.list("BTC", start="2024-01-01", end="2024-01-02", cursor=result.next_cursor)
|
|
27
24
|
... trades.extend(result.data)
|
|
25
|
+
>>>
|
|
26
|
+
>>> # Get recent trades (Lighter only - has real-time data)
|
|
27
|
+
>>> recent = client.lighter.trades.recent("BTC")
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
def __init__(self, http: HttpClient, base_path: str = "/v1"):
|
|
@@ -135,6 +135,10 @@ class TradesResource:
|
|
|
135
135
|
"""
|
|
136
136
|
Get most recent trades for a coin.
|
|
137
137
|
|
|
138
|
+
Note: This method is only available for Lighter (client.lighter.trades.recent())
|
|
139
|
+
which has real-time data ingestion. Hyperliquid uses hourly backfill so this
|
|
140
|
+
endpoint is not available for Hyperliquid.
|
|
141
|
+
|
|
138
142
|
Args:
|
|
139
143
|
coin: The coin symbol (e.g., 'BTC', 'ETH')
|
|
140
144
|
limit: Number of trades to return (default: 100)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|