oxarchive 0.5.2__py3-none-any.whl → 0.5.4__py3-none-any.whl

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/__init__.py CHANGED
@@ -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.2"
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oxarchive
3
- Version: 0.5.2
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
- trades: list[Trade] = client.trades.recent("BTC")
646
- result: CursorResponse = client.trades.list("BTC", start=..., end=...)
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"
@@ -1,4 +1,4 @@
1
- oxarchive/__init__.py,sha256=Y9i6Ev_nR_cA1CUMTd2JXQPOBSd00LFQ41-BlR3-NsM,2738
1
+ oxarchive/__init__.py,sha256=TUM5RDCVggBQhDMLsyj5NvCIm8Ln-eErWY2GlW8u-iA,2776
2
2
  oxarchive/client.py,sha256=XWQ_VEBQy3UIAnmZQ-Z_FyzXnvMA3FITwtinBOf3o-Y,4453
3
3
  oxarchive/exchanges.py,sha256=nTd0gRrgV2wDoptWWxwh38HXkCcunVNuNdNEwzNDsBM,2773
4
4
  oxarchive/http.py,sha256=SY_o9Ag8ADo1HI3i3uAKW1xwkYjPE75gRAjnMsddAGs,4211
@@ -11,7 +11,7 @@ oxarchive/resources/instruments.py,sha256=6q7rMdIaixXgFVXgwQsVd-YuO7RIXr1oGPT5jB
11
11
  oxarchive/resources/liquidations.py,sha256=kX3mEX2u6uEvgk1aKfL4U0JE9gOjJOwsLVpkIj84arE,6741
12
12
  oxarchive/resources/openinterest.py,sha256=whwo60KFNLGwvVrDmDYYc-rMZr35Fcizb5Iil-DSvD8,4553
13
13
  oxarchive/resources/orderbook.py,sha256=NzgKH45MBb2oAHyPmy6BSikaYyq0nM-8GFjur9LIRN8,6661
14
- oxarchive/resources/trades.py,sha256=t4iicyi1waaHzC7Q_cC-c7O4yVx1vqS4eMH8F8_5hxk,5503
15
- oxarchive-0.5.2.dist-info/METADATA,sha256=y29y_zkpyTPlMNSbXQsOpIuK4v1Zp8k5cYHewJlSTcg,17974
16
- oxarchive-0.5.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
- oxarchive-0.5.2.dist-info/RECORD,,
14
+ oxarchive/resources/trades.py,sha256=RhOTbhqSSBAaekden6rLY8qJL-NDArGTqCempvUbX08,5801
15
+ oxarchive-0.5.4.dist-info/METADATA,sha256=Ctk2ZoCuaoaEA6jqEohnwJAx2jFaQpmKrNQPL8Ys2Pc,19166
16
+ oxarchive-0.5.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ oxarchive-0.5.4.dist-info/RECORD,,