Welcome to roadip.com on July 9 2009.
This is an internet experiment running to monitor browsing habbits of individuals through wikipedia contents.

SEDOL

From Wikipedia, the free encyclopedia

Jump to: navigation, search

SEDOL stands for Stock Exchange Daily Official List, a list of security identifiers used in the United Kingdom and Ireland for clearing purposes. The numbers are assigned by the London Stock Exchange, on request by the security issuer. SEDOLs serve as the NSIN for all securities issued in the United Kingdom and are therefore part of the security's ISIN as well.

Contents

[edit] Description

SEDOLs are seven characters in length, consisting of two parts: a six-place alphanumeric code and a trailing check digit. SEDOLs issued prior to January 26, 2004 were composed only of numbers. For those older SEDOLs, those from Asia and Africa typically begin with 6, those from the UK and Ireland (until Ireland joined the EU) typically begin with 0 or 3 those from Europe typically began with 4, 5 or 7 and those from the Americas began with 2. After January 26, 2004, SEDOLs were changed to be alpha-numeric and are issued sequentially, beginning with B000009. At each character position numbers precede letters and vowels are never used. All new SEDOLs, therefore, begin with a letter. Ranges beginning with 9 are reserved for end user allocation.

The check digit for a SEDOL is chosen to make the total weighted sum of all seven characters a multiple of 10. The check digit is computed using a weighted sum of the first six characters. Letters have value 9 plus their alphabet position, such that B = 11 and Z = 35. While vowels are never used in SEDOLs, they are not ignored when computing this weighted sum (e.g. H = 17 and J = 19, even though I is not used), simplifying code to compute this sum. The resulting string of numbers is then multiplied by the weighting factor as follows:

First   1
Second  3
Third   1
Fourth  7
Fifth   3
Sixth   9
Seventh 1 (the check digit)

The character values are multiplied by the weights. The check digit is chosen to make the total sum, including the check digit, a multiple of 10, which can be calculated from the weighted sum of the first six characters as (10 − (this sum modulo 10) modulo 10.

For British and Irish securities, SEDOLs are converted to ISINs by padding the front with two zeros, then adding the country code on the front and the ISIN check digit at the end.

[edit] Example

BAE Systems: 0263494

The checksum can be calculated by multiplying the first six digits by their weightings:

(0×1, 2×3, 6×1, 3×7, 4×3, 9×9) = (0, 6, 6, 21, 12, 81)

Then summing up the results:

0 + 6 + 6 + 21 + 12 + 81 = 126

The check digit is then calculated by:

(10 − (126 modulo 10)) modulo 10 = (10 − 6) modulo 10 = 4

[edit] In Delphi

function GetSedolCheckDigit(const BaseSedol: string): Integer;
const
  Weights: array[1..6] of Integer = ( 1, 3, 1, 7, 3, 9 );
var
  i, d: Integer;
begin
  if Length(BaseSedol) <> 6 then
    raise Exception.Create(
      'SEDOLs without a check-digit must be six characters long');
  Result := 0;
  for i := 1 to 6 do begin
    case BaseSedol[i] of
      '0'..'9': d := Ord(BaseSedol[i]) - Ord('0');
      'A'..'Z': d := Ord(BaseSedol[i]) - Ord('A') + 10;
      else 
        raise Exception.Create(
          'SEDOLs must have only digits and uppercase letters');
    end;
    Inc(Result, d * Weights[i]);
  end;
  Result := (10 - (Result mod 10)) mod 10;
end;

[edit] In J

(other formulations as possible; some twice as fast[1]):

   sn   =.  '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'  NB.  SEDOL numerals
   acs  =:  (10 | 1 3 1 7 3 9 +/@:* -)&.(sn i. |:)  NB.  Checksum

[edit] In Perl

my @weights = (1, 3, 1, 7, 3, 9);
 
sub sedol_check_digit
{
    my ($sedol) = @_;
    die "invalid SEDOL format: `$sedol'\n"
        if $sedol !~ /^[0-9A-Z]{6,7}$/;
 
    my @chars = split //, $sedol;
    my $sum = 0;
    for my $i ( 0 .. $#weights )
    {
        my $char = $chars[$i];
        my $value = $char =~ /\d/
            ? $char
            : ord($char) - ord('A') + 10;
 
        $sum += $value * $weights[$i];
    }
 
    return (10 - ($sum % 10)) % 10;
}

[edit] In Python

import string
 
# constants
sedolchars = string.digits + string.ascii_uppercase
sedol2value = dict((ch, n) for n,ch in enumerate(sedolchars))
for ch in 'AEIOU':
    del sedol2value[ch]
 
sedolchars = sorted(sedol2value.keys())
sedolweight = [1,3,1,7,3,9,1]
 
def check(sedol):
    return len(sedol) == 7 and \
           all(ch in sedolchars for ch in sedol) and \
           sum( sedol2value[ch] * sedolweight[n]
                for n,ch in enumerate(sedol) ) % 10 == 0
 
def checksum(sedol):
    tmp = sum( sedol2value[ch] * sedolweight[n]
               for n,ch in enumerate(sedol[:6]) )
    return sedolchars[ (10 - (tmp % 10)) % 10]
 
sedol = '0263494'
print sedol, checksum(sedol)

[edit] In Visual Basic

Option Explicit
 
Public Function getSedolCheckDigit(str As String) As Variant
    ' calculates the final digit of a six digit sedol code using the algo described on wikipedia
    If Len(str) <> 6 Then
        getSedolCheckDigit = "Six chars only please"
        Exit Function
    End If
    Dim mult(6) As Integer
    mult(1) = 1: mult(2) = 3: mult(3) = 1: mult(4) = 7: mult(5) = 3: mult(6) = 9
    ' didn't use Array() to avoid Option Base problems
    Dim i, total As Integer
    Dim s As String
    total = 0
    For i = 1 To 6
        s = Mid(str, i, 1)
        total = total + IIf(IsNumeric(s), Val(s), Asc(s) - 55) * mult(i)
    Next
    getSedolCheckDigit = (10 - (total Mod 10)) Mod 10
End Function
 
function IsSedolValid(const Sedol: string): Boolean;
 
  function HasOnlyValidChars: Boolean;
  const
    ValidChars = ['0'..'9', 'A'..'Z'];
  var
    ch: Char;
  begin
    for ch in Sedol do begin
      if not (ch in ValidChars) then begin
        Result := False;
        Exit;
      end;
    end;
    Result := True;
  end;
 
begin
  Result := (Length(Sedol) = 7)
    and HasOnlyValidChars
    and (GetSedolCheckDigit(Copy(Sedol, 1, 6)) = Ord(Sedol[7]) - Ord('0'));
end;

[edit] In T-SQL

CREATE FUNCTION [dbo].[fn_IsSEDOLValid] ( @sSEDOL  AS  NVARCHAR(10))
-- Author: Abul Hasnat
-- Description: SEDOL Validation code in TSQL
RETURNS BIT
AS
BEGIN
  -- Declare the return variable here
  DECLARE @ResultVar AS BIT
        , @i	     AS	INT
        , @total     AS	INT
        , @s	     AS	NVARCHAR(10)
        , @tmpStr    AS	NVARCHAR(10)
        , @tmpDigit  AS	INT
 
  DECLARE @Multi	AS	TABLE(ID INT,IDX INT)
 
  --Populate TempTable
  INSERT INTO @Multi (ID,IDX) VALUES (1,1)
  INSERT INTO @Multi (ID,IDX) VALUES (2,3)
  INSERT INTO @Multi (ID,IDX) VALUES (3,1)
  INSERT INTO @Multi (ID,IDX) VALUES (4,7)
  INSERT INTO @Multi (ID,IDX) VALUES (5,3)
  INSERT INTO @Multi (ID,IDX) VALUES (6,9)
  -- Check Given SEDOL Code is 7 Digit
  IF(LEN(@sSEDOL)<>7)
    BEGIN
      SET @ResultVar = 0
    END
  ELSE
    BEGIN
      -- CHECK last digit is number
      IF(ISNUMERIC(SUBSTRING(@sSEDOL,LEN(@sSEDOL),1))=1)
        BEGIN 
	  SET @total = 0
	  SET @tmpStr = SUBSTRING(@sSEDOL,1,6)
	  SET @i=1
	  WHILE (SELECT @i) <=6
	    BEGIN
	      SET @s = SUBSTRING(@tmpStr, @i, 1)
              SET @total = @total + (SELECT CASE ISNUMERIC(@s) WHEN 1  THEN @s ELSE (ASCII(@s) - 55) END)* (SELECT IDX FROM @Multi WHERE ID=@i)
	      SET @i= @i +1
	    END
	  -- Get Check Digit
	  SET @tmpDigit = (10 - (@total % 10)) % 10
	  -- Match Check Digit for SEDOL
	  IF (SUBSTRING(@sSEDOL,LEN(@sSEDOL),1) = @tmpDigit)
	    SET @ResultVar = 1
	  ELSE
	    SET @ResultVar = 0
	END
      ELSE
	BEGIN 
	  SET @ResultVar = 0
	END
   END
   -- Return 1 if valid otherwise Return 0 as False
   RETURN @ResultVar
END
GO

[edit] Notes

[edit] External links

Personal tools

Visit joltnews for the latest headlines
Visit bloit.com for company information
Geed Media does computer consulting on long island.
This page viewed times. See Logs