fix_spec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.travis.yml +11 -0
- data/CONTRIBUTION_GUIDELINES.md +22 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +81 -0
- data/LICENSE.txt +14 -0
- data/QUICKFIX_LICENSE.txt +46 -0
- data/README.md +181 -0
- data/Rakefile +35 -0
- data/VERSION +1 -0
- data/features/builder.feature +148 -0
- data/features/equivalence.feature +52 -0
- data/features/equivalence_data_dictionary.feature +166 -0
- data/features/memory.feature +47 -0
- data/features/message_type.feature +25 -0
- data/features/nested_builder.feature +63 -0
- data/features/paths.feature +14 -0
- data/features/step_definitions/steps.rb +3 -0
- data/features/support/FIX42.xml +2670 -0
- data/features/support/env.rb +20 -0
- data/fix_spec.gemspec +89 -0
- data/lib/fix_spec/builder.rb +99 -0
- data/lib/fix_spec/configuration.rb +16 -0
- data/lib/fix_spec/cucumber.rb +76 -0
- data/lib/fix_spec/helpers.rb +98 -0
- data/lib/fix_spec/matchers/be_fix_eql.rb +45 -0
- data/lib/fix_spec/matchers/have_fix_path.rb +29 -0
- data/lib/fix_spec/matchers.rb +18 -0
- data/lib/fix_spec.rb +10 -0
- data/spec/fix_spec/helpers_spec.rb +114 -0
- data/spec/spec_helper.rb +13 -0
- metadata +194 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
If you come across any issues, please [tell us](https://github.com/connamara/fix_spec/issues).
|
2
|
+
Pull requests (with tests) are appreciated. No pull request is too small. Please help with:
|
3
|
+
|
4
|
+
* Reporting bugs
|
5
|
+
* Suggesting features
|
6
|
+
* Writing or improving documentation
|
7
|
+
* Fixing typos
|
8
|
+
* Cleaning whitespace
|
9
|
+
* Refactoring code
|
10
|
+
* Adding tests
|
11
|
+
* Closing [issues](https://github.com/connamara/fix_spec/issues)
|
12
|
+
|
13
|
+
Contributing to fix\_spec:
|
14
|
+
|
15
|
+
1. Fork the [official repository](https://github.com/connamara/fix_spec/tree/master).
|
16
|
+
2. Make your changes in a topic branch.
|
17
|
+
3. Send a pull request.
|
18
|
+
|
19
|
+
Notes:
|
20
|
+
* If you report a bug and don't include a fix, please include a failing test.
|
21
|
+
* Contributions without tests won't be accepted.
|
22
|
+
* Please don't update the Gem version
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "json_spec", "~> 1.1.1"
|
4
|
+
gem "quickfix-jruby", "~>1.5.3"
|
5
|
+
gem "cuke_mem", "~> 0.1.1"
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "rspec", "~> 2.14"
|
9
|
+
gem "jeweler", "~> 1.8"
|
10
|
+
gem "cucumber", "~> 1.3"
|
11
|
+
gem "rake", "~> 10.1"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
6
|
+
cucumber (1.3.6)
|
7
|
+
builder (>= 2.1.2)
|
8
|
+
diff-lcs (>= 1.1.3)
|
9
|
+
gherkin (~> 2.12.0)
|
10
|
+
multi_json (~> 1.7.5)
|
11
|
+
multi_test (>= 0.0.2)
|
12
|
+
cuke_mem (0.1.1)
|
13
|
+
cucumber (~> 1.3)
|
14
|
+
diff-lcs (1.2.4)
|
15
|
+
faraday (0.8.8)
|
16
|
+
multipart-post (~> 1.2.0)
|
17
|
+
gherkin (2.12.1-java)
|
18
|
+
multi_json (~> 1.3)
|
19
|
+
git (1.2.6)
|
20
|
+
github_api (0.10.1)
|
21
|
+
addressable
|
22
|
+
faraday (~> 0.8.1)
|
23
|
+
hashie (>= 1.2)
|
24
|
+
multi_json (~> 1.4)
|
25
|
+
nokogiri (~> 1.5.2)
|
26
|
+
oauth2
|
27
|
+
hashie (2.0.5)
|
28
|
+
highline (1.6.19)
|
29
|
+
httpauth (0.2.0)
|
30
|
+
jeweler (1.8.7)
|
31
|
+
builder
|
32
|
+
bundler (~> 1.0)
|
33
|
+
git (>= 1.2.5)
|
34
|
+
github_api (= 0.10.1)
|
35
|
+
highline (>= 1.6.15)
|
36
|
+
nokogiri (= 1.5.10)
|
37
|
+
rake
|
38
|
+
rdoc
|
39
|
+
json (1.8.0-java)
|
40
|
+
json_spec (1.1.1)
|
41
|
+
multi_json (~> 1.0)
|
42
|
+
rspec (~> 2.0)
|
43
|
+
jwt (0.1.8)
|
44
|
+
multi_json (>= 1.5)
|
45
|
+
multi_json (1.7.9)
|
46
|
+
multi_test (0.0.2)
|
47
|
+
multi_xml (0.5.5)
|
48
|
+
multipart-post (1.2.0)
|
49
|
+
nokogiri (1.5.10-java)
|
50
|
+
oauth2 (0.9.2)
|
51
|
+
faraday (~> 0.8)
|
52
|
+
httpauth (~> 0.2)
|
53
|
+
jwt (~> 0.1.4)
|
54
|
+
multi_json (~> 1.0)
|
55
|
+
multi_xml (~> 0.5)
|
56
|
+
rack (~> 1.2)
|
57
|
+
quickfix-jruby (1.5.3-java)
|
58
|
+
rack (1.5.2)
|
59
|
+
rake (10.1.0)
|
60
|
+
rdoc (4.0.1)
|
61
|
+
json (~> 1.4)
|
62
|
+
rspec (2.14.1)
|
63
|
+
rspec-core (~> 2.14.0)
|
64
|
+
rspec-expectations (~> 2.14.0)
|
65
|
+
rspec-mocks (~> 2.14.0)
|
66
|
+
rspec-core (2.14.5)
|
67
|
+
rspec-expectations (2.14.2)
|
68
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
69
|
+
rspec-mocks (2.14.3)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
java
|
73
|
+
|
74
|
+
DEPENDENCIES
|
75
|
+
cucumber (~> 1.3)
|
76
|
+
cuke_mem (~> 0.1.1)
|
77
|
+
jeweler (~> 1.8)
|
78
|
+
json_spec (~> 1.1.1)
|
79
|
+
quickfix-jruby (~> 1.5.3)
|
80
|
+
rake (~> 10.1)
|
81
|
+
rspec (~> 2.14)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright (C) 2013 Connamara Systems, llc
|
2
|
+
|
3
|
+
This program is free software: you can redistribute it and/or modify
|
4
|
+
it under the terms of the GNU General Public License as published by
|
5
|
+
the Free Software Foundation, either version 3 of the License, or
|
6
|
+
(at your option) any later version.
|
7
|
+
|
8
|
+
This program is distributed in the hope that it will be useful,
|
9
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
GNU General Public License for more details.
|
12
|
+
|
13
|
+
You should have received a copy of the GNU General Public License
|
14
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
@@ -0,0 +1,46 @@
|
|
1
|
+
The QuickFIX Software License, Version 1.0
|
2
|
+
|
3
|
+
Copyright (c) 2001-2010 quickfixengine.org All rights
|
4
|
+
reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions
|
8
|
+
are met:
|
9
|
+
|
10
|
+
1. Redistributions of source code must retain the above copyright
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
12
|
+
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
notice, this list of conditions and the following disclaimer in
|
15
|
+
the documentation and/or other materials provided with the
|
16
|
+
distribution.
|
17
|
+
|
18
|
+
3. The end-user documentation included with the redistribution,
|
19
|
+
if any, must include the following acknowledgment:
|
20
|
+
"This product includes software developed by
|
21
|
+
quickfixengine.org (http://www.quickfixengine.org/)."
|
22
|
+
Alternately, this acknowledgment may appear in the software itself,
|
23
|
+
if and wherever such third-party acknowledgments normally appear.
|
24
|
+
|
25
|
+
4. The names "QuickFIX" and "quickfixengine.org" must
|
26
|
+
not be used to endorse or promote products derived from this
|
27
|
+
software without prior written permission. For written
|
28
|
+
permission, please contact ask@quickfixengine.org
|
29
|
+
|
30
|
+
5. Products derived from this software may not be called "QuickFIX",
|
31
|
+
nor may "QuickFIX" appear in their name, without prior written
|
32
|
+
permission of quickfixengine.org
|
33
|
+
|
34
|
+
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
35
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
36
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
37
|
+
DISCLAIMED. IN NO EVENT SHALL QUICKFIXENGINE.ORG OR
|
38
|
+
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
39
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
40
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
41
|
+
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
42
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
43
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
44
|
+
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
45
|
+
SUCH DAMAGE.
|
46
|
+
|
data/README.md
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
fix\_spec [![Build Status](https://travis-ci.org/connamara/fix_spec.png)](https://travis-ci.org/connamara/fix_spec)
|
2
|
+
=========
|
3
|
+
|
4
|
+
RSpec matchers and Cucumber step definitions for testing FIX Messages using [json_spec](https://github.com/collectiveidea/json_spec) and [quickfix-jruby](https://github.com/connamara/quickfix-jruby)
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
|
9
|
+
### RSpec
|
10
|
+
|
11
|
+
fix\_spec currently defines two matchers:
|
12
|
+
|
13
|
+
* ```be_fix_eql```
|
14
|
+
* ```have_fix_path```
|
15
|
+
|
16
|
+
The matchers can be used as their counterparts are used in json\_spec
|
17
|
+
|
18
|
+
### Cucumber
|
19
|
+
|
20
|
+
fix_spec provides Cucumber steps that utilize its RSpec matchers.
|
21
|
+
|
22
|
+
In order to us ethe Cucumber steps, in your `env.rb` you must:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require "fix_spec/cucumber"
|
26
|
+
```
|
27
|
+
|
28
|
+
#### "Should" Assertions
|
29
|
+
|
30
|
+
In order to test the contents of a FIX message, you will need to define a `last_fix` method. This method will be called by fix_spec to grab the FIX message to test. For example, suppose a step aquires a fix message and assigns it to `@my_fix_message`. In your `env.rb` you could then have
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
def last_fix
|
34
|
+
@my_fix_message
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
See [features/support/env.rb](features/support/env.rb) and [features/step_definitions/steps.rb](features/step_definitions/steps.rb) for a very simple implementation.
|
39
|
+
|
40
|
+
Now you can use fix_spec steps in your features:
|
41
|
+
|
42
|
+
```cucumber
|
43
|
+
Feature: New Order
|
44
|
+
|
45
|
+
Background:
|
46
|
+
|
47
|
+
Given some order message
|
48
|
+
|
49
|
+
Scenario: A Market Order is valid
|
50
|
+
Then the FIX message type should be "NewOrderSingle"
|
51
|
+
Then the FIX should have tag "OrderQty"
|
52
|
+
And the FIX message should not have tag "Price"
|
53
|
+
And the FIX at "SenderCompID" should be "MY_SENDER"
|
54
|
+
|
55
|
+
And the FIX messsage should have the following:
|
56
|
+
|SenderCompID | "MY_SENDER" |
|
57
|
+
|TargetCompID | "MY_TARGET" |
|
58
|
+
|OrderQty | 123 |
|
59
|
+
|OrdType | "MARKET" |
|
60
|
+
|
61
|
+
And the FIX message should be:
|
62
|
+
"""
|
63
|
+
{
|
64
|
+
"BeginString":"FIX.4.2",
|
65
|
+
"BodyLength":81,
|
66
|
+
"MsgType":"NewOrderSingle",
|
67
|
+
"SenderCompID":"MY_SENDER",
|
68
|
+
"TargetCompID":"MY_TARGET",
|
69
|
+
"OrdType": "MARKET",
|
70
|
+
"OrderQty": 123,
|
71
|
+
"CheckSum":"083"
|
72
|
+
}
|
73
|
+
"""
|
74
|
+
|
75
|
+
And the FIX message should be:
|
76
|
+
"""
|
77
|
+
8=FIX.4.29-8135=D49=MY_SENDER56=MY_TARGET40=138=12310=083
|
78
|
+
"""
|
79
|
+
```
|
80
|
+
|
81
|
+
The background step isn't provided by fix_spec. The remaining steps fix_spec provides. See [features](features/) for more examples.
|
82
|
+
|
83
|
+
|
84
|
+
#### Building FIX Messages
|
85
|
+
|
86
|
+
In order to use the Cucumber steps for building FIX messages, in your `env.rb` you must:
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
require "fix_spec/builder"
|
90
|
+
```
|
91
|
+
Now you can use fix_spec builder steps in your features:
|
92
|
+
|
93
|
+
```cucumber
|
94
|
+
Feature: Order Adapter accepts Orders
|
95
|
+
|
96
|
+
Scenario: It accepts Market Orders
|
97
|
+
|
98
|
+
Given I create a FIX.4.2 message of type "NewOrderSingle"
|
99
|
+
And I set the FIX message at "SenderCompID" to "MY_SENDER"
|
100
|
+
And I set the FIX message at "TargetCompID" to "MY_TARGET"
|
101
|
+
And I set the FIX message at "OrdType" to "MARKET"
|
102
|
+
And I set the FIX message at "OrderQty" to 123
|
103
|
+
Then I send the message
|
104
|
+
```
|
105
|
+
|
106
|
+
The built FIX message can be accessed through the `message` function in the ```FIXSpec::Builder``` module.
|
107
|
+
|
108
|
+
### Configuration
|
109
|
+
|
110
|
+
#### DataDictionary
|
111
|
+
|
112
|
+
FIXSpec works best when a DataDictionary is provided. With a DataDictionary loaded, you can inspect a message with named tags, enumeration, and type specific tag values.
|
113
|
+
|
114
|
+
The DataDictionary is globally set:
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
FIXSpec::data_dictionary = quickfix.DataDictionary.new "config/FIX42.xml"
|
118
|
+
```
|
119
|
+
|
120
|
+
#### Exclusion
|
121
|
+
|
122
|
+
When checking for fix message equality, you may wish to ignore some common fields that are mostly session level. For example, at an application level, BodyLength and CheckSum can be assumed to be set correctly. Tag exclusion is configured globally via JsonSpec:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
JsonSpec.configure do
|
126
|
+
exclude_keys "BodyLength", "CheckSum", "MsgSeqNum"
|
127
|
+
end
|
128
|
+
```
|
129
|
+
|
130
|
+
### More
|
131
|
+
|
132
|
+
Check out [specs](spec/) and [features](features/) to see all the ways you can use fix_spec.
|
133
|
+
|
134
|
+
Install
|
135
|
+
-------
|
136
|
+
|
137
|
+
```shell
|
138
|
+
gem install fix_spec
|
139
|
+
```
|
140
|
+
|
141
|
+
or add the following to Gemfile:
|
142
|
+
```ruby
|
143
|
+
gem 'fix_spec'
|
144
|
+
```
|
145
|
+
and run `bundle install` from your shell.
|
146
|
+
|
147
|
+
More Information
|
148
|
+
----------------
|
149
|
+
|
150
|
+
* [Rubygems](https://rubygems.org/gems/fix_spec)
|
151
|
+
* [Issues](https://github.com/connamara/fix_spec/issues)
|
152
|
+
* [Connamara Systems](http://connamara.com)
|
153
|
+
|
154
|
+
Contributing
|
155
|
+
------------
|
156
|
+
|
157
|
+
Please see the [contribution guidelines](CONTRIBUTION_GUIDELINES.md).
|
158
|
+
|
159
|
+
Credits
|
160
|
+
-------
|
161
|
+
|
162
|
+
Contributers:
|
163
|
+
|
164
|
+
* Chris Busbey
|
165
|
+
* Matt Lane
|
166
|
+
* Ben Gura
|
167
|
+
|
168
|
+
![Connamara Systems](http://www.connamara.com/images/home-connamara-logo-lg.png)
|
169
|
+
|
170
|
+
fix_spec is maintained and funded by [Connamara Systems, llc](http://connamara.com).
|
171
|
+
|
172
|
+
The names and logos for Connamara Systems are trademarks of Connamara Systems, llc.
|
173
|
+
|
174
|
+
Licensing
|
175
|
+
---------
|
176
|
+
|
177
|
+
fix_spec is Copyright © 2013 Connamara Systems, llc.
|
178
|
+
|
179
|
+
This software is available under the GPL and a commercial license. Please see the [LICENSE](LICENSE.txt) file for the terms specified by the GPL license. The commercial license offers more flexible licensing terms compared to the GPL, and includes support services. [Contact us](mailto:info@connamara.com) for more information on the Connamara commercial license, what it enables, and how you can start commercial development with it.
|
180
|
+
|
181
|
+
This product includes software developed by quickfixengine.org ([http://www.quickfixengine.org/](http://www.quickfixengine.org/)). Please see the [QuickFIX Software LICENSE](QUICKFIX_LICENSE.txt) for the terms specified by the QuickFIX Software License.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
|
13
|
+
require "rspec/core/rake_task"
|
14
|
+
require 'cucumber/rake/task'
|
15
|
+
RSpec::Core::RakeTask.new(:spec)
|
16
|
+
Cucumber::Rake::Task.new(:cucumber) do |t|
|
17
|
+
t.cucumber_opts = %w{--color --format pretty}
|
18
|
+
end
|
19
|
+
|
20
|
+
task :test => [:spec,:cucumber]
|
21
|
+
task :default => :test
|
22
|
+
|
23
|
+
require 'jeweler'
|
24
|
+
Jeweler::Tasks.new do |gem|
|
25
|
+
gem.name = "fix_spec"
|
26
|
+
gem.homepage = "http://github.com/connamara/fix_spec"
|
27
|
+
gem.license = "GPL"
|
28
|
+
gem.summary = %Q{Build and Inspect FIX Messages}
|
29
|
+
gem.description = %Q{Build and Inspect FIX Messages with RSpec and Cucumber steps}
|
30
|
+
gem.email = "info@connamara.com"
|
31
|
+
gem.authors = ["Chris Busbey"]
|
32
|
+
# dependencies defined in Gemfile
|
33
|
+
end
|
34
|
+
|
35
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,148 @@
|
|
1
|
+
@with_data_dictionary
|
2
|
+
Feature: Building Fix Messages
|
3
|
+
|
4
|
+
@ignore_length_and_checksum
|
5
|
+
Scenario: Building via raw fix
|
6
|
+
Given the following unvalidated fix message:
|
7
|
+
"""
|
8
|
+
8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
|
9
|
+
"""
|
10
|
+
When I get the fix message
|
11
|
+
|
12
|
+
Then the FIX message should be:
|
13
|
+
"""
|
14
|
+
{
|
15
|
+
"BeginString":"FIX.4.2",
|
16
|
+
"MsgType":"ExecutionReport",
|
17
|
+
"SenderCompID":"ITG",
|
18
|
+
"TargetCompID":"SILO",
|
19
|
+
"MaturityDay":4,
|
20
|
+
"DayOrderQty": 23.45,
|
21
|
+
"ExchangeForPhysical": true,
|
22
|
+
"AvgPx": 100.25,
|
23
|
+
"OrdType": "MARKET",
|
24
|
+
"PossDupFlag": false,
|
25
|
+
"AdvTransType": "NEW",
|
26
|
+
"UnderlyingPutOrCall": 8,
|
27
|
+
"WtAverageLiquidity":50.25
|
28
|
+
}
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: Building from scratch
|
32
|
+
|
33
|
+
Given I create a fix message
|
34
|
+
And I set the FIX message at "BeginString" to "FIX.4.2"
|
35
|
+
And I set the FIX message at "MsgType" to "ExecutionReport"
|
36
|
+
And I set the FIX message at "SenderCompID" to "ITG"
|
37
|
+
And I set the FIX message at "TargetCompID" to "SILO"
|
38
|
+
And I set the FIX message at "MaturityDay" to 4
|
39
|
+
And I set the FIX message at "DayOrderQty" to 23.45
|
40
|
+
And I set the FIX message at "ExchangeForPhysical" to true
|
41
|
+
And I set the FIX message at "AvgPx" to 100.25
|
42
|
+
And I set the FIX message at "OrdType" to "MARKET"
|
43
|
+
And I set the FIX message at "PossDupFlag" to false
|
44
|
+
|
45
|
+
When I get the fix message
|
46
|
+
Then the fix message should be:
|
47
|
+
"""
|
48
|
+
{
|
49
|
+
"BeginString":"FIX.4.2",
|
50
|
+
"MsgType":"ExecutionReport",
|
51
|
+
"SenderCompID":"ITG",
|
52
|
+
"TargetCompID":"SILO",
|
53
|
+
"MaturityDay":4,
|
54
|
+
"DayOrderQty": 23.45,
|
55
|
+
"ExchangeForPhysical": true,
|
56
|
+
"AvgPx": 100.25,
|
57
|
+
"OrdType": "MARKET",
|
58
|
+
"PossDupFlag": false
|
59
|
+
}
|
60
|
+
"""
|
61
|
+
|
62
|
+
Scenario: Building a message of some type
|
63
|
+
Given I create a fix message of type "ExecutionReport"
|
64
|
+
And I set the FIX message at "BeginString" to "FIX.4.2"
|
65
|
+
And I set the FIX message at "SenderCompID" to "ITG"
|
66
|
+
And I set the FIX message at "TargetCompID" to "SILO"
|
67
|
+
And I set the FIX message at "MaturityDay" to 4
|
68
|
+
And I set the FIX message at "DayOrderQty" to 23.45
|
69
|
+
And I set the FIX message at "ExchangeForPhysical" to true
|
70
|
+
And I set the FIX message at "AvgPx" to 100.25
|
71
|
+
And I set the FIX message at "OrdType" to "MARKET"
|
72
|
+
And I set the FIX message at "PossDupFlag" to false
|
73
|
+
|
74
|
+
When I get the fix message
|
75
|
+
Then the fix message should be:
|
76
|
+
"""
|
77
|
+
{
|
78
|
+
"BeginString":"FIX.4.2",
|
79
|
+
"MsgType":"ExecutionReport",
|
80
|
+
"SenderCompID":"ITG",
|
81
|
+
"TargetCompID":"SILO",
|
82
|
+
"MaturityDay":4,
|
83
|
+
"DayOrderQty": 23.45,
|
84
|
+
"ExchangeForPhysical": true,
|
85
|
+
"AvgPx": 100.25,
|
86
|
+
"OrdType": "MARKET",
|
87
|
+
"PossDupFlag": false
|
88
|
+
}
|
89
|
+
"""
|
90
|
+
|
91
|
+
|
92
|
+
Scenario: Building a message of some type and version
|
93
|
+
|
94
|
+
Given I create a FIX.4.2 message of type "ExecutionReport"
|
95
|
+
And I set the FIX message at "SenderCompID" to "ITG"
|
96
|
+
And I set the FIX message at "TargetCompID" to "SILO"
|
97
|
+
And I set the FIX message at "MaturityDay" to 4
|
98
|
+
And I set the FIX message at "DayOrderQty" to 23.45
|
99
|
+
And I set the FIX message at "ExchangeForPhysical" to true
|
100
|
+
And I set the FIX message at "AvgPx" to 100.25
|
101
|
+
And I set the FIX message at "OrdType" to "MARKET"
|
102
|
+
And I set the FIX message at "PossDupFlag" to false
|
103
|
+
|
104
|
+
When I get the fix message
|
105
|
+
Then the fix message should be:
|
106
|
+
"""
|
107
|
+
{
|
108
|
+
"BeginString":"FIX.4.2",
|
109
|
+
"MsgType":"ExecutionReport",
|
110
|
+
"SenderCompID":"ITG",
|
111
|
+
"TargetCompID":"SILO",
|
112
|
+
"MaturityDay":4,
|
113
|
+
"DayOrderQty": 23.45,
|
114
|
+
"ExchangeForPhysical": true,
|
115
|
+
"AvgPx": 100.25,
|
116
|
+
"OrdType": "MARKET",
|
117
|
+
"PossDupFlag": false
|
118
|
+
}
|
119
|
+
"""
|
120
|
+
|
121
|
+
|
122
|
+
Scenario: Setting message fields via table
|
123
|
+
Given I create the following FIX.4.2 message of type "ExecutionReport":
|
124
|
+
|SenderCompID | "ITG" |
|
125
|
+
|TargetCompID | "SILO" |
|
126
|
+
|MaturityDay | 4 |
|
127
|
+
|DayOrderQty | 23.45 |
|
128
|
+
|ExchangeForPhysical | true |
|
129
|
+
|AvgPx | 100.25 |
|
130
|
+
|OrdType | "MARKET" |
|
131
|
+
|PossDupFlag | false |
|
132
|
+
|
133
|
+
When I get the fix message
|
134
|
+
Then the fix message should be:
|
135
|
+
"""
|
136
|
+
{
|
137
|
+
"BeginString":"FIX.4.2",
|
138
|
+
"MsgType":"ExecutionReport",
|
139
|
+
"SenderCompID":"ITG",
|
140
|
+
"TargetCompID":"SILO",
|
141
|
+
"MaturityDay":4,
|
142
|
+
"DayOrderQty": 23.45,
|
143
|
+
"ExchangeForPhysical": true,
|
144
|
+
"AvgPx": 100.25,
|
145
|
+
"OrdType": "MARKET",
|
146
|
+
"PossDupFlag": false
|
147
|
+
}
|
148
|
+
"""
|
@@ -0,0 +1,52 @@
|
|
1
|
+
Feature: Equivalence
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given the following unvalidated fix message:
|
5
|
+
"""
|
6
|
+
8=FIX.4.235=849=ITG56=SILO205=4
|
7
|
+
"""
|
8
|
+
And I get the fix message
|
9
|
+
|
10
|
+
Scenario: Identical Fix as JSON
|
11
|
+
Then the FIX message should be:
|
12
|
+
"""
|
13
|
+
{
|
14
|
+
"8":"FIX.4.2",
|
15
|
+
"9":"26",
|
16
|
+
"35":"8",
|
17
|
+
"49":"ITG",
|
18
|
+
"56":"SILO",
|
19
|
+
"205":"4",
|
20
|
+
"10":"084"
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
|
24
|
+
Scenario: Identical Fix as raw FIX
|
25
|
+
Then the FIX message should be:
|
26
|
+
"""
|
27
|
+
8=FIX.4.29=2635=849=ITG56=SILO205=410=084
|
28
|
+
"""
|
29
|
+
|
30
|
+
#check sum and msg length are optional when using raw fix
|
31
|
+
Then the FIX message should be:
|
32
|
+
"""
|
33
|
+
8=FIX.4.235=849=ITG56=SILO205=4
|
34
|
+
"""
|
35
|
+
|
36
|
+
|
37
|
+
Scenario: String
|
38
|
+
Then the FIX at "49" should be "ITG"
|
39
|
+
|
40
|
+
And the fix message at tag "49" should be:
|
41
|
+
"""
|
42
|
+
"ITG"
|
43
|
+
"""
|
44
|
+
And the FIX at "49" should not be "blah"
|
45
|
+
|
46
|
+
#everything is a string w/o a data dictionary
|
47
|
+
And the FIX at tag "205" should be "4"
|
48
|
+
|
49
|
+
Scenario: Table format
|
50
|
+
Then the fix should have the following:
|
51
|
+
| 35 | "8" |
|
52
|
+
| 8 | "FIX.4.2" |
|