Class: Fix::Protocol::Messages::Instrument

Inherits:
UnorderedPart show all
Defined in:
lib/fix/protocol/messages/instrument.rb

Overview

Constant Summary collapse

SECURITY_ID_SOURCE =

The security ID source codes

{
  '1' => :cusip,
  '2' => :sedol,
  '3' => :quik,
  '4' => :isin,
  '5' => :ric,
  '6' => :iso_currency,
  '7' => :iso_country,
  '8' => :exchange,
  '9' => :consolidated_tape_association,
  'A' => :bloomberg,
  'B' => :wertpapier,
  'C' => :dutch,
  'D' => :valoren,
  'E' => :sicovam,
  'F' => :belgian,
  'G' => :common,
  'H' => :clearing,
  'I' => :isda_fpml,
  'J' => :options_price_reporting_authority
}
PRODUCTS =

The product codes

{
  1 => :agency,
  2 => :commodity,
  3 => :corporate,
  4 => :currency,
  5 => :equity,
  6 => :government,
  7 => :index,
  8 => :loan,
  9 => :moneymarket,
  10 => :mortgage,
  11 => :municipal,
  12 => :other,
  13 => :financing
}

Instance Attribute Summary

Attributes inherited from Fix::Protocol::MessagePart

#delegations, #name, #parse_failure

Instance Method Summary collapse

Methods inherited from UnorderedPart

#parse

Methods inherited from Fix::Protocol::MessagePart

collection, #dump, field, inherited, #initialize, #initialize_node, #node_for_name, #nodes, parent_delegate, parse, #parse, part, structure, unordered

Constructor Details

This class inherits a constructor from Fix::Protocol::MessagePart

Instance Method Details

#can_parse?(str) ⇒ Boolean

Checks whether the start of the given string can be parsed as this particular part



66
67
68
# File 'lib/fix/protocol/messages/instrument.rb', line 66

def can_parse?(str)
  str =~ /(#{self.class.structure.map { |i| i[:tag] }.map(&:to_s).join('|')})=[^\x01]+\x01/
end

#errorsObject

Returns an error if security_id and security_source_id are not in the same filled/empty state



73
74
75
76
77
78
79
80
81
# File 'lib/fix/protocol/messages/instrument.rb', line 73

def errors
  e = []

  if !!security_id ^ !!security_id_source
    e << "Security ID, and security source must either be both blank, or both must be provided"
  end

  [super, e].flatten
end