美股 研發成長股策略
In [ ]:
Copied!
%%capture
!pip install finlab
!pip install ta-lib-bin
%%capture
!pip install finlab
!pip install ta-lib-bin
研發費用催化劑¶
投入較多資源進行研發的公司,會較受市場青睞而被給予較高的估值嗎?
In [ ]:
Copied!
from finlab import data
from finlab.backtest import sim
close = data.get('us_price:close')
revenue = data.get('us_fundamental:revenue')
eps = data.get('us_fundamental:eps')
# 研發費用
rnd = data.get('us_fundamental:rnd')
# 投資人投入資本
invcap = data.get('us_fundamental:invcap')
# 選出研發費用成長為排名前10%個股
condition1 = rnd.pct_change() > rnd.pct_change().quantile_row(0.9)
condition2 = eps > eps.average(2)
condition3 = invcap > invcap.average(2)
condition4 = close > close.average(250)
# 再以ESP及投資人投入資本增加、收盤價站上年線為濾網
position = condition1 & condition2 & condition3 & condition4
# 最後以營收成長率作為排序篩選出最大的前15名標的
revenue_growth = revenue.pct_change().index_str_to_date()
position *= revenue_growth
position = position.is_largest(10)
report = sim(position, resample='M', name='美股研發成長股策略', stop_loss=0.15, position_limit=0.2)
# report.display()
from finlab import data
from finlab.backtest import sim
close = data.get('us_price:close')
revenue = data.get('us_fundamental:revenue')
eps = data.get('us_fundamental:eps')
# 研發費用
rnd = data.get('us_fundamental:rnd')
# 投資人投入資本
invcap = data.get('us_fundamental:invcap')
# 選出研發費用成長為排名前10%個股
condition1 = rnd.pct_change() > rnd.pct_change().quantile_row(0.9)
condition2 = eps > eps.average(2)
condition3 = invcap > invcap.average(2)
condition4 = close > close.average(250)
# 再以ESP及投資人投入資本增加、收盤價站上年線為濾網
position = condition1 & condition2 & condition3 & condition4
# 最後以營收成長率作為排序篩選出最大的前15名標的
revenue_growth = revenue.pct_change().index_str_to_date()
position *= revenue_growth
position = position.is_largest(10)
report = sim(position, resample='M', name='美股研發成長股策略', stop_loss=0.15, position_limit=0.2)
# report.display()
/usr/local/lib/python3.10/dist-packages/finlab/analysis/alphaBetaAnalysis.py:22: RuntimeWarning: invalid value encountered in double_scalars
/usr/local/lib/python3.10/dist-packages/finlab/analysis/alphaBetaAnalysis.py:22: RuntimeWarning: invalid value encountered in double_scalars
annualized_rate_of_return | sharpe | max_drawdown | win_ratio | |
---|---|---|---|---|
25.17% | 0.77 | -34.71% | 41.38% |
entry_date | exit_date | entry_sig_date | exit_sig_date | position | period | entry_index | exit_index | return | trade_price@entry_date | trade_price@exit_date | mae | gmfe | bmfe | mdd | pdays | weight | next_weights | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
stock_id | ||||||||||||||||||
TIO TINGO GROUP INC | 2023-06-01 | 2023-06-06 | 2023-05-31 | 2023-06-05 | 0.1 | 3.0 | 1613.0 | 1616.0 | -0.580952 | 3.150 | 1.32 | -0.580952 | 0.000000 | 0.000000 | -0.580952 | 0.0 | 0.0 | 0.1 |
ALAR ALARUM TECHNOLOGIES LTD | 2023-06-01 | NaT | 2023-05-31 | 2023-06-30 | 0.1 | 7.0 | 1613.0 | -1.0 | -0.133627 | 2.724 | 2.36 | -0.137298 | 0.000000 | 0.000000 | -0.137298 | 0.0 | 0.1 | 0.0 |
ASUR ASURE SOFTWARE INC | 2023-06-01 | NaT | 2023-05-31 | NaT | 0.1 | 7.0 | 1613.0 | -1.0 | -0.026917 | 12.260 | 11.93 | -0.026917 | 0.041599 | 0.041599 | -0.065779 | 4.0 | 0.1 | 0.1 |
EH EHANG HOLDINGS LTD | 2023-06-01 | NaT | 2023-05-31 | NaT | 0.1 | 7.0 | 1613.0 | -1.0 | 0.030870 | 10.690 | 11.02 | 0.000000 | 0.035547 | 0.000000 | -0.026388 | 6.0 | 0.1 | 0.1 |
GHSI GUARDION HEALTH SCIENCES INC | 2023-06-01 | NaT | 2023-05-31 | NaT | 0.1 | 7.0 | 1613.0 | -1.0 | -0.018003 | 6.110 | 6.00 | -0.018003 | 0.014730 | 0.014730 | -0.032258 | 2.0 | 0.1 | 0.1 |