fix_spec 0.1.0

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.
@@ -0,0 +1,166 @@
1
+ @with_data_dictionary
2
+ Feature: Equivalence with data dictionary
3
+
4
+ When configured with a data dictionary, cucumber steps can accept richer, type specific fix parameters and values
5
+
6
+ Scenario: All these checks are acceptable
7
+ Given the following unvalidated fix message:
8
+ """
9
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
10
+ """
11
+ When I get the fix message
12
+
13
+ Then the FIX at "SenderCompID" should be "ITG"
14
+ Then the fix at tag "SenderCompID" should be "ITG"
15
+ Then the fix message at "SenderCompID" should be "ITG"
16
+ And the FIX at "SenderCompID" should not be "blah"
17
+ And the fix message at tag "SenderCompID" should be:
18
+ """
19
+ "ITG"
20
+ """
21
+
22
+ And the fix message at tag "SenderCompID" should not be:
23
+ """
24
+ "NOT ITG"
25
+ """
26
+
27
+ Scenario: Identical Fix as JSON
28
+ Given the following unvalidated fix message:
29
+ """
30
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
31
+ """
32
+ When I get the fix message
33
+
34
+ Then the FIX message should be:
35
+ """
36
+ {
37
+ "BeginString":"FIX.4.2",
38
+ "BodyLength":81,
39
+ "MsgType":"ExecutionReport",
40
+ "SenderCompID":"ITG",
41
+ "TargetCompID":"SILO",
42
+ "MaturityDay":4,
43
+ "DayOrderQty": 23.45,
44
+ "ExchangeForPhysical": true,
45
+ "AvgPx": 100.25,
46
+ "OrdType": "MARKET",
47
+ "PossDupFlag": false,
48
+ "AdvTransType": "NEW",
49
+ "UnderlyingPutOrCall": 8,
50
+ "WtAverageLiquidity": 50.25,
51
+ "CheckSum":"083"
52
+ }
53
+ """
54
+
55
+ @ignore_length_and_checksum
56
+ Scenario: Identical Fix as JSON, ignoring length and checksum
57
+ Given the following unvalidated fix message:
58
+ """
59
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
60
+ """
61
+ When I get the fix message
62
+
63
+
64
+ Then the FIX message should be:
65
+ """
66
+ {
67
+ "BeginString":"FIX.4.2",
68
+ "MsgType":"ExecutionReport",
69
+ "SenderCompID":"ITG",
70
+ "TargetCompID":"SILO",
71
+ "MaturityDay":4,
72
+ "DayOrderQty": 23.45,
73
+ "ExchangeForPhysical": true,
74
+ "AvgPx": 100.25,
75
+ "OrdType": "MARKET",
76
+ "PossDupFlag": false,
77
+ "AdvTransType": "NEW",
78
+ "UnderlyingPutOrCall": 8,
79
+ "WtAverageLiquidity": 50.25
80
+ }
81
+ """
82
+
83
+ Scenario: Identical Fix as raw FIX.
84
+ Given the following unvalidated fix message:
85
+ """
86
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
87
+ """
88
+ When I get the fix message
89
+
90
+
91
+ Then the FIX message should be:
92
+ """
93
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
94
+ """
95
+
96
+ Scenario Outline: Types values are type specific
97
+ Given the following unvalidated fix message:
98
+ """
99
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
100
+ """
101
+ When I get the fix message
102
+
103
+
104
+ Then the FIX at tag "<TAG>" should be <VALUE>
105
+
106
+ Examples: Enumerations
107
+ | TAG | VALUE |
108
+ | OrdType | "MARKET" |
109
+ | AdvTransType | "NEW" |
110
+
111
+ Examples: MsgType -doesn't map to DD description
112
+ | MsgType | "ExecutionReport"|
113
+
114
+ Examples: STRING
115
+ | TAG | VALUE |
116
+ | SenderCompID | "ITG" |
117
+
118
+ Examples: INT
119
+ | TAG | VALUE |
120
+ |UnderlyingPutOrCall | 8 |
121
+
122
+ Examples: DAYOFMONTH
123
+ | TAG | VALUE |
124
+ |MaturityDay | 4 |
125
+
126
+ Examples: FLOAT and derivative types can accept many different formats
127
+ | TAG | VALUE |
128
+ | AvgPx | 100.25|
129
+ | AvgPx | 100.25000|
130
+ | AvgPx | 100.25e0|
131
+ | AvgPx | 100.25e+0|
132
+ | AvgPx | 100.25e-0|
133
+ | AvgPx | 1.0025e+2|
134
+
135
+ Examples: PRICE
136
+ | TAG | VALUE |
137
+ |AvgPx | 100.25 |
138
+
139
+ Examples: FLOAT
140
+ | TAG | VALUE |
141
+ |WtAverageLiquidity | 50.25 |
142
+
143
+ Examples: QTY
144
+ | TAG | VALUE |
145
+ |DayOrderQty | 23.45 |
146
+
147
+ Examples: BOOLEAN
148
+ | TAG | VALUE |
149
+ |PossDupFlag | false |
150
+ |ExchangeForPhysical | true |
151
+
152
+
153
+ Scenario: Table Format
154
+ Given the following unvalidated fix message:
155
+ """
156
+ 8=FIX.4.235=849=ITG56=SILO205=4315=86=100.25410=50.25424=23.45411=Y43=N40=15=N
157
+ """
158
+ When I get the fix message
159
+
160
+
161
+ Then the fix should have the following:
162
+ | SenderCompID | "ITG" |
163
+ | BeginString | "FIX.4.2" |
164
+ | MaturityDay | 4 |
165
+ | UnderlyingPutOrCall | 8 |
166
+ | AvgPx | 100.25 |
@@ -0,0 +1,47 @@
1
+ @with_data_dictionary @ignore_length_and_checksum
2
+ Feature: Memory
3
+
4
+ Background:
5
+
6
+ Given the following fix message:
7
+ """
8
+ 8=FIX.4.235=849=ITG56=SILO44=1250.25
9
+ """
10
+
11
+ When I get the fix message
12
+
13
+ Scenario: Entire FIX message
14
+ When I keep the FIX message as "FIX1"
15
+ Then the FIX message should be %{FIX1}
16
+ And the FIX message should be:
17
+ """
18
+ %{FIX1}
19
+ """
20
+
21
+ Scenario: String header field
22
+ When I keep the FIX message at tag "MsgType" as "MSGTYPE"
23
+ Then the FIX message at "MsgType" should be %{MSGTYPE}
24
+ And the FIX message should be:
25
+ """
26
+ {
27
+ "MsgType": %{MSGTYPE},
28
+ "SenderCompID": "ITG",
29
+ "TargetCompID": "SILO",
30
+ "BeginString": "FIX.4.2",
31
+ "Price": 1250.25
32
+ }
33
+ """
34
+
35
+ Scenario: Numerical body field
36
+ When I keep the FIX message at tag "Price" as "PRICE"
37
+ Then the FIX message at "Price" should be %{PRICE}
38
+ And the FIX message should be:
39
+ """
40
+ {
41
+ "MsgType": "ExecutionReport",
42
+ "SenderCompID": "ITG",
43
+ "TargetCompID": "SILO",
44
+ "BeginString": "FIX.4.2",
45
+ "Price": %{PRICE}
46
+ }
47
+ """
@@ -0,0 +1,25 @@
1
+ Feature: Message Type
2
+
3
+ Scenario: the FIX message type should be...
4
+ Given the following unvalidated fix message:
5
+ """
6
+ 8=FIX.4.435=B49=TR_Initiator52=20090101-17:13:06.68456=TR_Acceptor61=033=158=uno58=dos148=abc
7
+ """
8
+ When I get the fix message
9
+ Then the FIX message type should be "B"
10
+
11
+ Scenario: The FIX message type should not be...
12
+ Given the following unvalidated fix message:
13
+ """
14
+ 8=FIX.4.435=B49=TR_Initiator52=20090101-17:13:06.68456=TR_Acceptor61=033=158=uno58=dos148=abc
15
+ """
16
+ When I get the fix message
17
+ Then the FIX message type should not be "A"
18
+
19
+ @with_data_dictionary
20
+ Scenario: With Data Dictionary loaded, message type is pretty string
21
+ """
22
+ 8=FIX.4.435=B49=TR_Initiator52=20090101-17:13:06.68456=TR_Acceptor61=033=158=uno58=dos148=abc
23
+ """
24
+ When I get the fix message
25
+ Then the FIX message type should be "News"
@@ -0,0 +1,63 @@
1
+ @with_data_dictionary
2
+ Feature: Building Fix Messages with repeating groups from raw fix
3
+
4
+ @ignore_length_and_checksum
5
+ Scenario: Building fix message with 2 instances in a repeated group
6
+ Given the following fix message:
7
+ """
8
+ 8=FIX.4.235=B49=ITG56=SILO148=Market Bulls Have Short Sellers on the Run33=258=The bears have been cowed by the bulls.58=Buy buy buy354=043=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":"News",
17
+ "PossDupFlag":false,
18
+ "SenderCompID":"ITG",
19
+ "TargetCompID":"SILO",
20
+ "Headline":"Market Bulls Have Short Sellers on the Run",
21
+ "LinesOfText":[
22
+ {
23
+ "Text":"The bears have been cowed by the bulls."
24
+ },
25
+ {
26
+ "Text":"Buy buy buy",
27
+ "EncodedTextLen":0
28
+ }
29
+ ]
30
+ }
31
+ """
32
+
33
+
34
+ @ignore_length_and_checksum
35
+ Scenario: Building fix message with repeating groups in repeating groups
36
+ Given the following fix message:
37
+ """
38
+ 8=FIX.4.235=i49=ITG56=SILO117=ITG_SILO_MASS_QUOTE_001296=1302=Qset001311=JDSU304=1295=1299=Qset001_Q001
39
+ """
40
+ When I get the fix message
41
+
42
+ Then the FIX message should be:
43
+ """
44
+ {
45
+ "BeginString":"FIX.4.2",
46
+ "MsgType":"MassQuote",
47
+ "SenderCompID":"ITG",
48
+ "TargetCompID":"SILO",
49
+ "QuoteID":"ITG_SILO_MASS_QUOTE_001",
50
+ "NoQuoteSets":[
51
+ {
52
+ "QuoteSetID":"Qset001",
53
+ "UnderlyingSymbol":"JDSU",
54
+ "TotQuoteEntries":1,
55
+ "NoQuoteEntries":[
56
+ {
57
+ "QuoteEntryID":"Qset001_Q001"
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ """
@@ -0,0 +1,14 @@
1
+ Feature: Paths
2
+
3
+ Background:
4
+
5
+ Given the following unvalidated fix message:
6
+ """
7
+ 8=FIX.4.235=849=ITG56=SILO
8
+ """
9
+
10
+ When I get the fix message
11
+
12
+ Scenario: BasePaths
13
+ Then the fix should have tag "35"
14
+ And the fix should not have tag "50"
@@ -0,0 +1,3 @@
1
+ When /^I get the fix message$/ do
2
+ @last_fix = FIXSpec::Builder.message
3
+ end