How to Measure Stock Portfolio Performance using R

Stock market is a place where people arrange a transaction for buying or selling shares of publicly listed company

Indonesia has been named as the Largest Economy in Southeast Asia by the World Bank. As one of the four most populous countries in the world with more than 200 million people living in this country, Indonesia has a bargaining power to emerge as one of the biggest economies in the world. Those promising prospect of Indonesia economic condition makes this country as one of the best choices to put your investment on.

Indonesia stock markets with more than 600 listed enterprises still on the uptrends before the coronavirus outbreak. Some of the listed enterprises are state-owned enterprises and for this case study, I will only analyze 17 state-owned enterprises which been a member of the latest IDX-BUMN20 Index.

Stock used for analysis:

ANTM.JK, BBNI.JK, BBRI.JK, BBTN.JK, BJBR.JK, BMRI.JK, ELSA.JK, JSMR.JK, KAEF.JK, PGAS.JK, PTBA.JK, PTPP.JK, SMGR.JK, TINS.JK, TLKM.JK, WIKA.JK, WSKT.JK

The assumption for this case study:

  1. Stocks weight in the portfolio is the same for every enterprise.
  2. Analysis based on the historical adjusted closing price data from 1st January 2013 to 26th July 2020.
  3. Risk-Free Rate: 4.5%
  4. Portfolio rebalancing quarterly

Import and Prepare Stocks Data

We will import stock price data using getSymbols() function from the quantmod package. getSymbols() function is a particular function to load and manage financial data from various sources, but for this example, we will use Yahoo Finance as our data source.

#Import Library
	library(PerformanceAnalytics)
	library(quantmod)
	library(ggplot2)
	library(xts)
	library(zoo)
	library(tidyverse)
	library(dplyr)
	library(PortfolioAnalytics)

	#Set Default Time Period
	setDefaults(getSymbols.yahoo, from = as.Date('2013/01/01'), to= as.Date('2020/07/26')) #Set GetSymbols default parameter such as Data Source and Time Periods 

	#IDX- BUMN20 Symbol List
	IDXBUMN20 = c('ANTM.JK','BBNI.JK','BBRI.JK','BBTN.JK','BJBR.JK','BMRI.JK','ELSA.JK','JSMR.JK','KAEF.JK',
	                  'PGAS.JK','PTBA.JK','PTPP.JK','SMGR.JK','TINS.JK','TLKM.JK','WIKA.JK','WSKT.JK')

	weight = rep(1/length(IDXBUMN20), length(IDXBUMN20)) #Define Weight for every stock in Portfolio
	#Import Stock Price from yahoo Finance
	getSymbols(IDXBUMN20)

Import Stock Price Data from Yahoo Finance

In default, we will have every stock price data assigned to their stock code as xts object (ex: ANTM.JK prices will be stored in ANTM.JK variable as xts object). To make it easier for analysis, we should gather all these separate data into a single xts object.

#IDX-BUMN20 Create Dataframe
	Index <- list(ANTM.JK,BBNI.JK,BBRI.JK,BBTN.JK,BJBR.JK,BMRI.JK,ELSA.JK,JSMR.JK,KAEF.JK,
	                  PGAS.JK,PTBA.JK,PTPP.JK,SMGR.JK,TINS.JK,TLKM.JK,WIKA.JK,WSKT.JK)
	names(Index) <- IDXBUMN20
	Index <- lapply(Index, '[', i =,j = 6) #Select only Adjusted Close Price
	Index <- do.call(cbind.data.frame, Index) #List To Dataframe
	names(Index) <- IDXBUMN20 #Change Colnames

	Index <- as.xts(Index)
view raw
Closing Adj. Price and Gather Object.R hosted with ❤ by GitHub

Gather separate data into a single xts object
Image for post

Fig-1. Index xts object preview

Portfolio Analytics

We already made a portfolio, and it stored as single xts object in a variable named Index. The data that we store in this variable is still in closing price format for every market day, since most of the portfolio analytics method need to feed by return data, we have to calculate its Return first before taking a step into portfolio analysis.

#finance #towards-data-science #stock-market #portfolio #data-analysis #data analysis

What is GEEK

Buddha Community

How to Measure Stock Portfolio Performance using R

How to Measure Stock Portfolio Performance using R

Stock market is a place where people arrange a transaction for buying or selling shares of publicly listed company

Indonesia has been named as the Largest Economy in Southeast Asia by the World Bank. As one of the four most populous countries in the world with more than 200 million people living in this country, Indonesia has a bargaining power to emerge as one of the biggest economies in the world. Those promising prospect of Indonesia economic condition makes this country as one of the best choices to put your investment on.

Indonesia stock markets with more than 600 listed enterprises still on the uptrends before the coronavirus outbreak. Some of the listed enterprises are state-owned enterprises and for this case study, I will only analyze 17 state-owned enterprises which been a member of the latest IDX-BUMN20 Index.

Stock used for analysis:

ANTM.JK, BBNI.JK, BBRI.JK, BBTN.JK, BJBR.JK, BMRI.JK, ELSA.JK, JSMR.JK, KAEF.JK, PGAS.JK, PTBA.JK, PTPP.JK, SMGR.JK, TINS.JK, TLKM.JK, WIKA.JK, WSKT.JK

The assumption for this case study:

  1. Stocks weight in the portfolio is the same for every enterprise.
  2. Analysis based on the historical adjusted closing price data from 1st January 2013 to 26th July 2020.
  3. Risk-Free Rate: 4.5%
  4. Portfolio rebalancing quarterly

Import and Prepare Stocks Data

We will import stock price data using getSymbols() function from the quantmod package. getSymbols() function is a particular function to load and manage financial data from various sources, but for this example, we will use Yahoo Finance as our data source.

#Import Library
	library(PerformanceAnalytics)
	library(quantmod)
	library(ggplot2)
	library(xts)
	library(zoo)
	library(tidyverse)
	library(dplyr)
	library(PortfolioAnalytics)

	#Set Default Time Period
	setDefaults(getSymbols.yahoo, from = as.Date('2013/01/01'), to= as.Date('2020/07/26')) #Set GetSymbols default parameter such as Data Source and Time Periods 

	#IDX- BUMN20 Symbol List
	IDXBUMN20 = c('ANTM.JK','BBNI.JK','BBRI.JK','BBTN.JK','BJBR.JK','BMRI.JK','ELSA.JK','JSMR.JK','KAEF.JK',
	                  'PGAS.JK','PTBA.JK','PTPP.JK','SMGR.JK','TINS.JK','TLKM.JK','WIKA.JK','WSKT.JK')

	weight = rep(1/length(IDXBUMN20), length(IDXBUMN20)) #Define Weight for every stock in Portfolio
	#Import Stock Price from yahoo Finance
	getSymbols(IDXBUMN20)

Import Stock Price Data from Yahoo Finance

In default, we will have every stock price data assigned to their stock code as xts object (ex: ANTM.JK prices will be stored in ANTM.JK variable as xts object). To make it easier for analysis, we should gather all these separate data into a single xts object.

#IDX-BUMN20 Create Dataframe
	Index <- list(ANTM.JK,BBNI.JK,BBRI.JK,BBTN.JK,BJBR.JK,BMRI.JK,ELSA.JK,JSMR.JK,KAEF.JK,
	                  PGAS.JK,PTBA.JK,PTPP.JK,SMGR.JK,TINS.JK,TLKM.JK,WIKA.JK,WSKT.JK)
	names(Index) <- IDXBUMN20
	Index <- lapply(Index, '[', i =,j = 6) #Select only Adjusted Close Price
	Index <- do.call(cbind.data.frame, Index) #List To Dataframe
	names(Index) <- IDXBUMN20 #Change Colnames

	Index <- as.xts(Index)
view raw
Closing Adj. Price and Gather Object.R hosted with ❤ by GitHub

Gather separate data into a single xts object
Image for post

Fig-1. Index xts object preview

Portfolio Analytics

We already made a portfolio, and it stored as single xts object in a variable named Index. The data that we store in this variable is still in closing price format for every market day, since most of the portfolio analytics method need to feed by return data, we have to calculate its Return first before taking a step into portfolio analysis.

#finance #towards-data-science #stock-market #portfolio #data-analysis #data analysis

Hubify Apps

Hubify Apps

1614420140

Back In Stock Notification App for Your Shopify Store

The last thing you want to do is to dissatisfy your customers. It is quite disappointing for online shoppers to want to purchase a product and they end up discovering that it is out of stock.

One thing that is common among Shopify stores is that they usually experience stockouts. A stockout occurs when inventory gets finished. If customers want to handle issues concerning stock outs effectively, then, they should use Shopify product back-in-stock alerts App.

What can back in stock alerts help you do? It can help customers notify shoppers when products are available if they subscribe to it using the back in stock notification app.

Learn More : https://hubifyapps.com/back-in-stock-notification-app/

#back in stock notification app #back in stock alert #in stock alert #in stock #back in stock #stock alert app

Nandini roy

Nandini roy

1618667097

Responsive Personal Portfolio Website Using HTML CSS and JavaScript

Tutorial: https://youtu.be/9DDiorNZiyw

#create a portfolio website with html css javascript #personal portfolio complete website using only html css javascript #responsive portfolio website html css javascript #responsive personal portfolio website #portfolio website #responsive website

Why Use WordPress? What Can You Do With WordPress?

Can you use WordPress for anything other than blogging? To your surprise, yes. WordPress is more than just a blogging tool, and it has helped thousands of websites and web applications to thrive. The use of WordPress powers around 40% of online projects, and today in our blog, we would visit some amazing uses of WordPress other than blogging.
What Is The Use Of WordPress?

WordPress is the most popular website platform in the world. It is the first choice of businesses that want to set a feature-rich and dynamic Content Management System. So, if you ask what WordPress is used for, the answer is – everything. It is a super-flexible, feature-rich and secure platform that offers everything to build unique websites and applications. Let’s start knowing them:

1. Multiple Websites Under A Single Installation
WordPress Multisite allows you to develop multiple sites from a single WordPress installation. You can download WordPress and start building websites you want to launch under a single server. Literally speaking, you can handle hundreds of sites from one single dashboard, which now needs applause.
It is a highly efficient platform that allows you to easily run several websites under the same login credentials. One of the best things about WordPress is the themes it has to offer. You can simply download them and plugin for various sites and save space on sites without losing their speed.

2. WordPress Social Network
WordPress can be used for high-end projects such as Social Media Network. If you don’t have the money and patience to hire a coder and invest months in building a feature-rich social media site, go for WordPress. It is one of the most amazing uses of WordPress. Its stunning CMS is unbeatable. And you can build sites as good as Facebook or Reddit etc. It can just make the process a lot easier.
To set up a social media network, you would have to download a WordPress Plugin called BuddyPress. It would allow you to connect a community page with ease and would provide all the necessary features of a community or social media. It has direct messaging, activity stream, user groups, extended profiles, and so much more. You just have to download and configure it.
If BuddyPress doesn’t meet all your needs, don’t give up on your dreams. You can try out WP Symposium or PeepSo. There are also several themes you can use to build a social network.

3. Create A Forum For Your Brand’s Community
Communities are very important for your business. They help you stay in constant connection with your users and consumers. And allow you to turn them into a loyal customer base. Meanwhile, there are many good technologies that can be used for building a community page – the good old WordPress is still the best.
It is the best community development technology. If you want to build your online community, you need to consider all the amazing features you get with WordPress. Plugins such as BB Press is an open-source, template-driven PHP/ MySQL forum software. It is very simple and doesn’t hamper the experience of the website.
Other tools such as wpFoRo and Asgaros Forum are equally good for creating a community blog. They are lightweight tools that are easy to manage and integrate with your WordPress site easily. However, there is only one tiny problem; you need to have some technical knowledge to build a WordPress Community blog page.

4. Shortcodes
Since we gave you a problem in the previous section, we would also give you a perfect solution for it. You might not know to code, but you have shortcodes. Shortcodes help you execute functions without having to code. It is an easy way to build an amazing website, add new features, customize plugins easily. They are short lines of code, and rather than memorizing multiple lines; you can have zero technical knowledge and start building a feature-rich website or application.
There are also plugins like Shortcoder, Shortcodes Ultimate, and the Basics available on WordPress that can be used, and you would not even have to remember the shortcodes.

5. Build Online Stores
If you still think about why to use WordPress, use it to build an online store. You can start selling your goods online and start selling. It is an affordable technology that helps you build a feature-rich eCommerce store with WordPress.
WooCommerce is an extension of WordPress and is one of the most used eCommerce solutions. WooCommerce holds a 28% share of the global market and is one of the best ways to set up an online store. It allows you to build user-friendly and professional online stores and has thousands of free and paid extensions. Moreover as an open-source platform, and you don’t have to pay for the license.
Apart from WooCommerce, there are Easy Digital Downloads, iThemes Exchange, Shopify eCommerce plugin, and so much more available.

6. Security Features
WordPress takes security very seriously. It offers tons of external solutions that help you in safeguarding your WordPress site. While there is no way to ensure 100% security, it provides regular updates with security patches and provides several plugins to help with backups, two-factor authorization, and more.
By choosing hosting providers like WP Engine, you can improve the security of the website. It helps in threat detection, manage patching and updates, and internal security audits for the customers, and so much more.

Read More

#use of wordpress #use wordpress for business website #use wordpress for website #what is use of wordpress #why use wordpress #why use wordpress to build a website

anita maity

anita maity

1618639156

Responsive Personal Portfolio Website HTML CSS and JavaScript

Demo: https://cutt.ly/TvxhH2T

#portfolio website html css #personal portfolio website tutorial #portfolio website #responsive personal portfolio website #portfolio website html css javascript #responsive portfolio website html css javascript