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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 530c314fdf89cb24a0b093077ca43a8130f907cc
|
4
|
+
data.tar.gz: 8acfe54a1cb546ea8ca3104d9769a5c397a6f99c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f252a53f8fc68cc596039a1f819e3ad75235cc4d10172db45f67553602aaf6a670b9af7203563c3871796c83bf7382fce7a671265786e0d456fa84d505f2247
|
7
|
+
data.tar.gz: f8a35c377f64daa52cf9096d0621699488531c062c51f8425a439c381956045878537bdca433476e6c5360dec25d4ada384dfc39f9673cce4309ff5071cb4561
|
data/lib/fix/protocol/message.rb
CHANGED
@@ -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
|
@@ -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 <
|
8
|
+
class Instrument < UnorderedPart
|
9
9
|
|
10
|
-
|
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
|
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 =~ /
|
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
|
data/lib/fix/protocol/version.rb
CHANGED