투자론/퀀트

우선주 괴리율 시각화 (2)

Q42 2020. 11. 1. 23:02

지난 포스트에 기본적인 우선주 괴리율 차트를 그릴 준비는 다 되었습니다.

남은 것은 적당한 크기로 화면을 배열하고 제목과 범례 등을 달아주면 됩니다. 결과 화면은 다음과 같습니다:

012345

먼저 차트에서 한글(유니코드)를 표시하기 위해서는 폰트를 설정해야 합니다. 이는 다음 포스트를 참고하였습니다:

buomsoo-kim.github.io/colab/2018/04/27/Using-External-fonts-in-colab.md/

 

Using external fonts in Google Colaboratory (Google colab에서 한글 폰트 사용하기) · Buomsoo Kim

Using external fonts in Google Colaboratory (Google colab에서 한글 폰트 사용하기) 27 Apr 2018 | Python Colab Colaboratory Using external fonts in Google colaboratory In most cases, it is enough to use default font in Python programming, especiall

buomsoo-kim.github.io

 

지난 번에 작성한 함수 중 두 군데를 수정합니다.

종목명으로 우선주 일별 주가 리스트를 리턴하는 get_prefs() 에 cache 를 적용해서 매번 적지 않은 로딩 시간을 줄였고,

plot_prefs 에 제목과 범례를 표시하도록 했습니다.

 

이제 마지막으로 figure 당 5x5 의 subplot 으로 나누고, tickers 에 대해 하나씩 그려줍니다.

전제 코드는 다음에서 확인 가능합니다:

colab.research.google.com/drive/10Xt40n7XywtuItcRSnX8Bow7zyIorBny?usp=sharing

 

Google Colaboratory

 

colab.research.google.com