Main Content

diff

diff is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Description

example

newfts = diff(oldfts) computes the difference of all the data in the data series of the object oldfts and returns the result in the object newfts. newfts is a financial time series object containing the same data series (names) as the input oldfts.

Examples

collapse all

  1. Create a fints object.

    dates_and_times = (now:now+5)'
    dates_and_times =
    
       1.0e+05 *
    
        7.3840
        7.3840
        7.3840
        7.3841
        7.3841
        7.3841
    
     oldfts = fints(dates_and_times, randn(6,1))
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints (line 169) 
    oldfts = 
     
        desc:  (none)
        freq:  Unknown (0)
    
        {'dates:  (6)'}    {'times:  (6)'}    {'series1:  (6)'}
        {'03-Sep-2021'}    {'12:34'      }    {[      -1.0616]}
        {'04-Sep-2021'}    {'12:34'      }    {[       2.3505]}
        {'05-Sep-2021'}    {'12:34'      }    {[      -0.6156]}
        {'06-Sep-2021'}    {'12:34'      }    {[       0.7481]}
        {'07-Sep-2021'}    {'12:34'      }    {[      -0.1924]}
        {'08-Sep-2021'}    {'12:34'      }    {[       0.8886]}
  2. Convert the frequency using convertto.

    newfts = diff(oldfts)
    Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. 
    > In fints/diff (line 21) 
     newfts = 
     
        desc:  DIFF of 
        freq:  Unknown (0)
    
        {'dates:  (5)'}    {'times:  (5)'}    {'series1:  (5)'}
        {'04-Sep-2021'}    {'12:34'      }    {[       3.4120]}
        {'05-Sep-2021'}    {'12:34'      }    {[      -2.9661]}
        {'06-Sep-2021'}    {'12:34'      }    {[       1.3637]}
        {'07-Sep-2021'}    {'12:34'      }    {[      -0.9405]}
        {'08-Sep-2021'}    {'12:34'      }    {[       1.0810]}

Input Arguments

collapse all

Financial time series object, specified as a fints object.

Data Types: object

Output Arguments

collapse all

Financial time series object, returned as a fints object.

Version History

Introduced before R2006a