Skip to content

Instantly share code, notes, and snippets.

@tej87681088
tej87681088 / TEJ_API_Python_MediumWeek2.ipynb
Last active March 9, 2021 05:34
TEJ_API_Python_MediumWeek2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tej87681088
tej87681088 / TEJAPI_MediumWeek1.ipynb
Last active March 9, 2021 03:09
TEJ_API_Python_MediumWeek1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tej87681088
tej87681088 / update_DB.py
Last active September 1, 2021 06:23
MediumWeek2_update_DB
import sqlite3
import datetime
import tejapi
stocks = tejapi.get('TWN/EWNPRCSTD',paginate=True)
# 上市所有普通股代碼
code = stocks[(stocks.market=='TSE')&(stocks.stypenm == '普通股')].coid.values
# 連接資料庫
conn = sqlite3.connect('example.db')
for stock in code:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tej87681088
tej87681088 / TEJAPI_MediumWeek4.ipynb
Last active March 31, 2021 08:50
TEJ_API_Python_MediumWeek4
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 14:52:38 2021
@author: 2021011903
"""
return_=pd.DataFrame()
dates = result['財報年月'].astype(str).apply(lambda x: x.split(' ')[0]).unique()
step = 0.2
for date in dates:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# 調整畫圖模組
plt.style.use('seaborn-darkgrid')
# 調整字體
plt.rcParams['font.sans-serif']=['Microsoft YaHei']
# 可自行輸入股票代號
stock =input()
title = stock+' '+stk['證券名稱'][stk['證券碼']==stock].to_list()[0]
fig, FI1 = plt.subplots(figsize=(10,5))
plt.title(title,{'fontsize' : 20})
plt.xlabel('Date', fontsize=14)