stealthex 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.
- stealthex-0.1.0/.gitignore +46 -0
- stealthex-0.1.0/LICENSE +15 -0
- stealthex-0.1.0/PKG-INFO +182 -0
- stealthex-0.1.0/README.md +170 -0
- stealthex-0.1.0/examples/quickstart.py +24 -0
- stealthex-0.1.0/pyproject.toml +42 -0
- stealthex-0.1.0/src/stealthex/__init__.py +21 -0
- stealthex-0.1.0/src/stealthex/client.py +324 -0
- stealthex-0.1.0/src/stealthex/errors.py +21 -0
- stealthex-0.1.0/src/stealthex/types.py +51 -0
- stealthex-0.1.0/tests/test_client.py +121 -0
- stealthex-0.1.0/tests/test_live.py +19 -0
- stealthex-0.1.0/uv.lock +295 -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
|
stealthex-0.1.0/LICENSE
ADDED
|
@@ -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.
|
stealthex-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: stealthex
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for the StealthEX cryptocurrency exchange API
|
|
5
|
+
Project-URL: Repository, https://github.com/TysikGG/api-kit
|
|
6
|
+
Project-URL: Documentation, https://documenter.getpostman.com/view/24333719/2s9YJZ54yN
|
|
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
|
+
# stealthex
|
|
14
|
+
|
|
15
|
+
[](https://pypi.org/project/stealthex/)
|
|
16
|
+
[](LICENSE)
|
|
17
|
+
[](https://pypi.org/project/stealthex/)
|
|
18
|
+
|
|
19
|
+
Modern, fully typed Python client library for the [StealthEX](https://stealthex.io) instant non-custodial cryptocurrency exchange API.
|
|
20
|
+
|
|
21
|
+
Official API documentation: <https://documenter.getpostman.com/view/24333719/2s9YJZ54yN>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- ⚡ **Fixed & Floating Swaps** — Exchange at real-time floating market rates or lock in a fixed rate for 20 minutes.
|
|
28
|
+
- 🪙 **1400+ Coins & Tokens** — Wide asset selection across Bitcoin, Ethereum, Monero, Ripple, Solana, and more.
|
|
29
|
+
- 🐍 **Modern Pythonic Design** — Type annotations, dataclass models (`ExchangeDetails`, `StealthEXCurrency`, `RangeResult`), context manager support (`with StealthEX(...) as client:`), and custom exceptions.
|
|
30
|
+
- 🔒 **Non-Custodial & Private** — Direct wallet-to-wallet transactions with no mandatory account registration.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install stealthex
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Requires Python 3.10 or higher.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Quick Start (Safe Check)
|
|
45
|
+
|
|
46
|
+
The quick check only inspects supported currencies and price estimates. It does not create orders:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import os
|
|
50
|
+
from stealthex import StealthEX
|
|
51
|
+
|
|
52
|
+
with StealthEX(api_key=os.environ["STEALTHEX_API_KEY"]) as client:
|
|
53
|
+
# 1. Fetch available currencies
|
|
54
|
+
currencies = client.get_currencies()
|
|
55
|
+
print(f"Available currencies: {len(currencies)}")
|
|
56
|
+
|
|
57
|
+
# 2. Query floating rate estimate for 0.1 BTC to ETH
|
|
58
|
+
estimate = client.get_estimate(symbol_from="btc", symbol_to="eth", amount=0.1, fixed=False)
|
|
59
|
+
print(f"Estimated receive amount: {estimate.estimated_amount} ETH")
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Usage Guide
|
|
65
|
+
|
|
66
|
+
### 1. Creating a Floating Rate Swap
|
|
67
|
+
|
|
68
|
+
Check exchange limits, get estimate, create swap order, and monitor progress:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from stealthex import StealthEX, StealthEXError
|
|
72
|
+
|
|
73
|
+
with StealthEX(api_key="your_api_key") as client:
|
|
74
|
+
# 1. Check deposit range (min and max limits)
|
|
75
|
+
range_info = client.get_range(symbol_from="btc", symbol_to="eth", fixed=False)
|
|
76
|
+
print(f"Min: {range_info.min_amount} BTC, Max: {range_info.max_amount or 'No limit'}")
|
|
77
|
+
|
|
78
|
+
# 2. Create the exchange order
|
|
79
|
+
order = client.create_exchange(
|
|
80
|
+
currency_from="btc",
|
|
81
|
+
currency_to="eth",
|
|
82
|
+
amount=0.1,
|
|
83
|
+
address_to="0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
84
|
+
refund_address="bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", # optional
|
|
85
|
+
fixed=False,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
print(f"Exchange Created! ID: {order.id}")
|
|
89
|
+
print(f"Send 0.1 BTC to: {order.address_from}")
|
|
90
|
+
print(f"Current Status: {order.status}")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. Creating a Fixed Rate Swap
|
|
94
|
+
|
|
95
|
+
Lock in an exact payout amount for 20 minutes:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
fixed_order = client.create_exchange(
|
|
99
|
+
currency_from="eth",
|
|
100
|
+
currency_to="btc",
|
|
101
|
+
amount=2.0,
|
|
102
|
+
address_to="bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
|
|
103
|
+
fixed=True,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
print(f"Fixed Exchange ID: {fixed_order.id}")
|
|
107
|
+
print(f"Guaranteed Payout: {fixed_order.amount_to} BTC")
|
|
108
|
+
print(f"Deposit Address: {fixed_order.address_from}")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Tracking Exchange Status
|
|
112
|
+
|
|
113
|
+
Check deposit confirmations and outbound transaction hashes:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
status = client.get_exchange(order.id)
|
|
117
|
+
print(f"Status: {status.status}")
|
|
118
|
+
|
|
119
|
+
if status.status == "finished":
|
|
120
|
+
print(f"Payout Tx Hash: {status.tx_to}")
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## API Reference
|
|
126
|
+
|
|
127
|
+
### `StealthEX` Class
|
|
128
|
+
|
|
129
|
+
#### Constructor
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
StealthEX(
|
|
133
|
+
api_key: str,
|
|
134
|
+
base_url: str = "https://api.stealthex.io/v2",
|
|
135
|
+
timeout: float = 30.0,
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
| Parameter | Type | Default | Description |
|
|
140
|
+
| :--- | :--- | :--- | :--- |
|
|
141
|
+
| `api_key` | `str` | **Required** | Your StealthEX API key. |
|
|
142
|
+
| `base_url` | `str` | `"https://api.stealthex.io/v2"` | StealthEX API base URL. |
|
|
143
|
+
| `timeout` | `float` | `30.0` | HTTP request timeout in seconds. |
|
|
144
|
+
|
|
145
|
+
#### Methods
|
|
146
|
+
|
|
147
|
+
- **`get_currencies(fixed=None) -> list[StealthEXCurrency]`** — Retrieves all supported coins.
|
|
148
|
+
- **`get_currency(symbol: str) -> StealthEXCurrency`** — Gets metadata for a specific coin.
|
|
149
|
+
- **`get_pairs(symbol=None) -> list[str]`** — Returns available trading pairs for an asset.
|
|
150
|
+
- **`get_range(symbol_from, symbol_to, fixed=False) -> RangeResult`** — Retrieves min/max limits.
|
|
151
|
+
- **`get_min_amount(symbol_from, symbol_to, fixed=False) -> float`** — Minimum deposit limit.
|
|
152
|
+
- **`get_estimate(symbol_from, symbol_to, amount, fixed=False) -> EstimateResult`** — Returns estimated receive amount.
|
|
153
|
+
- **`create_exchange(currency_from, currency_to, amount, address_to, fixed=False, ...) -> ExchangeDetails`** — Creates order.
|
|
154
|
+
- **`get_exchange(exchange_id: str) -> ExchangeDetails`** — Retrieves status of an exchange.
|
|
155
|
+
- **`get_exchanges(limit=None) -> list[ExchangeDetails]`** — Lists past exchanges.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Error Handling
|
|
160
|
+
|
|
161
|
+
When the API returns an error, `StealthEXError` is raised:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from stealthex import StealthEX, StealthEXError
|
|
165
|
+
|
|
166
|
+
try:
|
|
167
|
+
with StealthEX(api_key="invalid_key") as client:
|
|
168
|
+
client.get_currencies()
|
|
169
|
+
except StealthEXError as exc:
|
|
170
|
+
print(f"StealthEX Error: {exc.message} (Status: {exc.status})")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Common HTTP status codes:
|
|
174
|
+
- `400 Bad Request` — Amount outside limits or invalid address.
|
|
175
|
+
- `401 Unauthorized` — Invalid API key.
|
|
176
|
+
- `404 Not Found` — Exchange ID not found.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
ISC
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# stealthex
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/stealthex/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://pypi.org/project/stealthex/)
|
|
6
|
+
|
|
7
|
+
Modern, fully typed Python client library for the [StealthEX](https://stealthex.io) instant non-custodial cryptocurrency exchange API.
|
|
8
|
+
|
|
9
|
+
Official API documentation: <https://documenter.getpostman.com/view/24333719/2s9YJZ54yN>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- ⚡ **Fixed & Floating Swaps** — Exchange at real-time floating market rates or lock in a fixed rate for 20 minutes.
|
|
16
|
+
- 🪙 **1400+ Coins & Tokens** — Wide asset selection across Bitcoin, Ethereum, Monero, Ripple, Solana, and more.
|
|
17
|
+
- 🐍 **Modern Pythonic Design** — Type annotations, dataclass models (`ExchangeDetails`, `StealthEXCurrency`, `RangeResult`), context manager support (`with StealthEX(...) as client:`), and custom exceptions.
|
|
18
|
+
- 🔒 **Non-Custodial & Private** — Direct wallet-to-wallet transactions with no mandatory account registration.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install stealthex
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Requires Python 3.10 or higher.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Quick Start (Safe Check)
|
|
33
|
+
|
|
34
|
+
The quick check only inspects supported currencies and price estimates. It does not create orders:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import os
|
|
38
|
+
from stealthex import StealthEX
|
|
39
|
+
|
|
40
|
+
with StealthEX(api_key=os.environ["STEALTHEX_API_KEY"]) as client:
|
|
41
|
+
# 1. Fetch available currencies
|
|
42
|
+
currencies = client.get_currencies()
|
|
43
|
+
print(f"Available currencies: {len(currencies)}")
|
|
44
|
+
|
|
45
|
+
# 2. Query floating rate estimate for 0.1 BTC to ETH
|
|
46
|
+
estimate = client.get_estimate(symbol_from="btc", symbol_to="eth", amount=0.1, fixed=False)
|
|
47
|
+
print(f"Estimated receive amount: {estimate.estimated_amount} ETH")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Usage Guide
|
|
53
|
+
|
|
54
|
+
### 1. Creating a Floating Rate Swap
|
|
55
|
+
|
|
56
|
+
Check exchange limits, get estimate, create swap order, and monitor progress:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from stealthex import StealthEX, StealthEXError
|
|
60
|
+
|
|
61
|
+
with StealthEX(api_key="your_api_key") as client:
|
|
62
|
+
# 1. Check deposit range (min and max limits)
|
|
63
|
+
range_info = client.get_range(symbol_from="btc", symbol_to="eth", fixed=False)
|
|
64
|
+
print(f"Min: {range_info.min_amount} BTC, Max: {range_info.max_amount or 'No limit'}")
|
|
65
|
+
|
|
66
|
+
# 2. Create the exchange order
|
|
67
|
+
order = client.create_exchange(
|
|
68
|
+
currency_from="btc",
|
|
69
|
+
currency_to="eth",
|
|
70
|
+
amount=0.1,
|
|
71
|
+
address_to="0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
|
|
72
|
+
refund_address="bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", # optional
|
|
73
|
+
fixed=False,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
print(f"Exchange Created! ID: {order.id}")
|
|
77
|
+
print(f"Send 0.1 BTC to: {order.address_from}")
|
|
78
|
+
print(f"Current Status: {order.status}")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Creating a Fixed Rate Swap
|
|
82
|
+
|
|
83
|
+
Lock in an exact payout amount for 20 minutes:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
fixed_order = client.create_exchange(
|
|
87
|
+
currency_from="eth",
|
|
88
|
+
currency_to="btc",
|
|
89
|
+
amount=2.0,
|
|
90
|
+
address_to="bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
|
|
91
|
+
fixed=True,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
print(f"Fixed Exchange ID: {fixed_order.id}")
|
|
95
|
+
print(f"Guaranteed Payout: {fixed_order.amount_to} BTC")
|
|
96
|
+
print(f"Deposit Address: {fixed_order.address_from}")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Tracking Exchange Status
|
|
100
|
+
|
|
101
|
+
Check deposit confirmations and outbound transaction hashes:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
status = client.get_exchange(order.id)
|
|
105
|
+
print(f"Status: {status.status}")
|
|
106
|
+
|
|
107
|
+
if status.status == "finished":
|
|
108
|
+
print(f"Payout Tx Hash: {status.tx_to}")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## API Reference
|
|
114
|
+
|
|
115
|
+
### `StealthEX` Class
|
|
116
|
+
|
|
117
|
+
#### Constructor
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
StealthEX(
|
|
121
|
+
api_key: str,
|
|
122
|
+
base_url: str = "https://api.stealthex.io/v2",
|
|
123
|
+
timeout: float = 30.0,
|
|
124
|
+
)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
| Parameter | Type | Default | Description |
|
|
128
|
+
| :--- | :--- | :--- | :--- |
|
|
129
|
+
| `api_key` | `str` | **Required** | Your StealthEX API key. |
|
|
130
|
+
| `base_url` | `str` | `"https://api.stealthex.io/v2"` | StealthEX API base URL. |
|
|
131
|
+
| `timeout` | `float` | `30.0` | HTTP request timeout in seconds. |
|
|
132
|
+
|
|
133
|
+
#### Methods
|
|
134
|
+
|
|
135
|
+
- **`get_currencies(fixed=None) -> list[StealthEXCurrency]`** — Retrieves all supported coins.
|
|
136
|
+
- **`get_currency(symbol: str) -> StealthEXCurrency`** — Gets metadata for a specific coin.
|
|
137
|
+
- **`get_pairs(symbol=None) -> list[str]`** — Returns available trading pairs for an asset.
|
|
138
|
+
- **`get_range(symbol_from, symbol_to, fixed=False) -> RangeResult`** — Retrieves min/max limits.
|
|
139
|
+
- **`get_min_amount(symbol_from, symbol_to, fixed=False) -> float`** — Minimum deposit limit.
|
|
140
|
+
- **`get_estimate(symbol_from, symbol_to, amount, fixed=False) -> EstimateResult`** — Returns estimated receive amount.
|
|
141
|
+
- **`create_exchange(currency_from, currency_to, amount, address_to, fixed=False, ...) -> ExchangeDetails`** — Creates order.
|
|
142
|
+
- **`get_exchange(exchange_id: str) -> ExchangeDetails`** — Retrieves status of an exchange.
|
|
143
|
+
- **`get_exchanges(limit=None) -> list[ExchangeDetails]`** — Lists past exchanges.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Error Handling
|
|
148
|
+
|
|
149
|
+
When the API returns an error, `StealthEXError` is raised:
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from stealthex import StealthEX, StealthEXError
|
|
153
|
+
|
|
154
|
+
try:
|
|
155
|
+
with StealthEX(api_key="invalid_key") as client:
|
|
156
|
+
client.get_currencies()
|
|
157
|
+
except StealthEXError as exc:
|
|
158
|
+
print(f"StealthEX Error: {exc.message} (Status: {exc.status})")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Common HTTP status codes:
|
|
162
|
+
- `400 Bad Request` — Amount outside limits or invalid address.
|
|
163
|
+
- `401 Unauthorized` — Invalid API key.
|
|
164
|
+
- `404 Not Found` — Exchange ID not found.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
ISC
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from stealthex import StealthEX
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main() -> None:
|
|
8
|
+
api_key = os.environ.get("STEALTHEX_API_KEY")
|
|
9
|
+
if not api_key:
|
|
10
|
+
print("Please set STEALTHEX_API_KEY environment variable.", file=sys.stderr)
|
|
11
|
+
sys.exit(1)
|
|
12
|
+
|
|
13
|
+
with StealthEX(api_key=api_key) as client:
|
|
14
|
+
currencies = client.get_currencies()
|
|
15
|
+
print(f"Currencies count: {len(currencies)}")
|
|
16
|
+
sample = [f"{c['name']} ({c['symbol'].upper()})" for c in currencies[:5]]
|
|
17
|
+
print("Sample:", ", ".join(sample))
|
|
18
|
+
|
|
19
|
+
est = client.get_estimate("btc", "eth", "0.1")
|
|
20
|
+
print(f"\n0.1 BTC -> {est['estimated_amount']} ETH")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
main()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stealthex"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python client for the StealthEX cryptocurrency exchange API"
|
|
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://documenter.getpostman.com/view/24333719/2s9YJZ54yN"
|
|
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/stealthex"]
|
|
29
|
+
|
|
30
|
+
[tool.pytest.ini_options]
|
|
31
|
+
markers = [
|
|
32
|
+
"live: calls the real StealthEX API and needs STEALTHEX_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,21 @@
|
|
|
1
|
+
"""StealthEX cryptocurrency exchange client."""
|
|
2
|
+
|
|
3
|
+
from .client import StealthEX
|
|
4
|
+
from .errors import StealthEXError
|
|
5
|
+
from .types import (
|
|
6
|
+
EstimateResult,
|
|
7
|
+
ExchangeDetails,
|
|
8
|
+
MinAmountResult,
|
|
9
|
+
RangeResult,
|
|
10
|
+
StealthEXCurrency,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"EstimateResult",
|
|
15
|
+
"ExchangeDetails",
|
|
16
|
+
"MinAmountResult",
|
|
17
|
+
"RangeResult",
|
|
18
|
+
"StealthEX",
|
|
19
|
+
"StealthEXError",
|
|
20
|
+
"StealthEXCurrency",
|
|
21
|
+
]
|