fix-protocol 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c0beed30259b1a1ac0e530e0b4a96ac0329e5ab
4
- data.tar.gz: cb85ffdeb3c76826ad078091219ecbbd22e796cc
3
+ metadata.gz: 530c314fdf89cb24a0b093077ca43a8130f907cc
4
+ data.tar.gz: 8acfe54a1cb546ea8ca3104d9769a5c397a6f99c
5
5
  SHA512:
6
- metadata.gz: 620109d57d076bc3ccac65e8edfe1ec96db7e0cc01e048458d495fbb0f69503273148910fa9240eb352e39c7dc8f1d48468a581dba614b63e2480606a99fffbd
7
- data.tar.gz: fcce3d4785f25e28e4f962c27e525e4a7d803109448265cfb41383bcf2d1a24533beca16c002e536ade01940d3f17feb9ec2aa74a97c7a37919736c0ebe34437
6
+ metadata.gz: 7f252a53f8fc68cc596039a1f819e3ad75235cc4d10172db45f67553602aaf6a670b9af7203563c3871796c83bf7382fce7a671265786e0d456fa84d505f2247
7
+ data.tar.gz: f8a35c377f64daa52cf9096d0621699488531c062c51f8425a439c381956045878537bdca433476e6c5360dec25d4ada384dfc39f9673cce4309ff5071cb4561
@@ -14,6 +14,11 @@ module Fix
14
14
  DEFAULT_VERSION = 'FIX.4.4'
15
15
  @@expected_version = DEFAULT_VERSION
16
16
 
17
+ #
18
+ # Allows the version tag to be overridden at runtime
19
+ #
20
+ # @param version [String] The version to output and expect in messages
21
+ #
17
22
  def self.version=(v)
18
23
  @@expected_version = v
19
24
  end
@@ -7,6 +7,9 @@ module Fix
7
7
  #
8
8
  class BusinessMessageReject < Message
9
9
 
10
+ #
11
+ # The business reject reason codes
12
+ #
10
13
  BUSINESS_REJECT_REASONS = {
11
14
  0 => 'Other',
12
15
  1 => 'Unkown ID',
@@ -5,18 +5,79 @@ module Fix
5
5
  #
6
6
  # An Instrument component, see http://www.onixs.biz/fix-dictionary/4.4/compBlock_Instrument.html
7
7
  #
8
- class Instrument < MessagePart
8
+ class Instrument < UnorderedPart
9
9
 
10
- field :symbol, tag: 55, required: true
10
+ #
11
+ # The security ID source codes
12
+ #
13
+ SECURITY_ID_SOURCE = {
14
+ '1' => :cusip,
15
+ '2' => :sedol,
16
+ '3' => :quik,
17
+ '4' => :isin,
18
+ '5' => :ric,
19
+ '6' => :iso_currency,
20
+ '7' => :iso_country,
21
+ '8' => :exchange,
22
+ '9' => :consolidated_tape_association,
23
+ 'A' => :bloomberg,
24
+ 'B' => :wertpapier,
25
+ 'C' => :dutch,
26
+ 'D' => :valoren,
27
+ 'E' => :sicovam,
28
+ 'F' => :belgian,
29
+ 'G' => :common,
30
+ 'H' => :clearing,
31
+ 'I' => :isda_fpml,
32
+ 'J' => :options_price_reporting_authority
33
+ }
34
+
35
+ #
36
+ # The product codes
37
+ #
38
+ PRODUCTS = {
39
+ 1 => :agency,
40
+ 2 => :commodity,
41
+ 3 => :corporate,
42
+ 4 => :currency,
43
+ 5 => :equity,
44
+ 6 => :government,
45
+ 7 => :index,
46
+ 8 => :loan,
47
+ 9 => :moneymarket,
48
+ 10 => :mortgage,
49
+ 11 => :municipal,
50
+ 12 => :other,
51
+ 13 => :financing
52
+ }
53
+
54
+ field :symbol, tag: 55
55
+ field :security_id, tag: 48
56
+ field :security_id_source, tag: 22, mapping: SECURITY_ID_SOURCE
57
+ field :product, tag: 460, type: :integer, mapping: PRODUCTS
58
+ field :security_desc, tag: 107
11
59
 
12
60
  #
13
- # Checks whether the start of the given string can be parsed as this particular field
61
+ # Checks whether the start of the given string can be parsed as this particular part
14
62
  #
15
63
  # @param str [String] The string for which we want to parse the beginning
16
64
  # @return [Boolean] Whether the beginning of the string can be parsed for this field
17
65
  #
18
66
  def can_parse?(str)
19
- str =~ /55\=[^\x01]+\x01/
67
+ str =~ /(#{self.class.structure.map { |i| i[:tag] }.map(&:to_s).join('|')})=[^\x01]+\x01/
68
+ end
69
+
70
+ #
71
+ # Returns an error if security_id and security_source_id are not in the same filled/empty state
72
+ #
73
+ def errors
74
+ e = []
75
+
76
+ if !!security_id ^ !!security_id_source
77
+ e << "Security ID, and security source must either be both blank, or both must be provided"
78
+ end
79
+
80
+ [super, e].flatten
20
81
  end
21
82
 
22
83
  end
@@ -4,7 +4,7 @@ module Fix
4
4
  #
5
5
  # The fix-protocol gem version string
6
6
  #
7
- VERSION = '1.1.1'
7
+ VERSION = '1.1.2'
8
8
 
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David François