fix-protocol 0.0.4 → 0.0.41

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: 3eaeccdfef785de62e4ba4d4c3fdf35f9b5e7deb
4
- data.tar.gz: d39b8458438d5d4fbb1bd4ebd4e0f2bec636ff96
3
+ metadata.gz: 9ac67d01fa57ccfa5afe685f930ddadbf019a811
4
+ data.tar.gz: 19a31a25cd16be7ae00c3bd50d563d7976b58a4e
5
5
  SHA512:
6
- metadata.gz: 522826d4dccc9a32ded210c8ca7b1409221091e78c456550217d0543ee401c37cfaac28505ea9d2b49fa5bf4da92913ecda49edc34b2ae81c975891750fd519a
7
- data.tar.gz: 97d715b60b8e49ab80d917d28f380e232c3e7fe5e7d469bd8875edcd6255bf1a7db44d9bf810252f56e5a1fce76eef9753dca683153f3d7c04e1e3035585301f
6
+ metadata.gz: af15983b1cd341165148f5dbf8917a46f93ff6021cb2a452fd046ff21467b37e230ecba6313b17606bab47a55d1a95b2ca005e6f70a3ef1d8d53da794d75ed11
7
+ data.tar.gz: 99b289677c11e08d5818b9db818871480b6395bc7200e883dacb9544a4d4ebc4792b3ed4a9c7fc5f74ca8f2c5e2671d0286a496a189a271bc3eef9d21fbd0b19
data/README.md CHANGED
@@ -11,8 +11,9 @@ Currently it only supports the FIX messages needed for our own use. Additional m
11
11
  require 'fix/protocol'
12
12
 
13
13
  msg = FP::Messages::Logon.new
14
- msg.header.sender_comp_id = 'MY_ID'
15
- msg.header.target_comp_id = 'MY_COUNTERPARTY'
14
+ msg.sender_comp_id = 'MY_ID'
15
+ msg.target_comp_id = 'MY_COUNTERPARTY'
16
+ msg.msg_seq_num = 0
16
17
  msg.username = 'MY_USERNAME'
17
18
 
18
19
  if msg.valid?
@@ -24,7 +24,7 @@ module Fix
24
24
  # @return [String] A message fragment terminated by the separator byte
25
25
  #
26
26
  def dump
27
- "#{tag}=#{@value}\x01"
27
+ @value && "#{tag}=#{@value}\x01"
28
28
  end
29
29
 
30
30
  #
@@ -40,6 +40,8 @@ module Fix
40
40
  str.gsub(/^[^\x01]+\x01/, '')
41
41
  elsif required
42
42
  self.parse_failure = "Expected <#{str}> to start with a <#{tag}=...|> required field"
43
+ else
44
+ str
43
45
  end
44
46
  end
45
47
 
@@ -1,5 +1,6 @@
1
1
  require 'polyglot'
2
2
  require 'treetop'
3
+ require 'forwardable'
3
4
 
4
5
  require 'fix/protocol/message_part'
5
6
  require 'fix/protocol/repeating_message_part'
@@ -13,6 +14,13 @@ module Fix
13
14
  #
14
15
  class Message < MessagePart
15
16
 
17
+ extend Forwardable
18
+ def_delegators :header,
19
+ :sender_comp_id, :sender_comp_id=,
20
+ :target_comp_id, :target_comp_id=,
21
+ :msg_seq_num, :msg_seq_num=,
22
+ :sending_time, :sending_time=
23
+
16
24
  part :header, klass: MessageHeader
17
25
 
18
26
  def initialize
@@ -16,7 +16,9 @@ module Fix
16
16
  '2' => :resend_request,
17
17
  '3' => :reject,
18
18
  '5' => :logout,
19
- 'V' => :market_data_request
19
+ 'V' => :market_data_request,
20
+ 'W' => :market_data_snapshot,
21
+ 'X' => :market_data_incremental_refresh
20
22
  }
21
23
 
22
24
  #
@@ -9,7 +9,7 @@ module Fix
9
9
  class MessageHeader < MessagePart
10
10
 
11
11
  field :version, tag: 8, required: true, default: 'FIX.4.4'
12
- field :body_length, tag: 9
12
+ field :body_length, tag: 9, default: 0
13
13
  field :msg_type, tag: 35, required: true
14
14
  field :sender_comp_id, tag: 49, required: true
15
15
  field :target_comp_id, tag: 56, required: true
@@ -7,7 +7,7 @@ module Fix
7
7
  #
8
8
  class Logout < Message
9
9
 
10
- has_field :text, tag: 58
10
+ field :text, tag: 58
11
11
 
12
12
  end
13
13
  end
@@ -0,0 +1,20 @@
1
+ require 'fix/protocol/messages/instrument'
2
+ require 'fix/protocol/messages/md_entry'
3
+
4
+ module Fix
5
+ module Protocol
6
+ module Messages
7
+
8
+ #
9
+ # A full market refresh
10
+ #
11
+ class MarketDataIncrementalRefresh < Message
12
+
13
+ field :md_req_id, tag: 262, required: true
14
+ collection :md_entries, counter_tag: 268, klass: FP::Messages::MdEntry
15
+
16
+ end
17
+ end
18
+ end
19
+ end
20
+
@@ -10,26 +10,35 @@ module Fix
10
10
  #
11
11
  class MarketDataRequest < Message
12
12
 
13
- # SUBSCRIPTION_TYPES = {
14
- # snapshot: 1,
15
- # updates: 2,
16
- # unsubscribe: 3
17
- # }
18
13
  #
19
- # MKT_DPTH_TYPES = {
20
- # full: 0,
21
- # top: 1
22
- # }
14
+ # The subscription type, see: http://www.onixs.biz/fix-dictionary/4.4/tagNum_263.html
23
15
  #
24
- # UPDATE_TYPES = {
25
- # full: 0,
26
- # incremental: 1
27
- # }
16
+ SUBSCRIPTION_TYPES = {
17
+ snapshot: 1,
18
+ updates: 2,
19
+ unsubscribe: 3
20
+ }
21
+
22
+ #
23
+ # Whether to return the full book or only the best bid/ask
24
+ #
25
+ MKT_DPTH_TYPES = {
26
+ full: 0,
27
+ top: 1
28
+ }
29
+
30
+ #
31
+ # Whether to send a full market depth on each update, we'll probably only support the incremental type
32
+ #
33
+ UPDATE_TYPES = {
34
+ full: 0,
35
+ incremental: 1
36
+ }
28
37
 
29
38
  field :md_req_id, tag: 262, required: true
30
- field :subscription_request_type, tag: 263, required: true, type: :integer #, mapping: SUBSCRIPTION_TYPES
31
- field :market_depth, tag: 264, required: true, type: :integer #, mapping: MKT_DPTH_TYPES
32
- field :md_update_type, tag: 265, required: true, type: :integer #, mapping: UPDATE_TYPES
39
+ field :subscription_request_type, tag: 263, required: true, type: :integer, mapping: SUBSCRIPTION_TYPES
40
+ field :market_depth, tag: 264, required: true, type: :integer, mapping: MKT_DPTH_TYPES
41
+ field :md_update_type, tag: 265, required: true, type: :integer, mapping: UPDATE_TYPES
33
42
 
34
43
  collection :md_entry_types, counter_tag: 267, klass: FP::Messages::MdEntryType
35
44
  collection :instruments, counter_tag: 146, klass: FP::Messages::Instrument
@@ -0,0 +1,23 @@
1
+ require 'fix/protocol/messages/instrument'
2
+ require 'fix/protocol/messages/md_entry'
3
+
4
+ module Fix
5
+ module Protocol
6
+ module Messages
7
+
8
+ #
9
+ # A full market refresh
10
+ #
11
+ class MarketDataSnapshot < Message
12
+
13
+ field :md_req_id, tag: 262, required: true
14
+
15
+ part :instrument, klass: FP::Messages::Instrument
16
+
17
+ collection :md_entries, counter_tag: 268, klass: FP::Messages::MdEntry
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,46 @@
1
+ module Fix
2
+ module Protocol
3
+ module Messages
4
+
5
+ #
6
+ # A market data entry
7
+ #
8
+ class MdEntry < MessagePart
9
+
10
+ #
11
+ # The MD entry type mapping
12
+ #
13
+ MD_ENTRY_TYPES = {
14
+ bid: 0,
15
+ ask: 1,
16
+ trade: 2,
17
+ index: 3,
18
+ open: 4,
19
+ close: 5,
20
+ settlement: 6,
21
+ high: 7,
22
+ low: 8,
23
+ vwap: 9,
24
+ imbalance: 'A',
25
+ volume: 'B',
26
+ open_interest: 'C'
27
+ }
28
+
29
+ #
30
+ # The update actions when updating a market data entry
31
+ #
32
+ MD_UPDATE_ACTIONS = {
33
+ new: 0,
34
+ change: 1,
35
+ delete: 2
36
+ }
37
+
38
+ field :update_action, tag: 279, mapping: MD_UPDATE_ACTIONS
39
+ field :md_entry_type, tag: 269, required: true, mapping: MD_ENTRY_TYPES
40
+ field :md_entry_px, tag: 270
41
+ field :currency, tag: 15
42
+ field :md_entry_size, tag: 271
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,3 +1,5 @@
1
+ require 'fix/protocol/messages/md_entry'
2
+
1
3
  module Fix
2
4
  module Protocol
3
5
  module Messages
@@ -7,25 +9,7 @@ module Fix
7
9
  #
8
10
  class MdEntryType < MessagePart
9
11
 
10
- #
11
- # The MD entry type mapping
12
- #
13
- MD_ENTRY_TYPES = {
14
- bid: 0,
15
- ask: 1,
16
- offer: 1,
17
- trade: 2,
18
- index: 3,
19
- open: 4,
20
- close: 5,
21
- settlement: 6,
22
- high: 7,
23
- low: 8,
24
- vwap: 9,
25
- volume: 'B'
26
- }
27
-
28
- field :md_entry_type, tag: 269, required: true, mapping: MD_ENTRY_TYPES
12
+ field :md_entry_type, tag: 269, required: true, mapping: FP::Messages::MdEntry::MD_ENTRY_TYPES
29
13
 
30
14
  end
31
15
 
@@ -4,7 +4,7 @@ module Fix
4
4
  #
5
5
  # The fix-protocol gem version string
6
6
  #
7
- VERSION = '0.0.4'
7
+ VERSION = '0.0.41'
8
8
 
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fix-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - David François
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -140,7 +140,10 @@ files:
140
140
  - lib/fix/protocol/messages/instrument.rb
141
141
  - lib/fix/protocol/messages/logon.rb
142
142
  - lib/fix/protocol/messages/logout.rb
143
+ - lib/fix/protocol/messages/market_data_incremental_refresh.rb
143
144
  - lib/fix/protocol/messages/market_data_request.rb
145
+ - lib/fix/protocol/messages/market_data_snapshot.rb
146
+ - lib/fix/protocol/messages/md_entry.rb
144
147
  - lib/fix/protocol/messages/md_entry_type.rb
145
148
  - lib/fix/protocol/messages/reject.rb
146
149
  - lib/fix/protocol/messages/resend_request.rb