From f2f8183d0e372aeed696de5e7d70ade73f0f5ca3 Mon Sep 17 00:00:00 2001 From: uJhin Date: Sun, 6 Feb 2022 18:41:16 +0900 Subject: [PATCH 1/3] Update setup.py Support Python Version 3.10 --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index a3259b4..45fa94f 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10' + 'Programming Language :: Python :: 3.10', ], keywords = [ 'Upbit', From ded6ffcd93651a0b93a60a8229f468c514333bad Mon Sep 17 00:00:00 2001 From: uJhin Date: Sun, 6 Feb 2022 18:41:57 +0900 Subject: [PATCH 2/3] [Update] Update Version 1.3.1.0 Update Version 1.3.1.0 --- upbit/__init__.py | 4 ++-- upbit/authentication.py | 4 ++-- upbit/client.py | 2 +- upbit/models.py | 16 ++++++++-------- upbit/pkginfo.py | 6 +++--- upbit/utils.py | 8 ++++---- upbit/websocket.py | 38 +++++++++++++++++++------------------- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/upbit/__init__.py b/upbit/__init__.py index 028fdac..89206d3 100644 --- a/upbit/__init__.py +++ b/upbit/__init__.py @@ -4,7 +4,7 @@ Please read the official Upbit Client document. Documents: https://ujhin.github.io/upbit-client-docs/ -- Upbit OPEN API Version: 1.2.2 +- Upbit OPEN API Version: 1.3.1 - Author: ujhin - Email: ujhin942@gmail.com - GitHub: https://github.com/uJhin @@ -15,5 +15,5 @@ from . import pkginfo -__all__ = ['client', 'websocket'] +__all__ = [ "client", "websocket" ] __version__ = pkginfo.CURRENT_VERSION diff --git a/upbit/authentication.py b/upbit/authentication.py index 65512ec..653d41b 100644 --- a/upbit/authentication.py +++ b/upbit/authentication.py @@ -11,12 +11,12 @@ class APIKeyAuthenticator(Authenticator): MAPPER = "swg_mapper.json" - QUERY_PARAMS = ("uuids", "txids", "identifiers", "states") + QUERY_PARAMS = ( "uuids", "txids", "identifiers", "states" ) def __init__( self, - host: str, + host : str, access_key: str, secret_key: str ): diff --git a/upbit/client.py b/upbit/client.py index 0be3a9d..49fdf4d 100644 --- a/upbit/client.py +++ b/upbit/client.py @@ -10,7 +10,7 @@ class Upbit: - Base URL: https://api.upbit.com - Base Path: /v1 - - Upbit OPEN API Version: 1.2.2 + - Upbit OPEN API Version: 1.3.1 - Author: ujhin - Email: ujhin942@gmail.com - GitHub: https://github.com/uJhin diff --git a/upbit/models.py b/upbit/models.py index f413ffa..83bfa72 100644 --- a/upbit/models.py +++ b/upbit/models.py @@ -22,13 +22,13 @@ def __init__( **kwargs ): - arg_config = kwargs.get('config') - arg_spec_uri = kwargs.get('spec_uri') + arg_config = kwargs.get("config") + arg_spec_uri = kwargs.get("spec_uri") config = { - 'also_return_response': False, - 'validate_responses': False, - 'use_models': False, - 'host': HOST + "also_return_response": False, + "validate_responses" : False, + "use_models" : False, + "host" : HOST } if not arg_config else arg_config spec_uri = SPEC_URI if not arg_spec_uri else arg_spec_uri @@ -36,7 +36,7 @@ def __init__( request_client = RequestsClient() request_client.authenticator = APIKeyAuthenticator( - host=config['host'], + host=config["host"], access_key=access_key, secret_key=secret_key ) @@ -55,7 +55,7 @@ def __init__( ) @property - def SWGClient(self): + def SWGClient(self) -> SwaggerClient: return self.__client diff --git a/upbit/pkginfo.py b/upbit/pkginfo.py index 473adba..502c101 100644 --- a/upbit/pkginfo.py +++ b/upbit/pkginfo.py @@ -4,7 +4,7 @@ Please read the official Upbit Client document. Documents: https://ujhin.github.io/upbit-client-docs/ -- Upbit OPEN API Version: 1.2.2 +- Upbit OPEN API Version: 1.3.1 - Author: ujhin - Email: ujhin942@gmail.com - GitHub: https://github.com/uJhin @@ -28,8 +28,8 @@ def _get_versions(package_name): PACKAGE_NAME = "upbit-client" -OPEN_API_VERSION = "1.2.2" -CURRENT_VERSION = OPEN_API_VERSION+".4" +OPEN_API_VERSION = "1.3.1" +CURRENT_VERSION = OPEN_API_VERSION+".0" RELEASED_VERSION = _get_versions(PACKAGE_NAME) LATEST_VERSION = RELEASED_VERSION[0] diff --git a/upbit/utils.py b/upbit/utils.py index 66898ba..5862156 100644 --- a/upbit/utils.py +++ b/upbit/utils.py @@ -1,11 +1,11 @@ -from typing import Union +import typing as t class HTTPFutureExtractor: @staticmethod - def remaining_request(headers: dict) -> dict: + def remaining_request(headers: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]: """ Check Request limit times @@ -24,7 +24,7 @@ def remaining_request(headers: dict) -> dict: } @staticmethod - def future_extraction(http_future) -> dict: + def future_extraction(http_future) -> t.Dict[str, t.Any]: resp = http_future.future.result() remaining = HTTPFutureExtractor.remaining_request(resp.headers) @@ -59,7 +59,7 @@ def future_extraction(http_future) -> dict: class Validator: @staticmethod - def validate_price(price: Union[int, float, str]) -> float: + def validate_price(price: t.Union[int, float, str]) -> float: """ Please read the official Upbit Client document. Documents: https://ujhin.github.io/upbit-client-docs/ diff --git a/upbit/websocket.py b/upbit/websocket.py index e0beb02..5679c18 100644 --- a/upbit/websocket.py +++ b/upbit/websocket.py @@ -3,7 +3,7 @@ import uuid import json -from typing import Union, List +import typing as t class UpbitWebSocket: @@ -21,15 +21,15 @@ class UpbitWebSocket: """ WEBSOCKET_URI = "wss://api.upbit.com/websocket/v1" - FIELD_TYPES = ("ticker", "trade", "orderbook") - FIELD_FORMATS = ("SIMPLE", "DEFAULT") + FIELD_TYPES = ( "ticker", "trade", "orderbook" ) + FIELD_FORMATS = ( "SIMPLE", "DEFAULT" ) def __init__( self, - uri: Union[str] = None, - ping_interval: Union[int, float] = None, - ping_timeout: Union[int, float] = None + uri : str = None, + ping_interval: t.Union[int, float] = None, + ping_timeout : t.Union[int, float] = None ): self.__uri = uri if uri else UpbitWebSocket.WEBSOCKET_URI @@ -59,8 +59,8 @@ def Connection(self, conn): def connect( self, - ping_interval: Union[int, float] = None, - ping_timeout: Union[int, float] = None + ping_interval: t.Union[int, float] = None, + ping_timeout : t.Union[int, float] = None ): """ :param ping_interval: ping 간격 제한 @@ -90,9 +90,9 @@ async def ping(self, decode: str = "utf8"): @staticmethod def generate_orderbook_codes( - currencies: Union[List[str]], - counts: Union[List[int]] = None - ) -> List[str]: + currencies: t.List[str], + counts : t.List[int] = None + ) -> t.List[str]: """ :param currencies: 수신할 `orderbook` field 마켓 코드 리스트 :type currencies: list[str, ...] @@ -111,11 +111,11 @@ def generate_orderbook_codes( @staticmethod def generate_type_field( - type: str, - codes: Union[List[str]], + type : str, + codes : t.List[str], isOnlySnapshot: bool = None, isOnlyRealtime: bool = None, - ) -> dict: + ) -> t.Dict[str, t.Any]: """ :param type: 수신할 시세 타입 (현재가: `ticker`, 체결: `trade`, 호가: `orderbook`) :type type: str @@ -151,9 +151,9 @@ def generate_type_field( @staticmethod def generate_payload( - type_fields: Union[List[dict]], - ticket: str = None, - format: str = 'DEFAULT' + type_fields: t.List[t.Dict[str, t.Any]], + ticket : str = None, + format : str = "DEFAULT" ) -> str: """ :param type_fields: Type Fields @@ -169,13 +169,13 @@ def generate_payload( payload = [] ticket = ticket if ticket else str(uuid.uuid4()) - payload.append({"ticket": ticket}) + payload.append( { "ticket": ticket } ) payload.extend(type_fields) fmt = format.upper() fmt = fmt if fmt in UpbitWebSocket.FIELD_FORMATS else "DEFAULT" - payload.append({"format": fmt}) + payload.append( { "format": fmt } ) return json.dumps(payload) From 49c13b1c7b536aa5dd967fc547363d161557b7ac Mon Sep 17 00:00:00 2001 From: Yu Jhin <73587140+uJhin@users.noreply.github.com> Date: Sun, 6 Feb 2022 18:45:14 +0900 Subject: [PATCH 3/3] Update setup.py Support Python Version 3.10 --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 45fa94f..6dfd71d 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,6 @@ classifiers = [ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10' 'Programming Language :: Python :: 3.10', ], keywords = [