BaşlayınÜcretsiz Başlayın

Define the portfolio optimization problem

We define the portfolio optimization problem to minimize portfolio standard deviation subject to full investment and long only constraints. In this problem, we will set up the portfolio specification based on the defined problem. The following exercises in this chapter will build on the initial portfolio specification set up here.

Bu egzersiz

Intermediate Portfolio Analysis in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a portfolio specification object using assets from the asset_returns dataset and name the portfolio specification object port_spec.
  • Add a full investment constraint such that the weights sum to 1 to the port_spec object.
  • Add a long only constraint such that the weight of an asset is between 0 and 1 to the port_spec object.
  • Add an objective to minimize portfolio standard deviation to the port_spec object.
  • Print the portfolio specification object.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.


# Create the portfolio specification


# Add a full investment constraint such that the weights sum to 1


# Add a long only constraint such that the weight of an asset is between 0 and 1


# Add an objective to minimize portfolio standard deviation


# Print the portfolio specification
Kodu Düzenle ve Çalıştır