ksxt 0.0.8__py3-none-any.whl → 0.0.9__py3-none-any.whl

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 (141) hide show
  1. ksxt/__init__.py +3 -1
  2. ksxt/__pycache__/__init__.cpython-312.pyc +0 -0
  3. ksxt/__pycache__/bithumb.cpython-312.pyc +0 -0
  4. ksxt/__pycache__/koreainvest.cpython-312.pyc +0 -0
  5. ksxt/__pycache__/upbit.cpython-312.pyc +0 -0
  6. ksxt/api/__init__.py +26 -0
  7. ksxt/api/__pycache__/__init__.cpython-312.pyc +0 -0
  8. ksxt/api/__pycache__/bithumb.cpython-312.pyc +0 -0
  9. ksxt/api/__pycache__/koreainvest.cpython-312.pyc +0 -0
  10. ksxt/api/__pycache__/upbit.cpython-312.pyc +0 -0
  11. ksxt/api/auto/api_generator.py +54 -0
  12. ksxt/api/auto/bithumb.py +35 -0
  13. ksxt/api/auto/koreainvest.py +49 -0
  14. ksxt/api/auto/upbit.py +39 -0
  15. ksxt/api/bithumb.py +42 -0
  16. ksxt/api/koreainvest.py +40 -0
  17. ksxt/api/upbit.py +54 -0
  18. ksxt/async_/__init__.py +4 -0
  19. ksxt/async_/__pycache__/__init__.cpython-312.pyc +0 -0
  20. ksxt/async_/__pycache__/bithumb.cpython-312.pyc +0 -0
  21. ksxt/async_/__pycache__/koreainvest.cpython-312.pyc +0 -0
  22. ksxt/async_/__pycache__/upbit.cpython-312.pyc +0 -0
  23. ksxt/async_/base/__init__.py +0 -0
  24. ksxt/async_/base/__pycache__/__init__.cpython-312.pyc +0 -0
  25. ksxt/async_/base/__pycache__/async_exchange.cpython-312.pyc +0 -0
  26. ksxt/async_/base/__pycache__/throttler.cpython-312.pyc +0 -0
  27. ksxt/async_/base/async_exchange.py +232 -0
  28. ksxt/async_/base/throttler.py +63 -0
  29. ksxt/async_/bithumb.py +455 -0
  30. ksxt/async_/koreainvest.py +849 -0
  31. ksxt/async_/upbit.py +488 -0
  32. ksxt/base/__pycache__/__init__.cpython-312.pyc +0 -0
  33. ksxt/base/__pycache__/errors.cpython-312.pyc +0 -0
  34. ksxt/base/__pycache__/exchange.cpython-312.pyc +0 -0
  35. ksxt/base/__pycache__/rest_exchange.cpython-312.pyc +0 -0
  36. ksxt/base/__pycache__/types.cpython-312.pyc +0 -0
  37. ksxt/base/com_exchange.py +2 -2
  38. ksxt/base/errors.py +10 -0
  39. ksxt/base/exchange.py +188 -497
  40. ksxt/base/rest_exchange.py +297 -113
  41. ksxt/base/types.py +1 -36
  42. ksxt/bithumb.py +504 -0
  43. ksxt/config/__init__.py +2 -1
  44. ksxt/config/__pycache__/__init__.cpython-312.pyc +0 -0
  45. ksxt/config/bithumb.toml +380 -0
  46. ksxt/config/koreainvest.toml +312 -0
  47. ksxt/config/token.toml +7 -0
  48. ksxt/config/upbit.toml +428 -0
  49. ksxt/koreainvest.py +409 -1055
  50. ksxt/market/__pycache__/base.cpython-312.pyc +0 -0
  51. ksxt/market/__pycache__/db.cpython-312.pyc +0 -0
  52. ksxt/market/__pycache__/logging.cpython-312.pyc +0 -0
  53. ksxt/market/__pycache__/manager.cpython-312.pyc +0 -0
  54. ksxt/market/__pycache__/markets.cpython-312.pyc +0 -0
  55. ksxt/market/base.py +50 -50
  56. ksxt/market/db.py +5 -4
  57. ksxt/market/krx/__pycache__/kosdaq.cpython-312.pyc +0 -0
  58. ksxt/market/krx/__pycache__/kospi.cpython-312.pyc +0 -0
  59. ksxt/market/krx/__pycache__/stock.cpython-312.pyc +0 -0
  60. ksxt/market/krx/kosdaq.py +150 -147
  61. ksxt/market/krx/kospi.py +179 -175
  62. ksxt/market/krx/stock.py +136 -134
  63. ksxt/market/logging.py +4 -4
  64. ksxt/market/manager.py +10 -12
  65. ksxt/market/markets.py +1 -1
  66. ksxt/market/us/__pycache__/amex.cpython-312.pyc +0 -0
  67. ksxt/market/us/__pycache__/nasdaq.cpython-312.pyc +0 -0
  68. ksxt/market/us/__pycache__/nyse.cpython-312.pyc +0 -0
  69. ksxt/market/us/__pycache__/stock.cpython-312.pyc +0 -0
  70. ksxt/market/us/amex.py +31 -31
  71. ksxt/market/us/nasdaq.py +31 -31
  72. ksxt/market/us/nyse.py +31 -31
  73. ksxt/market/us/stock.py +20 -28
  74. ksxt/models/__init__.py +16 -0
  75. ksxt/models/__pycache__/__init__.cpython-312.pyc +0 -0
  76. ksxt/models/__pycache__/balance.cpython-312.pyc +0 -0
  77. ksxt/models/__pycache__/cash.cpython-312.pyc +0 -0
  78. ksxt/models/__pycache__/common.cpython-312.pyc +0 -0
  79. ksxt/models/__pycache__/error.cpython-312.pyc +0 -0
  80. ksxt/models/__pycache__/historical.cpython-312.pyc +0 -0
  81. ksxt/models/__pycache__/market.cpython-312.pyc +0 -0
  82. ksxt/models/__pycache__/order.cpython-312.pyc +0 -0
  83. ksxt/models/__pycache__/orderbook.cpython-312.pyc +0 -0
  84. ksxt/models/__pycache__/ticker.cpython-312.pyc +0 -0
  85. ksxt/models/__pycache__/token.cpython-312.pyc +0 -0
  86. ksxt/models/__pycache__/transaction.cpython-312.pyc +0 -0
  87. ksxt/models/balance.py +30 -0
  88. ksxt/models/cash.py +15 -0
  89. ksxt/models/common.py +31 -0
  90. ksxt/models/error.py +13 -0
  91. ksxt/models/historical.py +26 -0
  92. ksxt/models/market.py +81 -0
  93. ksxt/models/order.py +42 -0
  94. ksxt/models/orderbook.py +32 -0
  95. ksxt/models/ticker.py +25 -0
  96. ksxt/models/token.py +14 -0
  97. ksxt/models/transaction.py +79 -0
  98. ksxt/parser/__pycache__/bithumb.cpython-312.pyc +0 -0
  99. ksxt/parser/__pycache__/koreainvest.cpython-312.pyc +0 -0
  100. ksxt/parser/__pycache__/parser.cpython-312.pyc +0 -0
  101. ksxt/parser/__pycache__/upbit.cpython-312.pyc +0 -0
  102. ksxt/parser/bithumb.py +300 -0
  103. ksxt/parser/koreainvest.py +323 -0
  104. ksxt/parser/parser.py +114 -0
  105. ksxt/parser/upbit.py +308 -0
  106. ksxt/upbit.py +499 -0
  107. ksxt/utils/__pycache__/safer.cpython-312.pyc +0 -0
  108. ksxt/utils/__pycache__/sorter.cpython-312.pyc +0 -0
  109. ksxt/utils/__pycache__/timer.cpython-312.pyc +0 -0
  110. ksxt/utils/safer.py +48 -0
  111. ksxt/utils/sorter.py +8 -0
  112. ksxt/utils/timer.py +47 -0
  113. {ksxt-0.0.8.dist-info → ksxt-0.0.9.dist-info}/METADATA +11 -1
  114. ksxt-0.0.9.dist-info/RECORD +119 -0
  115. {ksxt-0.0.8.dist-info → ksxt-0.0.9.dist-info}/WHEEL +1 -1
  116. ksxt/__pycache__/__init__.cpython-39.pyc +0 -0
  117. ksxt/__pycache__/koreainvest.cpython-39.pyc +0 -0
  118. ksxt/base/__pycache__/__init__.cpython-39.pyc +0 -0
  119. ksxt/base/__pycache__/exchange.cpython-39.pyc +0 -0
  120. ksxt/base/__pycache__/rest_exchange.cpython-39.pyc +0 -0
  121. ksxt/base/__pycache__/restexchange.cpython-39.pyc +0 -0
  122. ksxt/base/__pycache__/types.cpython-39.pyc +0 -0
  123. ksxt/base/api_response.py +0 -68
  124. ksxt/config/__pycache__/__init__.cpython-39.pyc +0 -0
  125. ksxt/config/tr_app.json +0 -381
  126. ksxt/config/tr_dev.json +0 -446
  127. ksxt/market/__pycache__/base.cpython-39.pyc +0 -0
  128. ksxt/market/__pycache__/db.cpython-39.pyc +0 -0
  129. ksxt/market/__pycache__/logging.cpython-39.pyc +0 -0
  130. ksxt/market/__pycache__/manager.cpython-39.pyc +0 -0
  131. ksxt/market/__pycache__/markets.cpython-39.pyc +0 -0
  132. ksxt/market/krx/__pycache__/kosdaq.cpython-39.pyc +0 -0
  133. ksxt/market/krx/__pycache__/kospi.cpython-39.pyc +0 -0
  134. ksxt/market/krx/__pycache__/stock.cpython-39.pyc +0 -0
  135. ksxt/market/us/__pycache__/amex.cpython-39.pyc +0 -0
  136. ksxt/market/us/__pycache__/nasdaq.cpython-39.pyc +0 -0
  137. ksxt/market/us/__pycache__/nyse.cpython-39.pyc +0 -0
  138. ksxt/market/us/__pycache__/stock.cpython-39.pyc +0 -0
  139. ksxt-0.0.8.dist-info/RECORD +0 -49
  140. {ksxt-0.0.8.dist-info → ksxt-0.0.9.dist-info}/LICENSE.txt +0 -0
  141. {ksxt-0.0.8.dist-info → ksxt-0.0.9.dist-info}/top_level.txt +0 -0
ksxt/market/krx/stock.py CHANGED
@@ -5,216 +5,218 @@ from ksxt.market.db import Base
5
5
 
6
6
 
7
7
  SCRT_GRP_CLS_CODES = {
8
- 'ST': '주권',
9
- 'MF': '증권투자회사',
10
- 'RT': '부동산투자회사',
11
- 'SC': '선박투자회사',
12
- 'IF': '사회간접자본투융자회사',
13
- 'DR': '주식예탁증서',
14
- 'EW': 'ELW',
15
- 'EF': 'ETF',
16
- 'SW': '신주인수권증권',
17
- 'SR': '신주인수권증서',
18
- 'BC': '수익증권',
19
- 'FE': '해외ETF',
20
- 'FS': '외국주권',
8
+ "ST": "주권",
9
+ "MF": "증권투자회사",
10
+ "RT": "부동산투자회사",
11
+ "SC": "선박투자회사",
12
+ "IF": "사회간접자본투융자회사",
13
+ "DR": "주식예탁증서",
14
+ "EW": "ELW",
15
+ "EF": "ETF",
16
+ "SW": "신주인수권증권",
17
+ "SR": "신주인수권증서",
18
+ "BC": "수익증권",
19
+ "FE": "해외ETF",
20
+ "FS": "외국주권",
21
21
  }
22
22
 
23
23
  AVLS_SCAL_CLS_CODES = {
24
- '0': '제외',
25
- '1': '',
26
- '2': '',
27
- '3': '',
24
+ "0": "제외",
25
+ "1": "",
26
+ "2": "",
27
+ "3": "",
28
28
  }
29
29
 
30
30
  ETP_PROD_CLS_CODES = {
31
- '0': '해당없음',
32
- '1': '투자회사형',
33
- '2': '수익증권형',
34
- '3': 'ETN',
35
- '4': '손실제한ETN',
31
+ "0": "해당없음",
32
+ "1": "투자회사형",
33
+ "2": "수익증권형",
34
+ "3": "ETN",
35
+ "4": "손실제한ETN",
36
36
  }
37
37
 
38
38
  SHORT_OVER_CLS_CODES = {
39
- '0': '해당없음',
40
- '1': '지정예고',
41
- '2': '지정',
42
- '3': '지정연장(해제연기)',
39
+ "0": "해당없음",
40
+ "1": "지정예고",
41
+ "2": "지정",
42
+ "3": "지정연장(해제연기)",
43
43
  }
44
44
 
45
45
  MRKT_ALRM_CLS_CODES = {
46
- '00': '해당없음',
47
- '01': '투자주의',
48
- '02': '투자경고',
49
- '03': '투자위험',
46
+ "00": "해당없음",
47
+ "01": "투자주의",
48
+ "02": "투자경고",
49
+ "03": "투자위험",
50
50
  }
51
51
 
52
52
  FLNG_CLS_CODES = {
53
- '00': '해당사항없음',
54
- '01': '권리락',
55
- '02': '배당락',
56
- '03': '분배락',
57
- '04': '권배락',
58
- '05': '중간배당락',
59
- '06': '권리중간배당락',
60
- '99': '기타',
53
+ "00": "해당사항없음",
54
+ "01": "권리락",
55
+ "02": "배당락",
56
+ "03": "분배락",
57
+ "04": "권배락",
58
+ "05": "중간배당락",
59
+ "06": "권리중간배당락",
60
+ "99": "기타",
61
61
  }
62
62
 
63
63
  FCAM_MOD_CLS_CODES = {
64
- '00': '해당없음',
65
- '01': '액면분할',
66
- '02': '액면병합',
67
- '99': '기타',
64
+ "00": "해당없음",
65
+ "01": "액면분할",
66
+ "02": "액면병합",
67
+ "99": "기타",
68
68
  }
69
69
 
70
70
  ICIC_CLS_CODES = {
71
- '00': '해당없음',
72
- '01': '유상증자',
73
- '02': '무상증자',
74
- '03': '유무상증자',
75
- '99': '기타',
71
+ "00": "해당없음",
72
+ "01": "유상증자",
73
+ "02": "무상증자",
74
+ "03": "유무상증자",
75
+ "99": "기타",
76
76
  }
77
77
 
78
78
  PRST_CLS_CODES = {
79
- '0': '해당없음(보통주)',
80
- '1': '구형우선주',
81
- '2': '신형우선주',
79
+ "0": "해당없음(보통주)",
80
+ "1": "구형우선주",
81
+ "2": "신형우선주",
82
82
  }
83
83
 
84
+
84
85
  class KrxStockItem(MarketItemBase):
85
- '''국내 주식 정보'''
86
+ """국내 주식 정보"""
87
+
86
88
  excd: str
87
- '''거래소 정보'''
89
+ """거래소 정보"""
88
90
  mksc_shrn_iscd: str
89
- '''단축코드'''
91
+ """단축코드"""
90
92
  stnd_iscd: str
91
- '''표준코드'''
93
+ """표준코드"""
92
94
  hts_kor_isnm: str
93
- '''한글종목명'''
94
- scrt_grp_cls_code: Literal['ST', 'MF', 'RT', 'SC', 'IF', 'DR', 'EW', 'EF', 'SW', 'SR', 'BC', 'FE', 'FS']
95
- '''증권그룹구분코드'''
95
+ """한글종목명"""
96
+ scrt_grp_cls_code: Literal["ST", "MF", "RT", "SC", "IF", "DR", "EW", "EF", "SW", "SR", "BC", "FE", "FS"]
97
+ """증권그룹구분코드"""
96
98
  curr: str
97
- '''화폐 정보'''
98
- avls_scal_cls_code: Literal['0', '1', '2', '3']
99
- '''시가총액 규모 구분 코드 유가'''
99
+ """화폐 정보"""
100
+ avls_scal_cls_code: Literal["0", "1", "2", "3"]
101
+ """시가총액 규모 구분 코드 유가"""
100
102
  bstp_larg_div_code: str
101
- '''지수 업종 대분류 코드'''
103
+ """지수 업종 대분류 코드"""
102
104
  bstp_medm_div_code: str
103
- '''지수 업종 중분류 코드'''
105
+ """지수 업종 중분류 코드"""
104
106
  bstp_smal_div_code: str
105
- '''지수 업종 소분류 코드'''
107
+ """지수 업종 소분류 코드"""
106
108
  low_current_yn: bool
107
- '''저유동성종목 여부'''
109
+ """저유동성종목 여부"""
108
110
  krx_issu_yn: bool
109
- '''KRX 종목 여부'''
110
- etp_prod_cls_code: Literal['0', '1', '2', '3']
111
- '''ETP 상품구분코드'''
111
+ """KRX 종목 여부"""
112
+ etp_prod_cls_code: Literal["0", "1", "2", "3"]
113
+ """ETP 상품구분코드"""
112
114
  krx100_issu_yn: bool
113
- '''KRX100 종목 여부'''
115
+ """KRX100 종목 여부"""
114
116
  krx_car_yn: bool
115
- '''KRX 자동차 여부'''
117
+ """KRX 자동차 여부"""
116
118
  krx_smcn_yn: bool
117
- '''KRX 반도체 여부'''
119
+ """KRX 반도체 여부"""
118
120
  krx_bio_yn: bool
119
- '''KRX 바이오 여부'''
121
+ """KRX 바이오 여부"""
120
122
  krx_bank_yn: bool
121
- '''KRX 은행 여부'''
123
+ """KRX 은행 여부"""
122
124
  etpr_undt_objt_co_yn: bool
123
- '''기업인수목적회사여부'''
125
+ """기업인수목적회사여부"""
124
126
  krx_enrg_chms_yn: bool
125
- '''KRX 에너지 화학 여부'''
127
+ """KRX 에너지 화학 여부"""
126
128
  krx_stel_yn: bool
127
- '''KRX 철강 여부'''
128
- short_over_cls_code: Literal['0', '1', '2', '3']
129
- '''단기과열종목구분코드'''
129
+ """KRX 철강 여부"""
130
+ short_over_cls_code: Literal["0", "1", "2", "3"]
131
+ """단기과열종목구분코드"""
130
132
  krx_medi_cmnc_yn: bool
131
- '''KRX 미디어 통신 여부'''
133
+ """KRX 미디어 통신 여부"""
132
134
  krx_cnst_yn: bool
133
- '''KRX 건설 여부'''
135
+ """KRX 건설 여부"""
134
136
  krx_scrt_yn: bool
135
- '''KRX 증권 구분'''
137
+ """KRX 증권 구분"""
136
138
  krx_ship_yn: bool
137
- '''KRX 선박 구분'''
139
+ """KRX 선박 구분"""
138
140
  krx_insu_yn: bool
139
- '''KRX섹터지수 보험여부'''
141
+ """KRX섹터지수 보험여부"""
140
142
  krx_trnp_yn: bool
141
- '''KRX섹터지수 운송여부'''
143
+ """KRX섹터지수 운송여부"""
142
144
  stck_sdpr: int
143
- '''주식 기준가'''
145
+ """주식 기준가"""
144
146
  frml_mrkt_deal_qty_unit: int
145
- '''정규 시장 매매 수량 단위'''
147
+ """정규 시장 매매 수량 단위"""
146
148
  ovtm_mrkt_deal_qty_unit: int
147
- '''시간외 시장 매매 수량'''
149
+ """시간외 시장 매매 수량"""
148
150
  trht_yn: bool
149
- '''거래정지 여부'''
151
+ """거래정지 여부"""
150
152
  sltr_yn: bool
151
- '''정리매매 여부'''
153
+ """정리매매 여부"""
152
154
  mang_issu_yn: bool
153
- '''관리 종목 여부'''
154
- mrkt_alrm_cls_code: Literal['00', '01', '02', '03']
155
- '''시장 경고 구분 코드'''
155
+ """관리 종목 여부"""
156
+ mrkt_alrm_cls_code: Literal["00", "01", "02", "03"]
157
+ """시장 경고 구분 코드"""
156
158
  mrkt_alrm_risk_adnt_yn: bool
157
- '''시장 경고위험 예고 여부'''
159
+ """시장 경고위험 예고 여부"""
158
160
  insn_pbnt_yn: bool
159
- '''불성실 공시 여부'''
161
+ """불성실 공시 여부"""
160
162
  byps_lstn_yn: bool
161
- '''우회 상장 여부'''
162
- flng_cls_code: Literal['00', '01', '02', '03', '04', '05', '06', '99']
163
- '''락구분 코드'''
164
- fcam_mod_cls_code: Literal['00', '01', '02', '99']
165
- '''액면가 변경 구분 코드'''
166
- icic_cls_code: Literal['00', '01', '02', '03', '99']
167
- '''증자 구분 코드'''
163
+ """우회 상장 여부"""
164
+ flng_cls_code: Literal["00", "01", "02", "03", "04", "05", "06", "99"]
165
+ """락구분 코드"""
166
+ fcam_mod_cls_code: Literal["00", "01", "02", "99"]
167
+ """액면가 변경 구분 코드"""
168
+ icic_cls_code: Literal["00", "01", "02", "03", "99"]
169
+ """증자 구분 코드"""
168
170
  marg_rate: int
169
- '''증거금 비율'''
171
+ """증거금 비율"""
170
172
  crdt_able: bool
171
- '''신용주문 가능 여부'''
173
+ """신용주문 가능 여부"""
172
174
  crdt_days: int
173
- '''신용기간'''
175
+ """신용기간"""
174
176
  prdy_vol: int
175
- '''전일 거래량'''
177
+ """전일 거래량"""
176
178
  stck_fcam: int
177
- '''주식 액면가'''
179
+ """주식 액면가"""
178
180
  stck_lstn_date: datetime
179
- '''주식 상장 일자'''
181
+ """주식 상장 일자"""
180
182
  lstn_stcn: int
181
- '''상장 주수(천)'''
183
+ """상장 주수(천)"""
182
184
  cpfn: int
183
- '''자본금'''
185
+ """자본금"""
184
186
  stac_month: int
185
- '''결산 월'''
187
+ """결산 월"""
186
188
  po_prc: int
187
- '''공모 가격'''
188
- prst_cls_code: Literal['0', '1', '2']
189
- '''우선주 구분 코드'''
189
+ """공모 가격"""
190
+ prst_cls_code: Literal["0", "1", "2"]
191
+ """우선주 구분 코드"""
190
192
  ssts_hot_yn: bool
191
- '''공매도과열종목여부'''
193
+ """공매도과열종목여부"""
192
194
  stange_runup_yn: bool
193
- '''이상급등종목여부'''
195
+ """이상급등종목여부"""
194
196
  krx300_issu_yn: bool
195
- '''KRX300 종목 여부'''
197
+ """KRX300 종목 여부"""
196
198
  sale_account: int
197
- '''매출액'''
199
+ """매출액"""
198
200
  bsop_prfi: int
199
- '''영업이익'''
201
+ """영업이익"""
200
202
  op_prfi: int
201
- '''경상이익'''
203
+ """경상이익"""
202
204
  thtr_ntin: int
203
- '''당기순이익'''
205
+ """당기순이익"""
204
206
  roe: float
205
- '''ROE(자기자본이익률)'''
207
+ """ROE(자기자본이익률)"""
206
208
  base_date: datetime
207
- '''기준년월'''
209
+ """기준년월"""
208
210
  prdy_avls_scal: int
209
- '''전일기준 시가총액 (억)'''
211
+ """전일기준 시가총액 (억)"""
210
212
  grp_code: str
211
- '''그룹사 코드'''
213
+ """그룹사 코드"""
212
214
  co_crdt_limt_over_yn: bool
213
- '''회사신용한도초과여부'''
215
+ """회사신용한도초과여부"""
214
216
  secu_lend_able_yn: bool
215
- '''담보대출가능여부'''
217
+ """담보대출가능여부"""
216
218
  stln_able_yn: bool
217
- '''대주가능여부'''
219
+ """대주가능여부"""
218
220
 
219
221
  @property
220
222
  def scrt_grp_cls_name(self) -> str:
@@ -256,25 +258,25 @@ class KrxStockItem(MarketItemBase):
256
258
  super().__init__(data)
257
259
 
258
260
 
259
- t_item = TypeVar('t_item', bound=KrxStockItem)
260
- t_dbitem = TypeVar('t_dbitem', bound=Base)
261
+ t_item = TypeVar("t_item", bound=KrxStockItem)
262
+ t_dbitem = TypeVar("t_dbitem", bound=Base)
261
263
 
262
264
 
263
265
  class KrxStockMarket(Generic[t_item, t_dbitem], MarketBase[t_item, t_dbitem]):
264
266
  def search(self, name: str, limit: int = 50) -> Iterable[t_item]:
265
- '''종목을 검색합니다.'''
267
+ """종목을 검색합니다."""
266
268
  _, db_type = get_args(self.__orig_bases__[0]) # type: ignore
267
269
  return self._search(db_type.hts_kor_isnm, name, limit) # type: ignore
268
270
 
269
271
  def items(self, offset: int = 0, limit: int = 100) -> Iterable[t_item]:
270
- '''종목을 가져옵니다.'''
272
+ """종목을 가져옵니다."""
271
273
  return super().items(offset, limit)
272
274
 
273
275
  def all(self) -> Iterator[t_item]:
274
- '''모든 종목을 가져옵니다.'''
276
+ """모든 종목을 가져옵니다."""
275
277
  return super().all() # type: ignore
276
-
278
+
277
279
  def __getitem__(self, code: str) -> t_item:
278
- '''종목을 가져옵니다.'''
280
+ """종목을 가져옵니다."""
279
281
  _, db_type = get_args(self.__orig_bases__[0]) # type: ignore
280
- return self._get(db_type.mksc_shrn_iscd, code)
282
+ return self._get(db_type.mksc_shrn_iscd, code)
ksxt/market/logging.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
 
3
3
 
4
- default_logger = logging.getLogger('')
4
+ default_logger = logging.getLogger("")
5
5
  default_logger.level = logging.INFO
6
6
 
7
7
 
@@ -13,7 +13,7 @@ class KsxtLogger:
13
13
 
14
14
  def _emit_logger(self, logger: logging.Logger = None):
15
15
  if logger:
16
- n = logger != getattr(self, 'logger', None)
16
+ n = logger != getattr(self, "logger", None)
17
17
  self.logger = logger
18
18
  else:
19
19
  self.logger = default_logger
@@ -22,6 +22,6 @@ class KsxtLogger:
22
22
  for obj in self.__dict__.values():
23
23
  if isinstance(obj, KsxtLogger):
24
24
  obj._emit_logger(self.logger)
25
-
25
+
26
26
  if n:
27
- self._logger_ready(logger) # type: ignore
27
+ self._logger_ready(logger) # type: ignore
ksxt/market/manager.py CHANGED
@@ -27,7 +27,7 @@ class MarketManager(KsxtLogger):
27
27
  db_path: str
28
28
  engine: Engine
29
29
  markets: dict[str, MarketBase]
30
-
30
+
31
31
  _sessionmaker: sessionmaker
32
32
  _rth: int = 0
33
33
  _sstd: datetime
@@ -42,22 +42,22 @@ class MarketManager(KsxtLogger):
42
42
  def kosdaq(self) -> Kosdaq:
43
43
  """코스닥"""
44
44
  return self["kosdaq"] # type: ignore
45
-
45
+
46
46
  @property
47
47
  def nasdaq(self) -> Nasdaq:
48
48
  """나스닥(National Association of Securities Dealers Automated Quotations)"""
49
- return self['nasdaq'] # type: ignore
50
-
49
+ return self["nasdaq"] # type: ignore
50
+
51
51
  @property
52
52
  def nyse(self) -> Nyse:
53
53
  """뉴욕증권거래소(the New York Stock Exchange)"""
54
- return self['nyse'] # type: ignore
55
-
54
+ return self["nyse"] # type: ignore
55
+
56
56
  @property
57
57
  def amex(self) -> Amex:
58
58
  """미국증권거래소(AMerican stock EXchange)"""
59
- return self['amex'] # type: ignore
60
-
59
+ return self["amex"] # type: ignore
60
+
61
61
  @property
62
62
  def session(self) -> Session:
63
63
  """세션"""
@@ -175,9 +175,7 @@ class MarketManager(KsxtLogger):
175
175
  market = self.markets[code]
176
176
  return market # type: ignore
177
177
 
178
- def search(
179
- self, keyword: str, origin: list[str] = None
180
- ) -> dict[str, Iterable[MARKET_ITEM_TYPE]]:
178
+ def search(self, keyword: str, origin: list[str] = None) -> dict[str, Iterable[MARKET_ITEM_TYPE]]:
181
179
  """종목 검색을 수행합니다.
182
180
 
183
181
  Args:
@@ -217,4 +215,4 @@ class MarketManager(KsxtLogger):
217
215
  return None
218
216
 
219
217
  def stock_search_one(self, keyword: str) -> KrxStockItem:
220
- return self.search_one(keyword, ["kospi", "kosdaq"]) # type: ignore
218
+ return self.search_one(keyword, ["kospi", "kosdaq"]) # type: ignore
ksxt/market/markets.py CHANGED
@@ -14,4 +14,4 @@ MARKETS = {
14
14
  }
15
15
 
16
16
  MARKET_TYPE = Union[Kospi, Kosdaq, Nyse, Nasdaq, Amex]
17
- MARKET_ITEM_TYPE = Union[KospiItem, KosdaqItem, NyseItem, NasdaqItem, AmexItem]
17
+ MARKET_ITEM_TYPE = Union[KospiItem, KosdaqItem, NyseItem, NasdaqItem, AmexItem]
ksxt/market/us/amex.py CHANGED
@@ -48,30 +48,30 @@ from ksxt.market.us.stock import UsStockItem, UsStockMarket
48
48
  @dataclass
49
49
  class AmexItem(UsStockItem):
50
50
  CONTROL = [
51
- ('ncod', 2+1),
52
- ('exid', 3+1),
53
- ('excd', 3+1),
54
- ('exnm', 16+1),
55
- ('symb', 16+1),
56
- ('rsym', 16+1),
57
- ('knam', 64+1),
58
- ('enam', 64+1),
59
- ('stis', 1+1),
60
- ('curr', 4+1),
61
- ('zdiv', 1+1),
62
- ('ztyp', 1+1),
63
- ('base', 12+1),
64
- ('bnit', 8+1),
65
- ('anit', 8+1),
66
- ('mstm', 4+1),
67
- ('metm', 4+1),
68
- ('isdr', 1+1),
69
- ('drcd', 2+1),
70
- ('icod', 4+1),
71
- ('sjong', 1+1),
72
- ('ttyp', 1+1),
73
- ('etyp', 3+1),
74
- ('ttyp_sb', 3+1)
51
+ ("ncod", 2 + 1),
52
+ ("exid", 3 + 1),
53
+ ("excd", 3 + 1),
54
+ ("exnm", 16 + 1),
55
+ ("symb", 16 + 1),
56
+ ("rsym", 16 + 1),
57
+ ("knam", 64 + 1),
58
+ ("enam", 64 + 1),
59
+ ("stis", 1 + 1),
60
+ ("curr", 4 + 1),
61
+ ("zdiv", 1 + 1),
62
+ ("ztyp", 1 + 1),
63
+ ("base", 12 + 1),
64
+ ("bnit", 8 + 1),
65
+ ("anit", 8 + 1),
66
+ ("mstm", 4 + 1),
67
+ ("metm", 4 + 1),
68
+ ("isdr", 1 + 1),
69
+ ("drcd", 2 + 1),
70
+ ("icod", 4 + 1),
71
+ ("sjong", 1 + 1),
72
+ ("ttyp", 1 + 1),
73
+ ("etyp", 3 + 1),
74
+ ("ttyp_sb", 3 + 1),
75
75
  ]
76
76
 
77
77
  # Notional code
@@ -91,9 +91,9 @@ class AmexItem(UsStockItem):
91
91
  # English name
92
92
  enam: str
93
93
  # Security Type
94
- stis: Literal['1', '2', '3', '4']
94
+ stis: Literal["1", "2", "3", "4"]
95
95
  # currency
96
- curr: str
96
+ curr: str
97
97
  # float position
98
98
  zdiv: str
99
99
  # data type
@@ -115,11 +115,11 @@ class AmexItem(UsStockItem):
115
115
  # 업종분류코드
116
116
  icod: str
117
117
  # 지수구성종목 존재 여부
118
- sjong: Literal['0', '1']
118
+ sjong: Literal["0", "1"]
119
119
  # Tick Size Type
120
120
  ttyp: str
121
121
  #
122
- etyp: Literal['001', '002', '003', '004', '005', '006']
122
+ etyp: Literal["001", "002", "003", "004", "005", "006"]
123
123
  # Tick size type 상세 (ttyp 8일 경우 사용) : 런던 제트라 유로넥스트
124
124
  ttyp_sb: str
125
125
 
@@ -129,7 +129,7 @@ class AmexItem(UsStockItem):
129
129
 
130
130
 
131
131
  class _AmexItem(Base):
132
- __tablename__ = 'amex'
132
+ __tablename__ = "amex"
133
133
  # Notional code
134
134
  ncod = Column(String)
135
135
  # Exchange ID
@@ -149,7 +149,7 @@ class _AmexItem(Base):
149
149
  # Security Type
150
150
  stis = Column(String)
151
151
  # currency
152
- curr = Column(String)
152
+ curr = Column(String)
153
153
  # float position
154
154
  zdiv = Column(String)
155
155
  # data type
@@ -182,4 +182,4 @@ class _AmexItem(Base):
182
182
 
183
183
  class Amex(UsStockMarket[AmexItem, _AmexItem]):
184
184
  def __init__(self, client):
185
- super().__init__(client, 'amex', '아멕스', 'https://new.real.download.dws.co.kr/common/master/amsmst.cod.zip')
185
+ super().__init__(client, "amex", "아멕스", "https://new.real.download.dws.co.kr/common/master/amsmst.cod.zip")