ksxt 1.0.3__tar.gz → 1.0.4__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.
- {ksxt-1.0.3/src/ksxt.egg-info → ksxt-1.0.4}/PKG-INFO +1 -1
- {ksxt-1.0.3 → ksxt-1.0.4}/pyproject.toml +1 -1
- ksxt-1.0.4/src/ksxt/__pycache__/__init__.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/__pycache__/bithumb.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/__pycache__/koreainvest.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/__pycache__/upbit.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/__pycache__/__init__.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/__pycache__/bithumb.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/__pycache__/koreainvest.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/__pycache__/upbit.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/__pycache__/__init__.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/__pycache__/bithumb.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/__pycache__/koreainvest.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/__pycache__/upbit.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/async_/base/__pycache__/__init__.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/base/__pycache__/async_exchange.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/base/__pycache__/throttler.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/base/async_exchange.py +3 -1
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/bithumb.py +4 -2
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/koreainvest.py +6 -2
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/upbit.py +6 -2
- ksxt-1.0.4/src/ksxt/base/__pycache__/__init__.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/__pycache__/errors.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/__pycache__/exchange.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/__pycache__/rate_limiter.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/__pycache__/rest_exchange.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/base/__pycache__/types.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/exchange.py +4 -45
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/rest_exchange.py +3 -2
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/bithumb.py +4 -2
- ksxt-1.0.4/src/ksxt/config/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/config/token.toml +7 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/koreainvest.py +6 -2
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/__pycache__/base.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/__pycache__/db.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/__pycache__/logging.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/__pycache__/manager.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/__pycache__/markets.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/krx/__pycache__/kosdaq.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/krx/__pycache__/kospi.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/krx/__pycache__/stock.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/__pycache__/amex.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/__pycache__/nasdaq.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/__pycache__/nyse.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/__pycache__/stock.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/__init__.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/balance.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/cash.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/common.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/error.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/models/__pycache__/historical.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/market.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/order.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/orderbook.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/models/__pycache__/ticker.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/models/__pycache__/token.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__pycache__/transaction.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/parser/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/parser/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/parser/__pycache__/parser.cpython-312.pyc +0 -0
- ksxt-1.0.4/src/ksxt/parser/__pycache__/upbit.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/parser/bithumb.py +19 -6
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/parser/koreainvest.py +10 -4
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/parser/parser.py +4 -2
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/parser/upbit.py +19 -6
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/upbit.py +6 -2
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/utils/__pycache__/safer.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/utils/__pycache__/sorter.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/utils/__pycache__/timer.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4/src/ksxt.egg-info}/PKG-INFO +1 -1
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt.egg-info/SOURCES.txt +0 -3
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt.egg-info/top_level.txt +1 -0
- ksxt-1.0.3/src/ksxt/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/api/auto/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/api/auto/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/api/auto/__pycache__/upbit.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/async_/base/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/base/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/base/__pycache__/types.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/config/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/config/token.toml +0 -7
- ksxt-1.0.3/src/ksxt/models/__pycache__/historical.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/models/__pycache__/ticker.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/models/__pycache__/token.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/parser/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/parser/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/parser/__pycache__/parser.cpython-312.pyc +0 -0
- ksxt-1.0.3/src/ksxt/parser/__pycache__/upbit.cpython-312.pyc +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/LICENSE.txt +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/MANIFEST.in +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/README.md +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/setup.cfg +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/auto/api_generator.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/auto/bithumb.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/auto/koreainvest.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/auto/upbit.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/bithumb.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/koreainvest.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/api/upbit.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/async_/base/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/com_exchange.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/errors.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/rate_limiter.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/base/types.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/config/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/config/bithumb.toml +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/config/koreainvest.toml +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/config/upbit.toml +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/base.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/db.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/krx/kosdaq.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/krx/kospi.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/krx/stock.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/logging.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/manager.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/markets.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/amex.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/nasdaq.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/nyse.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/market/us/stock.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/__init__.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/balance.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/cash.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/common.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/error.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/historical.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/market.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/order.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/orderbook.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/ticker.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/token.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/models/transaction.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/sample/symbol_sync.ipynb +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/utils/safer.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/utils/sorter.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt/utils/timer.py +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt.egg-info/dependency_links.txt +0 -0
- {ksxt-1.0.3 → ksxt-1.0.4}/src/ksxt.egg-info/requires.txt +0 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -142,7 +142,9 @@ class AsyncExchange(RestExchange):
|
|
142
142
|
async def fetch_user_info(self, base_market: str = "KRW"):
|
143
143
|
raise NotSupportedError(f"{self.id} {self.fetch_user_info.__qualname__}() is not supported yet.")
|
144
144
|
|
145
|
-
async def fetch_balance(
|
145
|
+
async def fetch_balance(
|
146
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
147
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
146
148
|
raise NotSupportedError(f"{self.id} {self.fetch_balance.__qualname__}() is not supported yet.")
|
147
149
|
|
148
150
|
async def fetch_cash(self, acc_num: str, base_market: str = "KRW") -> ksxt.models.KsxtCashResponse:
|
@@ -219,7 +219,9 @@ class Bithumb(AsyncExchange, ImplicitAPI):
|
|
219
219
|
|
220
220
|
return ksxt.models.KsxtMultiOrderBookResponse(header=common_header, response=common_response, info=parsed_info)
|
221
221
|
|
222
|
-
async def fetch_balance(
|
222
|
+
async def fetch_balance(
|
223
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
224
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
223
225
|
params = {}
|
224
226
|
|
225
227
|
common_header = self.create_common_header(request_params=params)
|
@@ -233,7 +235,7 @@ class Bithumb(AsyncExchange, ImplicitAPI):
|
|
233
235
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=None)
|
234
236
|
|
235
237
|
# 데이터 파싱
|
236
|
-
parsed_info = self.parser.parse_balance(response, base_market)
|
238
|
+
parsed_info = self.parser.parse_balance(response, base_market, excluded_symbols=excluded_symbols)
|
237
239
|
|
238
240
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=parsed_info)
|
239
241
|
|
@@ -124,7 +124,9 @@ class KoreaInvest(AsyncExchange, ImplicitAPI):
|
|
124
124
|
)
|
125
125
|
|
126
126
|
@AsyncExchange.check_token
|
127
|
-
async def fetch_balance(
|
127
|
+
async def fetch_balance(
|
128
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
129
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
128
130
|
if base_market == "KRW":
|
129
131
|
params = {
|
130
132
|
"CANO": acc_num[:8],
|
@@ -150,7 +152,9 @@ class KoreaInvest(AsyncExchange, ImplicitAPI):
|
|
150
152
|
if common_response.success != "0":
|
151
153
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=None)
|
152
154
|
|
153
|
-
parsed_info = self.parser.parse_balance(
|
155
|
+
parsed_info = self.parser.parse_balance(
|
156
|
+
response=response, base_market=base_market, excluded_symbols=excluded_symbols
|
157
|
+
)
|
154
158
|
|
155
159
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=parsed_info)
|
156
160
|
|
@@ -209,7 +209,9 @@ class Upbit(AsyncExchange, ImplicitAPI):
|
|
209
209
|
|
210
210
|
return ksxt.models.KsxtMultiOrderBookResponse(header=common_header, response=common_response, info=parsed_info)
|
211
211
|
|
212
|
-
async def fetch_balance(
|
212
|
+
async def fetch_balance(
|
213
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
214
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
213
215
|
params = {}
|
214
216
|
|
215
217
|
common_header = self.create_common_header(request_params=params)
|
@@ -220,7 +222,9 @@ class Upbit(AsyncExchange, ImplicitAPI):
|
|
220
222
|
if common_response.success != "0":
|
221
223
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=None)
|
222
224
|
|
223
|
-
parsed_info = self.parser.parse_balance(
|
225
|
+
parsed_info = self.parser.parse_balance(
|
226
|
+
response=response, base_market=base_market, excluded_symbols=excluded_symbols
|
227
|
+
)
|
224
228
|
|
225
229
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=parsed_info)
|
226
230
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -24,7 +24,7 @@ class Exchange:
|
|
24
24
|
session_lifetime = 10
|
25
25
|
# 세션의 마지막 사용 시간
|
26
26
|
session_last_used: time = None
|
27
|
-
|
27
|
+
|
28
28
|
timeout = 10000 # milliseconds = seconds * 1000
|
29
29
|
synchronous = True
|
30
30
|
|
@@ -139,13 +139,14 @@ class Exchange:
|
|
139
139
|
"""
|
140
140
|
pass
|
141
141
|
|
142
|
-
def fetch_balance(self, acc_num: str, base_market: str = "KRW"):
|
142
|
+
def fetch_balance(self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None):
|
143
143
|
"""
|
144
144
|
보유 자산 조회
|
145
145
|
|
146
146
|
Args:
|
147
147
|
acc_num (str): 계좌 번호
|
148
148
|
base_market (str, optional): Market 구분 코드. Defaults to 'KRW'.
|
149
|
+
excluded_symbols (Optional[list[str]], optional): 제외할 종목 리스트. Defaults to None.
|
149
150
|
"""
|
150
151
|
pass
|
151
152
|
|
@@ -300,48 +301,6 @@ class Exchange:
|
|
300
301
|
|
301
302
|
# endregion broker
|
302
303
|
|
303
|
-
# TODO : @abstractmethod로 제약을 하는게 나을까?는 고민 필요.
|
304
|
-
def get_success_response(self, result):
|
305
|
-
pass
|
306
|
-
|
307
|
-
def get_success_response(self, response_code, msg_code, msg, org_data):
|
308
|
-
return {
|
309
|
-
"response": {
|
310
|
-
# 성공 실패 여부
|
311
|
-
"success": response_code,
|
312
|
-
# 응답코드
|
313
|
-
"code": msg_code,
|
314
|
-
# 응답메세지
|
315
|
-
"message": msg,
|
316
|
-
# 원본 데이터
|
317
|
-
"info": org_data,
|
318
|
-
},
|
319
|
-
"header": {},
|
320
|
-
}
|
321
|
-
|
322
|
-
def get_error_response(self, error_code, error_message, org_data=None):
|
323
|
-
return {
|
324
|
-
"response": {
|
325
|
-
# 성공 실패 여부
|
326
|
-
"success": "-1",
|
327
|
-
# 응답코드
|
328
|
-
"code": error_code,
|
329
|
-
# 응답메세지
|
330
|
-
"message": error_message,
|
331
|
-
# 원본 데이터
|
332
|
-
"info": org_data,
|
333
|
-
},
|
334
|
-
"header": {},
|
335
|
-
}
|
336
|
-
|
337
|
-
def update_success_response_header(self, response: dict, header: dict):
|
338
|
-
response["header"].update(header)
|
339
|
-
return response
|
340
|
-
|
341
|
-
def update_success_response_body(self, response: dict, body: dict):
|
342
|
-
response.update(body)
|
343
|
-
return response
|
344
|
-
|
345
304
|
def create_common_response(self, success: str, msg_code: str, msg: str, info: dict) -> CommonResponse:
|
346
305
|
return CommonResponse(success=success, msg_code=msg_code, msg=msg, info=info)
|
347
306
|
|
@@ -370,7 +329,7 @@ class Exchange:
|
|
370
329
|
def set_attr(self, attrs):
|
371
330
|
for key in attrs:
|
372
331
|
if hasattr(self, key) and isinstance(getattr(self, key), dict):
|
373
|
-
setattr(self, key,
|
332
|
+
setattr(self, key, Exchange.deep_extend(getattr(self, key), attrs[key]))
|
374
333
|
else:
|
375
334
|
setattr(self, key, attrs[key])
|
376
335
|
|
@@ -44,7 +44,6 @@ class RestExchange(Exchange):
|
|
44
44
|
def __init__(self, config: Dict = None, filename: str = None) -> None:
|
45
45
|
super().__init__()
|
46
46
|
|
47
|
-
|
48
47
|
self.rate_limiters: Dict[str, RateLimiterContext] = {}
|
49
48
|
|
50
49
|
self.headers = dict() if self.headers is None else self.headers
|
@@ -323,7 +322,9 @@ class RestExchange(Exchange):
|
|
323
322
|
raise NotSupportedError(f"{self.id} {self.fetch_user_info.__qualname__}() is not supported yet.")
|
324
323
|
|
325
324
|
@check_token
|
326
|
-
def fetch_balance(
|
325
|
+
def fetch_balance(
|
326
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
327
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
327
328
|
raise NotSupportedError(f"{self.id} {self.fetch_balance.__qualname__}() is not supported yet.")
|
328
329
|
|
329
330
|
@check_token
|
@@ -221,7 +221,9 @@ class Bithumb(RestExchange, ImplicitAPI):
|
|
221
221
|
|
222
222
|
return ksxt.models.KsxtMultiOrderBookResponse(header=common_header, response=common_response, info=parsed_info)
|
223
223
|
|
224
|
-
def fetch_balance(
|
224
|
+
def fetch_balance(
|
225
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
226
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
225
227
|
params = {}
|
226
228
|
|
227
229
|
common_header = self.create_common_header(request_params=params)
|
@@ -235,7 +237,7 @@ class Bithumb(RestExchange, ImplicitAPI):
|
|
235
237
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=None)
|
236
238
|
|
237
239
|
# 데이터 파싱
|
238
|
-
parsed_info = self.parser.parse_balance(response, base_market)
|
240
|
+
parsed_info = self.parser.parse_balance(response, base_market, excluded_symbols=excluded_symbols)
|
239
241
|
|
240
242
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=parsed_info)
|
241
243
|
|
Binary file
|
@@ -0,0 +1,7 @@
|
|
1
|
+
[PS80UIBxOj1XGF1Dl9eRdJa8mVRtQqvnV2y1]
|
2
|
+
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6IjJkMWE4MjI0LTVlMjgtNGMwYy1hMTZmLWZmNTFhOGFmMDY2MiIsInByZHRfY2QiOiIiLCJpc3MiOiJ1bm9ndyIsImV4cCI6MTcxNzMxNDQ2MywiaWF0IjoxNzE3MjI4MDYzLCJqdGkiOiJQUzgwVUlCeE9qMVhHRjFEbDllUmRKYThtVlJ0UXF2blYyeTEifQ.8G5fotvUupZonIAsEEGEC0810sqGayj08-recM4smwdRA23-fE2HISzl4HY9wHlPtkYwVMr0svZlo9HIrR-mlw"
|
3
|
+
expired = "2024-06-02 16:47:43"
|
4
|
+
|
5
|
+
[PSCWKArP3T1L4qMgyZ4DXIDlqcaK48jJW1J5]
|
6
|
+
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6IjVjMWYzMWZhLTViYzEtNGM1OS04OGY1LTk5OTU5NmExMmMzMCIsInByZHRfY2QiOiIiLCJpc3MiOiJ1bm9ndyIsImV4cCI6MTcxODAwNDQ4NywiaWF0IjoxNzE3OTE4MDg3LCJqdGkiOiJQU0NXS0FyUDNUMUw0cU1neVo0RFhJRGxxY2FLNDhqSlcxSjUifQ.D6R4xlYKqZQykIyQUA5SgB6vxIEG33f_m_MzSrB9xGRdVKjcr0CyMleWeenyTZLAu6hQpu-3133uYachjI1zjw"
|
7
|
+
expired = "2024-06-10 16:28:07"
|
@@ -124,7 +124,9 @@ class KoreaInvest(RestExchange, ImplicitAPI):
|
|
124
124
|
)
|
125
125
|
|
126
126
|
@RestExchange.check_token
|
127
|
-
def fetch_balance(
|
127
|
+
def fetch_balance(
|
128
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
129
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
128
130
|
if base_market == "KRW":
|
129
131
|
params = {
|
130
132
|
"CANO": acc_num[:8],
|
@@ -150,7 +152,9 @@ class KoreaInvest(RestExchange, ImplicitAPI):
|
|
150
152
|
if common_response.success != "0":
|
151
153
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=None)
|
152
154
|
|
153
|
-
parsed_info = self.parser.parse_balance(
|
155
|
+
parsed_info = self.parser.parse_balance(
|
156
|
+
response=response, base_market=base_market, excluded_symbols=excluded_symbols
|
157
|
+
)
|
154
158
|
|
155
159
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=parsed_info)
|
156
160
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from operator import attrgetter
|
3
|
-
from typing import Dict, List
|
3
|
+
from typing import Dict, List, Optional
|
4
4
|
|
5
5
|
from ksxt.models.transaction import (
|
6
6
|
ClosedOrderHistory,
|
@@ -160,9 +160,19 @@ class BithumbParser(BaseParser):
|
|
160
160
|
|
161
161
|
return ask_data, bid_data
|
162
162
|
|
163
|
-
def parse_balance(
|
164
|
-
|
165
|
-
|
163
|
+
def parse_balance(
|
164
|
+
self, response: List[Dict], base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
165
|
+
) -> BalanceInfo:
|
166
|
+
# 1. Filter out entries where 'currency' is not the base_market
|
167
|
+
# 2. Ensure 'unit_currency' is the base_market
|
168
|
+
# 3. Exclude entries where 'currency' is in excluded_symbols
|
169
|
+
filtered_data = [
|
170
|
+
data
|
171
|
+
for data in response
|
172
|
+
if data["currency"] != base_market
|
173
|
+
and data["unit_currency"] == base_market
|
174
|
+
and (excluded_symbols is None or data["currency"] not in excluded_symbols)
|
175
|
+
]
|
166
176
|
|
167
177
|
# Initialize balance list
|
168
178
|
balances = [self._parse_balance(data, base_market) for data in filtered_data]
|
@@ -196,8 +206,11 @@ class BithumbParser(BaseParser):
|
|
196
206
|
)
|
197
207
|
|
198
208
|
def parse_cash(self, response: List[Dict], base_market: str = "KRW") -> CashInfo:
|
199
|
-
#
|
200
|
-
|
209
|
+
# 1. Filter entries where 'currency' is equal to 'base_market'
|
210
|
+
# 2. Ensure 'unit_currency' is also equal to 'base_market'
|
211
|
+
filtered_data = [
|
212
|
+
data for data in response if data["currency"] == base_market and data["unit_currency"] == base_market
|
213
|
+
]
|
201
214
|
|
202
215
|
# 필터링된 데이터가 없으면 기본값으로 CashInfo 반환
|
203
216
|
if not filtered_data:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from datetime import datetime
|
2
|
-
from typing import Dict, List
|
2
|
+
from typing import Dict, List, Optional
|
3
3
|
|
4
4
|
from ksxt.models.balance import BalanceData, BalanceInfo
|
5
5
|
from ksxt.models.cash import CashInfo
|
@@ -153,11 +153,17 @@ class KoreaInvestParser(BaseParser):
|
|
153
153
|
|
154
154
|
return ask_data, bid_data
|
155
155
|
|
156
|
-
def parse_balance(
|
156
|
+
def parse_balance(
|
157
|
+
self, response: List[Dict], base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
158
|
+
) -> BalanceInfo:
|
157
159
|
safe_response = safer.safe_value(response, "output1")
|
158
160
|
|
159
|
-
# Initialize balance list
|
160
|
-
balances = [
|
161
|
+
# Initialize balance list with filtering
|
162
|
+
balances = [
|
163
|
+
self._parse_balance(_, base_market)
|
164
|
+
for _ in safe_response
|
165
|
+
if excluded_symbols is None or safer.safe_string(_, "pdno") not in excluded_symbols
|
166
|
+
]
|
161
167
|
|
162
168
|
# 총 매입금액
|
163
169
|
total_amount = sum(bal.price * bal.qty for bal in balances)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Dict, List
|
1
|
+
from typing import Dict, List, Optional
|
2
2
|
import inspect
|
3
3
|
|
4
4
|
from ksxt.models.balance import BalanceData, BalanceInfo
|
@@ -62,7 +62,9 @@ class BaseParser:
|
|
62
62
|
) -> tuple[OrderBookData, OrderBookData]:
|
63
63
|
self._raise_not_implemented_error()
|
64
64
|
|
65
|
-
def parse_balance(
|
65
|
+
def parse_balance(
|
66
|
+
self, response: List[Dict], base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
67
|
+
) -> BalanceInfo:
|
66
68
|
self._raise_not_implemented_error()
|
67
69
|
|
68
70
|
def _parse_balance(self, data: Dict, base_market: str = "KRW") -> BalanceData:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from datetime import datetime
|
2
2
|
from operator import attrgetter
|
3
|
-
from typing import Dict, List
|
3
|
+
from typing import Dict, List, Optional
|
4
4
|
|
5
5
|
from ksxt.models.balance import BalanceData, BalanceInfo
|
6
6
|
from ksxt.models.cash import CashInfo
|
@@ -166,9 +166,19 @@ class UpbitParser(BaseParser):
|
|
166
166
|
|
167
167
|
return ask_data, bid_data
|
168
168
|
|
169
|
-
def parse_balance(
|
170
|
-
|
171
|
-
|
169
|
+
def parse_balance(
|
170
|
+
self, response: List[Dict], base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
171
|
+
) -> BalanceInfo:
|
172
|
+
# 1. Filter out entries where 'currency' is not the base_market
|
173
|
+
# 2. Ensure 'unit_currency' is the base_market
|
174
|
+
# 3. Exclude entries where 'currency' is in excluded_symbols
|
175
|
+
filtered_data = [
|
176
|
+
data
|
177
|
+
for data in response
|
178
|
+
if data["currency"] != base_market
|
179
|
+
and data["unit_currency"] == base_market
|
180
|
+
and (excluded_symbols is None or data["currency"] not in excluded_symbols)
|
181
|
+
]
|
172
182
|
|
173
183
|
# Initialize balance list
|
174
184
|
balances = [self._parse_balance(data, base_market) for data in filtered_data]
|
@@ -202,8 +212,11 @@ class UpbitParser(BaseParser):
|
|
202
212
|
)
|
203
213
|
|
204
214
|
def parse_cash(self, response: List[Dict], base_market: str = "KRW") -> CashInfo:
|
205
|
-
#
|
206
|
-
|
215
|
+
# 1. Filter entries where 'currency' is equal to 'base_market'
|
216
|
+
# 2. Ensure 'unit_currency' is also equal to 'base_market'
|
217
|
+
filtered_data = [
|
218
|
+
data for data in response if data["currency"] == base_market and data["unit_currency"] == base_market
|
219
|
+
]
|
207
220
|
|
208
221
|
# 필터링된 데이터가 없으면 기본값으로 CashInfo 반환
|
209
222
|
if not filtered_data:
|
@@ -224,7 +224,9 @@ class Upbit(RestExchange, ImplicitAPI):
|
|
224
224
|
|
225
225
|
return ksxt.models.KsxtMultiOrderBookResponse(header=common_header, response=common_response, info=parsed_info)
|
226
226
|
|
227
|
-
def fetch_balance(
|
227
|
+
def fetch_balance(
|
228
|
+
self, acc_num: str, base_market: str = "KRW", excluded_symbols: Optional[list[str]] = None
|
229
|
+
) -> ksxt.models.KsxtBalanceResponse:
|
228
230
|
params = {}
|
229
231
|
|
230
232
|
common_header = self.create_common_header(request_params=params)
|
@@ -235,7 +237,9 @@ class Upbit(RestExchange, ImplicitAPI):
|
|
235
237
|
if common_response.success != "0":
|
236
238
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=None)
|
237
239
|
|
238
|
-
parsed_info = self.parser.parse_balance(
|
240
|
+
parsed_info = self.parser.parse_balance(
|
241
|
+
response=response, base_market=base_market, excluded_symbols=excluded_symbols
|
242
|
+
)
|
239
243
|
|
240
244
|
return ksxt.models.KsxtBalanceResponse(header=common_header, response=common_response, info=parsed_info)
|
241
245
|
|
Binary file
|
Binary file
|
Binary file
|
@@ -27,9 +27,6 @@ src/ksxt/api/auto/api_generator.py
|
|
27
27
|
src/ksxt/api/auto/bithumb.py
|
28
28
|
src/ksxt/api/auto/koreainvest.py
|
29
29
|
src/ksxt/api/auto/upbit.py
|
30
|
-
src/ksxt/api/auto/__pycache__/bithumb.cpython-312.pyc
|
31
|
-
src/ksxt/api/auto/__pycache__/koreainvest.cpython-312.pyc
|
32
|
-
src/ksxt/api/auto/__pycache__/upbit.cpython-312.pyc
|
33
30
|
src/ksxt/async_/__init__.py
|
34
31
|
src/ksxt/async_/bithumb.py
|
35
32
|
src/ksxt/async_/koreainvest.py
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,7 +0,0 @@
|
|
1
|
-
[PSXkvBM1hQXJDRHg2rLvC7Tr8SoyPudlbx9o]
|
2
|
-
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6ImQ0N2EzYjY4LTlkMjQtNGE3YS04YmU2LTNjOWI5MzVmZDZhZCIsInByZHRfY2QiOiIiLCJpc3MiOiJ1bm9ndyIsImV4cCI6MTcyMzAzOTYzOSwiaWF0IjoxNzIyOTUzMjM5LCJqdGkiOiJQU1hrdkJNMWhRWEpEUkhnMnJMdkM3VHI4U295UHVkbGJ4OW8ifQ.573I5Sdj6339IWT5gxhdTFFeWCJDu_ukVAu5QbH9X_SU_laTjhFPttlKBn3HJZzmhYBV89BBcwnYiCwGFU9PFg"
|
3
|
-
expired = 2024-08-07T23:07:19
|
4
|
-
|
5
|
-
[PSo9UuHWHtg1QzRkyu1WeXYERyUkpRK9LSii]
|
6
|
-
token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6ImNhY2NjNGZhLWMxMzktNGE5MC1hNjg2LTI2OTVmZmNiZmQ0NyIsInByZHRfY2QiOiIiLCJpc3MiOiJ1bm9ndyIsImV4cCI6MTcyMzM3ODExNSwiaWF0IjoxNzIzMjkxNzE1LCJqdGkiOiJQU285VXVIV0h0ZzFRelJreXUxV2VYWUVSeVVrcFJLOUxTaWkifQ.EnsBporS5hoD7Prx_fvXoklkxvx1u0Swp3jL9MXv3GnXtU_totbAtfDqsHWexQGJNqgEAPe6Bd2L2M0rCNUpCg"
|
7
|
-
expired = 2024-08-11T21:08:35
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|