Login     Register

        Contact Us     Search

XLeratorDB/financial Documentation

SQL Server date conversion for Eurodollar futures


ED_FUT2DATE

Updated: 29 Mar 2013


Use ED_FUT2DATE to convert a Eurodollar futures delivery code into a delivery date. The delivery code consists of a letter identifying the delivery month and a one- or two-digit suffix identifying the delivery year. The calculation of the delivery date is based upon the start date passed to the function. If no start date is provided, the start date defaults to the server date.
Syntax
SELECT [wctFinancial].[wct].[ED_FUT2DATE](
  <@DeliveryCode, nvarchar(4000),>
 ,<@StartDate, datetime,>)
Arguments
@DeliveryCode
the standard delivery codes for Eurodollar futures, consisting of a letter and a one- or two-digit number.
@StartDate
the date from which the delivery date is calculated. @StartDate is an expression of type datetime or of a type that can be implicitly converted to datetime.
Return Type
datetime
Remarks
·         If @StartDate is NULL, @StartDate =GETDATE()
·         Valid letters for @DeliveryCode are F, G, H, J, K, M, N, Q, U, V, X, and Z.
Example
In this example we calculate the delivery dates for the futures strip for the next 2 years as of 2013-03-25.
SELECT DC as [DELIVERY CODE]
,wct.ED_FUT2DATE(dc,'2013-03-25') AS [DELIVERY DATE]
FROM (
      SELECT 'M13' UNION ALL
      SELECT 'U13' UNION ALL
      SELECT 'Z13' UNION ALL
      SELECT 'H14' UNION ALL
      SELECT 'M14' UNION ALL
      SELECT 'U14' UNION ALL
      SELECT 'Z14' UNION ALL 
      SELECT 'H15'
      )n(dc)
This produces the following result.
DELIVERY CODE DELIVERY DATE
------------- -----------------------
M13           2013-06-19 00:00:00.000
U13           2013-09-18 00:00:00.000
Z13           2013-12-18 00:00:00.000
H14           2014-03-19 00:00:00.000
M14           2014-06-18 00:00:00.000
U14           2014-09-17 00:00:00.000
Z14           2014-12-17 00:00:00.000
H15           2015-03-18 00:00:00.000

In this example, we enter the same futures strip using a single digit to represent the year.
SELECT DC as [DELIVERY CODE]
,wct.ED_FUT2DATE(dc,'2013-03-25') AS [DELIVERY DATE]
FROM (
      SELECT 'M3' UNION ALL
      SELECT 'U3' UNION ALL
      SELECT 'Z3' UNION ALL
      SELECT 'H4' UNION ALL
      SELECT 'M4' UNION ALL
      SELECT 'U4' UNION ALL
      SELECT 'Z4' UNION ALL  
      SELECT 'H5'
      )n(dc)

This produces the following result.
DELIVERY CODE DELIVERY DATE
------------- -----------------------
M3            2013-06-19 00:00:00.000
U3            2013-09-18 00:00:00.000
Z3            2013-12-18 00:00:00.000
H4            2014-03-19 00:00:00.000
M4            2014-06-18 00:00:00.000
U4            2014-09-17 00:00:00.000
Z4            2014-12-17 00:00:00.000
H5            2015-03-18 00:00:00.000
 


Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service