ksxt 0.0.7__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.
- ksxt/__init__.py +3 -1
- ksxt/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt/__pycache__/upbit.cpython-312.pyc +0 -0
- ksxt/api/__init__.py +26 -0
- ksxt/api/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/api/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt/api/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt/api/__pycache__/upbit.cpython-312.pyc +0 -0
- ksxt/api/auto/api_generator.py +54 -0
- ksxt/api/auto/bithumb.py +35 -0
- ksxt/api/auto/koreainvest.py +49 -0
- ksxt/api/auto/upbit.py +39 -0
- ksxt/api/bithumb.py +42 -0
- ksxt/api/koreainvest.py +40 -0
- ksxt/api/upbit.py +54 -0
- ksxt/async_/__init__.py +4 -0
- ksxt/async_/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/async_/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt/async_/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt/async_/__pycache__/upbit.cpython-312.pyc +0 -0
- ksxt/async_/base/__init__.py +0 -0
- ksxt/async_/base/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/async_/base/__pycache__/async_exchange.cpython-312.pyc +0 -0
- ksxt/async_/base/__pycache__/throttler.cpython-312.pyc +0 -0
- ksxt/async_/base/async_exchange.py +232 -0
- ksxt/async_/base/throttler.py +63 -0
- ksxt/async_/bithumb.py +455 -0
- ksxt/async_/koreainvest.py +849 -0
- ksxt/async_/upbit.py +488 -0
- ksxt/base/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/base/__pycache__/errors.cpython-312.pyc +0 -0
- ksxt/base/__pycache__/exchange.cpython-312.pyc +0 -0
- ksxt/base/__pycache__/rest_exchange.cpython-312.pyc +0 -0
- ksxt/base/__pycache__/types.cpython-312.pyc +0 -0
- ksxt/base/com_exchange.py +2 -2
- ksxt/base/errors.py +10 -0
- ksxt/base/exchange.py +188 -497
- ksxt/base/rest_exchange.py +297 -113
- ksxt/base/types.py +1 -36
- ksxt/bithumb.py +504 -0
- ksxt/config/__init__.py +2 -1
- ksxt/config/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/config/bithumb.toml +380 -0
- ksxt/config/koreainvest.toml +312 -0
- ksxt/config/token.toml +7 -0
- ksxt/config/upbit.toml +428 -0
- ksxt/koreainvest.py +409 -1055
- ksxt/market/__pycache__/base.cpython-312.pyc +0 -0
- ksxt/market/__pycache__/db.cpython-312.pyc +0 -0
- ksxt/market/__pycache__/logging.cpython-312.pyc +0 -0
- ksxt/market/__pycache__/manager.cpython-312.pyc +0 -0
- ksxt/market/__pycache__/markets.cpython-312.pyc +0 -0
- ksxt/market/base.py +50 -50
- ksxt/market/db.py +5 -4
- ksxt/market/krx/__pycache__/kosdaq.cpython-312.pyc +0 -0
- ksxt/market/krx/__pycache__/kospi.cpython-312.pyc +0 -0
- ksxt/market/krx/__pycache__/stock.cpython-312.pyc +0 -0
- ksxt/market/krx/kosdaq.py +150 -147
- ksxt/market/krx/kospi.py +179 -175
- ksxt/market/krx/stock.py +136 -134
- ksxt/market/logging.py +4 -4
- ksxt/market/manager.py +11 -13
- ksxt/market/markets.py +1 -1
- ksxt/market/us/__pycache__/amex.cpython-312.pyc +0 -0
- ksxt/market/us/__pycache__/nasdaq.cpython-312.pyc +0 -0
- ksxt/market/us/__pycache__/nyse.cpython-312.pyc +0 -0
- ksxt/market/us/__pycache__/stock.cpython-312.pyc +0 -0
- ksxt/market/us/amex.py +31 -31
- ksxt/market/us/nasdaq.py +31 -31
- ksxt/market/us/nyse.py +31 -31
- ksxt/market/us/stock.py +20 -28
- ksxt/models/__init__.py +16 -0
- ksxt/models/__pycache__/__init__.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/balance.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/cash.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/common.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/error.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/historical.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/market.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/order.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/orderbook.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/ticker.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/token.cpython-312.pyc +0 -0
- ksxt/models/__pycache__/transaction.cpython-312.pyc +0 -0
- ksxt/models/balance.py +30 -0
- ksxt/models/cash.py +15 -0
- ksxt/models/common.py +31 -0
- ksxt/models/error.py +13 -0
- ksxt/models/historical.py +26 -0
- ksxt/models/market.py +81 -0
- ksxt/models/order.py +42 -0
- ksxt/models/orderbook.py +32 -0
- ksxt/models/ticker.py +25 -0
- ksxt/models/token.py +14 -0
- ksxt/models/transaction.py +79 -0
- ksxt/parser/__pycache__/bithumb.cpython-312.pyc +0 -0
- ksxt/parser/__pycache__/koreainvest.cpython-312.pyc +0 -0
- ksxt/parser/__pycache__/parser.cpython-312.pyc +0 -0
- ksxt/parser/__pycache__/upbit.cpython-312.pyc +0 -0
- ksxt/parser/bithumb.py +300 -0
- ksxt/parser/koreainvest.py +323 -0
- ksxt/parser/parser.py +114 -0
- ksxt/parser/upbit.py +308 -0
- ksxt/upbit.py +499 -0
- ksxt/utils/__pycache__/safer.cpython-312.pyc +0 -0
- ksxt/utils/__pycache__/sorter.cpython-312.pyc +0 -0
- ksxt/utils/__pycache__/timer.cpython-312.pyc +0 -0
- ksxt/utils/safer.py +48 -0
- ksxt/utils/sorter.py +8 -0
- ksxt/utils/timer.py +47 -0
- {ksxt-0.0.7.dist-info → ksxt-0.0.9.dist-info}/METADATA +11 -1
- ksxt-0.0.9.dist-info/RECORD +119 -0
- {ksxt-0.0.7.dist-info → ksxt-0.0.9.dist-info}/WHEEL +1 -1
- ksxt/__pycache__/__init__.cpython-39.pyc +0 -0
- ksxt/__pycache__/koreainvest.cpython-39.pyc +0 -0
- ksxt/base/__pycache__/__init__.cpython-39.pyc +0 -0
- ksxt/base/__pycache__/exchange.cpython-39.pyc +0 -0
- ksxt/base/__pycache__/rest_exchange.cpython-39.pyc +0 -0
- ksxt/base/__pycache__/restexchange.cpython-39.pyc +0 -0
- ksxt/base/__pycache__/types.cpython-39.pyc +0 -0
- ksxt/base/api_response.py +0 -68
- ksxt/config/__pycache__/__init__.cpython-39.pyc +0 -0
- ksxt/config/tr_app.json +0 -381
- ksxt/config/tr_dev.json +0 -446
- ksxt/market/__pycache__/base.cpython-39.pyc +0 -0
- ksxt/market/__pycache__/db.cpython-39.pyc +0 -0
- ksxt/market/__pycache__/logging.cpython-39.pyc +0 -0
- ksxt/market/__pycache__/manager.cpython-39.pyc +0 -0
- ksxt/market/__pycache__/markets.cpython-39.pyc +0 -0
- ksxt/market/krx/__pycache__/kosdaq.cpython-39.pyc +0 -0
- ksxt/market/krx/__pycache__/kospi.cpython-39.pyc +0 -0
- ksxt/market/krx/__pycache__/stock.cpython-39.pyc +0 -0
- ksxt/market/us/__pycache__/amex.cpython-39.pyc +0 -0
- ksxt/market/us/__pycache__/nasdaq.cpython-39.pyc +0 -0
- ksxt/market/us/__pycache__/nyse.cpython-39.pyc +0 -0
- ksxt/market/us/__pycache__/stock.cpython-39.pyc +0 -0
- ksxt-0.0.7.dist-info/RECORD +0 -49
- {ksxt-0.0.7.dist-info → ksxt-0.0.9.dist-info}/LICENSE.txt +0 -0
- {ksxt-0.0.7.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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
"0": "제외",
|
25
|
+
"1": "대",
|
26
|
+
"2": "중",
|
27
|
+
"3": "소",
|
28
28
|
}
|
29
29
|
|
30
30
|
ETP_PROD_CLS_CODES = {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
"0": "해당없음",
|
32
|
+
"1": "투자회사형",
|
33
|
+
"2": "수익증권형",
|
34
|
+
"3": "ETN",
|
35
|
+
"4": "손실제한ETN",
|
36
36
|
}
|
37
37
|
|
38
38
|
SHORT_OVER_CLS_CODES = {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
"0": "해당없음",
|
40
|
+
"1": "지정예고",
|
41
|
+
"2": "지정",
|
42
|
+
"3": "지정연장(해제연기)",
|
43
43
|
}
|
44
44
|
|
45
45
|
MRKT_ALRM_CLS_CODES = {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
"00": "해당없음",
|
47
|
+
"01": "투자주의",
|
48
|
+
"02": "투자경고",
|
49
|
+
"03": "투자위험",
|
50
50
|
}
|
51
51
|
|
52
52
|
FLNG_CLS_CODES = {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
"00": "해당없음",
|
65
|
+
"01": "액면분할",
|
66
|
+
"02": "액면병합",
|
67
|
+
"99": "기타",
|
68
68
|
}
|
69
69
|
|
70
70
|
ICIC_CLS_CODES = {
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
"00": "해당없음",
|
72
|
+
"01": "유상증자",
|
73
|
+
"02": "무상증자",
|
74
|
+
"03": "유무상증자",
|
75
|
+
"99": "기타",
|
76
76
|
}
|
77
77
|
|
78
78
|
PRST_CLS_CODES = {
|
79
|
-
|
80
|
-
|
81
|
-
|
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[
|
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[
|
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
|
-
|
110
|
-
etp_prod_cls_code: Literal[
|
111
|
-
|
111
|
+
"""KRX 종목 여부"""
|
112
|
+
etp_prod_cls_code: Literal["0", "1", "2", "3"]
|
113
|
+
"""ETP 상품구분코드"""
|
112
114
|
krx100_issu_yn: bool
|
113
|
-
|
115
|
+
"""KRX100 종목 여부"""
|
114
116
|
krx_car_yn: bool
|
115
|
-
|
117
|
+
"""KRX 자동차 여부"""
|
116
118
|
krx_smcn_yn: bool
|
117
|
-
|
119
|
+
"""KRX 반도체 여부"""
|
118
120
|
krx_bio_yn: bool
|
119
|
-
|
121
|
+
"""KRX 바이오 여부"""
|
120
122
|
krx_bank_yn: bool
|
121
|
-
|
123
|
+
"""KRX 은행 여부"""
|
122
124
|
etpr_undt_objt_co_yn: bool
|
123
|
-
|
125
|
+
"""기업인수목적회사여부"""
|
124
126
|
krx_enrg_chms_yn: bool
|
125
|
-
|
127
|
+
"""KRX 에너지 화학 여부"""
|
126
128
|
krx_stel_yn: bool
|
127
|
-
|
128
|
-
short_over_cls_code: Literal[
|
129
|
-
|
129
|
+
"""KRX 철강 여부"""
|
130
|
+
short_over_cls_code: Literal["0", "1", "2", "3"]
|
131
|
+
"""단기과열종목구분코드"""
|
130
132
|
krx_medi_cmnc_yn: bool
|
131
|
-
|
133
|
+
"""KRX 미디어 통신 여부"""
|
132
134
|
krx_cnst_yn: bool
|
133
|
-
|
135
|
+
"""KRX 건설 여부"""
|
134
136
|
krx_scrt_yn: bool
|
135
|
-
|
137
|
+
"""KRX 증권 구분"""
|
136
138
|
krx_ship_yn: bool
|
137
|
-
|
139
|
+
"""KRX 선박 구분"""
|
138
140
|
krx_insu_yn: bool
|
139
|
-
|
141
|
+
"""KRX섹터지수 보험여부"""
|
140
142
|
krx_trnp_yn: bool
|
141
|
-
|
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[
|
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[
|
163
|
-
|
164
|
-
fcam_mod_cls_code: Literal[
|
165
|
-
|
166
|
-
icic_cls_code: Literal[
|
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[
|
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
|
-
|
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
|
-
|
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(
|
260
|
-
t_dbitem = TypeVar(
|
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,
|
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[
|
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[
|
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[
|
60
|
-
|
59
|
+
return self["amex"] # type: ignore
|
60
|
+
|
61
61
|
@property
|
62
62
|
def session(self) -> Session:
|
63
63
|
"""세션"""
|
@@ -70,7 +70,7 @@ class MarketManager(KsxtLogger):
|
|
70
70
|
def __init__(
|
71
71
|
self,
|
72
72
|
db_path: Optional[str] = None,
|
73
|
-
auto_sync: bool =
|
73
|
+
auto_sync: bool = False,
|
74
74
|
):
|
75
75
|
if db_path is None:
|
76
76
|
db_path = path.join(tempfile.gettempdir(), f".ksxt-cache_market.{datetime.now().strftime('%Y%m%d')}.db")
|
@@ -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
Binary file
|
Binary file
|
Binary file
|
Binary file
|
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
|
-
(
|
52
|
-
(
|
53
|
-
(
|
54
|
-
(
|
55
|
-
(
|
56
|
-
(
|
57
|
-
(
|
58
|
-
(
|
59
|
-
(
|
60
|
-
(
|
61
|
-
(
|
62
|
-
(
|
63
|
-
(
|
64
|
-
(
|
65
|
-
(
|
66
|
-
(
|
67
|
-
(
|
68
|
-
(
|
69
|
-
(
|
70
|
-
(
|
71
|
-
(
|
72
|
-
(
|
73
|
-
(
|
74
|
-
(
|
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[
|
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[
|
118
|
+
sjong: Literal["0", "1"]
|
119
119
|
# Tick Size Type
|
120
120
|
ttyp: str
|
121
121
|
#
|
122
|
-
etyp: Literal[
|
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__ =
|
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,
|
185
|
+
super().__init__(client, "amex", "아멕스", "https://new.real.download.dws.co.kr/common/master/amsmst.cod.zip")
|