ED_FUT2DATE
Updated 2023-10-13 12:39:17.437000
Syntax
SELECT [westclintech].[wct].[ED_FUT2DATE](
<@DeliveryCode, nvarchar(4000),>
,<@StartDate, datetime,>)
Description
Use the scalar function 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.
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
float
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.
Examples
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.
{"columns":[{"field":"DELIVERY CODE"},{"field":"DELIVERY DATE","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"DELIVERY CODE":"M13","DELIVERY DATE":"2013-06-19 00:00:00.000"},{"DELIVERY CODE":"U13","DELIVERY DATE":"2013-09-18 00:00:00.000"},{"DELIVERY CODE":"Z13","DELIVERY DATE":"2013-12-18 00:00:00.000"},{"DELIVERY CODE":"H14","DELIVERY DATE":"2014-03-19 00:00:00.000"},{"DELIVERY CODE":"M14","DELIVERY DATE":"2014-06-18 00:00:00.000"},{"DELIVERY CODE":"U14","DELIVERY DATE":"2014-09-17 00:00:00.000"},{"DELIVERY CODE":"Z14","DELIVERY DATE":"2014-12-17 00:00:00.000"},{"DELIVERY CODE":"H15","DELIVERY DATE":"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.
{"columns":[{"field":"DELIVERY CODE"},{"field":"DELIVERY DATE","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"DELIVERY CODE":"M3","DELIVERY DATE":"2013-06-19 00:00:00.000"},{"DELIVERY CODE":"U3","DELIVERY DATE":"2013-09-18 00:00:00.000"},{"DELIVERY CODE":"Z3","DELIVERY DATE":"2013-12-18 00:00:00.000"},{"DELIVERY CODE":"H4","DELIVERY DATE":"2014-03-19 00:00:00.000"},{"DELIVERY CODE":"M4","DELIVERY DATE":"2014-06-18 00:00:00.000"},{"DELIVERY CODE":"U4","DELIVERY DATE":"2014-09-17 00:00:00.000"},{"DELIVERY CODE":"Z4","DELIVERY DATE":"2014-12-17 00:00:00.000"},{"DELIVERY CODE":"H5","DELIVERY DATE":"2015-03-18 00:00:00.000"}]}