periodReturn            package:quantmod            R Documentation

_C_a_l_c_u_l_a_t_e _P_e_r_i_o_d_i_c _R_e_t_u_r_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Given a set of prices, return a 'quantmod.return' object of
     returns calculated during specified period.

_U_s_a_g_e:

     periodReturn(x, by = months, from = NULL, to = NULL)

     allReturns(x, from = NULL, to = NULL)
     dailyReturn(x, from = NULL, to = NULL)
     weeklyReturn(x, from = NULL, to = NULL)
     monthlyReturn(x, from = NULL, to = NULL)
     quarterlyReturn(x, from = NULL, to = NULL)
     annualReturn(x, from = NULL, to = NULL)

_A_r_g_u_m_e_n_t_s:

       x: zoo object of state prices

      by: character string indicating time period.  Valid entries are
          weekdays, weeks, months, quarters, years.  All  are
          accessible from wrapper functions described below. Defaults
          to monthly returns (same as monthlyReturn)

    from: character string representing dates in ISO 8601 format (e.g.
          1992-01-01).  Defaults to beginning of dataset

      to: character string representing dates in ISO 8601 format (e.g.
          1992-01-01).  Defaults to end of dataset

_D_e_t_a_i_l_s:

     'periodReturn' is the underlying function for wrappers:

        *  'allReturns: '      calculate all available return periods

        *  'dailyReturn: '     calculate daily returns

        *  'weeklyReturn: '    calculate weekly returns

        *  'monthlyReturn: '   calculate monthly returns

        *  'quarterlyReturn: ' calculate quarterly returns

        *  'annualReturn: '    calculate annual returns

_V_a_l_u_e:

     Returns object of class 'quantmod.returns' with ending dates of
     each period indexing the returns

_N_o_t_e:

     The final row of returned object will have the current period
     return to last date,  i.e. this week/month/quarter/year return to
     date.

     By default, if 'from' and/or 'to' is missing, they will be set to
     the dataset beginning and end, respectively. One or both may be
     set, and  will subset the data, inclusively, after all
     calculations have been made.  The values must  be character
     strings representing dates in ISO 8601 format. (e.g. 1992-01-01).

     Additional methods to handle 'ts' and 'data.frame' objects will
     enable automatic conversion to the suitable zoo object as returned
     by a call to 'getSymbols'

_A_u_t_h_o_r(_s):

     Jeffrey A. Ryan

_R_e_f_e_r_e_n_c_e_s:

     Bodie,Kane...

_S_e_e _A_l_s_o:

     'getSymbols'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     getSymbols('QQQQ',src='yahoo')
     allReturns(QQQQ)  # returns all periods

     periodReturn(QQQQ,by=years,from='2003-01-01')  # returns years 2003 to present
     periodReturn(QQQQ,by=years,from='2003-01-01',to='2004-01-01')  # returns year 2003

     rm(QQQQ)
     ## End(Not run)

