diff --git a/.gitignore b/.gitignore
index 99d7a41..e760945 100644
--- a/.gitignore
+++ b/.gitignore
@@ -130,3 +130,6 @@ dmypy.json
# vscode settings
.vscode/
+
+# jetbrains settings
+.idea
diff --git a/README.md b/README.md
index 7788419..e1459d5 100644
--- a/README.md
+++ b/README.md
@@ -75,6 +75,26 @@ git clone https://github.com/uJhin/upbit-client.git
### Quick Start
+#### Credentials
+```shell
+mkdir -p ~/.upbit
+```
+```
+# vi ~/.upbit/credentials
+
+[default]
+access_key = a
+secret_key = b
+
+[a]
+access_key = c
+secret_key = d
+```
+```python
+client = Upbit() # default
+client = Upbit(profile="a")
+```
+
#### REST Client
- Check Your API Keys
```python
@@ -174,3 +194,15 @@ event_loop.run_until_complete( ticker(sock, payload) )
+
+### Contributor
+```shell
+deactivate
+
+rm -rf venv
+
+python3 -m venv venv
+source venv/bin/activate
+
+pip3 install -r client/python/requirements.txt
+```
\ No newline at end of file
diff --git a/client/python/requirements.txt b/client/python/requirements.txt
index b34be70..7a5925f 100644
--- a/client/python/requirements.txt
+++ b/client/python/requirements.txt
@@ -1,3 +1,4 @@
+requests==2.30.0
arrow==1.2.3
attrs==23.1.0
bravado==11.0.3
@@ -17,7 +18,6 @@ pyrsistent==0.19.3
python-dateutil==2.8.2
pytz==2023.3
PyYAML==6.0
-requests==2.30.0
rfc3339-validator==0.1.4
rfc3987==1.3.8
simplejson==3.19.1
@@ -29,3 +29,4 @@ uri-template==1.2.0
urllib3==2.0.2
webcolors==1.13
websockets==11.0.3
+seunggabi_core_python
diff --git a/client/python/setup.py b/client/python/setup.py
index abc4eb0..8f430d0 100644
--- a/client/python/setup.py
+++ b/client/python/setup.py
@@ -1,38 +1,35 @@
-
from setuptools import setup
from setuptools import find_packages
from upbit import pkginfo
-
with open('README.rst') as readme:
long_description = readme.read()
-
setup(
- name = pkginfo.PACKAGE_NAME,
- version = pkginfo.CURRENT_VERSION,
- packages = find_packages(),
- install_requires = [
- 'bravado>=11.0.2'
+ name=pkginfo.PACKAGE_NAME,
+ version=pkginfo.CURRENT_VERSION,
+ packages=find_packages(),
+ install_requires=[
+ 'bravado>=11.0.2'
, 'PyJWT>=2.4.0'
, 'websockets>=10.3'
],
- extras_require = {
+ extras_require={
'fido': [
'fido>=4.2.1'
]
},
- python_requires = '>=3.8',
- classifiers = [
- 'Programming Language :: Python :: 3.8'
+ python_requires='>=3.8',
+ classifiers=[
+ 'Programming Language :: Python :: 3.8'
, 'Programming Language :: Python :: 3.9'
, 'Programming Language :: Python :: 3.10'
, 'Programming Language :: Python :: 3.11'
, 'Programming Language :: Python :: 3.12'
],
- keywords = [
- 'Upbit'
+ keywords=[
+ 'Upbit'
, 'upbit'
, 'upbit-client'
, 'Upbit-Client'
@@ -42,12 +39,12 @@
, 'Upbit_api_connector'
, 'upbit_api_connector'
],
- url = 'https://github.com/uJhin/upbit-client',
- download_url = 'https://github.com/uJhin/upbit-client/releases',
- license = 'MIT License',
- author = 'ujhin',
- author_email = 'ujhin942@gmail.com',
- description = 'Upbit OPEN API Client',
- long_description_content_type = 'text/x-rst',
- long_description = long_description
+ url='https://github.com/uJhin/upbit-client',
+ download_url='https://github.com/uJhin/upbit-client/releases',
+ license='MIT License',
+ author='ujhin',
+ author_email='ujhin942@gmail.com',
+ description='Upbit OPEN API Client',
+ long_description_content_type='text/x-rst',
+ long_description=long_description
)
diff --git a/client/python/upbit/client.py b/client/python/upbit/client.py
index bcec0fc..0cb4726 100644
--- a/client/python/upbit/client.py
+++ b/client/python/upbit/client.py
@@ -1,5 +1,6 @@
from . import models
+from seunggabi_core_python.util import config_util
class Upbit:
@@ -22,8 +23,17 @@ def __init__(
self,
access_key: str = None,
secret_key: str = None,
+ profile: str = None,
**kwargs
):
+ if access_key is None and secret_key is None:
+ credentials = config_util.get(
+ group="upbit",
+ context="credentials",
+ profile=profile
+ )
+ access_key = credentials["access_key"]
+ secret_key = credentials["secret_key"]
self.__client = models.ClientModel(
access_key=access_key,
diff --git a/client/python/upbit/models.py b/client/python/upbit/models.py
index 7f799c6..641282b 100644
--- a/client/python/upbit/models.py
+++ b/client/python/upbit/models.py
@@ -7,7 +7,7 @@
HOST = "https://api.upbit.com"
-SPEC_URI = "https://raw.githubusercontent.com/uJhin/upbit-client/main/mapper/swg_mapper.json"
+SPEC_URI = "https://raw.githubusercontent.com/seunggabi/upbit-client/main/mapper/swg_mapper.json"
class ClientModel:
@@ -530,6 +530,46 @@ def Order_cancel(self, **kwargs) -> dict:
future = self.__client.Order.Order_cancel(**kwargs)
return HTTPFutureExtractor.future_extraction(future)
+ def Order_cancel_all(
+ self,
+ side: str = None,
+ market: str = None,
+ ) -> dict:
+ args = {
+ "state": "wait"
+ }
+
+ if market:
+ args["market"] = market
+
+ result = []
+ while True:
+ waits = HTTPFutureExtractor.future_extraction(
+ self.__client.Order.Order_info_all(**args)
+ )["result"]
+
+ if len(waits) == 0:
+ break
+
+ for w in waits:
+ if w == "error":
+ return {
+ "result": result
+ }
+
+ if side and w["side"] != side:
+ continue
+
+ HTTPFutureExtractor.future_extraction(
+ self.__client.Order.Order_cancel(uuid=w["uuid"])
+ )
+
+ result.append(w)
+
+ return {
+ "result": result
+ }
+
class Trade:
"""
diff --git a/client/python/upbit/pkginfo.py b/client/python/upbit/pkginfo.py
index d152d4b..5866544 100644
--- a/client/python/upbit/pkginfo.py
+++ b/client/python/upbit/pkginfo.py
@@ -12,33 +12,7 @@
- Official Support Email: open-api@upbit.com
"""
-import logging
-import requests
-
-from distutils.version import LooseVersion
-
-
-def _get_versions(package_name):
- url = f"https://pypi.org/pypi/{package_name}/json"
- resp = requests.get(url)
- data = resp.json()
- versions = data["releases"].keys()
- return sorted(versions, key=LooseVersion, reverse=True)
-
-
-PACKAGE_NAME = "upbit-client"
+PACKAGE_NAME = "upbit-client"
OPEN_API_VERSION = "1.3.4"
-CURRENT_VERSION = OPEN_API_VERSION+".1"
-
-RELEASED_VERSION = _get_versions(PACKAGE_NAME)
-LATEST_VERSION = RELEASED_VERSION[0]
-
-
-if LATEST_VERSION != CURRENT_VERSION:
- logging.basicConfig(format="[%(levelname)s] %(message)s")
- logging.warning(
- f"{PACKAGE_NAME} is currently a newer version: {LATEST_VERSION}\n"
- f"Please update to the latest version using the pip command:"
- f"`pip install --upgrade {PACKAGE_NAME}`"
- )
+CURRENT_VERSION = OPEN_API_VERSION + ".1"
diff --git a/swg_generated/python/swagger_client/api/withdraw_api.py b/swg_generated/python/swagger_client/api/withdraw_api.py
index 51d1d22..aa9e38d 100644
--- a/swg_generated/python/swagger_client/api/withdraw_api.py
+++ b/swg_generated/python/swagger_client/api/withdraw_api.py
@@ -139,6 +139,7 @@ def withdraw_coin(self, currency, amount, address, **kwargs): # noqa: E501
:param async_req bool
:param str currency: Currency 코드 (required)
+ :param str net_type: 출금 네트워크 (required)
:param str amount: 출금 수량 (required)
:param str address: 출금 가능 주소에 등록된 출금 주소 (required)
:param str secondary_address: 2차 출금 주소 (필요한 코인에 한해서)