乖離率和財報濾網
1.安裝套件¶
In [ ]:
Copied!
!pip install finlab > log.txt
!pip install finlab > log.txt
2.乖離率和財報濾網¶
In [ ]:
Copied!
from finlab import data
from finlab.backtest import sim
# 下載 ROE 跟收盤價
roe = data.get("fundamental_features:ROE稅後")
close = data.get("price:收盤價")
position = ((close / close.shift(60)).is_largest(30) & (roe > 0))
# 回測,每月(M)調整一次
report = sim(position, resample="M", upload=False)
report.display()
from finlab import data
from finlab.backtest import sim
# 下載 ROE 跟收盤價
roe = data.get("fundamental_features:ROE稅後")
close = data.get("price:收盤價")
position = ((close / close.shift(60)).is_largest(30) & (roe > 0))
# 回測,每月(M)調整一次
report = sim(position, resample="M", upload=False)
report.display()
INFO:finlab.data:fundamental_features:ROE稅後 -- Daily data usage: 655.7 / 5000 MB
1319 0.055556 1522 0.055556 1524 0.055556 2305 0.055556 2364 0.055556 2482 0.055556 2736 0.055556 2929 0.055556 2939 0.055556 4543 0.055556 5258 0.055556 6113 0.055556 6199 0.055556 6472 0.055556 6655 0.055556 6715 0.055556 8097 0.055556 9802 0.055556 Name: 2022-07-31 00:00:00, dtype: float64
Timestamp('2022-07-31 00:00:00')