MultiFactor 0.3.1__tar.gz → 0.3.3__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.
- {multifactor-0.3.1 → multifactor-0.3.3}/PKG-INFO +19 -2
- {multifactor-0.3.1 → multifactor-0.3.3}/README.md +12 -1
- {multifactor-0.3.1 → multifactor-0.3.3}/pyproject.toml +7 -1
- multifactor-0.3.3/src/MultiFactor/Visual.py +94 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/__init__.py +3 -1
- multifactor-0.3.3/src/MultiFactor/vtreemap_kr.py +130 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor.egg-info/PKG-INFO +19 -2
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor.egg-info/SOURCES.txt +1 -0
- multifactor-0.3.3/src/MultiFactor.egg-info/requires.txt +11 -0
- multifactor-0.3.1/src/MultiFactor/Visual.py +0 -54
- multifactor-0.3.1/src/MultiFactor.egg-info/requires.txt +0 -5
- {multifactor-0.3.1 → multifactor-0.3.3}/setup.cfg +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/core.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/momentum.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/momentum_one.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/quality.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/quality_one.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/score.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/score_adj_weight.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/stockinfo.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/us_core.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/us_momentum.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/us_quality.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/us_stockinfo.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/us_value.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/value.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/value_one.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vcompare_idx.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vfinance_kr.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vheatmap_idx.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vheatmap_kr.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vheatmap_us.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vmulti_idx.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vmulti_kr.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vmulti_us.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vret_idx.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vret_kr.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vret_us.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vtargetprice_us.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor/vtreemap_us.py +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor.egg-info/dependency_links.txt +0 -0
- {multifactor-0.3.1 → multifactor-0.3.3}/src/MultiFactor.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MultiFactor
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: 멀티팩터 기반 주식 데이터 수집 패키지
|
|
5
5
|
Author-email: HANHO <hanhoman@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -14,6 +14,12 @@ Requires-Dist: pandas
|
|
|
14
14
|
Requires-Dist: numpy
|
|
15
15
|
Requires-Dist: matplotlib
|
|
16
16
|
Requires-Dist: yfinance
|
|
17
|
+
Requires-Dist: requests
|
|
18
|
+
Requires-Dist: seaborn
|
|
19
|
+
Requires-Dist: plotly
|
|
20
|
+
Requires-Dist: ipywidgets
|
|
21
|
+
Requires-Dist: ipython
|
|
22
|
+
Requires-Dist: anywidget
|
|
17
23
|
|
|
18
24
|
# MultiFactor 📈
|
|
19
25
|
|
|
@@ -105,7 +111,7 @@ mf_us = MultiFactorUS(N=50)
|
|
|
105
111
|
시각화 분석 객체는 다음 코드로 생성합니다.
|
|
106
112
|
|
|
107
113
|
```python
|
|
108
|
-
|
|
114
|
+
vis = Visual()
|
|
109
115
|
```
|
|
110
116
|
|
|
111
117
|
<br>
|
|
@@ -1231,6 +1237,7 @@ mf_us.get_Ngroup(df, Ngroup=10)
|
|
|
1231
1237
|
| 누적 수익률 | 미국주식 누적수익률 비교 차트 | vis.ret_us |
|
|
1232
1238
|
| 실적재무 종합 | 국내주식 실적 및 밸류 추이 | vis.finance_kr |
|
|
1233
1239
|
| 업종종목 트리맵 | 미국주식 주요종목 주가등락율 트리맵 | vis.treemap_us |
|
|
1240
|
+
| 업종종목 트리맵 | 국내주식 주요종목 주가등락율 트리맵 | vis.treemap_kr |
|
|
1234
1241
|
| 수익률 히트맵 | 지수 연월 수익률 히트맵 | vis.heatmap_idx |
|
|
1235
1242
|
| 수익률 히트맵 | 국내주식 연월 수익률 히트맵 | vis.heatmap_kr |
|
|
1236
1243
|
| 수익률 히트맵 | 미국주식 연월 수익률 히트맵 | vis.heatmap_us |
|
|
@@ -1336,6 +1343,16 @@ vis.treemap_us()
|
|
|
1336
1343
|
|
|
1337
1344
|
<br>
|
|
1338
1345
|
|
|
1346
|
+
⑩ (업종종목 트리맵) 국내주식 주요종목 주가등락율 트리맵
|
|
1347
|
+
|
|
1348
|
+
구글 Colab에서 다음 코드로 국내주식 주가등락률 트리맵을 출력합니다.
|
|
1349
|
+
|
|
1350
|
+
```python
|
|
1351
|
+
vis.treemap_kr()
|
|
1352
|
+
```
|
|
1353
|
+
|
|
1354
|
+
<br>
|
|
1355
|
+
|
|
1339
1356
|
⑩ (수익률 히트맵) 지수 연월 수익률 히트맵
|
|
1340
1357
|
|
|
1341
1358
|
```python
|
|
@@ -88,7 +88,7 @@ mf_us = MultiFactorUS(N=50)
|
|
|
88
88
|
시각화 분석 객체는 다음 코드로 생성합니다.
|
|
89
89
|
|
|
90
90
|
```python
|
|
91
|
-
|
|
91
|
+
vis = Visual()
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
<br>
|
|
@@ -1214,6 +1214,7 @@ mf_us.get_Ngroup(df, Ngroup=10)
|
|
|
1214
1214
|
| 누적 수익률 | 미국주식 누적수익률 비교 차트 | vis.ret_us |
|
|
1215
1215
|
| 실적재무 종합 | 국내주식 실적 및 밸류 추이 | vis.finance_kr |
|
|
1216
1216
|
| 업종종목 트리맵 | 미국주식 주요종목 주가등락율 트리맵 | vis.treemap_us |
|
|
1217
|
+
| 업종종목 트리맵 | 국내주식 주요종목 주가등락율 트리맵 | vis.treemap_kr |
|
|
1217
1218
|
| 수익률 히트맵 | 지수 연월 수익률 히트맵 | vis.heatmap_idx |
|
|
1218
1219
|
| 수익률 히트맵 | 국내주식 연월 수익률 히트맵 | vis.heatmap_kr |
|
|
1219
1220
|
| 수익률 히트맵 | 미국주식 연월 수익률 히트맵 | vis.heatmap_us |
|
|
@@ -1319,6 +1320,16 @@ vis.treemap_us()
|
|
|
1319
1320
|
|
|
1320
1321
|
<br>
|
|
1321
1322
|
|
|
1323
|
+
⑩ (업종종목 트리맵) 국내주식 주요종목 주가등락율 트리맵
|
|
1324
|
+
|
|
1325
|
+
구글 Colab에서 다음 코드로 국내주식 주가등락률 트리맵을 출력합니다.
|
|
1326
|
+
|
|
1327
|
+
```python
|
|
1328
|
+
vis.treemap_kr()
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
<br>
|
|
1332
|
+
|
|
1322
1333
|
⑩ (수익률 히트맵) 지수 연월 수익률 히트맵
|
|
1323
1334
|
|
|
1324
1335
|
```python
|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
# 1. PyPI에 등록될 배포 이름 (pip install MultiFactor)
|
|
7
7
|
name = "MultiFactor"
|
|
8
|
-
version = "0.3.
|
|
8
|
+
version = "0.3.3"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name="HANHO", email="hanhoman@gmail.com" },
|
|
11
11
|
]
|
|
@@ -27,6 +27,12 @@ dependencies = [
|
|
|
27
27
|
"numpy",
|
|
28
28
|
"matplotlib",
|
|
29
29
|
"yfinance",
|
|
30
|
+
"requests",
|
|
31
|
+
"seaborn",
|
|
32
|
+
"plotly",
|
|
33
|
+
"ipywidgets",
|
|
34
|
+
"ipython",
|
|
35
|
+
"anywidget",
|
|
30
36
|
]
|
|
31
37
|
|
|
32
38
|
# 3. src 폴더 안의 패키지를 자동으로 찾도록 설정
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import importlib
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
from . import vmulti_idx
|
|
5
|
+
from . import vmulti_kr
|
|
6
|
+
from . import vmulti_us
|
|
7
|
+
from . import vcompare_idx
|
|
8
|
+
from . import vret_idx
|
|
9
|
+
from . import vret_kr
|
|
10
|
+
from . import vret_us
|
|
11
|
+
from . import vfinance_kr
|
|
12
|
+
from . import vheatmap_idx
|
|
13
|
+
from . import vtreemap_us
|
|
14
|
+
from . import vtreemap_kr
|
|
15
|
+
from . import vheatmap_kr
|
|
16
|
+
from . import vheatmap_us
|
|
17
|
+
from . import vtargetprice_us
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _set_korean_font():
|
|
21
|
+
try:
|
|
22
|
+
fm = importlib.import_module("matplotlib.font_manager")
|
|
23
|
+
plt = importlib.import_module("matplotlib.pyplot")
|
|
24
|
+
except ImportError:
|
|
25
|
+
return None
|
|
26
|
+
|
|
27
|
+
font_paths = [
|
|
28
|
+
"/usr/share/fonts/truetype/nanum/NanumGothic.ttf",
|
|
29
|
+
"/usr/share/fonts/truetype/nanum/NanumBarunGothic.ttf",
|
|
30
|
+
"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
|
|
31
|
+
"/usr/share/fonts/opentype/noto/NotoSansCJKkr-Regular.otf",
|
|
32
|
+
"C:/Windows/Fonts/malgun.ttf",
|
|
33
|
+
"C:/Windows/Fonts/malgunbd.ttf",
|
|
34
|
+
"/System/Library/Fonts/AppleSDGothicNeo.ttc",
|
|
35
|
+
"/Library/Fonts/AppleGothic.ttf",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
for font_path in font_paths:
|
|
39
|
+
if os.path.exists(font_path):
|
|
40
|
+
fm.fontManager.addfont(font_path)
|
|
41
|
+
font_name = fm.FontProperties(fname=font_path).get_name()
|
|
42
|
+
plt.rcParams["font.family"] = font_name
|
|
43
|
+
plt.rcParams["axes.unicode_minus"] = False
|
|
44
|
+
return font_name
|
|
45
|
+
|
|
46
|
+
plt.rcParams["axes.unicode_minus"] = False
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Visual:
|
|
51
|
+
def __init__(self):
|
|
52
|
+
self.korean_font = _set_korean_font()
|
|
53
|
+
|
|
54
|
+
def multi_idx(self):
|
|
55
|
+
vmulti_idx.multi_idx()
|
|
56
|
+
|
|
57
|
+
def multi_kr(self):
|
|
58
|
+
vmulti_kr.multi_kr()
|
|
59
|
+
|
|
60
|
+
def multi_us(self):
|
|
61
|
+
vmulti_us.multi_us()
|
|
62
|
+
|
|
63
|
+
def compare_idx(self):
|
|
64
|
+
vcompare_idx.compare_idx()
|
|
65
|
+
|
|
66
|
+
def ret_idx(self):
|
|
67
|
+
vret_idx.ret_idx()
|
|
68
|
+
|
|
69
|
+
def ret_kr(self):
|
|
70
|
+
vret_kr.ret_kr()
|
|
71
|
+
|
|
72
|
+
def ret_us(self):
|
|
73
|
+
vret_us.ret_us()
|
|
74
|
+
|
|
75
|
+
def finance_kr(self):
|
|
76
|
+
vfinance_kr.finance_kr()
|
|
77
|
+
|
|
78
|
+
def heatmap_idx(self):
|
|
79
|
+
vheatmap_idx.heatmap_idx()
|
|
80
|
+
|
|
81
|
+
def treemap_us(self):
|
|
82
|
+
vtreemap_us.treemap_us()
|
|
83
|
+
|
|
84
|
+
def treemap_kr(self):
|
|
85
|
+
vtreemap_kr.treemap_kr()
|
|
86
|
+
|
|
87
|
+
def heatmap_kr(self):
|
|
88
|
+
vheatmap_kr.heatmap_kr()
|
|
89
|
+
|
|
90
|
+
def heatmap_us(self):
|
|
91
|
+
vheatmap_us.heatmap_us()
|
|
92
|
+
|
|
93
|
+
def targetprice_us(self):
|
|
94
|
+
vtargetprice_us.targetprice_us()
|
|
@@ -15,5 +15,7 @@ from .core import MultiFactorKR
|
|
|
15
15
|
from .us_core import MultiFactorUS
|
|
16
16
|
from .Visual import Visual
|
|
17
17
|
|
|
18
|
+
__version__ = "0.3.3"
|
|
19
|
+
|
|
18
20
|
# 패키지를 import할 때 노출할 항목을 명시합니다.
|
|
19
|
-
__all__ = ['MultiFactorKR', 'MultiFactorUS', 'Visual']
|
|
21
|
+
__all__ = ['MultiFactorKR', 'MultiFactorUS', 'Visual', '__version__']
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
from io import StringIO
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import FinanceDataReader as fdr
|
|
6
|
+
import plotly.express as px
|
|
7
|
+
import plotly.graph_objects as go
|
|
8
|
+
import ipywidgets as widgets
|
|
9
|
+
from IPython.display import clear_output, display
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _enable_colab_widgets():
|
|
13
|
+
try:
|
|
14
|
+
from google.colab import output
|
|
15
|
+
except ImportError:
|
|
16
|
+
return False
|
|
17
|
+
|
|
18
|
+
output.enable_custom_widget_manager()
|
|
19
|
+
return True
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _generate_sector_data(prompt):
|
|
23
|
+
try:
|
|
24
|
+
from google.colab import ai
|
|
25
|
+
except ImportError as exc:
|
|
26
|
+
raise RuntimeError("google.colab.ai를 사용할 수 있는 구글 Colab 환경에서 실행해주세요.") from exc
|
|
27
|
+
|
|
28
|
+
response = ai.generate_text(prompt)
|
|
29
|
+
sector = pd.read_csv(StringIO(response), names=["ticker_name", "sector"], on_bad_lines="skip")
|
|
30
|
+
sector["ticker_name"] = sector["ticker_name"].astype(str).str.strip()
|
|
31
|
+
sector["sector"] = sector["sector"].astype(str).str.strip()
|
|
32
|
+
sector = sector[(sector["ticker_name"] != "") & (sector["sector"] != "")]
|
|
33
|
+
return sector.drop_duplicates(subset=["ticker_name"], keep="first")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def treemap_kr():
|
|
37
|
+
_enable_colab_widgets()
|
|
38
|
+
|
|
39
|
+
print("코스피 주식 데이터를 가져오는 중입니다...")
|
|
40
|
+
required_cols = ["Code", "Name", "Marcap", "ChagesRatio", "Close"]
|
|
41
|
+
df_base = fdr.StockListing("KOSPI")
|
|
42
|
+
|
|
43
|
+
missing_cols = [col for col in required_cols if col not in df_base.columns]
|
|
44
|
+
if missing_cols:
|
|
45
|
+
print(f"필수 컬럼을 찾을 수 없습니다: {', '.join(missing_cols)}")
|
|
46
|
+
return
|
|
47
|
+
|
|
48
|
+
df_base = df_base[required_cols].copy()
|
|
49
|
+
df_base.columns = ["ticker", "ticker_name", "mktcap", "ret", "close"]
|
|
50
|
+
df_base["ticker_name"] = df_base["ticker_name"].astype(str).str.strip()
|
|
51
|
+
df_base = df_base.dropna(subset=["ticker_name", "mktcap", "ret", "close"])
|
|
52
|
+
df_base = df_base[df_base["mktcap"] > 0]
|
|
53
|
+
|
|
54
|
+
if df_base.empty:
|
|
55
|
+
print("트리맵을 생성할 코스피 데이터를 찾을 수 없습니다.")
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
print("데이터 로드 완료. 아래 드롭다운에서 분석할 종목 수를 선택하세요.")
|
|
59
|
+
|
|
60
|
+
@widgets.interact(top_n=widgets.Dropdown(options=[50, 100, 200], value=100, description="종목 수:"))
|
|
61
|
+
def generate_stock_treemap(top_n):
|
|
62
|
+
df = df_base.sort_values(by="mktcap", ascending=False).head(top_n).copy()
|
|
63
|
+
stock_names = "\n".join(df["ticker_name"])
|
|
64
|
+
|
|
65
|
+
prompt = f"""
|
|
66
|
+
#지시문
|
|
67
|
+
- 다음 종목명의 종목섹터를 알고 싶습니다.
|
|
68
|
+
- 종목섹터는 한글로 작성해주세요.
|
|
69
|
+
- 종목별로 섹터가 여러개로 분류되면, 대표섹터 하나만 생성합니다. (예: 반도체/IT이면, 반도체만 생성)
|
|
70
|
+
- 출력형식을 정확히 지켜서 작성해주세요. 형식이 틀리면 안 됩니다.
|
|
71
|
+
|
|
72
|
+
#출력형식
|
|
73
|
+
<종목명>,<섹터명>
|
|
74
|
+
<종목명>,<섹터명>
|
|
75
|
+
|
|
76
|
+
#종목명
|
|
77
|
+
{stock_names}
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
max_retries = 3
|
|
81
|
+
sector = pd.DataFrame(columns=["ticker_name", "sector"])
|
|
82
|
+
|
|
83
|
+
for retry_count in range(max_retries):
|
|
84
|
+
try:
|
|
85
|
+
print(f"\r[Gemini API] 업종 정보 추론 중... (시도 {retry_count + 1}/{max_retries})", end="")
|
|
86
|
+
sector_temp = _generate_sector_data(prompt)
|
|
87
|
+
test_merge = df.merge(sector_temp, on="ticker_name", how="left")
|
|
88
|
+
nan_count = test_merge["sector"].isna().sum() + (test_merge["sector"] == "nan").sum()
|
|
89
|
+
|
|
90
|
+
if nan_count < len(df) * 0.1:
|
|
91
|
+
sector = sector_temp
|
|
92
|
+
print(" -> 성공!")
|
|
93
|
+
break
|
|
94
|
+
except Exception as exc:
|
|
95
|
+
if retry_count == max_retries - 1:
|
|
96
|
+
print(f"\n[오류] 업종 정보 추론에 실패했습니다. 기타 업종으로 진행합니다. ({exc})")
|
|
97
|
+
|
|
98
|
+
df_final = df.merge(sector, on="ticker_name", how="left")
|
|
99
|
+
df_final["sector"] = df_final["sector"].fillna("기타 업종").replace("nan", "기타 업종")
|
|
100
|
+
df_final["mktcap_log"] = np.log10(df_final["mktcap"])
|
|
101
|
+
|
|
102
|
+
custom_colorscale = [
|
|
103
|
+
[0.0, "rgb(44, 95, 233)"],
|
|
104
|
+
[0.4, "rgb(151, 185, 255)"],
|
|
105
|
+
[0.5, "rgb(255, 255, 255)"],
|
|
106
|
+
[0.6, "rgb(255, 165, 165)"],
|
|
107
|
+
[1.0, "rgb(235, 41, 41)"],
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
fig = px.treemap(
|
|
111
|
+
df_final,
|
|
112
|
+
path=["sector", "ticker_name"],
|
|
113
|
+
values="mktcap_log",
|
|
114
|
+
color="ret",
|
|
115
|
+
color_continuous_scale=custom_colorscale,
|
|
116
|
+
color_continuous_midpoint=0,
|
|
117
|
+
title=f"코스피 시가총액 상위 {top_n} 종목 업종/종목별 등락률 트리맵",
|
|
118
|
+
hover_data={"ret": ":.2f", "mktcap": ":,", "close": ":,", "ticker": True, "mktcap_log": False},
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
fig.update_layout(
|
|
122
|
+
width=1000,
|
|
123
|
+
height=700,
|
|
124
|
+
title_font_size=16,
|
|
125
|
+
title_font_family="Malgun Gothic",
|
|
126
|
+
margin=dict(t=50, l=10, r=10, b=10),
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
clear_output(wait=True)
|
|
130
|
+
display(go.FigureWidget(fig))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MultiFactor
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: 멀티팩터 기반 주식 데이터 수집 패키지
|
|
5
5
|
Author-email: HANHO <hanhoman@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -14,6 +14,12 @@ Requires-Dist: pandas
|
|
|
14
14
|
Requires-Dist: numpy
|
|
15
15
|
Requires-Dist: matplotlib
|
|
16
16
|
Requires-Dist: yfinance
|
|
17
|
+
Requires-Dist: requests
|
|
18
|
+
Requires-Dist: seaborn
|
|
19
|
+
Requires-Dist: plotly
|
|
20
|
+
Requires-Dist: ipywidgets
|
|
21
|
+
Requires-Dist: ipython
|
|
22
|
+
Requires-Dist: anywidget
|
|
17
23
|
|
|
18
24
|
# MultiFactor 📈
|
|
19
25
|
|
|
@@ -105,7 +111,7 @@ mf_us = MultiFactorUS(N=50)
|
|
|
105
111
|
시각화 분석 객체는 다음 코드로 생성합니다.
|
|
106
112
|
|
|
107
113
|
```python
|
|
108
|
-
|
|
114
|
+
vis = Visual()
|
|
109
115
|
```
|
|
110
116
|
|
|
111
117
|
<br>
|
|
@@ -1231,6 +1237,7 @@ mf_us.get_Ngroup(df, Ngroup=10)
|
|
|
1231
1237
|
| 누적 수익률 | 미국주식 누적수익률 비교 차트 | vis.ret_us |
|
|
1232
1238
|
| 실적재무 종합 | 국내주식 실적 및 밸류 추이 | vis.finance_kr |
|
|
1233
1239
|
| 업종종목 트리맵 | 미국주식 주요종목 주가등락율 트리맵 | vis.treemap_us |
|
|
1240
|
+
| 업종종목 트리맵 | 국내주식 주요종목 주가등락율 트리맵 | vis.treemap_kr |
|
|
1234
1241
|
| 수익률 히트맵 | 지수 연월 수익률 히트맵 | vis.heatmap_idx |
|
|
1235
1242
|
| 수익률 히트맵 | 국내주식 연월 수익률 히트맵 | vis.heatmap_kr |
|
|
1236
1243
|
| 수익률 히트맵 | 미국주식 연월 수익률 히트맵 | vis.heatmap_us |
|
|
@@ -1336,6 +1343,16 @@ vis.treemap_us()
|
|
|
1336
1343
|
|
|
1337
1344
|
<br>
|
|
1338
1345
|
|
|
1346
|
+
⑩ (업종종목 트리맵) 국내주식 주요종목 주가등락율 트리맵
|
|
1347
|
+
|
|
1348
|
+
구글 Colab에서 다음 코드로 국내주식 주가등락률 트리맵을 출력합니다.
|
|
1349
|
+
|
|
1350
|
+
```python
|
|
1351
|
+
vis.treemap_kr()
|
|
1352
|
+
```
|
|
1353
|
+
|
|
1354
|
+
<br>
|
|
1355
|
+
|
|
1339
1356
|
⑩ (수익률 히트맵) 지수 연월 수익률 히트맵
|
|
1340
1357
|
|
|
1341
1358
|
```python
|
|
@@ -29,6 +29,7 @@ src/MultiFactor/vret_idx.py
|
|
|
29
29
|
src/MultiFactor/vret_kr.py
|
|
30
30
|
src/MultiFactor/vret_us.py
|
|
31
31
|
src/MultiFactor/vtargetprice_us.py
|
|
32
|
+
src/MultiFactor/vtreemap_kr.py
|
|
32
33
|
src/MultiFactor/vtreemap_us.py
|
|
33
34
|
src/MultiFactor.egg-info/PKG-INFO
|
|
34
35
|
src/MultiFactor.egg-info/SOURCES.txt
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
from . import vmulti_idx
|
|
2
|
-
from . import vmulti_kr
|
|
3
|
-
from . import vmulti_us
|
|
4
|
-
from . import vcompare_idx
|
|
5
|
-
from . import vret_idx
|
|
6
|
-
from . import vret_kr
|
|
7
|
-
from . import vret_us
|
|
8
|
-
from . import vfinance_kr
|
|
9
|
-
from . import vheatmap_idx
|
|
10
|
-
from . import vtreemap_us
|
|
11
|
-
from . import vheatmap_kr
|
|
12
|
-
from . import vheatmap_us
|
|
13
|
-
from . import vtargetprice_us
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class Visual:
|
|
17
|
-
def multi_idx(self):
|
|
18
|
-
vmulti_idx.multi_idx()
|
|
19
|
-
|
|
20
|
-
def multi_kr(self):
|
|
21
|
-
vmulti_kr.multi_kr()
|
|
22
|
-
|
|
23
|
-
def multi_us(self):
|
|
24
|
-
vmulti_us.multi_us()
|
|
25
|
-
|
|
26
|
-
def compare_idx(self):
|
|
27
|
-
vcompare_idx.compare_idx()
|
|
28
|
-
|
|
29
|
-
def ret_idx(self):
|
|
30
|
-
vret_idx.ret_idx()
|
|
31
|
-
|
|
32
|
-
def ret_kr(self):
|
|
33
|
-
vret_kr.ret_kr()
|
|
34
|
-
|
|
35
|
-
def ret_us(self):
|
|
36
|
-
vret_us.ret_us()
|
|
37
|
-
|
|
38
|
-
def finance_kr(self):
|
|
39
|
-
vfinance_kr.finance_kr()
|
|
40
|
-
|
|
41
|
-
def heatmap_idx(self):
|
|
42
|
-
vheatmap_idx.heatmap_idx()
|
|
43
|
-
|
|
44
|
-
def treemap_us(self):
|
|
45
|
-
vtreemap_us.treemap_us()
|
|
46
|
-
|
|
47
|
-
def heatmap_kr(self):
|
|
48
|
-
vheatmap_kr.heatmap_kr()
|
|
49
|
-
|
|
50
|
-
def heatmap_us(self):
|
|
51
|
-
vheatmap_us.heatmap_us()
|
|
52
|
-
|
|
53
|
-
def targetprice_us(self):
|
|
54
|
-
vtargetprice_us.targetprice_us()
|
|
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
|