exolix-client 0.1.0__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.
- exolix_client-0.1.0/.gitignore +46 -0
- exolix_client-0.1.0/LICENSE +15 -0
- exolix_client-0.1.0/PKG-INFO +206 -0
- exolix_client-0.1.0/README.md +194 -0
- exolix_client-0.1.0/examples/quickstart.py +34 -0
- exolix_client-0.1.0/pyproject.toml +42 -0
- exolix_client-0.1.0/src/exolix/__init__.py +28 -0
- exolix_client-0.1.0/src/exolix/client.py +377 -0
- exolix_client-0.1.0/src/exolix/errors.py +23 -0
- exolix_client-0.1.0/src/exolix/types.py +103 -0
- exolix_client-0.1.0/tests/test_client.py +345 -0
- exolix_client-0.1.0/tests/test_live.py +76 -0
- exolix_client-0.1.0/uv.lock +291 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnp.*
|
|
4
|
+
.yarn/
|
|
5
|
+
.pnpm-store/
|
|
6
|
+
|
|
7
|
+
# Build
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.tsbuildinfo
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.eggs/
|
|
13
|
+
wheels/
|
|
14
|
+
|
|
15
|
+
# Tests and coverage
|
|
16
|
+
coverage/
|
|
17
|
+
.nyc_output/
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
htmlcov/
|
|
22
|
+
.coverage
|
|
23
|
+
.coverage.*
|
|
24
|
+
|
|
25
|
+
# Python
|
|
26
|
+
__pycache__/
|
|
27
|
+
*.py[cod]
|
|
28
|
+
*$py.class
|
|
29
|
+
.venv/
|
|
30
|
+
venv/
|
|
31
|
+
env/
|
|
32
|
+
|
|
33
|
+
# Secrets
|
|
34
|
+
.env
|
|
35
|
+
.env.*
|
|
36
|
+
!.env.example
|
|
37
|
+
AGENTS.md
|
|
38
|
+
|
|
39
|
+
# GitBook / HonKit
|
|
40
|
+
_book/
|
|
41
|
+
|
|
42
|
+
# OS and editors
|
|
43
|
+
.DS_Store
|
|
44
|
+
Thumbs.db
|
|
45
|
+
.idea/
|
|
46
|
+
*.swp
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 api-kit contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: exolix-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the Exolix cryptocurrency exchange API (v2)
|
|
5
|
+
Project-URL: Repository, https://github.com/TysikGG/api-kit
|
|
6
|
+
Project-URL: Documentation, https://exolix.com/developers
|
|
7
|
+
License-Expression: ISC
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: httpx>=0.27
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# exolix-client
|
|
14
|
+
|
|
15
|
+
[](https://pypi.org/project/exolix-client/)
|
|
16
|
+
[](LICENSE)
|
|
17
|
+
[](https://pypi.org/project/exolix-client/)
|
|
18
|
+
|
|
19
|
+
Modern, fully typed Python client library for the [Exolix](https://exolix.com) instant cryptocurrency exchange API (v2).
|
|
20
|
+
|
|
21
|
+
Official API documentation: <https://exolix.com/developers>
|
|
22
|
+
|
|
23
|
+
The PyPI package is `exolix-client`. Import it as `exolix`.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- ⚡ **Fixed & Floating Rates** — Quote a swap by deposit `amount` or by desired `withdrawal_amount`, at a floating or fixed rate.
|
|
30
|
+
- 🪙 **Currencies & Networks** — List coins, networks for one coin, and the full network catalog.
|
|
31
|
+
- 🐍 **Modern Pythonic Design** — Type annotations, context manager support (`with Exolix(...) as client:`), and a custom exception.
|
|
32
|
+
- 🔄 **Transactions** — Create a swap, fetch it by id, and list affiliate transaction history.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install exolix-client
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Requires Python 3.10 or higher.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Authentication
|
|
47
|
+
|
|
48
|
+
Partner attribution is the affiliate API key. The default affiliate share is 0.3%. The client sends the key in one header and does not add a referral parameter:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from exolix import EXOLIX_API_KEY_HEADER
|
|
52
|
+
|
|
53
|
+
print(EXOLIX_API_KEY_HEADER) # "Authorization"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Pass the key to the constructor. The client does not read `EXOLIX_API_KEY` from the environment. Public reads work without a key. Transaction history requires a key that Exolix has enabled for that route.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Quick Start (Safe Check)
|
|
61
|
+
|
|
62
|
+
The quick check only queries currencies and a rate. It does not create a transaction:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import os
|
|
66
|
+
from exolix import Exolix
|
|
67
|
+
|
|
68
|
+
with Exolix(api_key=os.environ["EXOLIX_API_KEY"]) as client:
|
|
69
|
+
currencies = client.get_currencies(page=1, size=5, with_networks=True)
|
|
70
|
+
print(f"Available currencies: {currencies['count']}")
|
|
71
|
+
|
|
72
|
+
quote = client.get_rate(
|
|
73
|
+
"BTC",
|
|
74
|
+
"ETH",
|
|
75
|
+
"float",
|
|
76
|
+
network_from="BTC",
|
|
77
|
+
network_to="ETH",
|
|
78
|
+
amount="0.1",
|
|
79
|
+
)
|
|
80
|
+
print(f"0.1 BTC -> {quote['toAmount']} ETH (rate {quote['rate']})")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Usage Guide
|
|
86
|
+
|
|
87
|
+
### 1. Creating a Floating Rate Swap
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from exolix import Exolix, ExolixError
|
|
91
|
+
|
|
92
|
+
with Exolix(api_key="your_api_key") as client:
|
|
93
|
+
quote = client.get_rate(
|
|
94
|
+
"ETH",
|
|
95
|
+
"USDT",
|
|
96
|
+
"float",
|
|
97
|
+
network_from="ETH",
|
|
98
|
+
network_to="ETH",
|
|
99
|
+
amount="0.5",
|
|
100
|
+
)
|
|
101
|
+
print(f"Min {quote['minAmount']}, you receive {quote['toAmount']} USDT")
|
|
102
|
+
|
|
103
|
+
tx = client.create_transaction(
|
|
104
|
+
"ETH",
|
|
105
|
+
"USDT",
|
|
106
|
+
"ETH",
|
|
107
|
+
"ETH",
|
|
108
|
+
"0x0E29D1E501f90649Ad5982E900c455006e4522FC",
|
|
109
|
+
amount=0.5,
|
|
110
|
+
rate_type="float",
|
|
111
|
+
)
|
|
112
|
+
print(f"Send ETH to {tx['depositAddress']} ({tx['id']})")
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`create_transaction` opens a real swap. Quote with `get_rate` first.
|
|
116
|
+
|
|
117
|
+
### 2. Fixed Rate by Withdrawal Amount
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
quote = client.get_rate(
|
|
121
|
+
"ETH",
|
|
122
|
+
"USDT",
|
|
123
|
+
"fixed",
|
|
124
|
+
network_from="ETH",
|
|
125
|
+
network_to="ETH",
|
|
126
|
+
withdrawal_amount="50",
|
|
127
|
+
)
|
|
128
|
+
print(f"Send {quote['fromAmount']} ETH to receive {quote['toAmount']} USDT")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 3. Tracking Status and History
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
tx = client.get_transaction("ab93061434dd0s")
|
|
135
|
+
print(tx["status"]) # wait, confirmation, confirmed, exchanging, sending, success, ...
|
|
136
|
+
|
|
137
|
+
history = client.get_transactions(page=1, size=25, order="desc")
|
|
138
|
+
print(history["count"])
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
History is authenticated. Exolix enables it per API key.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## API Reference
|
|
146
|
+
|
|
147
|
+
### `Exolix` Class
|
|
148
|
+
|
|
149
|
+
#### Constructor
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
Exolix(
|
|
153
|
+
api_key: str | None = None,
|
|
154
|
+
base_url: str | None = None,
|
|
155
|
+
timeout: float = 30.0,
|
|
156
|
+
user_agent: str | None = None,
|
|
157
|
+
)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| Option | Type | Default | Description |
|
|
161
|
+
| :--- | :--- | :--- | :--- |
|
|
162
|
+
| `api_key` | `str` | unset | Affiliate API key. Sent as `Authorization`. |
|
|
163
|
+
| `base_url` | `str` | `"https://exolix.com/api/v2"` | API base URL. |
|
|
164
|
+
| `timeout` | `float` | `30.0` | Request timeout in seconds. |
|
|
165
|
+
| `user_agent` | `str` | `"exolix-client/0.1.0"` | User-Agent header. |
|
|
166
|
+
|
|
167
|
+
#### Methods
|
|
168
|
+
|
|
169
|
+
- **`get_currencies(...)`** — `GET /currencies`
|
|
170
|
+
- **`get_currency_networks(code)`** — `GET /currencies/{code}/networks`
|
|
171
|
+
- **`get_networks(...)`** — `GET /currencies/networks`
|
|
172
|
+
- **`get_rate(...)`** — `GET /rate` (`rate_type` `float` or `fixed`, `amount` or `withdrawal_amount`)
|
|
173
|
+
- **`create_transaction(...)`** — `POST /transactions`
|
|
174
|
+
- **`get_transaction(transaction_id)`** — `GET /transactions/{id}`
|
|
175
|
+
- **`get_transactions(...)`** — `GET /transactions` (authenticated history)
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Error Handling
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
from exolix import Exolix, ExolixError
|
|
183
|
+
|
|
184
|
+
try:
|
|
185
|
+
with Exolix(api_key="invalid_key") as client:
|
|
186
|
+
client.get_transactions()
|
|
187
|
+
except ExolixError as error:
|
|
188
|
+
print(f"{error.code}: {error.message} (HTTP {error.status_code})")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Live Tests
|
|
194
|
+
|
|
195
|
+
Unit tests mock HTTP and always run. The live suite calls the real API and runs only when `EXOLIX_API_KEY` is set. It is read-only: currencies, networks, a floating rate, a fixed rate, and transaction history. It never creates a transaction.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
uv run pytest -m "not live"
|
|
199
|
+
EXOLIX_API_KEY=your_key uv run pytest -m live
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
ISC
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# exolix-client
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/exolix-client/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://pypi.org/project/exolix-client/)
|
|
6
|
+
|
|
7
|
+
Modern, fully typed Python client library for the [Exolix](https://exolix.com) instant cryptocurrency exchange API (v2).
|
|
8
|
+
|
|
9
|
+
Official API documentation: <https://exolix.com/developers>
|
|
10
|
+
|
|
11
|
+
The PyPI package is `exolix-client`. Import it as `exolix`.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- ⚡ **Fixed & Floating Rates** — Quote a swap by deposit `amount` or by desired `withdrawal_amount`, at a floating or fixed rate.
|
|
18
|
+
- 🪙 **Currencies & Networks** — List coins, networks for one coin, and the full network catalog.
|
|
19
|
+
- 🐍 **Modern Pythonic Design** — Type annotations, context manager support (`with Exolix(...) as client:`), and a custom exception.
|
|
20
|
+
- 🔄 **Transactions** — Create a swap, fetch it by id, and list affiliate transaction history.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install exolix-client
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Requires Python 3.10 or higher.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Authentication
|
|
35
|
+
|
|
36
|
+
Partner attribution is the affiliate API key. The default affiliate share is 0.3%. The client sends the key in one header and does not add a referral parameter:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from exolix import EXOLIX_API_KEY_HEADER
|
|
40
|
+
|
|
41
|
+
print(EXOLIX_API_KEY_HEADER) # "Authorization"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Pass the key to the constructor. The client does not read `EXOLIX_API_KEY` from the environment. Public reads work without a key. Transaction history requires a key that Exolix has enabled for that route.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quick Start (Safe Check)
|
|
49
|
+
|
|
50
|
+
The quick check only queries currencies and a rate. It does not create a transaction:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import os
|
|
54
|
+
from exolix import Exolix
|
|
55
|
+
|
|
56
|
+
with Exolix(api_key=os.environ["EXOLIX_API_KEY"]) as client:
|
|
57
|
+
currencies = client.get_currencies(page=1, size=5, with_networks=True)
|
|
58
|
+
print(f"Available currencies: {currencies['count']}")
|
|
59
|
+
|
|
60
|
+
quote = client.get_rate(
|
|
61
|
+
"BTC",
|
|
62
|
+
"ETH",
|
|
63
|
+
"float",
|
|
64
|
+
network_from="BTC",
|
|
65
|
+
network_to="ETH",
|
|
66
|
+
amount="0.1",
|
|
67
|
+
)
|
|
68
|
+
print(f"0.1 BTC -> {quote['toAmount']} ETH (rate {quote['rate']})")
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Usage Guide
|
|
74
|
+
|
|
75
|
+
### 1. Creating a Floating Rate Swap
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from exolix import Exolix, ExolixError
|
|
79
|
+
|
|
80
|
+
with Exolix(api_key="your_api_key") as client:
|
|
81
|
+
quote = client.get_rate(
|
|
82
|
+
"ETH",
|
|
83
|
+
"USDT",
|
|
84
|
+
"float",
|
|
85
|
+
network_from="ETH",
|
|
86
|
+
network_to="ETH",
|
|
87
|
+
amount="0.5",
|
|
88
|
+
)
|
|
89
|
+
print(f"Min {quote['minAmount']}, you receive {quote['toAmount']} USDT")
|
|
90
|
+
|
|
91
|
+
tx = client.create_transaction(
|
|
92
|
+
"ETH",
|
|
93
|
+
"USDT",
|
|
94
|
+
"ETH",
|
|
95
|
+
"ETH",
|
|
96
|
+
"0x0E29D1E501f90649Ad5982E900c455006e4522FC",
|
|
97
|
+
amount=0.5,
|
|
98
|
+
rate_type="float",
|
|
99
|
+
)
|
|
100
|
+
print(f"Send ETH to {tx['depositAddress']} ({tx['id']})")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`create_transaction` opens a real swap. Quote with `get_rate` first.
|
|
104
|
+
|
|
105
|
+
### 2. Fixed Rate by Withdrawal Amount
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
quote = client.get_rate(
|
|
109
|
+
"ETH",
|
|
110
|
+
"USDT",
|
|
111
|
+
"fixed",
|
|
112
|
+
network_from="ETH",
|
|
113
|
+
network_to="ETH",
|
|
114
|
+
withdrawal_amount="50",
|
|
115
|
+
)
|
|
116
|
+
print(f"Send {quote['fromAmount']} ETH to receive {quote['toAmount']} USDT")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3. Tracking Status and History
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
tx = client.get_transaction("ab93061434dd0s")
|
|
123
|
+
print(tx["status"]) # wait, confirmation, confirmed, exchanging, sending, success, ...
|
|
124
|
+
|
|
125
|
+
history = client.get_transactions(page=1, size=25, order="desc")
|
|
126
|
+
print(history["count"])
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
History is authenticated. Exolix enables it per API key.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## API Reference
|
|
134
|
+
|
|
135
|
+
### `Exolix` Class
|
|
136
|
+
|
|
137
|
+
#### Constructor
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
Exolix(
|
|
141
|
+
api_key: str | None = None,
|
|
142
|
+
base_url: str | None = None,
|
|
143
|
+
timeout: float = 30.0,
|
|
144
|
+
user_agent: str | None = None,
|
|
145
|
+
)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
| Option | Type | Default | Description |
|
|
149
|
+
| :--- | :--- | :--- | :--- |
|
|
150
|
+
| `api_key` | `str` | unset | Affiliate API key. Sent as `Authorization`. |
|
|
151
|
+
| `base_url` | `str` | `"https://exolix.com/api/v2"` | API base URL. |
|
|
152
|
+
| `timeout` | `float` | `30.0` | Request timeout in seconds. |
|
|
153
|
+
| `user_agent` | `str` | `"exolix-client/0.1.0"` | User-Agent header. |
|
|
154
|
+
|
|
155
|
+
#### Methods
|
|
156
|
+
|
|
157
|
+
- **`get_currencies(...)`** — `GET /currencies`
|
|
158
|
+
- **`get_currency_networks(code)`** — `GET /currencies/{code}/networks`
|
|
159
|
+
- **`get_networks(...)`** — `GET /currencies/networks`
|
|
160
|
+
- **`get_rate(...)`** — `GET /rate` (`rate_type` `float` or `fixed`, `amount` or `withdrawal_amount`)
|
|
161
|
+
- **`create_transaction(...)`** — `POST /transactions`
|
|
162
|
+
- **`get_transaction(transaction_id)`** — `GET /transactions/{id}`
|
|
163
|
+
- **`get_transactions(...)`** — `GET /transactions` (authenticated history)
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Error Handling
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from exolix import Exolix, ExolixError
|
|
171
|
+
|
|
172
|
+
try:
|
|
173
|
+
with Exolix(api_key="invalid_key") as client:
|
|
174
|
+
client.get_transactions()
|
|
175
|
+
except ExolixError as error:
|
|
176
|
+
print(f"{error.code}: {error.message} (HTTP {error.status_code})")
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Live Tests
|
|
182
|
+
|
|
183
|
+
Unit tests mock HTTP and always run. The live suite calls the real API and runs only when `EXOLIX_API_KEY` is set. It is read-only: currencies, networks, a floating rate, a fixed rate, and transaction history. It never creates a transaction.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
uv run pytest -m "not live"
|
|
187
|
+
EXOLIX_API_KEY=your_key uv run pytest -m live
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
ISC
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from exolix import Exolix
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main() -> None:
|
|
8
|
+
api_key = os.environ.get("EXOLIX_API_KEY")
|
|
9
|
+
if not api_key:
|
|
10
|
+
print("Please set EXOLIX_API_KEY environment variable.", file=sys.stderr)
|
|
11
|
+
sys.exit(1)
|
|
12
|
+
|
|
13
|
+
with Exolix(api_key=api_key) as client:
|
|
14
|
+
currencies = client.get_currencies(page=1, size=5, with_networks=True)
|
|
15
|
+
print(f"Currencies available: {currencies['count']}")
|
|
16
|
+
sample = [f"{c['name']} ({c['code']})" for c in currencies["data"][:5]]
|
|
17
|
+
print("Sample:", ", ".join(sample))
|
|
18
|
+
|
|
19
|
+
networks = client.get_currency_networks("ETH")
|
|
20
|
+
print("\nETH networks:", ", ".join(network["network"] for network in networks))
|
|
21
|
+
|
|
22
|
+
quote = client.get_rate(
|
|
23
|
+
"BTC",
|
|
24
|
+
"ETH",
|
|
25
|
+
"float",
|
|
26
|
+
network_from="BTC",
|
|
27
|
+
network_to="ETH",
|
|
28
|
+
amount="0.1",
|
|
29
|
+
)
|
|
30
|
+
print(f"\nEstimated ETH for 0.1 BTC: {quote['toAmount']} (rate {quote['rate']})")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
main()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "exolix-client"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for the Exolix cryptocurrency exchange API (v2)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "ISC"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"httpx>=0.27",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Repository = "https://github.com/TysikGG/api-kit"
|
|
18
|
+
Documentation = "https://exolix.com/developers"
|
|
19
|
+
|
|
20
|
+
[dependency-groups]
|
|
21
|
+
dev = [
|
|
22
|
+
"pytest>=8",
|
|
23
|
+
"pytest-httpx>=0.30",
|
|
24
|
+
"ruff>=0.8",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.hatch.build.targets.wheel]
|
|
28
|
+
packages = ["src/exolix"]
|
|
29
|
+
|
|
30
|
+
[tool.pytest.ini_options]
|
|
31
|
+
markers = [
|
|
32
|
+
"live: calls the real Exolix API and needs EXOLIX_API_KEY",
|
|
33
|
+
]
|
|
34
|
+
testpaths = ["tests"]
|
|
35
|
+
|
|
36
|
+
[tool.ruff]
|
|
37
|
+
target-version = "py310"
|
|
38
|
+
line-length = 100
|
|
39
|
+
src = ["src", "tests", "examples"]
|
|
40
|
+
|
|
41
|
+
[tool.ruff.lint]
|
|
42
|
+
select = ["E", "F", "I", "UP"]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Exolix cryptocurrency exchange API (v2) client."""
|
|
2
|
+
|
|
3
|
+
from .client import EXOLIX_API_KEY_HEADER, Exolix
|
|
4
|
+
from .errors import ExolixError
|
|
5
|
+
from .types import (
|
|
6
|
+
Currency,
|
|
7
|
+
Network,
|
|
8
|
+
PaginatedCurrencies,
|
|
9
|
+
PaginatedNetworks,
|
|
10
|
+
PaginatedTransactions,
|
|
11
|
+
Rate,
|
|
12
|
+
RateType,
|
|
13
|
+
Transaction,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"EXOLIX_API_KEY_HEADER",
|
|
18
|
+
"Currency",
|
|
19
|
+
"Exolix",
|
|
20
|
+
"ExolixError",
|
|
21
|
+
"Network",
|
|
22
|
+
"PaginatedCurrencies",
|
|
23
|
+
"PaginatedNetworks",
|
|
24
|
+
"PaginatedTransactions",
|
|
25
|
+
"Rate",
|
|
26
|
+
"RateType",
|
|
27
|
+
"Transaction",
|
|
28
|
+
]
|