By: Jeremya Dharmawan · Nov 01, 2024
Y(t) = Trend(t) + Seasonal(t) + Residual(t)
Y(t) = Trend(t) * Seasonal(t) * Residual(t)
data
variable :
symbol | date | close | volume | market_cap |
---|---|---|---|---|
BBCA.JK | 2019-08-12 | 6040 | 52705000 | NaN |
BBCA.JK | 2019-08-13 | 6015 | 84406000 | NaN |
BBCA.JK | 2019-08-14 | 6010 | 81942000 | NaN |
BBCA.JK | 2019-08-15 | 6000 | 52561500 | NaN |
BBCA.JK | 2019-08-16 | 5960 | 49821500 | NaN |
seasonal_decompose
from statsmodel
seasonal
component, we identify the dates where these minimum and maximum values occur. Below is the code snippet to accomplish this:
seasonal_decompose
result in a variable called seasonal
.
.idxmin()
and .idxmax()
to get the dates where the seasonal trend reaches its minimum and maximum values, respectively.
calendar.month_name
, we convert the month numbers of these dates into their corresponding month names.
Position Size = Target Risk / Forecasted Volatility
where Target Risk
is a predefined amount of capital at risk per trade.
Date | Future Volatility | Position Size |
---|---|---|
2024-08-30 | 0.211042 | 47383.833926 |
2024-09-02 | 0.211006 | 47392.010809 |
2024-09-03 | 0.208473 | 47967.750053 |
2024-09-04 | 0.204720 | 48847.234923 |
2024-09-05 | 0.212859 | 46979.355676 |