MulaiMulai sekarang secara gratis

Returns Sharpe ratio in quantstrat

One of the main reasons to include an initial equity (in this case, initeq, which is set to 100,000) in your strategy is to be able to work with returns, which are based off of your profit and loss over your initial equity.

While you just computed a cash Sharpe ratio in the previous exercise, you will see in this exercise that quantstrat can also compute the standard returns-based Sharpe ratio as well.

Latihan ini adalah bagian dari kursus

Financial Trading in R

Lihat Kursus

Petunjuk latihan

  • Use PortfReturns() on our portfolio strategy portfolio.st to get the instrument returns.
  • Compute the annualized Sharpe ratio using the instrument returns computed in the previous step.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Get instrument returns
instrets <- PortfReturns(___)

# Compute Sharpe ratio from returns
SharpeRatio.annualized(___, geometric = FALSE)
Edit dan Jalankan Kode