Trading saham atau jual beli merupakan suatu hal yang booming ketika Lockdown imbas covid-19 dimuali. Semua orang berlomba-lomba untuk investasi dengan melakukan jual beli saham di Bursa Efek Indonesia. Basically seperti berdagang pada umumnya, prinsip beli murah dan jual mahal untuk keuntungan sebesarnya tetap berlaku. Beberapa saham yang bisa dibilang kuat atau bervaluasi tinggi di BEI, diklasifikasikan sebagai LQ45 dengan tolak ukur Index Saham. Index saham merupakan statistik yang mengukur seluruh pegerakan harga saham yang dipilih berdasarkan kriteria tertendu dalam Bursa Efek Indonesia (BEI). Salah satu indeks saham yang paling sering digunakan di Indonesia adalah Indeks LQ45 yang terdiri dari 45 perusahaan dengan kriteria salah satunya selama 12 bulan terakhir masuk dalam 60 perusahaan dengan kapitalisasi pasar tertinggi di Bursa Efek Indonesia (BEI).
Dalam dunia trading, ada yang dinamakan portofolio atau bisa dikatakan list kepemilikan saham perusahaan apa saja yang kita miliki atau beli, dalam artikel ini kita akan melihat contoh 3 emiten LQ45 dari 2022 yang akan dianalisis resiko dan returnnya. Saham yang diambil adalah :
-> PT. Adaro Energy Tbk. (ADRO) -> Barito Pacific Tbk. (BRPT) -> PT. Saratoga Investama Sedaya Tbk.
Value at Risk (VaR) is a statistical measure used to quantify the level of financial risk within a portfolio, investment, or organization over a specified time horizon. It represents the maximum potential loss in value of a portfolio, or a specific investment, within a given confidence level and time frame.
Portofolio Assets
library(quantmod)
library(plotly)
library(PerformanceAnalytics)
ticks = c('ADRO.JK', 'BRPT.JK','SRTG.JK')
tickslabel = c("Adaro Energy Tbk.", "Barito Pacific Renewable Energy", " PT. Saratoga Investama Sedaya ")
stockx = getSymbols(ticks, from="2022-04-01", to="2024-04-01", src="yahoo", adjust=F)
stockx## [1] "ADRO.JK" "BRPT.JK" "SRTG.JK"
Calculate Daily Return BAsed on CLosing Price
closing = NULL
for (stock in ticks) { closing = cbind(closing, Cl(get(stock)))}
return = Return.calculate(closing)
return = data.frame(return)
return = na.omit(return)
head (return)## ADRO.JK.Close BRPT.JK.Close SRTG.JK.Close
## 2022-04-04 0.000000000 0.011111108 0.000000000
## 2022-04-05 0.067615658 -0.005494538 0.035714286
## 2022-04-06 0.023333333 0.000000000 0.051724138
## 2022-04-07 -0.006514658 -0.016574548 0.003278689
## 2022-04-08 0.036065574 0.000000000 0.147058824
## 2022-04-11 -0.006329114 -0.022471973 0.082621083
#Asset Weights
Assume we equally invest in all of the 3 stocks given above
Calculate the portfolios returns and standard deviation based on equal weights for each stock.
num_stocks <- length(closing)
weights <- rep(1/num_stocks, num_stocks)
portfolio_returns <- rowSums(closing * weights)
portfolio_sd <- sqrt(var(portfolio_returns))
cat("Portfolio Returns:", mean(portfolio_returns), "\n")## Portfolio Returns: 4.175659
## Portfolio Volatility : 0.6698445
VAR Using COPULA
## Loading required package: timeDate
##
## Attaching package: 'timeDate'
## The following objects are masked from 'package:PerformanceAnalytics':
##
## kurtosis, skewness
## Loading required package: timeSeries
##
## Attaching package: 'timeSeries'
## The following object is masked from 'package:zoo':
##
## time<-
## The following objects are masked from 'package:graphics':
##
## lines, points
## Loading required package: fBasics
##
## Attaching package: 'fBasics'
## The following objects are masked from 'package:PerformanceAnalytics':
##
## kurtosis, skewness
## The following object is masked from 'package:TTR':
##
## volatility
## Loading required package: fAssets
##
## Attaching package: 'fPortfolio'
## The following object is masked from 'package:copula':
##
## getSigma
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:copula':
##
## interval
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
set.seed(100)
n = 10000
rho = 0.5
normalCop = normalCopula(param = rho, dim = 2)
U = rCopula(n, normalCop)
X = qnorm(U)
asset1_returns = X[, 1]
asset2_returns = X[ ,2]
initial = 10000000
portvalue = initial * (1+asset1_returns + asset2_returns)
sorted = sort(portvalue)
conflevell = 0.95
varpercentile = 0.05
varindex = round(varpercentile * n )
VAR = sorted[varindex]
VAR## [1] -19123833
Nilai VAR Menyatakan minus yang artinya Saham yang dipilih ada kemungkinsn besar sedang mengalami kerugian atau penurunan harga saham.