Login     Register

        Contact Us     Search

XLeratorDB/financial Documentation

History for SORTINO2 - 2008 (history as of 4/4/2015 9:32:18 PM)

SORTINO2

Updated: 29 March 2012


Use SORTINO2 to calculate the Sortino ratio based upon price data. The Sortino ratio is calculated as the mean difference of the returns (R) and the minimum acceptable return (Rm) divided by the downside deviation. The downside return is calculated where R – Rm < 0.

XLeratorDB formula for SORTINO function for SQL Server
Syntax
XLeratorDB syntax for SORTINO2 function for SQL Server
Arguments
@PDate
the date associated with the price or valuation. @PDate is an expression of type datetime or of a type that can be implicitly converted to datetime.
@PValue
the price or value for the @PDate. @PValue is an expression of type float or of a type that can be implicitly converted to float.
@Mar
the minimum acceptable return. @Mar is an expression of type float or of a type that can be implicitly converted to float.
Return Type
float
Remarks
·         If there are no negative returns, then SORTINO2 is NULL.
·         @Mar must be the same for all rows in the GROUP BY.
Examples
SELECT wct.SORTINO2(
pdate                                     --@PDate
,pvalue                                   --@PValue
,cast(.15 as float)/cast(52 as float)     --@MAR
) as SORTINO
FROM (VALUES
      ('IBM','2013-03-18',212.08),
      ('IBM','2013-03-11',214.92),
      ('IBM','2013-03-04',210.38),
      ('IBM','2013-02-25',202.91),
      ('IBM','2013-02-19',201.09),
      ('IBM','2013-02-11',200.98),
      ('IBM','2013-02-04',201.68),
      ('IBM','2013-01-28',204.32),
      ('IBM','2013-01-22',204.11),
      ('IBM','2013-01-14',193.65),
      ('IBM','2013-01-07',193.63),
      ('IBM','2012-12-31',193.18),
      ('IBM','2012-12-24',189.03),
      ('IBM','2012-12-17',192.61),
      ('IBM','2012-12-10',190.96),
      ('IBM','2012-12-03',191.15),
      ('IBM','2012-11-26',189.27),
      ('IBM','2012-11-19',192.68),
      ('IBM','2012-11-12',186.16),
      ('IBM','2012-11-05',188.85),
      ('IBM','2012-10-31',191.78),
      ('IBM','2012-10-22',191.62),
      ('IBM','2012-10-15',191.71),
      ('IBM','2012-10-08',206.03),
      ('IBM','2012-10-01',208.79),
      ('IBM','2012-09-24',205.68),
      ('IBM','2012-09-17',204.22),
      ('IBM','2012-09-10',205.05),
      ('IBM','2012-09-04',197.8),
      ('IBM','2012-08-27',193.19),
      ('IBM','2012-08-20',196.08),
      ('IBM','2012-08-13',199.5),
      ('IBM','2012-08-06',197.59),
      ('IBM','2012-07-30',195.99),
      ('IBM','2012-07-23',193.89),
      ('IBM','2012-07-16',190),
      ('IBM','2012-07-09',183.64),
      ('IBM','2012-07-02',188.97),
      ('IBM','2012-06-25',193.09),
      ('IBM','2012-06-18',191.23),
      ('IBM','2012-06-11',196.56),
      ('IBM','2012-06-04',192.65),
      ('IBM','2012-05-29',186.67),
      ('IBM','2012-05-21',191.82),
      ('IBM','2012-05-14',193.38),
      ('IBM','2012-05-07',198.61),
      ('IBM','2012-04-30',201.53),
      ('IBM','2012-04-23',203.32),
      ('IBM','2012-04-16',196.23),
      ('IBM','2012-04-09',199.38),
      ('IBM','2012-04-02',202),
      ('IBM','2012-03-26',205.13)
      )n(s,pdate,pvalue)
This produces the following result.
               SORTINO
----------------------
   -0.0917833577538954
See Also
  

|<< Back |    

Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service