Skip to content

Commit a9dc60d

Browse files
dropping 3.9 with EOL (#3)
bump packages and version
1 parent da2a7b6 commit a9dc60d

File tree

29 files changed

+189
-238
lines changed

29 files changed

+189
-238
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Set up Python
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: '3.9'
16+
python-version: '3.10'
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
@@ -33,7 +33,7 @@ jobs:
3333
- name: Set up Python
3434
uses: actions/setup-python@v4
3535
with:
36-
python-version: '3.9'
36+
python-version: '3.10'
3737

3838
- name: Install build dependencies
3939
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ['3.9', '3.10', '3.11']
14+
python-version: ['3.10', '3.11', '3.12']
1515

1616
steps:
1717
- uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ^examples/
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v5.0.0
4+
rev: v6.0.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
@@ -12,13 +12,13 @@ repos:
1212
- id: requirements-txt-fixer
1313

1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.12.10
15+
rev: v0.14.1
1616
hooks:
1717
- id: ruff
1818
args: [--fix, --exit-non-zero-on-fix]
1919
- id: ruff-format
2020

2121
- repo: https://github.com/RobertCraigie/pyright-python
22-
rev: v1.1.404
22+
rev: v1.1.406
2323
hooks:
2424
- id: pyright

aiowhitebit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"""
66

77
# Version information
8-
__version__ = "0.3.0"
8+
__version__ = "0.4.0"

aiowhitebit/clients/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Base client functionality for the WhiteBit API."""
22

33
from asyncio import Semaphore
4-
from typing import Any, Callable, Optional, TypeVar
4+
from collections.abc import Callable
5+
from typing import Any, TypeVar
56

67
import aiohttp
78

@@ -23,7 +24,7 @@ def __init__(self):
2324
2425
Sets up an empty session and default rate limiter.
2526
"""
26-
self._session: Optional[aiohttp.ClientSession] = None
27+
self._session: aiohttp.ClientSession | None = None
2728
self._rate_limiter = Semaphore(100) # Default rate limit
2829

2930
@property
@@ -97,7 +98,7 @@ def request_url(self, path: str) -> str:
9798
"""
9899
return f"{self.base_url}{path}"
99100

100-
async def _make_request(self, path: str, converter: Optional[Callable[[dict], T]] = None) -> T:
101+
async def _make_request(self, path: str, converter: Callable[[dict], T] | None = None) -> T:
101102
full_url = self.request_url(path)
102103
json_obj = await self.get(full_url)
103104
return converter(json_obj) if converter else json_obj

aiowhitebit/clients/private/v4.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import hmac
66
import json
77
import time
8-
from typing import Callable, Optional, Union
8+
from collections.abc import Callable
99

1010
import aiohttp
1111
from pydantic import BaseModel
@@ -66,8 +66,8 @@ def __init__(
6666
self.api_key = api_key
6767
self.secret_key = secret_key
6868
self.base_url = base_url
69-
self.payload: Optional[bytes] = None
70-
self.signature: Optional[str] = None
69+
self.payload: bytes | None = None
70+
self.signature: str | None = None
7171
self.session = None
7272

7373
def gen_nonce(self) -> str:
@@ -125,8 +125,8 @@ def prepared_headers(self) -> dict:
125125

126126
async def get_trading_balance(
127127
self,
128-
ticker: Optional[str] = None,
129-
) -> Union[TradingBalanceItem, TradingBalanceList]:
128+
ticker: str | None = None,
129+
) -> TradingBalanceItem | TradingBalanceList:
130130
"""Get trading balance for all or a specific currency.
131131
132132
Args:
@@ -161,14 +161,14 @@ async def create_base_orders(
161161
path: str,
162162
data_model: BaseModel,
163163
converter: Callable,
164-
) -> Union[
165-
CreateOrderResponse,
166-
CancelOrderResponse,
167-
list[CreateOrderResponse],
168-
ExecutedOrdersResponse,
169-
ExecutedDealsResponse,
170-
ExecutedOrdersByMarketResponse,
171-
]:
164+
) -> (
165+
CreateOrderResponse
166+
| CancelOrderResponse
167+
| list[CreateOrderResponse]
168+
| ExecutedOrdersResponse
169+
| ExecutedDealsResponse
170+
| ExecutedOrdersByMarketResponse
171+
):
172172
"""Base method for creating orders.
173173
174174
Args:

aiowhitebit/clients/public/v1.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""WhiteBit Public API v1 client."""
22

3-
from typing import Optional
4-
53
from aiowhitebit.clients.base import BaseClient
64
from aiowhitebit.config import APIEndpoints
75
from aiowhitebit.converters.public import (
@@ -58,10 +56,10 @@ async def get_single_market(self, market: str) -> MarketSingleResponse:
5856
async def get_kline_market(
5957
self,
6058
market: str,
61-
start: Optional[int] = None,
62-
end: Optional[int] = None,
63-
interval: Optional[str] = None,
64-
limit: Optional[int] = None,
59+
start: int | None = None,
60+
end: int | None = None,
61+
interval: str | None = None,
62+
limit: int | None = None,
6563
) -> Kline:
6664
"""Get kline data for the requested market."""
6765
validate_market(market)
@@ -102,7 +100,7 @@ async def get_symbols(self) -> Symbols:
102100
return await self._make_request(APIEndpoints.SYMBOLS_V1, converter=lambda x: Symbols(**x))
103101

104102
@rate_limit(limit=1000, window=10.0)
105-
async def get_order_depth(self, market: str, limit: Optional[int] = None) -> OrderDepth:
103+
async def get_order_depth(self, market: str, limit: int | None = None) -> OrderDepth:
106104
"""Get order book for the requested market.
107105
108106
Args:
@@ -128,7 +126,7 @@ async def get_order_depth(self, market: str, limit: Optional[int] = None) -> Ord
128126

129127
@rate_limit(limit=1000, window=10.0)
130128
async def get_trade_history(
131-
self, market: str, last_id: Optional[int] = None, limit: Optional[int] = None
129+
self, market: str, last_id: int | None = None, limit: int | None = None
132130
) -> TradeHistory:
133131
"""Get trade history for the requested market."""
134132
validate_market(market)

aiowhitebit/clients/public/v4.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""WhiteBit Public API v4 client."""
22

3-
from typing import Optional, Union
4-
53
from aiowhitebit.clients.base import BaseClient
64
from aiowhitebit.config import APIEndpoints
75
from aiowhitebit.converters.public import (
@@ -60,7 +58,7 @@ async def get_maintenance_status(self) -> MaintenanceStatus:
6058
return await self._make_request(APIEndpoints.MAINTENANCE_STATUS, converter=lambda x: MaintenanceStatus(**x))
6159

6260
@rate_limit(limit=2000, window=10.0)
63-
async def get_orderbook(self, market: str, limit: Optional[int] = None, level: Optional[int] = None) -> Orderbook:
61+
async def get_orderbook(self, market: str, limit: int | None = None, level: int | None = None) -> Orderbook:
6462
"""Get orderbook for specific market.
6563
6664
Args:
@@ -117,7 +115,7 @@ async def get_depth(self, market: str) -> Depth:
117115
return await self._make_request(url, converter=lambda x: Depth(**x))
118116

119117
@rate_limit(limit=2000, window=10.0)
120-
async def get_recent_trades(self, market: str, trade_type: Optional[str] = None) -> RecentTrades:
118+
async def get_recent_trades(self, market: str, trade_type: str | None = None) -> RecentTrades:
121119
"""Get recent trades for specific market.
122120
123121
Args:
@@ -149,7 +147,7 @@ async def get_fee(self) -> FeeResponse:
149147
FeeResponse: Dictionary mapping currency tickers to their fee information
150148
"""
151149

152-
def convert_fee_details(details) -> Union[FeeDetails, dict[str, FeeDetails]]:
150+
def convert_fee_details(details) -> FeeDetails | dict[str, FeeDetails]:
153151
if not details: # Handle empty dictionaries
154152
return FeeDetails(min_amount="0", max_amount="0", fixed=None, flex=None)
155153

aiowhitebit/clients/webhook/webhook_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import hmac
1111
import json
1212
import logging
13-
from typing import Any, Callable, Optional
13+
from collections.abc import Callable
14+
from typing import Any
1415

1516
from multidict import CIMultiDictProxy
1617

@@ -40,7 +41,7 @@ def __init__(
4041
"X-TXC-PAYLOAD",
4142
"X-TXC-SIGNATURE",
4243
]
43-
self.current_request: Optional[WebhookRequest] = None
44+
self.current_request: WebhookRequest | None = None
4445
self._handlers: dict[str, Callable[[WebhookRequest], Any]] = {}
4546

4647
# Register default handlers

aiowhitebit/clients/websocket/public.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import json
44
import logging
5-
from typing import Any, Optional
5+
from typing import Any
66

77
import websockets
88

@@ -23,7 +23,7 @@ def __init__(self, uri: str) -> None:
2323
uri: WebSocket URI
2424
"""
2525
self.uri = uri
26-
self.connection: Optional[Any] = None
26+
self.connection: Any | None = None
2727

2828
async def connect(self):
2929
"""Connect to the WebSocket server.
@@ -69,7 +69,7 @@ class PublicWebSocketClient:
6969
This client provides methods to interact with the WhiteBit Public WebSocket API.
7070
"""
7171

72-
def __init__(self, ws: Optional[BaseWebSocketClient] = None) -> None:
72+
def __init__(self, ws: BaseWebSocketClient | None = None) -> None:
7373
"""Initialize the WhiteBit Public WebSocket API client.
7474
7575
Args:

0 commit comments

Comments
 (0)