Skip to content

Commit

Permalink
update book
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunyulhenry committed Mar 17, 2020
1 parent 017c2f3 commit 3f5ecb1
Show file tree
Hide file tree
Showing 22 changed files with 297 additions and 819 deletions.
2 changes: 2 additions & 0 deletions _output.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ bookdown::gitbook:
edit: null
download: no
split_bib: no
includes:
after_body: disqus.html

11 changes: 11 additions & 0 deletions disqus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div id="disqus_thread"></div>
<script>
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://quant_cookbook.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
88 changes: 44 additions & 44 deletions docs/04-crawling.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,26 @@ print(data_title)


```
## [1] "켐트로스, 특별관계자 지분변동"
## [2] "에스넷, 15억원 규모 자사주 취득 "
## [3] "우원개발 에스케이건설과 354억원 계"
## [4] "[제로금리시대-증시] 대폭락 응급처방"
## [5] "알엔투테크놀로지, 20억원 규모 자사"
## [6] "톱텍-레몬 \"방역마스크 월 1억개 정"
## [7] "'대원강업' 5% 이상 상승, 주가 "
## [8] "'키네마스터' 10% 이상 상승, 전"
## [9] "GST, 20억원 규모 자사주 취득 "
## [10] "'엘앤씨바이오' 10% 이상 상승, "
## [11] "[인사]KR투자증권"
## [12] "'대한해운' 5% 이상 상승, 외국인"
## [13] "자이글, 2020년 흑자전환 경영 선"
## [14] "필로시스생명과학, 라이브저축은행에 대"
## [15] "[종목톡톡]랩지노믹스 \"진단키트 美F"
## [16] "[특징주] 신신제약, 미국 보훈조달시"
## [17] "엘앤씨바이오, 주가 반등 현재는 +1"
## [18] "한국테크놀로지-SK플래닛, ‘지갑 없"
## [19] "하이즈항공, 16억원 규모 자사주 매"
## [20] "코텍, 50억원 규모 자사주 취득 결"
## [1] "[사진]'코스피 내리고, 코스닥 오르"
## [2] "[사진]'코스닥 오르고, 코스피 내리"
## [3] "[포토]원·달러 환율 17.5원 급등"
## [4] "[머니S포토] 충격적인 금융시장"
## [5] "[사진]'녹아내린 코스피'"
## [6] "[사진]코스피 폭락, 원달러환율 폭등"
## [7] "[머니S포토] 1670선대로 후퇴한 "
## [8] "초저금리 시대 투자…ELS·DLS 미"
## [9] "17개국 러브콜…코로나19 진단키트 "
## [10] "[사진]1670선까지 밀린 코스피.."
## [11] "코스피 1700선 깨져 폭락, 환율은"
## [12] "[머니S포토] 코스피, 외국인 매도에"
## [13] "[사진]2.4% 폭락한 코스피...1"
## [14] "[머니S포토] 코스피 1700선 붕괴"
## [15] "[사진]1,670선까지 밀린 코스피"
## [16] "에스에이엠티, 자사주 100만주 취득"
## [17] "미국 대폭락 속 중국증시 약보합 마감"
## [18] "[사진]연일 폭락하는 코스피"
## [19] "코스피, 외국인 1조 매도에 2.5%"
## [20] "코스피, 1670선 후퇴...외국인 "
```

### 기업공시채널에서 오늘의 공시 불러오기
Expand Down Expand Up @@ -432,18 +432,18 @@ print(head(table))
```
## N 종목명 현재가 전일비 등락률 액면가
## 1 NA
## 2 1 삼성전자 48,200 700 -1.43% 100
## 3 2 SK하이닉스 81,700 1,100 +1.36% 5,000
## 4 3 삼성전자우 40,600 400 -0.98% 100
## 5 4 삼성바이오로직스 420,000 10,000 -2.33% 2,500
## 6 5 NAVER 149,500 5,500 -3.55% 100
## 2 1 삼성전자 47,300 1,600 -3.27% 100
## 3 2 SK하이닉스 80,400 200 -0.25% 5,000
## 4 3 삼성전자우 39,650 1,350 -3.29% 100
## 5 4 삼성바이오로직스 417,500 12,500 -2.91% 2,500
## 6 5 NAVER 151,000 4,000 -2.58% 100
## 시가총액 상장주식수 외국인비율 거래량 PER
## 1 NA <NA>
## 2 2,877,435 5,969,783 55.66 37,551,181 15.22
## 3 594,778 728,002 49.32 5,844,707 29.55
## 4 334,092 822,887 89.40 3,332,058 12.82
## 5 277,893 66,165 10.55 354,850 136.94
## 6 245,574 164,263 57.92 721,594 42.26
## 2 2,823,707 5,969,783 55.66 50,591,171 14.94
## 3 585,314 728,002 49.32 7,077,377 29.08
## 4 326,275 822,887 89.40 4,636,530 12.52
## 5 276,239 66,165 10.55 419,463 136.13
## 6 248,038 164,263 57.92 947,528 42.68
## ROE 토론실
## 1 <NA> NA
## 2 8.69 NA
Expand All @@ -464,26 +464,26 @@ print(head(table))

```
## N 종목명 현재가 전일비 등락률 액면가
## 2 1 삼성전자 48,200 700 -1.43% 100
## 3 2 SK하이닉스 81,700 1,100 +1.36% 5,000
## 4 3 삼성전자우 40,600 400 -0.98% 100
## 5 4 삼성바이오로직스 420,000 10,000 -2.33% 2,500
## 6 5 NAVER 149,500 5,500 -3.55% 100
## 10 6 셀트리온 170,500 5,000 +3.02% 1,000
## 2 1 삼성전자 47,300 1,600 -3.27% 100
## 3 2 SK하이닉스 80,400 200 -0.25% 5,000
## 4 3 삼성전자우 39,650 1,350 -3.29% 100
## 5 4 삼성바이오로직스 417,500 12,500 -2.91% 2,500
## 6 5 NAVER 151,000 4,000 -2.58% 100
## 10 6 LG화학 306,500 6,000 -1.92% 5,000
## 시가총액 상장주식수 외국인비율 거래량 PER
## 2 2,877,435 5,969,783 55.66 37,551,181 15.22
## 3 594,778 728,002 49.32 5,844,707 29.55
## 4 334,092 822,887 89.40 3,332,058 12.82
## 5 277,893 66,165 10.55 354,850 136.94
## 6 245,574 164,263 57.92 721,594 42.26
## 10 218,831 128,347 20.54 1,175,695 93.02
## 2 2,823,707 5,969,783 55.66 50,591,171 14.94
## 3 585,314 728,002 49.32 7,077,377 29.08
## 4 326,275 822,887 89.40 4,636,530 12.52
## 5 276,239 66,165 10.55 419,463 136.13
## 6 248,038 164,263 57.92 947,528 42.68
## 10 216,366 70,592 38.63 816,489 76.57
## ROE
## 2 8.69
## 3 4.25
## 4 N/A
## 5 4.77
## 6 10.56
## 10 10.84
## 10 1.84
```

이제 필요한 정보는 6자리 티커입니다. 티커 역시 개발자 도구 화면을 통해 tbody → td → a 태그의 href 속성에 위치하고 있음을 알고 있습니다. 티커를 추출하는 코드는 다음과 같습니다.
Expand Down Expand Up @@ -553,7 +553,7 @@ print(head(symbol, 10))

```
## [1] "005930" "000660" "005935" "207940" "035420"
## [6] "068270" "051910" "005380" "051900" "006400"
## [6] "051910" "068270" "005380" "051900" "006400"
```

`unique()` 함수를 이용해 중복되는 티커를 제거하면 우리가 원하는 티커 부분만 깔끔하게 정리됩니다. 해당 내용을 위에서 구한 테이블에 입력한 후 데이터를 다듬는 과정은 다음과 같습니다.
Expand Down
14 changes: 7 additions & 7 deletions docs/05-crawling_practice.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ print(down_sector)
## 1 코스피 030720 동원수산… 어업 8940
## 2 코스피 007160 사조산업… 어업 54400
## 3 코스피 006040 동원산업… 어업 246500
## 4 코스피 004970 신라교역… 어업 14350
## 5 코스피 012320 경동인베스… 광업 40300
## 6 코스피 003580 넥스트사이… 광업 5200
## 7 코스피 017810 풀무원 음식료품 11300
## 8 코스피 280360 롯데제과… 음식료품 159500
## 9 코스피 271560 오리온 음식료품 83300
## 10 코스피 006090 사조오양… 음식료품 8220
## 4 코스피 006090 사조오양… 음식료품 8220
## 5 코스피 014710 사조씨푸드… 음식료품 6220
## 6 코스피 271560 오리온 음식료품 83300
## 7 코스피 007310 오뚜기 음식료품 694000
## 8 코스피 012610 경인양행… 화학 6660
## 9 코스피 006060 화승인더… 화학 10300
## 10 코스피 004970 신라교역… 어업 14350
## # … with 2,233 more rows, and 2 more variables:
## # 전일대비 <dbl>, `시가총액(원)` <dbl>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/06-crawling_actual.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ print(tail(price))
## 2020-03-12 50800
## 2020-03-13 49950
## 2020-03-16 48900
## 2020-03-17 48200
## 2020-03-17 47300
```

1. 날짜에 해당하는 첫 번째 열과, 종가에 해당하는 다섯 번째 열만 선택해 저장합니다.
Expand Down
2 changes: 1 addition & 1 deletion docs/08-data_analysis.md

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions docs/api를-이용한-데이터-수집.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,18 @@ <h3><span class="header-section-number">3.2.3</span> FRED 데이터 다운로드
<li id="fn7"><p><a href="https://fred.stlouisfed.org/" class="uri">https://fred.stlouisfed.org/</a><a href="api를-이용한-데이터-수집.html#fnref7" class="footnote-back"></a></p></li>
</ol>
</div>
<div id="disqus_thread"></div>
<script>
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//quant_cookbook.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">
comments powered by Disqus.</a></noscript>
</section>

</div>
Expand Down
11 changes: 11 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,17 @@ <h2>종목과 관련된 유의사항</h2>

</div>
</div>
<div id="disqus_thread"></div>
<script>
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://quant_cookbook.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</section>

</div>
Expand Down
12 changes: 12 additions & 0 deletions docs/references.html
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,18 @@ <h1>References</h1>



<div id="disqus_thread"></div>
<script>
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//quant_cookbook.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">
comments powered by Disqus.</a></noscript>
</section>

</div>
Expand Down
28 changes: 20 additions & 8 deletions docs/금융-데이터-수집하기-기본.html
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,14 @@ <h3><span class="header-section-number">5.1.1</span> 산업별 현황 크롤링<
## &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;dbl&gt;
## 1 코스피 030720 동원수산… 어업 8940
## 2 코스피 007160 사조산업… 어업 54400
## 3 코스피 006040 동원산업… 어업 246500
## 4 코스피 004970 신라교역… 어업 14350
## 5 코스피 012320 경동인베스… 광업 40300
## 6 코스피 003580 넥스트사이… 광업 5200
## 7 코스피 017810 풀무원 음식료품 11300
## 8 코스피 280360 롯데제과… 음식료품 159500
## 9 코스피 271560 오리온 음식료품 83300
## 10 코스피 006090 사조오양… 음식료품 8220
## 3 코스피 004970 신라교역… 어업 14350
## 4 코스피 006040 동원산업… 어업 246500
## 5 코스피 006090 사조오양… 음식료품 8220
## 6 코스피 017810 풀무원 음식료품 11300
## 7 코스피 000087 하이트진로… 음식료품 16650
## 8 코스피 097955 CJ제일제… 음식료품 124500
## 9 코스피 097950 CJ제일제… 음식료품 280000
## 10 코스피 007310 오뚜기 음식료품 694000
## # … with 2,233 more rows, and 2 more variables:
## # 전일대비 &lt;dbl&gt;, `시가총액(원)` &lt;dbl&gt;</code></pre>
<p>위 과정을 통해 down_sector 변수에는 산업별 현황 데이터가 저장되었습니다. 이를 csv 파일로 저장하겠습니다.</p>
Expand Down Expand Up @@ -951,6 +951,18 @@ <h2><span class="header-section-number">5.2</span> WICS 기준 섹터정보 크
<li id="fn13"><p><a href="http://www.wiseindex.com/" class="uri">http://www.wiseindex.com/</a><a href="금융-데이터-수집하기-기본.html#fnref13" class="footnote-back"></a></p></li>
</ol>
</div>
<div id="disqus_thread"></div>
<script>
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//quant_cookbook.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">
comments powered by Disqus.</a></noscript>
</section>

</div>
Expand Down
14 changes: 13 additions & 1 deletion docs/금융-데이터-수집하기-심화.html
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ <h3><span class="header-section-number">6.1.1</span> 개별종목 주가 크롤
## 2020-03-12 50800
## 2020-03-13 49950
## 2020-03-16 48900
## 2020-03-17 48250</code></pre>
## 2020-03-17 47300</code></pre>
<ol style="list-style-type: decimal">
<li>날짜에 해당하는 첫 번째 열과, 종가에 해당하는 다섯 번째 열만 선택해 저장합니다.</li>
<li>티블 형태의 데이터를 데이터 프레임 형태로 변경합니다.</li>
Expand Down Expand Up @@ -1083,6 +1083,18 @@ <h3><span class="header-section-number">6.2.3</span> 전 종목 재무제표 및
<li id="fn17"><p>분모에 사용되는 재무데이터의 구체적인 항목과 발행주식수를 계산하는 방법의 차이로 인해 여러 업체에서 제공하는 가치지표와 다소 차이가 발생할 수 있습니다.<a href="금융-데이터-수집하기-심화.html#fnref17" class="footnote-back"></a></p></li>
</ol>
</div>
<div id="disqus_thread"></div>
<script>
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//quant_cookbook.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript">
comments powered by Disqus.</a></noscript>
</section>

</div>
Expand Down
14 changes: 13 additions & 1 deletion docs/데이터-분석-및-시각화하기.html

Large diffs are not rendered by default.

Loading

0 comments on commit 3f5ecb1

Please sign in to comment.