oxarchive 0.3.4__py3-none-any.whl → 0.4.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oxarchive
3
- Version: 0.3.4
3
+ Version: 0.4.3
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
@@ -24,7 +24,7 @@ Requires-Python: >=3.9
24
24
  Requires-Dist: httpx>=0.25.0
25
25
  Requires-Dist: pydantic>=2.0.0
26
26
  Provides-Extra: all
27
- Requires-Dist: websockets>=12.0; extra == 'all'
27
+ Requires-Dist: websockets>=14.0; extra == 'all'
28
28
  Provides-Extra: dev
29
29
  Requires-Dist: mypy>=1.9.0; extra == 'dev'
30
30
  Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
@@ -32,12 +32,16 @@ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
32
32
  Requires-Dist: pytest>=8.0.0; extra == 'dev'
33
33
  Requires-Dist: ruff>=0.4.0; extra == 'dev'
34
34
  Provides-Extra: websocket
35
- Requires-Dist: websockets>=12.0; extra == 'websocket'
35
+ Requires-Dist: websockets>=14.0; extra == 'websocket'
36
36
  Description-Content-Type: text/markdown
37
37
 
38
38
  # oxarchive
39
39
 
40
- Official Python SDK for [0xarchive](https://0xarchive.io) - Hyperliquid Historical Data API.
40
+ Official Python SDK for [0xarchive](https://0xarchive.io) - Historical Market Data API.
41
+
42
+ Supports multiple exchanges:
43
+ - **Hyperliquid** - Perpetuals data from April 2023
44
+ - **Lighter.xyz** - Perpetuals data (August 2025+ for fills, Jan 2026+ for OB, OI, Funding Rate)
41
45
 
42
46
  ## Installation
43
47
 
@@ -58,12 +62,16 @@ from oxarchive import Client
58
62
 
59
63
  client = Client(api_key="ox_your_api_key")
60
64
 
61
- # Get current order book
62
- orderbook = client.orderbook.get("BTC")
63
- print(f"BTC mid price: {orderbook.mid_price}")
65
+ # Hyperliquid data
66
+ hl_orderbook = client.hyperliquid.orderbook.get("BTC")
67
+ print(f"Hyperliquid BTC mid price: {hl_orderbook.mid_price}")
68
+
69
+ # Lighter.xyz data
70
+ lighter_orderbook = client.lighter.orderbook.get("BTC")
71
+ print(f"Lighter BTC mid price: {lighter_orderbook.mid_price}")
64
72
 
65
73
  # Get historical order book snapshots
66
- history = client.orderbook.history(
74
+ history = client.hyperliquid.orderbook.history(
67
75
  "ETH",
68
76
  start="2024-01-01",
69
77
  end="2024-01-02",
@@ -82,10 +90,13 @@ from oxarchive import Client
82
90
  async def main():
83
91
  client = Client(api_key="ox_your_api_key")
84
92
 
85
- # Async get
86
- orderbook = await client.orderbook.aget("BTC")
93
+ # Async get (Hyperliquid)
94
+ orderbook = await client.hyperliquid.orderbook.aget("BTC")
87
95
  print(f"BTC mid price: {orderbook.mid_price}")
88
96
 
97
+ # Async get (Lighter.xyz)
98
+ lighter_ob = await client.lighter.orderbook.aget("BTC")
99
+
89
100
  # Don't forget to close the client
90
101
  await client.aclose()
91
102
 
@@ -96,7 +107,7 @@ Or use as async context manager:
96
107
 
97
108
  ```python
98
109
  async with Client(api_key="ox_your_api_key") as client:
99
- orderbook = await client.orderbook.aget("BTC")
110
+ orderbook = await client.hyperliquid.orderbook.aget("BTC")
100
111
  ```
101
112
 
102
113
  ## Configuration
@@ -111,20 +122,25 @@ client = Client(
111
122
 
112
123
  ## REST API Reference
113
124
 
125
+ All examples use `client.hyperliquid.*` but the same methods are available on `client.lighter.*` for Lighter.xyz data.
126
+
114
127
  ### Order Book
115
128
 
116
129
  ```python
117
- # Get current order book
118
- orderbook = client.orderbook.get("BTC")
130
+ # Get current order book (Hyperliquid)
131
+ orderbook = client.hyperliquid.orderbook.get("BTC")
132
+
133
+ # Get current order book (Lighter.xyz)
134
+ orderbook = client.lighter.orderbook.get("BTC")
119
135
 
120
136
  # Get order book at specific timestamp
121
- historical = client.orderbook.get("BTC", timestamp=1704067200000)
137
+ historical = client.hyperliquid.orderbook.get("BTC", timestamp=1704067200000)
122
138
 
123
139
  # Get with limited depth
124
- shallow = client.orderbook.get("BTC", depth=10)
140
+ shallow = client.hyperliquid.orderbook.get("BTC", depth=10)
125
141
 
126
142
  # Get historical snapshots (start and end are required)
127
- history = client.orderbook.history(
143
+ history = client.hyperliquid.orderbook.history(
128
144
  "BTC",
129
145
  start="2024-01-01",
130
146
  end="2024-01-02",
@@ -133,25 +149,65 @@ history = client.orderbook.history(
133
149
  )
134
150
 
135
151
  # Async versions
136
- orderbook = await client.orderbook.aget("BTC")
137
- history = await client.orderbook.ahistory("BTC", start=..., end=...)
152
+ orderbook = await client.hyperliquid.orderbook.aget("BTC")
153
+ history = await client.hyperliquid.orderbook.ahistory("BTC", start=..., end=...)
154
+ ```
155
+
156
+ #### Lighter Orderbook Granularity
157
+
158
+ Lighter.xyz orderbook history supports a `granularity` parameter for different data resolutions. Tier restrictions apply.
159
+
160
+ | Granularity | Interval | Tier Required | Credit Multiplier |
161
+ |-------------|----------|---------------|-------------------|
162
+ | `checkpoint` | ~60s | Free+ | 1x |
163
+ | `30s` | 30s | Build+ | 2x |
164
+ | `10s` | 10s | Build+ | 3x |
165
+ | `1s` | 1s | Pro+ | 10x |
166
+ | `tick` | tick-level | Enterprise | 20x |
167
+
168
+ ```python
169
+ # Get Lighter orderbook history with 10s resolution (Build+ tier)
170
+ history = client.lighter.orderbook.history(
171
+ "BTC",
172
+ start="2024-01-01",
173
+ end="2024-01-02",
174
+ granularity="10s"
175
+ )
176
+
177
+ # Get 1-second resolution (Pro+ tier)
178
+ history = client.lighter.orderbook.history(
179
+ "BTC",
180
+ start="2024-01-01",
181
+ end="2024-01-02",
182
+ granularity="1s"
183
+ )
184
+
185
+ # Tick-level data (Enterprise tier) - returns checkpoint + raw deltas
186
+ history = client.lighter.orderbook.history(
187
+ "BTC",
188
+ start="2024-01-01",
189
+ end="2024-01-02",
190
+ granularity="tick"
191
+ )
138
192
  ```
139
193
 
194
+ **Note:** The `granularity` parameter is ignored for Hyperliquid orderbook history.
195
+
140
196
  ### Trades
141
197
 
142
198
  The trades API uses cursor-based pagination for efficient retrieval of large datasets.
143
199
 
144
200
  ```python
145
201
  # Get recent trades
146
- recent = client.trades.recent("BTC", limit=100)
202
+ recent = client.hyperliquid.trades.recent("BTC", limit=100)
147
203
 
148
204
  # Get trade history with cursor-based pagination
149
- result = client.trades.list("ETH", start="2024-01-01", end="2024-01-02", limit=1000)
205
+ result = client.hyperliquid.trades.list("ETH", start="2024-01-01", end="2024-01-02", limit=1000)
150
206
  trades = result.data
151
207
 
152
208
  # Paginate through all results
153
209
  while result.next_cursor:
154
- result = client.trades.list(
210
+ result = client.hyperliquid.trades.list(
155
211
  "ETH",
156
212
  start="2024-01-01",
157
213
  end="2024-01-02",
@@ -161,61 +217,103 @@ while result.next_cursor:
161
217
  trades.extend(result.data)
162
218
 
163
219
  # Filter by side
164
- buys = client.trades.list("BTC", start=..., end=..., side="buy")
220
+ buys = client.hyperliquid.trades.list("BTC", start=..., end=..., side="buy")
165
221
 
166
222
  # Async versions
167
- recent = await client.trades.arecent("BTC")
168
- result = await client.trades.alist("ETH", start=..., end=...)
223
+ recent = await client.hyperliquid.trades.arecent("BTC")
224
+ result = await client.hyperliquid.trades.alist("ETH", start=..., end=...)
169
225
  ```
170
226
 
171
227
  ### Instruments
172
228
 
173
229
  ```python
174
- # List all trading instruments
175
- instruments = client.instruments.list()
230
+ # List all trading instruments (Hyperliquid)
231
+ instruments = client.hyperliquid.instruments.list()
176
232
 
177
233
  # Get specific instrument details
178
- btc = client.instruments.get("BTC")
234
+ btc = client.hyperliquid.instruments.get("BTC")
235
+ print(f"BTC size decimals: {btc.sz_decimals}")
179
236
 
180
237
  # Async versions
181
- instruments = await client.instruments.alist()
182
- btc = await client.instruments.aget("BTC")
238
+ instruments = await client.hyperliquid.instruments.alist()
239
+ btc = await client.hyperliquid.instruments.aget("BTC")
183
240
  ```
184
241
 
242
+ #### Lighter.xyz Instruments
243
+
244
+ Lighter instruments have a different schema with additional fields for fees, market IDs, and minimum order amounts:
245
+
246
+ ```python
247
+ # List Lighter instruments (returns LighterInstrument, not Instrument)
248
+ lighter_instruments = client.lighter.instruments.list()
249
+
250
+ # Get specific Lighter instrument
251
+ eth = client.lighter.instruments.get("ETH")
252
+ print(f"ETH taker fee: {eth.taker_fee}")
253
+ print(f"ETH maker fee: {eth.maker_fee}")
254
+ print(f"ETH market ID: {eth.market_id}")
255
+ print(f"ETH min base amount: {eth.min_base_amount}")
256
+
257
+ # Async versions
258
+ lighter_instruments = await client.lighter.instruments.alist()
259
+ eth = await client.lighter.instruments.aget("ETH")
260
+ ```
261
+
262
+ **Key differences:**
263
+ | Field | Hyperliquid (`Instrument`) | Lighter (`LighterInstrument`) |
264
+ |-------|---------------------------|------------------------------|
265
+ | Symbol | `name` | `symbol` |
266
+ | Size decimals | `sz_decimals` | `size_decimals` |
267
+ | Fee info | Not available | `taker_fee`, `maker_fee`, `liquidation_fee` |
268
+ | Market ID | Not available | `market_id` |
269
+ | Min amounts | Not available | `min_base_amount`, `min_quote_amount` |
270
+
185
271
  ### Funding Rates
186
272
 
187
273
  ```python
188
274
  # Get current funding rate
189
- current = client.funding.current("BTC")
275
+ current = client.hyperliquid.funding.current("BTC")
190
276
 
191
277
  # Get funding rate history (start is required)
192
- history = client.funding.history(
278
+ history = client.hyperliquid.funding.history(
193
279
  "ETH",
194
280
  start="2024-01-01",
195
281
  end="2024-01-07"
196
282
  )
197
283
 
198
284
  # Async versions
199
- current = await client.funding.acurrent("BTC")
200
- history = await client.funding.ahistory("ETH", start=..., end=...)
285
+ current = await client.hyperliquid.funding.acurrent("BTC")
286
+ history = await client.hyperliquid.funding.ahistory("ETH", start=..., end=...)
201
287
  ```
202
288
 
203
289
  ### Open Interest
204
290
 
205
291
  ```python
206
292
  # Get current open interest
207
- current = client.open_interest.current("BTC")
293
+ current = client.hyperliquid.open_interest.current("BTC")
208
294
 
209
295
  # Get open interest history (start is required)
210
- history = client.open_interest.history(
296
+ history = client.hyperliquid.open_interest.history(
211
297
  "ETH",
212
298
  start="2024-01-01",
213
299
  end="2024-01-07"
214
300
  )
215
301
 
216
302
  # Async versions
217
- current = await client.open_interest.acurrent("BTC")
218
- history = await client.open_interest.ahistory("ETH", start=..., end=...)
303
+ current = await client.hyperliquid.open_interest.acurrent("BTC")
304
+ history = await client.hyperliquid.open_interest.ahistory("ETH", start=..., end=...)
305
+ ```
306
+
307
+ ### Legacy API (Deprecated)
308
+
309
+ The following legacy methods are deprecated and will be removed in v2.0. They default to Hyperliquid data:
310
+
311
+ ```python
312
+ # Deprecated - use client.hyperliquid.orderbook.get() instead
313
+ orderbook = client.orderbook.get("BTC")
314
+
315
+ # Deprecated - use client.hyperliquid.trades.list() instead
316
+ trades = client.trades.list("BTC", start=..., end=...)
219
317
  ```
220
318
 
221
319
  ## WebSocket Client
@@ -421,8 +519,8 @@ except OxArchiveError as e:
421
519
  Full type hint support with Pydantic models:
422
520
 
423
521
  ```python
424
- from oxarchive import Client
425
- from oxarchive.types import OrderBook, Trade, Instrument, FundingRate, OpenInterest
522
+ from oxarchive import Client, LighterGranularity
523
+ from oxarchive.types import OrderBook, Trade, Instrument, LighterInstrument, FundingRate, OpenInterest
426
524
  from oxarchive.resources.trades import CursorResponse
427
525
 
428
526
  client = Client(api_key="ox_your_api_key")
@@ -430,6 +528,9 @@ client = Client(api_key="ox_your_api_key")
430
528
  orderbook: OrderBook = client.orderbook.get("BTC")
431
529
  trades: list[Trade] = client.trades.recent("BTC")
432
530
  result: CursorResponse = client.trades.list("BTC", start=..., end=...)
531
+
532
+ # Lighter granularity type hint
533
+ granularity: LighterGranularity = "10s"
433
534
  ```
434
535
 
435
536
  ## Requirements
@@ -0,0 +1,15 @@
1
+ oxarchive/__init__.py,sha256=OF26Yzxyp_899hbIRbm_0wud02SZ6vwbG9Zu0O7JLOk,2666
2
+ oxarchive/client.py,sha256=XWQ_VEBQy3UIAnmZQ-Z_FyzXnvMA3FITwtinBOf3o-Y,4453
3
+ oxarchive/exchanges.py,sha256=kk--Uh4g1U_tPfhJhYtZD_1zR6tJS5D-iaPnOGwWa9c,2425
4
+ oxarchive/http.py,sha256=SY_o9Ag8ADo1HI3i3uAKW1xwkYjPE75gRAjnMsddAGs,4211
5
+ oxarchive/types.py,sha256=hszHQVTxh2gRKvSzRANQ3d8sosPfPerKwF7QTK8p1a4,12443
6
+ oxarchive/websocket.py,sha256=MyffJxaabDBonECcJg9vF4hAQ_4thjP4DaS7MaR4uno,28381
7
+ oxarchive/resources/__init__.py,sha256=ZGS3rLOfQFD665oJYMia_MxfTWlal7MXtx874DLG5EE,448
8
+ oxarchive/resources/funding.py,sha256=ybMWkpoccrkdwnd6W3oHgsaor7cBcA2nkYy4CbjmHUg,4485
9
+ oxarchive/resources/instruments.py,sha256=6q7rMdIaixXgFVXgwQsVd-YuO7RIXr1oGPT5jBsqI9A,3733
10
+ oxarchive/resources/openinterest.py,sha256=whwo60KFNLGwvVrDmDYYc-rMZr35Fcizb5Iil-DSvD8,4553
11
+ oxarchive/resources/orderbook.py,sha256=NzgKH45MBb2oAHyPmy6BSikaYyq0nM-8GFjur9LIRN8,6661
12
+ oxarchive/resources/trades.py,sha256=t4iicyi1waaHzC7Q_cC-c7O4yVx1vqS4eMH8F8_5hxk,5503
13
+ oxarchive-0.4.3.dist-info/METADATA,sha256=d9NjrKnKn0UCNpTD9CLr9mhkYOAF1N9Ln4iiBvEisSs,14817
14
+ oxarchive-0.4.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
+ oxarchive-0.4.3.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- oxarchive/__init__.py,sha256=78RaSKLIkBs1iF_zgycz-KURflteYYxSmQ6dRBgaN34,2181
2
- oxarchive/client.py,sha256=3P0fvOcyM5BWppkVV4054NduDHKvRg-cWeluoGymmRk,3163
3
- oxarchive/http.py,sha256=SY_o9Ag8ADo1HI3i3uAKW1xwkYjPE75gRAjnMsddAGs,4211
4
- oxarchive/types.py,sha256=pQJt1ZilZaV6h4anPYHloVrB97Q9Y2v9B9iYTkMXFo0,11025
5
- oxarchive/websocket.py,sha256=hodeRIfY3sHrdD1DMexInnDvLXTtUzyXOrRM37Iyark,26941
6
- oxarchive/resources/__init__.py,sha256=WQ4GYQ8p3L0D2Isk4IV4h1DRpvyZlt6tOF1t_CJr6ls,385
7
- oxarchive/resources/funding.py,sha256=TXkZxodVQTVcVbzNG6SpMQAzf8AkLm2NYZJxnP4MNXw,3500
8
- oxarchive/resources/instruments.py,sha256=flD1sH6x3P3CTqV1ZwkfwbranVacmhsHn5Dhr7lGQhM,1606
9
- oxarchive/resources/openinterest.py,sha256=h13yLA72LpfryUf8IqF6W7uE4ObYY2Qbc-auv4LtPqc,3552
10
- oxarchive/resources/orderbook.py,sha256=o_DTdpzKrZvHL9YXm8cGGUugPM8uUa6r9O_72r1ByV0,4557
11
- oxarchive/resources/trades.py,sha256=XCi2rXA2hxaTt0KNlWw8f7W0hzAvNWyT7DaivMz_rHw,10012
12
- oxarchive-0.3.4.dist-info/METADATA,sha256=QcWBi6I7v368CIWisPiCBSmBlALylmHdIhGQtfUHww8,11070
13
- oxarchive-0.3.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
- oxarchive-0.3.4.dist-info/RECORD,,