ksxt 1.0.6__tar.gz → 1.0.8__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.
Files changed (179) hide show
  1. {ksxt-1.0.6 → ksxt-1.0.8}/LICENSE.txt +1 -1
  2. {ksxt-1.0.6/src/ksxt.egg-info → ksxt-1.0.8}/PKG-INFO +4 -3
  3. {ksxt-1.0.6 → ksxt-1.0.8}/pyproject.toml +1 -1
  4. ksxt-1.0.8/src/ksxt/__pycache__/__init__.cpython-311.pyc +0 -0
  5. ksxt-1.0.8/src/ksxt/__pycache__/bithumb.cpython-311.pyc +0 -0
  6. ksxt-1.0.8/src/ksxt/__pycache__/koreainvest.cpython-311.pyc +0 -0
  7. ksxt-1.0.8/src/ksxt/__pycache__/upbit.cpython-311.pyc +0 -0
  8. ksxt-1.0.8/src/ksxt/api/__pycache__/__init__.cpython-311.pyc +0 -0
  9. ksxt-1.0.8/src/ksxt/api/__pycache__/bithumb.cpython-311.pyc +0 -0
  10. ksxt-1.0.8/src/ksxt/api/__pycache__/koreainvest.cpython-311.pyc +0 -0
  11. ksxt-1.0.8/src/ksxt/api/__pycache__/upbit.cpython-311.pyc +0 -0
  12. ksxt-1.0.8/src/ksxt/async_/__pycache__/__init__.cpython-311.pyc +0 -0
  13. ksxt-1.0.8/src/ksxt/async_/__pycache__/bithumb.cpython-311.pyc +0 -0
  14. ksxt-1.0.8/src/ksxt/async_/__pycache__/koreainvest.cpython-311.pyc +0 -0
  15. ksxt-1.0.8/src/ksxt/async_/__pycache__/upbit.cpython-311.pyc +0 -0
  16. ksxt-1.0.8/src/ksxt/async_/base/__pycache__/__init__.cpython-311.pyc +0 -0
  17. ksxt-1.0.8/src/ksxt/async_/base/__pycache__/async_exchange.cpython-311.pyc +0 -0
  18. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/async_/base/async_exchange.py +64 -0
  19. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/async_/bithumb.py +2 -2
  20. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/async_/koreainvest.py +1 -1
  21. ksxt-1.0.8/src/ksxt/base/__pycache__/__init__.cpython-311.pyc +0 -0
  22. ksxt-1.0.8/src/ksxt/base/__pycache__/errors.cpython-311.pyc +0 -0
  23. ksxt-1.0.8/src/ksxt/base/__pycache__/exchange.cpython-311.pyc +0 -0
  24. ksxt-1.0.8/src/ksxt/base/__pycache__/rate_limiter.cpython-311.pyc +0 -0
  25. ksxt-1.0.8/src/ksxt/base/__pycache__/rest_exchange.cpython-311.pyc +0 -0
  26. ksxt-1.0.8/src/ksxt/base/__pycache__/types.cpython-311.pyc +0 -0
  27. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/bithumb.py +2 -2
  28. ksxt-1.0.8/src/ksxt/config/__pycache__/__init__.cpython-311.pyc +0 -0
  29. ksxt-1.0.8/src/ksxt/config/token.toml +3 -0
  30. ksxt-1.0.8/src/ksxt/market/__pycache__/base.cpython-311.pyc +0 -0
  31. ksxt-1.0.8/src/ksxt/market/__pycache__/db.cpython-311.pyc +0 -0
  32. ksxt-1.0.8/src/ksxt/market/__pycache__/logging.cpython-311.pyc +0 -0
  33. ksxt-1.0.8/src/ksxt/market/__pycache__/manager.cpython-311.pyc +0 -0
  34. ksxt-1.0.8/src/ksxt/market/__pycache__/markets.cpython-311.pyc +0 -0
  35. ksxt-1.0.8/src/ksxt/market/krx/__pycache__/kosdaq.cpython-311.pyc +0 -0
  36. ksxt-1.0.8/src/ksxt/market/krx/__pycache__/kospi.cpython-311.pyc +0 -0
  37. ksxt-1.0.8/src/ksxt/market/krx/__pycache__/stock.cpython-311.pyc +0 -0
  38. ksxt-1.0.8/src/ksxt/market/us/__pycache__/amex.cpython-311.pyc +0 -0
  39. ksxt-1.0.8/src/ksxt/market/us/__pycache__/nasdaq.cpython-311.pyc +0 -0
  40. ksxt-1.0.8/src/ksxt/market/us/__pycache__/nyse.cpython-311.pyc +0 -0
  41. ksxt-1.0.8/src/ksxt/market/us/__pycache__/stock.cpython-311.pyc +0 -0
  42. ksxt-1.0.8/src/ksxt/models/__pycache__/__init__.cpython-311.pyc +0 -0
  43. ksxt-1.0.8/src/ksxt/models/__pycache__/balance.cpython-311.pyc +0 -0
  44. ksxt-1.0.8/src/ksxt/models/__pycache__/cash.cpython-311.pyc +0 -0
  45. ksxt-1.0.8/src/ksxt/models/__pycache__/common.cpython-311.pyc +0 -0
  46. ksxt-1.0.8/src/ksxt/models/__pycache__/error.cpython-311.pyc +0 -0
  47. ksxt-1.0.8/src/ksxt/models/__pycache__/historical.cpython-311.pyc +0 -0
  48. ksxt-1.0.8/src/ksxt/models/__pycache__/market.cpython-311.pyc +0 -0
  49. ksxt-1.0.8/src/ksxt/models/__pycache__/order.cpython-311.pyc +0 -0
  50. ksxt-1.0.8/src/ksxt/models/__pycache__/orderbook.cpython-311.pyc +0 -0
  51. ksxt-1.0.8/src/ksxt/models/__pycache__/ticker.cpython-311.pyc +0 -0
  52. ksxt-1.0.8/src/ksxt/models/__pycache__/token.cpython-311.pyc +0 -0
  53. ksxt-1.0.8/src/ksxt/models/__pycache__/transaction.cpython-311.pyc +0 -0
  54. ksxt-1.0.8/src/ksxt/parser/__pycache__/bithumb.cpython-311.pyc +0 -0
  55. ksxt-1.0.8/src/ksxt/parser/__pycache__/koreainvest.cpython-311.pyc +0 -0
  56. ksxt-1.0.8/src/ksxt/parser/__pycache__/parser.cpython-311.pyc +0 -0
  57. ksxt-1.0.8/src/ksxt/parser/__pycache__/upbit.cpython-311.pyc +0 -0
  58. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/parser/upbit.py +2 -1
  59. ksxt-1.0.8/src/ksxt/utils/__pycache__/safer.cpython-311.pyc +0 -0
  60. ksxt-1.0.8/src/ksxt/utils/__pycache__/sorter.cpython-311.pyc +0 -0
  61. ksxt-1.0.8/src/ksxt/utils/__pycache__/timer.cpython-311.pyc +0 -0
  62. {ksxt-1.0.6 → ksxt-1.0.8/src/ksxt.egg-info}/PKG-INFO +4 -3
  63. ksxt-1.0.8/src/ksxt.egg-info/SOURCES.txt +123 -0
  64. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt.egg-info/top_level.txt +1 -0
  65. ksxt-1.0.6/src/ksxt/__pycache__/__init__.cpython-312.pyc +0 -0
  66. ksxt-1.0.6/src/ksxt/__pycache__/bithumb.cpython-312.pyc +0 -0
  67. ksxt-1.0.6/src/ksxt/__pycache__/koreainvest.cpython-312.pyc +0 -0
  68. ksxt-1.0.6/src/ksxt/__pycache__/upbit.cpython-312.pyc +0 -0
  69. ksxt-1.0.6/src/ksxt/api/__pycache__/__init__.cpython-312.pyc +0 -0
  70. ksxt-1.0.6/src/ksxt/api/__pycache__/bithumb.cpython-312.pyc +0 -0
  71. ksxt-1.0.6/src/ksxt/api/__pycache__/koreainvest.cpython-312.pyc +0 -0
  72. ksxt-1.0.6/src/ksxt/api/__pycache__/upbit.cpython-312.pyc +0 -0
  73. ksxt-1.0.6/src/ksxt/async_/__pycache__/__init__.cpython-312.pyc +0 -0
  74. ksxt-1.0.6/src/ksxt/async_/__pycache__/bithumb.cpython-312.pyc +0 -0
  75. ksxt-1.0.6/src/ksxt/async_/__pycache__/koreainvest.cpython-312.pyc +0 -0
  76. ksxt-1.0.6/src/ksxt/async_/__pycache__/upbit.cpython-312.pyc +0 -0
  77. ksxt-1.0.6/src/ksxt/async_/base/__pycache__/__init__.cpython-312.pyc +0 -0
  78. ksxt-1.0.6/src/ksxt/async_/base/__pycache__/async_exchange.cpython-312.pyc +0 -0
  79. ksxt-1.0.6/src/ksxt/base/__pycache__/__init__.cpython-312.pyc +0 -0
  80. ksxt-1.0.6/src/ksxt/base/__pycache__/errors.cpython-312.pyc +0 -0
  81. ksxt-1.0.6/src/ksxt/base/__pycache__/exchange.cpython-312.pyc +0 -0
  82. ksxt-1.0.6/src/ksxt/base/__pycache__/rate_limiter.cpython-312.pyc +0 -0
  83. ksxt-1.0.6/src/ksxt/base/__pycache__/rest_exchange.cpython-312.pyc +0 -0
  84. ksxt-1.0.6/src/ksxt/base/__pycache__/types.cpython-312.pyc +0 -0
  85. ksxt-1.0.6/src/ksxt/config/__pycache__/__init__.cpython-312.pyc +0 -0
  86. ksxt-1.0.6/src/ksxt/config/token.toml +0 -3
  87. ksxt-1.0.6/src/ksxt/market/__pycache__/base.cpython-312.pyc +0 -0
  88. ksxt-1.0.6/src/ksxt/market/__pycache__/db.cpython-312.pyc +0 -0
  89. ksxt-1.0.6/src/ksxt/market/__pycache__/logging.cpython-312.pyc +0 -0
  90. ksxt-1.0.6/src/ksxt/market/__pycache__/manager.cpython-312.pyc +0 -0
  91. ksxt-1.0.6/src/ksxt/market/__pycache__/markets.cpython-312.pyc +0 -0
  92. ksxt-1.0.6/src/ksxt/market/krx/__pycache__/kosdaq.cpython-312.pyc +0 -0
  93. ksxt-1.0.6/src/ksxt/market/krx/__pycache__/kospi.cpython-312.pyc +0 -0
  94. ksxt-1.0.6/src/ksxt/market/krx/__pycache__/stock.cpython-312.pyc +0 -0
  95. ksxt-1.0.6/src/ksxt/market/us/__pycache__/amex.cpython-312.pyc +0 -0
  96. ksxt-1.0.6/src/ksxt/market/us/__pycache__/nasdaq.cpython-312.pyc +0 -0
  97. ksxt-1.0.6/src/ksxt/market/us/__pycache__/nyse.cpython-312.pyc +0 -0
  98. ksxt-1.0.6/src/ksxt/market/us/__pycache__/stock.cpython-312.pyc +0 -0
  99. ksxt-1.0.6/src/ksxt/models/__pycache__/__init__.cpython-312.pyc +0 -0
  100. ksxt-1.0.6/src/ksxt/models/__pycache__/balance.cpython-312.pyc +0 -0
  101. ksxt-1.0.6/src/ksxt/models/__pycache__/cash.cpython-312.pyc +0 -0
  102. ksxt-1.0.6/src/ksxt/models/__pycache__/common.cpython-312.pyc +0 -0
  103. ksxt-1.0.6/src/ksxt/models/__pycache__/error.cpython-312.pyc +0 -0
  104. ksxt-1.0.6/src/ksxt/models/__pycache__/historical.cpython-312.pyc +0 -0
  105. ksxt-1.0.6/src/ksxt/models/__pycache__/market.cpython-312.pyc +0 -0
  106. ksxt-1.0.6/src/ksxt/models/__pycache__/order.cpython-312.pyc +0 -0
  107. ksxt-1.0.6/src/ksxt/models/__pycache__/orderbook.cpython-312.pyc +0 -0
  108. ksxt-1.0.6/src/ksxt/models/__pycache__/ticker.cpython-312.pyc +0 -0
  109. ksxt-1.0.6/src/ksxt/models/__pycache__/token.cpython-312.pyc +0 -0
  110. ksxt-1.0.6/src/ksxt/models/__pycache__/transaction.cpython-312.pyc +0 -0
  111. ksxt-1.0.6/src/ksxt/parser/__pycache__/bithumb.cpython-312.pyc +0 -0
  112. ksxt-1.0.6/src/ksxt/parser/__pycache__/koreainvest.cpython-312.pyc +0 -0
  113. ksxt-1.0.6/src/ksxt/parser/__pycache__/parser.cpython-312.pyc +0 -0
  114. ksxt-1.0.6/src/ksxt/parser/__pycache__/upbit.cpython-312.pyc +0 -0
  115. ksxt-1.0.6/src/ksxt/utils/__pycache__/safer.cpython-312.pyc +0 -0
  116. ksxt-1.0.6/src/ksxt/utils/__pycache__/sorter.cpython-312.pyc +0 -0
  117. ksxt-1.0.6/src/ksxt/utils/__pycache__/timer.cpython-312.pyc +0 -0
  118. ksxt-1.0.6/src/ksxt.egg-info/SOURCES.txt +0 -123
  119. {ksxt-1.0.6 → ksxt-1.0.8}/MANIFEST.in +0 -0
  120. {ksxt-1.0.6 → ksxt-1.0.8}/README.md +0 -0
  121. {ksxt-1.0.6 → ksxt-1.0.8}/setup.cfg +0 -0
  122. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/__init__.py +0 -0
  123. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/__init__.py +0 -0
  124. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/auto/api_generator.py +0 -0
  125. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/auto/bithumb.py +0 -0
  126. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/auto/koreainvest.py +0 -0
  127. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/auto/upbit.py +0 -0
  128. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/bithumb.py +0 -0
  129. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/koreainvest.py +0 -0
  130. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/api/upbit.py +0 -0
  131. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/async_/__init__.py +0 -0
  132. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/async_/base/__init__.py +0 -0
  133. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/async_/upbit.py +0 -0
  134. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/__init__.py +0 -0
  135. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/com_exchange.py +0 -0
  136. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/errors.py +0 -0
  137. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/exchange.py +0 -0
  138. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/rate_limiter.py +0 -0
  139. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/rest_exchange.py +0 -0
  140. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/base/types.py +0 -0
  141. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/config/__init__.py +0 -0
  142. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/config/bithumb.toml +0 -0
  143. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/config/koreainvest.toml +0 -0
  144. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/config/upbit.toml +0 -0
  145. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/koreainvest.py +0 -0
  146. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/base.py +0 -0
  147. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/db.py +0 -0
  148. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/krx/kosdaq.py +0 -0
  149. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/krx/kospi.py +0 -0
  150. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/krx/stock.py +0 -0
  151. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/logging.py +0 -0
  152. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/manager.py +0 -0
  153. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/markets.py +0 -0
  154. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/us/amex.py +0 -0
  155. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/us/nasdaq.py +0 -0
  156. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/us/nyse.py +0 -0
  157. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/market/us/stock.py +0 -0
  158. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/__init__.py +0 -0
  159. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/balance.py +0 -0
  160. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/cash.py +0 -0
  161. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/common.py +0 -0
  162. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/error.py +0 -0
  163. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/historical.py +0 -0
  164. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/market.py +0 -0
  165. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/order.py +0 -0
  166. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/orderbook.py +0 -0
  167. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/ticker.py +0 -0
  168. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/token.py +0 -0
  169. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/models/transaction.py +0 -0
  170. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/parser/bithumb.py +0 -0
  171. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/parser/koreainvest.py +0 -0
  172. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/parser/parser.py +0 -0
  173. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/sample/symbol_sync.ipynb +0 -0
  174. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/upbit.py +0 -0
  175. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/utils/safer.py +0 -0
  176. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/utils/sorter.py +0 -0
  177. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt/utils/timer.py +0 -0
  178. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt.egg-info/dependency_links.txt +0 -0
  179. {ksxt-1.0.6 → ksxt-1.0.8}/src/ksxt.egg-info/requires.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © 2023 AMOSA
3
+ Copyright © 2025 AMOSA
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ksxt
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  License: MIT License
5
5
 
6
- Copyright © 2023 AMOSA
6
+ Copyright © 2025 AMOSA
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
@@ -34,6 +34,7 @@ Requires-Dist: pyjwt
34
34
  Requires-Dist: pydantic
35
35
  Requires-Dist: black
36
36
  Requires-Dist: pytz
37
+ Dynamic: license-file
37
38
 
38
39
  # ksxt
39
40
  - Krx Stock eXchange Trading library
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
8
8
 
9
9
  [project]
10
10
  name = "ksxt"
11
- version = "1.0.6"
11
+ version = "1.0.8"
12
12
  readme = "README.md"
13
13
  license = { file="LICENSE.txt" }
14
14
 
@@ -1,4 +1,8 @@
1
+ import logging
1
2
  import asyncio
3
+ import toml
4
+ import os
5
+ import aiofiles
2
6
  import time
3
7
  import aiohttp
4
8
  from datetime import datetime
@@ -8,6 +12,7 @@ from typing import Any, Dict, Literal, Optional
8
12
  from ksxt.base.errors import NotSupportedError
9
13
  from ksxt.base.rate_limiter import RateLimiterContext
10
14
  from ksxt.base.rest_exchange import RestExchange
15
+ from ksxt.config import CONFIG_DIR
11
16
  from ksxt.config import VALID_METHODS
12
17
  import ksxt.models
13
18
 
@@ -46,6 +51,65 @@ class AsyncExchange(RestExchange):
46
51
  async def __aexit__(self, *args):
47
52
  await self.close()
48
53
 
54
+ def check_token(func):
55
+ async def wrapper(self, *args, **kwargs):
56
+ if not await self.is_valid_token():
57
+ await self.create_token()
58
+
59
+ return await func(self, *args, **kwargs)
60
+
61
+ return wrapper
62
+
63
+ async def is_valid_token(self) -> bool:
64
+ await self.load_token()
65
+ if self.token_expired is None:
66
+ return False
67
+
68
+ return datetime.now(self.timezone) <= self.timezone.localize(self.token_expired)
69
+
70
+ async def read_token(self):
71
+ try:
72
+ token_path = os.path.join(CONFIG_DIR, "token.toml")
73
+ async with aiofiles.open(token_path, mode="r") as f:
74
+ c = toml.loads(await f.read())
75
+ return c
76
+ except Exception as e:
77
+ return {}
78
+
79
+ async def load_token(self):
80
+ try:
81
+ data = await self.read_token()
82
+
83
+ if self.open_key in data.keys():
84
+ self.token = data[self.open_key]["token"]
85
+ self.token_expired = data[self.open_key]["expired"]
86
+ except Exception as e:
87
+ pass
88
+
89
+ async def save_token(self, open_key, token, expired):
90
+ try:
91
+ logging.info("save token")
92
+ logging.info(open_key)
93
+ logging.info(token)
94
+ logging.info(expired)
95
+
96
+ data = await self.read_token()
97
+ if open_key not in data:
98
+ data[open_key] = {}
99
+ data[open_key]["token"] = token
100
+ data[open_key]["expired"] = expired
101
+
102
+ token_path = os.path.join(CONFIG_DIR, "token.toml")
103
+ async with aiofiles.open(token_path, "w") as file:
104
+ await file.write(toml.dumps(data))
105
+
106
+ await self.load_token()
107
+ except Exception as e:
108
+ pass
109
+
110
+ async def create_token(self):
111
+ pass
112
+
49
113
  async def fetch(self, url, method="GET", headers=None, body=None, params=None):
50
114
  # Ensure that resources are initialized before the request
51
115
  await self.initialize()
@@ -167,7 +167,7 @@ class Bithumb(AsyncExchange, ImplicitAPI):
167
167
 
168
168
  # 실패 시 오류 응답 반환
169
169
  if common_response.success != "0":
170
- return ksxt.models.KsxtTickerResponse(header=common_header, response=common_response, info=[])
170
+ return ksxt.models.KsxtTickerResponse(header=common_header, response=common_response, info=None)
171
171
 
172
172
  # 데이터 파싱
173
173
  parsed_info = self.parser.parse_ticker(response, base_market)
@@ -186,7 +186,7 @@ class Bithumb(AsyncExchange, ImplicitAPI):
186
186
 
187
187
  # 실패 시 오류 응답 반환
188
188
  if common_response.success != "0":
189
- return ksxt.models.KsxtTickersResponse(header=common_header, response=common_response, info=[])
189
+ return ksxt.models.KsxtTickersResponse(header=common_header, response=common_response, info=None)
190
190
 
191
191
  # 데이터 파싱
192
192
  parsed_info = self.parser.parse_tickers(response, base_market)
@@ -87,7 +87,7 @@ class KoreaInvest(AsyncExchange, ImplicitAPI):
87
87
 
88
88
  parsed_info = self.parser.parse_token(response=response)
89
89
 
90
- self.save_token(self.open_key, parsed_info.access_token, expired=parsed_info.expired_datetime)
90
+ await self.save_token(self.open_key, parsed_info.access_token, expired=parsed_info.expired_datetime)
91
91
 
92
92
  return ksxt.models.KsxtTokenResponse(header=common_header, response=common_response, info=parsed_info)
93
93
 
@@ -169,7 +169,7 @@ class Bithumb(RestExchange, ImplicitAPI):
169
169
 
170
170
  # 실패 시 오류 응답 반환
171
171
  if common_response.success != "0":
172
- return ksxt.models.KsxtTickerResponse(header=common_header, response=common_response, info=[])
172
+ return ksxt.models.KsxtTickerResponse(header=common_header, response=common_response, info=None)
173
173
 
174
174
  # 데이터 파싱
175
175
  parsed_info = self.parser.parse_ticker(response, base_market)
@@ -188,7 +188,7 @@ class Bithumb(RestExchange, ImplicitAPI):
188
188
 
189
189
  # 실패 시 오류 응답 반환
190
190
  if common_response.success != "0":
191
- return ksxt.models.KsxtTickersResponse(header=common_header, response=common_response, info=[])
191
+ return ksxt.models.KsxtTickersResponse(header=common_header, response=common_response, info=None)
192
192
 
193
193
  # 데이터 파싱
194
194
  parsed_info = self.parser.parse_tickers(response, base_market)
@@ -0,0 +1,3 @@
1
+ [PSCWKArP3T1L4qMgyZ4DXIDlqcaK48jJW1J5]
2
+ token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6IjAyNjhmZDU2LWU4YzgtNDQyZS1hOWU5LTI2YjNiOGVkNGYwYiIsInByZHRfY2QiOiIiLCJpc3MiOiJ1bm9ndyIsImV4cCI6MTc0Mzc3NDk0OSwiaWF0IjoxNzQzNjg4NTQ5LCJqdGkiOiJQU0NXS0FyUDNUMUw0cU1neVo0RFhJRGxxY2FLNDhqSlcxSjUifQ.ILzpskgzsz9igynOuTrxGOYUCWknEoEar6AAPL3DdBGWM8pi1SkU7pcNgkx6eZ1k9nsvs2YeB1OsFTJtVp6kCQ"
3
+ expired = 2025-04-04T22:55:49
@@ -313,6 +313,8 @@ class UpbitParser(BaseParser):
313
313
  uuid=safer.safe_string(order, "uuid"),
314
314
  account_id="",
315
315
  transaction_type=safer.safe_string(order, "side"),
316
+ order_type=safer.safe_string(order, "ord_type"),
317
+ tr_position="long",
316
318
  symbol=self.safe_symbol(base_market, safer.safe_string(order, "market")),
317
319
  price=price,
318
320
  qty=safer.safe_number(order, "volume"),
@@ -320,7 +322,6 @@ class UpbitParser(BaseParser):
320
322
  tax=0,
321
323
  fee=safer.safe_number(order, "paid_fee"),
322
324
  currency=base_market,
323
- order_type=safer.safe_string(order, "ord_type"),
324
325
  created_at=datetime.fromisoformat(safer.safe_string(order, "created_at")),
325
326
  )
326
327
 
@@ -1,9 +1,9 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: ksxt
3
- Version: 1.0.6
3
+ Version: 1.0.8
4
4
  License: MIT License
5
5
 
6
- Copyright © 2023 AMOSA
6
+ Copyright © 2025 AMOSA
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
@@ -34,6 +34,7 @@ Requires-Dist: pyjwt
34
34
  Requires-Dist: pydantic
35
35
  Requires-Dist: black
36
36
  Requires-Dist: pytz
37
+ Dynamic: license-file
37
38
 
38
39
  # ksxt
39
40
  - Krx Stock eXchange Trading library
@@ -0,0 +1,123 @@
1
+ LICENSE.txt
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/ksxt/__init__.py
6
+ src/ksxt/bithumb.py
7
+ src/ksxt/koreainvest.py
8
+ src/ksxt/upbit.py
9
+ src/ksxt.egg-info/PKG-INFO
10
+ src/ksxt.egg-info/SOURCES.txt
11
+ src/ksxt.egg-info/dependency_links.txt
12
+ src/ksxt.egg-info/requires.txt
13
+ src/ksxt.egg-info/top_level.txt
14
+ src/ksxt/__pycache__/__init__.cpython-311.pyc
15
+ src/ksxt/__pycache__/bithumb.cpython-311.pyc
16
+ src/ksxt/__pycache__/koreainvest.cpython-311.pyc
17
+ src/ksxt/__pycache__/upbit.cpython-311.pyc
18
+ src/ksxt/api/__init__.py
19
+ src/ksxt/api/bithumb.py
20
+ src/ksxt/api/koreainvest.py
21
+ src/ksxt/api/upbit.py
22
+ src/ksxt/api/__pycache__/__init__.cpython-311.pyc
23
+ src/ksxt/api/__pycache__/bithumb.cpython-311.pyc
24
+ src/ksxt/api/__pycache__/koreainvest.cpython-311.pyc
25
+ src/ksxt/api/__pycache__/upbit.cpython-311.pyc
26
+ src/ksxt/api/auto/api_generator.py
27
+ src/ksxt/api/auto/bithumb.py
28
+ src/ksxt/api/auto/koreainvest.py
29
+ src/ksxt/api/auto/upbit.py
30
+ src/ksxt/async_/__init__.py
31
+ src/ksxt/async_/bithumb.py
32
+ src/ksxt/async_/koreainvest.py
33
+ src/ksxt/async_/upbit.py
34
+ src/ksxt/async_/__pycache__/__init__.cpython-311.pyc
35
+ src/ksxt/async_/__pycache__/bithumb.cpython-311.pyc
36
+ src/ksxt/async_/__pycache__/koreainvest.cpython-311.pyc
37
+ src/ksxt/async_/__pycache__/upbit.cpython-311.pyc
38
+ src/ksxt/async_/base/__init__.py
39
+ src/ksxt/async_/base/async_exchange.py
40
+ src/ksxt/async_/base/__pycache__/__init__.cpython-311.pyc
41
+ src/ksxt/async_/base/__pycache__/async_exchange.cpython-311.pyc
42
+ src/ksxt/base/__init__.py
43
+ src/ksxt/base/com_exchange.py
44
+ src/ksxt/base/errors.py
45
+ src/ksxt/base/exchange.py
46
+ src/ksxt/base/rate_limiter.py
47
+ src/ksxt/base/rest_exchange.py
48
+ src/ksxt/base/types.py
49
+ src/ksxt/base/__pycache__/__init__.cpython-311.pyc
50
+ src/ksxt/base/__pycache__/errors.cpython-311.pyc
51
+ src/ksxt/base/__pycache__/exchange.cpython-311.pyc
52
+ src/ksxt/base/__pycache__/rate_limiter.cpython-311.pyc
53
+ src/ksxt/base/__pycache__/rest_exchange.cpython-311.pyc
54
+ src/ksxt/base/__pycache__/types.cpython-311.pyc
55
+ src/ksxt/config/__init__.py
56
+ src/ksxt/config/bithumb.toml
57
+ src/ksxt/config/koreainvest.toml
58
+ src/ksxt/config/token.toml
59
+ src/ksxt/config/upbit.toml
60
+ src/ksxt/config/__pycache__/__init__.cpython-311.pyc
61
+ src/ksxt/market/base.py
62
+ src/ksxt/market/db.py
63
+ src/ksxt/market/logging.py
64
+ src/ksxt/market/manager.py
65
+ src/ksxt/market/markets.py
66
+ src/ksxt/market/__pycache__/base.cpython-311.pyc
67
+ src/ksxt/market/__pycache__/db.cpython-311.pyc
68
+ src/ksxt/market/__pycache__/logging.cpython-311.pyc
69
+ src/ksxt/market/__pycache__/manager.cpython-311.pyc
70
+ src/ksxt/market/__pycache__/markets.cpython-311.pyc
71
+ src/ksxt/market/krx/kosdaq.py
72
+ src/ksxt/market/krx/kospi.py
73
+ src/ksxt/market/krx/stock.py
74
+ src/ksxt/market/krx/__pycache__/kosdaq.cpython-311.pyc
75
+ src/ksxt/market/krx/__pycache__/kospi.cpython-311.pyc
76
+ src/ksxt/market/krx/__pycache__/stock.cpython-311.pyc
77
+ src/ksxt/market/us/amex.py
78
+ src/ksxt/market/us/nasdaq.py
79
+ src/ksxt/market/us/nyse.py
80
+ src/ksxt/market/us/stock.py
81
+ src/ksxt/market/us/__pycache__/amex.cpython-311.pyc
82
+ src/ksxt/market/us/__pycache__/nasdaq.cpython-311.pyc
83
+ src/ksxt/market/us/__pycache__/nyse.cpython-311.pyc
84
+ src/ksxt/market/us/__pycache__/stock.cpython-311.pyc
85
+ src/ksxt/models/__init__.py
86
+ src/ksxt/models/balance.py
87
+ src/ksxt/models/cash.py
88
+ src/ksxt/models/common.py
89
+ src/ksxt/models/error.py
90
+ src/ksxt/models/historical.py
91
+ src/ksxt/models/market.py
92
+ src/ksxt/models/order.py
93
+ src/ksxt/models/orderbook.py
94
+ src/ksxt/models/ticker.py
95
+ src/ksxt/models/token.py
96
+ src/ksxt/models/transaction.py
97
+ src/ksxt/models/__pycache__/__init__.cpython-311.pyc
98
+ src/ksxt/models/__pycache__/balance.cpython-311.pyc
99
+ src/ksxt/models/__pycache__/cash.cpython-311.pyc
100
+ src/ksxt/models/__pycache__/common.cpython-311.pyc
101
+ src/ksxt/models/__pycache__/error.cpython-311.pyc
102
+ src/ksxt/models/__pycache__/historical.cpython-311.pyc
103
+ src/ksxt/models/__pycache__/market.cpython-311.pyc
104
+ src/ksxt/models/__pycache__/order.cpython-311.pyc
105
+ src/ksxt/models/__pycache__/orderbook.cpython-311.pyc
106
+ src/ksxt/models/__pycache__/ticker.cpython-311.pyc
107
+ src/ksxt/models/__pycache__/token.cpython-311.pyc
108
+ src/ksxt/models/__pycache__/transaction.cpython-311.pyc
109
+ src/ksxt/parser/bithumb.py
110
+ src/ksxt/parser/koreainvest.py
111
+ src/ksxt/parser/parser.py
112
+ src/ksxt/parser/upbit.py
113
+ src/ksxt/parser/__pycache__/bithumb.cpython-311.pyc
114
+ src/ksxt/parser/__pycache__/koreainvest.cpython-311.pyc
115
+ src/ksxt/parser/__pycache__/parser.cpython-311.pyc
116
+ src/ksxt/parser/__pycache__/upbit.cpython-311.pyc
117
+ src/ksxt/sample/symbol_sync.ipynb
118
+ src/ksxt/utils/safer.py
119
+ src/ksxt/utils/sorter.py
120
+ src/ksxt/utils/timer.py
121
+ src/ksxt/utils/__pycache__/safer.cpython-311.pyc
122
+ src/ksxt/utils/__pycache__/sorter.cpython-311.pyc
123
+ src/ksxt/utils/__pycache__/timer.cpython-311.pyc
@@ -1,3 +0,0 @@
1
- [PSXkvBM1hQXJDRHg2rLvC7Tr8SoyPudlbx9o]
2
- token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0b2tlbiIsImF1ZCI6IjEyYzYxZWIxLTU3YzQtNGFiZC1iN2JhLTM0OGIwOTBjY2NlMyIsInByZHRfY2QiOiIiLCJpc3MiOiJ1bm9ndyIsImV4cCI6MTcxOTM1OTE1NiwiaWF0IjoxNzE5MjcyNzU2LCJqdGkiOiJQU1hrdkJNMWhRWEpEUkhnMnJMdkM3VHI4U295UHVkbGJ4OW8ifQ.B1CJ7IMEkkqVpQ7ECM8otr6lVVmV2Yp_bRaBBRlcOo29MIQZ5z8g5oEcXyO-ghaUa8UJZguuo8Q7iQreRBYkZg"
3
- expired = "2024-06-26 08:45:56"
@@ -1,123 +0,0 @@
1
- LICENSE.txt
2
- MANIFEST.in
3
- README.md
4
- pyproject.toml
5
- src/ksxt/__init__.py
6
- src/ksxt/bithumb.py
7
- src/ksxt/koreainvest.py
8
- src/ksxt/upbit.py
9
- src/ksxt.egg-info/PKG-INFO
10
- src/ksxt.egg-info/SOURCES.txt
11
- src/ksxt.egg-info/dependency_links.txt
12
- src/ksxt.egg-info/requires.txt
13
- src/ksxt.egg-info/top_level.txt
14
- src/ksxt/__pycache__/__init__.cpython-312.pyc
15
- src/ksxt/__pycache__/bithumb.cpython-312.pyc
16
- src/ksxt/__pycache__/koreainvest.cpython-312.pyc
17
- src/ksxt/__pycache__/upbit.cpython-312.pyc
18
- src/ksxt/api/__init__.py
19
- src/ksxt/api/bithumb.py
20
- src/ksxt/api/koreainvest.py
21
- src/ksxt/api/upbit.py
22
- src/ksxt/api/__pycache__/__init__.cpython-312.pyc
23
- src/ksxt/api/__pycache__/bithumb.cpython-312.pyc
24
- src/ksxt/api/__pycache__/koreainvest.cpython-312.pyc
25
- src/ksxt/api/__pycache__/upbit.cpython-312.pyc
26
- src/ksxt/api/auto/api_generator.py
27
- src/ksxt/api/auto/bithumb.py
28
- src/ksxt/api/auto/koreainvest.py
29
- src/ksxt/api/auto/upbit.py
30
- src/ksxt/async_/__init__.py
31
- src/ksxt/async_/bithumb.py
32
- src/ksxt/async_/koreainvest.py
33
- src/ksxt/async_/upbit.py
34
- src/ksxt/async_/__pycache__/__init__.cpython-312.pyc
35
- src/ksxt/async_/__pycache__/bithumb.cpython-312.pyc
36
- src/ksxt/async_/__pycache__/koreainvest.cpython-312.pyc
37
- src/ksxt/async_/__pycache__/upbit.cpython-312.pyc
38
- src/ksxt/async_/base/__init__.py
39
- src/ksxt/async_/base/async_exchange.py
40
- src/ksxt/async_/base/__pycache__/__init__.cpython-312.pyc
41
- src/ksxt/async_/base/__pycache__/async_exchange.cpython-312.pyc
42
- src/ksxt/base/__init__.py
43
- src/ksxt/base/com_exchange.py
44
- src/ksxt/base/errors.py
45
- src/ksxt/base/exchange.py
46
- src/ksxt/base/rate_limiter.py
47
- src/ksxt/base/rest_exchange.py
48
- src/ksxt/base/types.py
49
- src/ksxt/base/__pycache__/__init__.cpython-312.pyc
50
- src/ksxt/base/__pycache__/errors.cpython-312.pyc
51
- src/ksxt/base/__pycache__/exchange.cpython-312.pyc
52
- src/ksxt/base/__pycache__/rate_limiter.cpython-312.pyc
53
- src/ksxt/base/__pycache__/rest_exchange.cpython-312.pyc
54
- src/ksxt/base/__pycache__/types.cpython-312.pyc
55
- src/ksxt/config/__init__.py
56
- src/ksxt/config/bithumb.toml
57
- src/ksxt/config/koreainvest.toml
58
- src/ksxt/config/token.toml
59
- src/ksxt/config/upbit.toml
60
- src/ksxt/config/__pycache__/__init__.cpython-312.pyc
61
- src/ksxt/market/base.py
62
- src/ksxt/market/db.py
63
- src/ksxt/market/logging.py
64
- src/ksxt/market/manager.py
65
- src/ksxt/market/markets.py
66
- src/ksxt/market/__pycache__/base.cpython-312.pyc
67
- src/ksxt/market/__pycache__/db.cpython-312.pyc
68
- src/ksxt/market/__pycache__/logging.cpython-312.pyc
69
- src/ksxt/market/__pycache__/manager.cpython-312.pyc
70
- src/ksxt/market/__pycache__/markets.cpython-312.pyc
71
- src/ksxt/market/krx/kosdaq.py
72
- src/ksxt/market/krx/kospi.py
73
- src/ksxt/market/krx/stock.py
74
- src/ksxt/market/krx/__pycache__/kosdaq.cpython-312.pyc
75
- src/ksxt/market/krx/__pycache__/kospi.cpython-312.pyc
76
- src/ksxt/market/krx/__pycache__/stock.cpython-312.pyc
77
- src/ksxt/market/us/amex.py
78
- src/ksxt/market/us/nasdaq.py
79
- src/ksxt/market/us/nyse.py
80
- src/ksxt/market/us/stock.py
81
- src/ksxt/market/us/__pycache__/amex.cpython-312.pyc
82
- src/ksxt/market/us/__pycache__/nasdaq.cpython-312.pyc
83
- src/ksxt/market/us/__pycache__/nyse.cpython-312.pyc
84
- src/ksxt/market/us/__pycache__/stock.cpython-312.pyc
85
- src/ksxt/models/__init__.py
86
- src/ksxt/models/balance.py
87
- src/ksxt/models/cash.py
88
- src/ksxt/models/common.py
89
- src/ksxt/models/error.py
90
- src/ksxt/models/historical.py
91
- src/ksxt/models/market.py
92
- src/ksxt/models/order.py
93
- src/ksxt/models/orderbook.py
94
- src/ksxt/models/ticker.py
95
- src/ksxt/models/token.py
96
- src/ksxt/models/transaction.py
97
- src/ksxt/models/__pycache__/__init__.cpython-312.pyc
98
- src/ksxt/models/__pycache__/balance.cpython-312.pyc
99
- src/ksxt/models/__pycache__/cash.cpython-312.pyc
100
- src/ksxt/models/__pycache__/common.cpython-312.pyc
101
- src/ksxt/models/__pycache__/error.cpython-312.pyc
102
- src/ksxt/models/__pycache__/historical.cpython-312.pyc
103
- src/ksxt/models/__pycache__/market.cpython-312.pyc
104
- src/ksxt/models/__pycache__/order.cpython-312.pyc
105
- src/ksxt/models/__pycache__/orderbook.cpython-312.pyc
106
- src/ksxt/models/__pycache__/ticker.cpython-312.pyc
107
- src/ksxt/models/__pycache__/token.cpython-312.pyc
108
- src/ksxt/models/__pycache__/transaction.cpython-312.pyc
109
- src/ksxt/parser/bithumb.py
110
- src/ksxt/parser/koreainvest.py
111
- src/ksxt/parser/parser.py
112
- src/ksxt/parser/upbit.py
113
- src/ksxt/parser/__pycache__/bithumb.cpython-312.pyc
114
- src/ksxt/parser/__pycache__/koreainvest.cpython-312.pyc
115
- src/ksxt/parser/__pycache__/parser.cpython-312.pyc
116
- src/ksxt/parser/__pycache__/upbit.cpython-312.pyc
117
- src/ksxt/sample/symbol_sync.ipynb
118
- src/ksxt/utils/safer.py
119
- src/ksxt/utils/sorter.py
120
- src/ksxt/utils/timer.py
121
- src/ksxt/utils/__pycache__/safer.cpython-312.pyc
122
- src/ksxt/utils/__pycache__/sorter.cpython-312.pyc
123
- src/ksxt/utils/__pycache__/timer.cpython-312.pyc
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