Class: SecID::FISN

Inherits:
Base
  • Object
show all
Defined in:
lib/sec_id/fisn.rb

Overview

Financial Instrument Short Name (FISN) - a human-readable short name for financial instruments per ISO 18774.

Format: Issuer Name/Abbreviated Instrument Description

  • Total length: 1-35 characters
  • Issuer: 1-15 characters (uppercase A-Z, digits 0-9, space)
  • Separator: forward slash (/)
  • Description: 1-19 characters (uppercase A-Z, digits 0-9, space)

Examples:

Validate a FISN

SecID::FISN.valid?('APPLE INC/SH')  #=> true
SecID::FISN.valid?('apple inc/sh')  #=> true (normalized to uppercase)

Access FISN components

fisn = SecID::FISN.new('APPLE INC/SH')
fisn.issuer       #=> 'APPLE INC'
fisn.description  #=> 'SH'

See Also:

Constant Summary collapse

FULL_NAME =

Human-readable name of the standard.

'Financial Instrument Short Name'
ID_LENGTH =

Valid length(s) of a normalized identifier.

(3..35)
EXAMPLE =

A representative valid identifier.

'APPLE INC/SH'
VALID_CHARS_REGEX =

Pattern matching the identifier's permitted character set.

%r{\A[A-Z0-9 /]+\z}
SEPARATORS =

Separators stripped during normalization; spaces are structural here, so only hyphens.

/-/
ID_REGEX =

Regular expression for parsing FISN components. Issuer: 1-15 chars, Description: 1-19 chars, Total: max 35 chars

%r{\A
  (?<identifier>
    (?<issuer>[A-Z0-9 ]{1,15})
    /
    (?<description>[A-Z0-9 ]{1,19}))
\z}x
FISN_CHARSET =

Characters valid in a FISN segment (alphanumeric and space).

(ALPHANUMERIC + [' ']).freeze

Constants included from Generatable

Generatable::ALPHA, Generatable::ALPHANUMERIC, Generatable::DIGITS

Constants included from Validatable

Validatable::ERROR_MAP

Instance Attribute Summary collapse

Attributes inherited from Base

#full_id, #identifier

Instance Method Summary collapse

Methods inherited from Base

#==, #as_json, example, full_name, has_check_digit?, #hash, id_length, length_specificity, length_values, short_name, #to_h

Methods included from Validatable

#errors, #valid?, #validate, #validate!

Methods included from Normalizable

#normalize!, #normalized, #to_pretty_s, #to_str

Constructor Details

#initialize(fisn) ⇒ FISN

Returns a new instance of FISN.

Parameters:

  • fisn (String)

    the FISN string to parse



54
55
56
57
58
59
# File 'lib/sec_id/fisn.rb', line 54

def initialize(fisn)
  fisn_parts = parse(fisn)
  @identifier = fisn_parts[:identifier]
  @issuer = fisn_parts[:issuer]
  @description = fisn_parts[:description]
end

Instance Attribute Details

#descriptionString? (readonly)

Returns the abbreviated instrument description (after the slash).

Returns:

  • (String, nil)

    the abbreviated instrument description (after the slash)



51
52
53
# File 'lib/sec_id/fisn.rb', line 51

def description
  @description
end

#issuerString? (readonly)

Returns the issuer name portion (before the slash).

Returns:

  • (String, nil)

    the issuer name portion (before the slash)



48
49
50
# File 'lib/sec_id/fisn.rb', line 48

def issuer
  @issuer
end

Instance Method Details

#to_sString

Returns:

  • (String)


62
63
64
# File 'lib/sec_id/fisn.rb', line 62

def to_s
  identifier.to_s
end