revolut-x-python 1.0.0__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.
- revolut_x/__init__.py +103 -0
- revolut_x/_auth.py +139 -0
- revolut_x/_http.py +270 -0
- revolut_x/_version.py +10 -0
- revolut_x/account.py +203 -0
- revolut_x/client.py +170 -0
- revolut_x/exceptions.py +147 -0
- revolut_x/helpers.py +540 -0
- revolut_x/market.py +469 -0
- revolut_x/orders.py +522 -0
- revolut_x/py.typed +0 -0
- revolut_x/types.py +397 -0
- revolut_x_python-1.0.0.dist-info/METADATA +164 -0
- revolut_x_python-1.0.0.dist-info/RECORD +17 -0
- revolut_x_python-1.0.0.dist-info/WHEEL +5 -0
- revolut_x_python-1.0.0.dist-info/licenses/LICENSE +21 -0
- revolut_x_python-1.0.0.dist-info/top_level.txt +1 -0
revolut_x/types.py
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"""Type definitions, enums, and typed dictionaries for revolut-x-python.
|
|
2
|
+
|
|
3
|
+
This module provides:
|
|
4
|
+
|
|
5
|
+
* **Enums** — :class:`OrderSide`, :class:`OrderType`, :class:`Interval`,
|
|
6
|
+
:class:`TimeInForce` for type-safe parameter passing.
|
|
7
|
+
* **TypedDicts** — :class:`Candle`, :class:`Trade`, :class:`Ticker`,
|
|
8
|
+
:class:`Balance`, :class:`PairConfig`, etc. for IDE autocompletion
|
|
9
|
+
on API response data.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
from enum import Enum
|
|
14
|
+
from typing import TypedDict
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ---------------------------------------------------------------------------
|
|
18
|
+
# Enums
|
|
19
|
+
# ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
class OrderSide(str, Enum):
|
|
22
|
+
"""Direction of an order.
|
|
23
|
+
|
|
24
|
+
Example::
|
|
25
|
+
|
|
26
|
+
from revolut_x import OrderSide
|
|
27
|
+
side = OrderSide.BUY
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
BUY = "buy"
|
|
31
|
+
"""Buy the base currency (e.g. buy BTC for EUR)."""
|
|
32
|
+
|
|
33
|
+
SELL = "sell"
|
|
34
|
+
"""Sell the base currency (e.g. sell BTC for EUR)."""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class OrderType(str, Enum):
|
|
38
|
+
"""Type of an order.
|
|
39
|
+
|
|
40
|
+
Example::
|
|
41
|
+
|
|
42
|
+
from revolut_x import OrderType
|
|
43
|
+
order_type = OrderType.LIMIT
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
MARKET = "market"
|
|
47
|
+
"""Market order — executed immediately at the best available price (taker fee: 0.09%)."""
|
|
48
|
+
|
|
49
|
+
LIMIT = "limit"
|
|
50
|
+
"""Limit order — placed in the order book at a specific price (maker fee: 0.00%)."""
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class Interval(int, Enum):
|
|
54
|
+
"""Candlestick interval in minutes, as accepted by the Revolut X API.
|
|
55
|
+
|
|
56
|
+
Example::
|
|
57
|
+
|
|
58
|
+
from revolut_x import Interval
|
|
59
|
+
candles = client.get_candles("BTC-EUR", interval=Interval.HOUR_1)
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
MIN_1 = 1
|
|
63
|
+
"""1-minute candles."""
|
|
64
|
+
|
|
65
|
+
MIN_5 = 5
|
|
66
|
+
"""5-minute candles."""
|
|
67
|
+
|
|
68
|
+
MIN_15 = 15
|
|
69
|
+
"""15-minute candles."""
|
|
70
|
+
|
|
71
|
+
MIN_30 = 30
|
|
72
|
+
"""30-minute candles."""
|
|
73
|
+
|
|
74
|
+
HOUR_1 = 60
|
|
75
|
+
"""1-hour candles."""
|
|
76
|
+
|
|
77
|
+
HOUR_4 = 240
|
|
78
|
+
"""4-hour candles."""
|
|
79
|
+
|
|
80
|
+
DAY_1 = 1440
|
|
81
|
+
"""1-day (24h) candles."""
|
|
82
|
+
|
|
83
|
+
DAY_2 = 2880
|
|
84
|
+
"""2-day candles."""
|
|
85
|
+
|
|
86
|
+
DAY_4 = 5760
|
|
87
|
+
"""4-day candles."""
|
|
88
|
+
|
|
89
|
+
WEEK_1 = 10080
|
|
90
|
+
"""1-week candles."""
|
|
91
|
+
|
|
92
|
+
WEEK_2 = 20160
|
|
93
|
+
"""2-week candles."""
|
|
94
|
+
|
|
95
|
+
WEEK_4 = 40320
|
|
96
|
+
"""4-week (28-day) candles."""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class TimeInForce(str, Enum):
|
|
100
|
+
"""Time-in-force policy for limit orders.
|
|
101
|
+
|
|
102
|
+
Example::
|
|
103
|
+
|
|
104
|
+
from revolut_x import TimeInForce
|
|
105
|
+
client.place_limit_order(..., time_in_force=TimeInForce.GTC)
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
GTC = "gtc"
|
|
109
|
+
"""Good 'til canceled — the order stays open until filled or manually canceled."""
|
|
110
|
+
|
|
111
|
+
IOC = "ioc"
|
|
112
|
+
"""Immediate or cancel — fill as much as possible immediately, cancel the rest."""
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# ---------------------------------------------------------------------------
|
|
116
|
+
# TypedDicts — structured response types for IDE autocompletion
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
|
|
119
|
+
class Candle(TypedDict):
|
|
120
|
+
"""A single OHLCV candlestick returned by :meth:`RevolutXClient.get_candles`.
|
|
121
|
+
|
|
122
|
+
Attributes:
|
|
123
|
+
start: Candle open time as Unix timestamp in milliseconds.
|
|
124
|
+
open: Opening price (string to preserve decimal precision).
|
|
125
|
+
high: Highest price during the interval.
|
|
126
|
+
low: Lowest price during the interval.
|
|
127
|
+
close: Closing price.
|
|
128
|
+
volume: Trading volume in the base currency.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
start: int
|
|
132
|
+
open: str
|
|
133
|
+
high: str
|
|
134
|
+
low: str
|
|
135
|
+
close: str
|
|
136
|
+
volume: str
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class Trade(TypedDict, total=False):
|
|
140
|
+
"""A single public trade returned by :meth:`RevolutXClient.get_trades`.
|
|
141
|
+
|
|
142
|
+
Attributes:
|
|
143
|
+
id: Unique trade identifier (UUID string).
|
|
144
|
+
symbol: Trading pair (e.g. ``'BTC/EUR'``).
|
|
145
|
+
price: Execution price.
|
|
146
|
+
quantity: Traded quantity in the base currency.
|
|
147
|
+
timestamp: Trade time as Unix timestamp in milliseconds.
|
|
148
|
+
side: ``'buy'`` or ``'sell'``.
|
|
149
|
+
region: Venue region the trade was executed in (e.g. ``'EEA'``, ``'UK'``).
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
id: str
|
|
153
|
+
symbol: str
|
|
154
|
+
price: str
|
|
155
|
+
quantity: str
|
|
156
|
+
timestamp: int
|
|
157
|
+
side: str
|
|
158
|
+
region: str
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class Ticker(TypedDict, total=False):
|
|
162
|
+
"""Ticker data for a trading pair from :meth:`RevolutXClient.get_ticker`.
|
|
163
|
+
|
|
164
|
+
Attributes:
|
|
165
|
+
symbol: Trading pair (e.g. ``'BTC/EUR'``).
|
|
166
|
+
bid: Best bid (highest buy) price.
|
|
167
|
+
ask: Best ask (lowest sell) price.
|
|
168
|
+
mid: Midpoint between ``bid`` and ``ask``.
|
|
169
|
+
index_price: Reference index price.
|
|
170
|
+
last_price: Last traded price.
|
|
171
|
+
low_24h: 24-hour low price.
|
|
172
|
+
high_24h: 24-hour high price.
|
|
173
|
+
price_change_24h: Absolute price change over the last 24 hours.
|
|
174
|
+
volume_24h: 24-hour trading volume in the base currency.
|
|
175
|
+
quote_volume_24h: 24-hour trading volume in the quote currency.
|
|
176
|
+
region: Venue region (e.g. ``'EEA'``, ``'UK'``).
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
symbol: str
|
|
180
|
+
bid: str
|
|
181
|
+
ask: str
|
|
182
|
+
mid: str
|
|
183
|
+
index_price: str
|
|
184
|
+
last_price: str
|
|
185
|
+
low_24h: str
|
|
186
|
+
high_24h: str
|
|
187
|
+
price_change_24h: str
|
|
188
|
+
volume_24h: str
|
|
189
|
+
quote_volume_24h: str
|
|
190
|
+
region: str
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class PairConfig(TypedDict, total=False):
|
|
194
|
+
"""Configuration and trading limits for a single pair.
|
|
195
|
+
|
|
196
|
+
Returned by :meth:`RevolutXClient.get_pairs` and
|
|
197
|
+
:meth:`RevolutXClient.get_pair`.
|
|
198
|
+
|
|
199
|
+
Attributes:
|
|
200
|
+
base: Base currency symbol (e.g. ``'BTC'``).
|
|
201
|
+
quote: Quote currency symbol (e.g. ``'EUR'``).
|
|
202
|
+
base_step: Minimum quantity increment (e.g. ``'0.00000001'``).
|
|
203
|
+
quote_step: Minimum price increment (e.g. ``'0.01'``).
|
|
204
|
+
min_order_size: Minimum order size in the base currency.
|
|
205
|
+
max_order_size: Maximum order size in the base currency.
|
|
206
|
+
min_order_size_quote: Minimum order value in the quote currency.
|
|
207
|
+
max_order_size_quote: Maximum order value in the quote currency.
|
|
208
|
+
status: Pair status — ``'active'`` or ``'inactive'``.
|
|
209
|
+
slippage: Maximum allowed slippage percentage.
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
base: str
|
|
213
|
+
quote: str
|
|
214
|
+
base_step: str
|
|
215
|
+
quote_step: str
|
|
216
|
+
min_order_size: str
|
|
217
|
+
max_order_size: str
|
|
218
|
+
min_order_size_quote: str
|
|
219
|
+
max_order_size_quote: str
|
|
220
|
+
status: str
|
|
221
|
+
slippage: int
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class CurrencyConfig(TypedDict, total=False):
|
|
225
|
+
"""Configuration for a single currency.
|
|
226
|
+
|
|
227
|
+
Returned by :meth:`RevolutXClient.get_currencies`.
|
|
228
|
+
|
|
229
|
+
Attributes:
|
|
230
|
+
name: Human-readable currency name (e.g. ``'Bitcoin'``).
|
|
231
|
+
symbol: Currency ticker (e.g. ``'BTC'``).
|
|
232
|
+
scale: Number of decimal places.
|
|
233
|
+
asset_type: ``'crypto'`` or ``'fiat'``.
|
|
234
|
+
status: ``'active'`` or ``'inactive'``.
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
name: str
|
|
238
|
+
symbol: str
|
|
239
|
+
scale: int
|
|
240
|
+
asset_type: str
|
|
241
|
+
status: str
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class OrderBookLevel(TypedDict, total=False):
|
|
245
|
+
"""A single price level in the order book.
|
|
246
|
+
|
|
247
|
+
The Revolut X order book uses short field names. The two fields you
|
|
248
|
+
normally want are ``p`` (price) and ``q`` (quantity).
|
|
249
|
+
|
|
250
|
+
Attributes:
|
|
251
|
+
p: Price in the quote currency.
|
|
252
|
+
q: Quantity available at this price, in the base currency.
|
|
253
|
+
s: Side — ``'BUYI'`` for bids, ``'SELL'`` for asks.
|
|
254
|
+
pc: Price currency (e.g. ``'EUR'``).
|
|
255
|
+
qc: Quantity currency (e.g. ``'BTC'``).
|
|
256
|
+
aid: Asset identifier (e.g. ``'BTC'``).
|
|
257
|
+
anm: Asset name (e.g. ``'Bitcoin'``).
|
|
258
|
+
no: Number of orders aggregated into this level.
|
|
259
|
+
pn: Price notation (e.g. ``'MONE'``).
|
|
260
|
+
qn: Quantity notation (e.g. ``'UNIT'``).
|
|
261
|
+
ve: Venue (e.g. ``'REVX'``).
|
|
262
|
+
ts: Trading system (e.g. ``'CLOB'``).
|
|
263
|
+
pdt: Price timestamp as an ISO-8601 string.
|
|
264
|
+
"""
|
|
265
|
+
|
|
266
|
+
p: str
|
|
267
|
+
q: str
|
|
268
|
+
s: str
|
|
269
|
+
pc: str
|
|
270
|
+
qc: str
|
|
271
|
+
aid: str
|
|
272
|
+
anm: str
|
|
273
|
+
no: str
|
|
274
|
+
pn: str
|
|
275
|
+
qn: str
|
|
276
|
+
ve: str
|
|
277
|
+
ts: str
|
|
278
|
+
pdt: str
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
class OrderBook(TypedDict):
|
|
282
|
+
"""Order book snapshot from :meth:`RevolutXClient.get_order_book`.
|
|
283
|
+
|
|
284
|
+
Each entry is an :class:`OrderBookLevel` dictionary — **not** a
|
|
285
|
+
``[price, quantity]`` pair. Read the price and quantity from the
|
|
286
|
+
``p`` and ``q`` keys::
|
|
287
|
+
|
|
288
|
+
best_bid = book["bids"][0]
|
|
289
|
+
print(best_bid["p"], best_bid["q"])
|
|
290
|
+
|
|
291
|
+
Attributes:
|
|
292
|
+
bids: Buy levels, sorted best (highest price) first.
|
|
293
|
+
asks: Sell levels, sorted best (lowest price) first.
|
|
294
|
+
"""
|
|
295
|
+
|
|
296
|
+
bids: list[OrderBookLevel]
|
|
297
|
+
asks: list[OrderBookLevel]
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class Balance(TypedDict):
|
|
301
|
+
"""Account balance for a single currency.
|
|
302
|
+
|
|
303
|
+
Returned by :meth:`RevolutXClient.get_balances`.
|
|
304
|
+
|
|
305
|
+
Attributes:
|
|
306
|
+
currency: Currency symbol (e.g. ``'EUR'``, ``'BTC'``).
|
|
307
|
+
available: Amount available for trading.
|
|
308
|
+
reserved: Amount locked in open orders.
|
|
309
|
+
total: Total balance (available + reserved).
|
|
310
|
+
"""
|
|
311
|
+
|
|
312
|
+
currency: str
|
|
313
|
+
available: str
|
|
314
|
+
reserved: str
|
|
315
|
+
total: str
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
class OrderResponse(TypedDict, total=False):
|
|
319
|
+
"""Response returned after placing a new order.
|
|
320
|
+
|
|
321
|
+
Attributes:
|
|
322
|
+
venue_order_id: Exchange-assigned order ID.
|
|
323
|
+
client_order_id: Client-provided order ID (UUID).
|
|
324
|
+
state: Initial order state (e.g. ``'new'``).
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
venue_order_id: str
|
|
328
|
+
client_order_id: str
|
|
329
|
+
state: str
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
class OrderDetail(TypedDict, total=False):
|
|
333
|
+
"""Detailed order information from :meth:`RevolutXClient.get_order`.
|
|
334
|
+
|
|
335
|
+
Attributes:
|
|
336
|
+
id: Exchange order ID.
|
|
337
|
+
symbol: Trading pair.
|
|
338
|
+
side: ``'buy'`` or ``'sell'``.
|
|
339
|
+
type: ``'market'`` or ``'limit'``.
|
|
340
|
+
status: Order status (``'new'``, ``'filled'``, ``'canceled'``, …).
|
|
341
|
+
quantity: Requested quantity.
|
|
342
|
+
filled_quantity: Actually filled quantity.
|
|
343
|
+
amount: Requested amount in quote currency.
|
|
344
|
+
filled_amount: Actually filled amount in quote currency.
|
|
345
|
+
average_fill_price: Volume-weighted average fill price.
|
|
346
|
+
total_fee: Total fee charged.
|
|
347
|
+
fee_currency: Currency of the fee (e.g. ``'EUR'``).
|
|
348
|
+
created_date: Creation timestamp in milliseconds.
|
|
349
|
+
updated_date: Last update timestamp in milliseconds.
|
|
350
|
+
"""
|
|
351
|
+
|
|
352
|
+
id: str
|
|
353
|
+
symbol: str
|
|
354
|
+
side: str
|
|
355
|
+
type: str
|
|
356
|
+
status: str
|
|
357
|
+
quantity: str
|
|
358
|
+
filled_quantity: str
|
|
359
|
+
amount: str
|
|
360
|
+
filled_amount: str
|
|
361
|
+
average_fill_price: str
|
|
362
|
+
total_fee: str
|
|
363
|
+
fee_currency: str
|
|
364
|
+
created_date: int
|
|
365
|
+
updated_date: int
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class Fill(TypedDict, total=False):
|
|
369
|
+
"""A single fill (partial execution) of an order.
|
|
370
|
+
|
|
371
|
+
Returned by :meth:`RevolutXClient.get_order_fills`.
|
|
372
|
+
|
|
373
|
+
Attributes:
|
|
374
|
+
tdt: Trade timestamp in milliseconds.
|
|
375
|
+
aid: Asset ID (e.g. ``'BTC'``).
|
|
376
|
+
anm: Asset name (e.g. ``'Bitcoin'``).
|
|
377
|
+
p: Execution price.
|
|
378
|
+
pc: Price currency (e.g. ``'EUR'``).
|
|
379
|
+
q: Filled quantity.
|
|
380
|
+
qc: Quantity currency (e.g. ``'BTC'``).
|
|
381
|
+
tid: Trade ID.
|
|
382
|
+
oid: Order ID.
|
|
383
|
+
s: Side (``'buy'`` or ``'sell'``).
|
|
384
|
+
im: ``True`` if this fill was a maker trade (0% fee).
|
|
385
|
+
"""
|
|
386
|
+
|
|
387
|
+
tdt: int
|
|
388
|
+
aid: str
|
|
389
|
+
anm: str
|
|
390
|
+
p: str
|
|
391
|
+
pc: str
|
|
392
|
+
q: str
|
|
393
|
+
qc: str
|
|
394
|
+
tid: str
|
|
395
|
+
oid: str
|
|
396
|
+
s: str
|
|
397
|
+
im: bool
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: revolut-x-python
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python SDK for the Revolut X Crypto Exchange REST API (v1.0)
|
|
5
|
+
Author: Jan Přikryl
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://janprikryl1.github.io/revolut-x-python/
|
|
8
|
+
Project-URL: Documentation, https://janprikryl1.github.io/revolut-x-python/
|
|
9
|
+
Project-URL: Repository, https://github.com/janprikryl1/revolut-x-python
|
|
10
|
+
Project-URL: Changelog, https://github.com/janprikryl1/revolut-x-python/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Issues, https://github.com/janprikryl1/revolut-x-python/issues
|
|
12
|
+
Keywords: revolut,revolut-x,crypto,exchange,trading,api,sdk,bitcoin
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
25
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: requests>=2.31.0
|
|
31
|
+
Requires-Dist: cryptography>=41.0.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-mock>=3.10; extra == "dev"
|
|
35
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: twine>=6.1; extra == "dev"
|
|
37
|
+
Provides-Extra: docs
|
|
38
|
+
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
39
|
+
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
|
|
40
|
+
Requires-Dist: mkdocs-static-i18n>=1.2.0; extra == "docs"
|
|
41
|
+
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
|
|
42
|
+
Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Revolut X Python SDK
|
|
46
|
+
|
|
47
|
+
Python client library for the **Revolut X Crypto Exchange REST API (v1.0)**.
|
|
48
|
+
|
|
49
|
+
📖 **Documentation**: [janprikryl1.github.io/revolut-x-python](https://janprikryl1.github.io/revolut-x-python/)
|
|
50
|
+
🐘 **Looking for PHP?** See [revolut-x-php](https://github.com/janprikryl1/revolut-x-php).
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- **Revolut X API v1.0** — Complete coverage of market data, order placement, balances, and transaction history.
|
|
57
|
+
- **Ed25519 Authentication** — Cryptographic request signing using `cryptography` (PKCS#8 PEM).
|
|
58
|
+
- **Smart Maker Strategy (0.00% fee)** — Automatic offset pricing and `post_only` execution to prevent taker fees (0.09%).
|
|
59
|
+
- **Streaming Iterators** — `iter_candles()` and `iter_trades()` automatically handle cursor pagination and rate-limit delays.
|
|
60
|
+
- **100% Type Annotated** — Built with Python `TypedDict`, `Enum`, and type annotations.
|
|
61
|
+
- **AI Agent Skill** — Pre-packaged skill definition for AI coding assistants (Google Antigravity, Claude, Cursor).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install revolut-x-python
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
In a `requirements.txt`:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
revolut-x-python>=1.0.0
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary>Pre-release builds (TestPyPI)</summary>
|
|
79
|
+
|
|
80
|
+
Release candidates go to **TestPyPI** first. Versions `0.0.1` – `0.1.0` were
|
|
81
|
+
published there only; `1.0.0` is the first release on PyPI proper. To install
|
|
82
|
+
a pre-release build:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install --extra-index-url https://test.pypi.org/simple/ revolut-x-python
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Use `--extra-index-url` (rather than `--index-url`) so PyPI stays available
|
|
89
|
+
for the `requests` and `cryptography` dependencies, which are not mirrored on
|
|
90
|
+
TestPyPI.
|
|
91
|
+
|
|
92
|
+
</details>
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Quickstart
|
|
97
|
+
|
|
98
|
+
### 1. Public Market Data (No API Key Required)
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from revolut_x import RevolutXClient, Interval
|
|
102
|
+
|
|
103
|
+
client = RevolutXClient()
|
|
104
|
+
|
|
105
|
+
# Get BTC-EUR ticker
|
|
106
|
+
ticker = client.get_ticker("BTC-EUR")
|
|
107
|
+
print(f"BTC Price: {ticker['last_price']} EUR")
|
|
108
|
+
|
|
109
|
+
# Get 1-hour OHLCV candles
|
|
110
|
+
candles = client.get_candles("BTC-EUR", Interval.HOUR_1)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 2. Authenticated Trading & 0% Fee Maker Orders
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from revolut_x import RevolutXClient, OrderSide
|
|
117
|
+
|
|
118
|
+
client = RevolutXClient(
|
|
119
|
+
api_key="your-api-key",
|
|
120
|
+
private_key_path="keys/private.pem",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
# Submit zero-fee Maker limit order (post_only=True)
|
|
124
|
+
order = client.place_maker_order(
|
|
125
|
+
symbol="BTC-EUR",
|
|
126
|
+
side=OrderSide.BUY,
|
|
127
|
+
quote_size="50.00",
|
|
128
|
+
offset="0.10",
|
|
129
|
+
)
|
|
130
|
+
print(f"Order ID: {order['venue_order_id']}")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Running Tests
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pytest tests
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Academic Reference
|
|
144
|
+
|
|
145
|
+
This library was written as part of a **master's thesis** at **VŠB – Technical
|
|
146
|
+
University of Ostrava**, Faculty of Electrical Engineering and Computer Science.
|
|
147
|
+
|
|
148
|
+
- **Author**: Bc. Jan Přikryl
|
|
149
|
+
- **University**: VŠB – Technical University of Ostrava
|
|
150
|
+
- **Faculty**: Faculty of Electrical Engineering and Computer Science (FEI)
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Changelog
|
|
155
|
+
|
|
156
|
+
See [CHANGELOG.md](https://github.com/janprikryl1/revolut-x-python/blob/main/CHANGELOG.md).
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
This project is licensed under the MIT License — see the
|
|
163
|
+
[LICENSE](https://github.com/janprikryl1/revolut-x-python/blob/main/LICENSE)
|
|
164
|
+
file for details.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
revolut_x/__init__.py,sha256=gDLqthrI3-aQPQOYN6dthLric5wV8UGPf79vjf2nC4w,2250
|
|
2
|
+
revolut_x/_auth.py,sha256=Lor9eIas57Jzf1_FOwHtF_0O3XYhJRye04wfb1aUWm0,4457
|
|
3
|
+
revolut_x/_http.py,sha256=La5hi9BfN5ydA23wbNyC5jCC5oMKM9B5FeVn4VSKo2M,11879
|
|
4
|
+
revolut_x/_version.py,sha256=YZsBI4L0nwpRJN96Pp1wo8rndjGF2nQ8PjiWBXOUHZI,394
|
|
5
|
+
revolut_x/account.py,sha256=ucUYwL3DoFG0qW91DRHFT-D6ftYiyULix7nB8-76YIw,6800
|
|
6
|
+
revolut_x/client.py,sha256=5n7yIsyyKqToSgdEkolj2BzxpdqFaQVro5hpJGTb18o,6311
|
|
7
|
+
revolut_x/exceptions.py,sha256=oaTzLbC7IL-aA8DmavMOWcSubgA-YMWWaZaa5KpG4So,4899
|
|
8
|
+
revolut_x/helpers.py,sha256=3nF7QFtUDRijqrQlcg4IVwx2kiD7OeBz_rSlqMvc_Pk,20265
|
|
9
|
+
revolut_x/market.py,sha256=n2AHNuoHuv9ElpwX1A9lc8F3iQ154c8KmplDa4nnYpQ,17135
|
|
10
|
+
revolut_x/orders.py,sha256=OFjjJ9d6FIkl9HvBZwIidwGaxZm3Ezh1utjsi_OFD30,19409
|
|
11
|
+
revolut_x/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
revolut_x/types.py,sha256=EAkizOaqccBVlr3OFwaOUiPjAx9XB8SagXEQLNq0YUk,10745
|
|
13
|
+
revolut_x_python-1.0.0.dist-info/licenses/LICENSE,sha256=uZU5frhpA6kIvdHIJhmtkbsI6ddIlmA00Scbrd_lpBc,1069
|
|
14
|
+
revolut_x_python-1.0.0.dist-info/METADATA,sha256=4o2y6GK6J4bKySHaRkzGV58qfJth53SNiq-S0Ppj2h8,5157
|
|
15
|
+
revolut_x_python-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
16
|
+
revolut_x_python-1.0.0.dist-info/top_level.txt,sha256=qqp3klKfMJt3nKxLMzSMzzetP2MgoZArAio3alBrwiE,10
|
|
17
|
+
revolut_x_python-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jan Přikryl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
revolut_x
|