fin 0.1.4 → 0.1.5
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.
- data/HISTORY +4 -0
- data/VERSION +1 -1
- data/lib/fin/book.rb +3 -2
- data/lib/fin/models/model.rb +5 -2
- data/spec/fin/models/model_spec.rb +11 -4
- metadata +114 -118
- data/features/order_book.feature +0 -9
- data/features/step_definitions/order_book_steps.rb +0 -0
- data/features/support/env.rb +0 -10
- data/features/support/world.rb +0 -12
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/lib/fin/book.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'fin/container_list'
|
2
2
|
|
3
3
|
module Fin
|
4
|
-
# Represents Book (QuoteBook, DealBook, etc...)
|
5
|
-
#
|
4
|
+
# Represents a Book (QuoteBook, DealBook, etc...) -
|
5
|
+
# collection of all items associated with one security(isin)
|
6
|
+
# It is used as additional index by ContainerList subclasses (QuoteList, DealList)
|
6
7
|
class Book < ContainerList
|
7
8
|
|
8
9
|
attr_reader :isin_id
|
data/lib/fin/models/model.rb
CHANGED
@@ -49,14 +49,17 @@ module Fin
|
|
49
49
|
# Using static calls, create class method extracting attributes from raw records
|
50
50
|
attribute_extractor = attribute_types.map do |name, type|
|
51
51
|
case type
|
52
|
-
|
53
|
-
"rec.GetValAsString('#{name}')"
|
52
|
+
# TODO: Using indexes (...ByIndex) instead of names gives ~60% speed boost
|
54
53
|
when /^i[14]/
|
55
54
|
"rec.GetValAsLong('#{name}')"
|
56
55
|
when /^i8/
|
57
56
|
"rec.GetValAsString('#{name}').to_i"
|
58
57
|
when /^[df]/
|
59
58
|
"rec.GetValAsString('#{name}').to_f"
|
59
|
+
when /^[c]/
|
60
|
+
"rec.GetValAsString('#{name}')"
|
61
|
+
when /^[t]/ # "2009/12/01 12:35:44.785" => 20091201123544785
|
62
|
+
"rec.GetValAsVariant('#{name}')"
|
60
63
|
else
|
61
64
|
raise "Unrecognized attribute type: #{name} => #{type}"
|
62
65
|
end
|
@@ -137,6 +137,12 @@ describe Fin::Model, "as a base class for BD models" do
|
|
137
137
|
15
|
138
138
|
end
|
139
139
|
end
|
140
|
+
mock.stub(:GetValAsVariant) do |field|
|
141
|
+
case field
|
142
|
+
when 'time'
|
143
|
+
20100101003030000
|
144
|
+
end
|
145
|
+
end
|
140
146
|
end
|
141
147
|
end
|
142
148
|
|
@@ -196,7 +202,7 @@ describe Fin::Model, "as a base class for BD models" do
|
|
196
202
|
object.bar.should == 15
|
197
203
|
object.longint.should == 1322222222455664
|
198
204
|
object.name.should == 'rec_name'
|
199
|
-
object.time.should ==
|
205
|
+
object.time.should == 20100101003030000
|
200
206
|
object.price.should be_within(0.0001).of(16.7)
|
201
207
|
object.net.should be_within(0.0001).of(89.89)
|
202
208
|
end
|
@@ -223,7 +229,7 @@ describe Fin::Model, "as a base class for BD models" do
|
|
223
229
|
object.bar.should == 15
|
224
230
|
object.longint.should == 1322222222455664
|
225
231
|
object.name.should == 'rec_name'
|
226
|
-
object.time.should ==
|
232
|
+
object.time.should == 20100101003030000
|
227
233
|
object.price.should be_within(0.0001).of(16.7)
|
228
234
|
object.net.should be_within(0.0001).of(89.89)
|
229
235
|
end
|
@@ -232,15 +238,16 @@ describe Fin::Model, "as a base class for BD models" do
|
|
232
238
|
describe '.to_msg', 'Class method!' do
|
233
239
|
it 'converts RECORD into serializable representation' do
|
234
240
|
model_class.to_msg(rec).should ==
|
235
|
-
[1313, 11, 12, 13, 14, 15, 1322222222455664, "rec_name",
|
241
|
+
[1313, 11, 12, 13, 14, 15, 1322222222455664, "rec_name", 20100101003030000 , 16.7, 89.89]
|
236
242
|
end
|
237
243
|
end # to_msg
|
238
244
|
|
245
|
+
|
239
246
|
describe '#to_msg', 'Instance method!' do
|
240
247
|
it 'converts OBJECT into serializable representation' do
|
241
248
|
object = model_class.from_record(rec)
|
242
249
|
object.to_msg.should ==
|
243
|
-
[1313, 11, 12, 13, 14, 15, 1322222222455664, "rec_name",
|
250
|
+
[1313, 11, 12, 13, 14, 15, 1322222222455664, "rec_name", 20100101003030000 , 16.7, 89.89]
|
244
251
|
end
|
245
252
|
end # to_msg
|
246
253
|
|
metadata
CHANGED
@@ -2,50 +2,50 @@
|
|
2
2
|
name: fin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
|
8
|
+
- arvicco
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-11-18 00:00:00 +03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rspec
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.5.0
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cucumber
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: bundler
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.0
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
49
|
description: Provides basis for developing effective market data feed handlers
|
50
50
|
email: arvitallian@gmail.com
|
51
51
|
executables: []
|
@@ -53,106 +53,102 @@ executables: []
|
|
53
53
|
extensions: []
|
54
54
|
|
55
55
|
extra_rdoc_files:
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
- LICENSE
|
57
|
+
- HISTORY
|
58
|
+
- README.rdoc
|
59
59
|
files:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
- LICENSE
|
106
|
-
- VERSION
|
107
|
-
- HISTORY
|
108
|
-
- .gitignore
|
60
|
+
- lib/fin/book.rb
|
61
|
+
- lib/fin/book_manager.rb
|
62
|
+
- lib/fin/changed_list.rb
|
63
|
+
- lib/fin/container_list.rb
|
64
|
+
- lib/fin/deal_list.rb
|
65
|
+
- lib/fin/indexed_list.rb
|
66
|
+
- lib/fin/models/deal.rb
|
67
|
+
- lib/fin/models/instrument.rb
|
68
|
+
- lib/fin/models/model.rb
|
69
|
+
- lib/fin/models/money_limit.rb
|
70
|
+
- lib/fin/models/order.rb
|
71
|
+
- lib/fin/models/position.rb
|
72
|
+
- lib/fin/models/quote.rb
|
73
|
+
- lib/fin/quote_list.rb
|
74
|
+
- lib/fin.rb
|
75
|
+
- lib/legacy.rb
|
76
|
+
- lib/version.rb
|
77
|
+
- spec/fin/book_spec.rb
|
78
|
+
- spec/fin/changed_list_spec.rb
|
79
|
+
- spec/fin/container_list_spec.rb
|
80
|
+
- spec/fin/deal_list_spec.rb
|
81
|
+
- spec/fin/indexed_list_spec.rb
|
82
|
+
- spec/fin/models/deal_spec.rb
|
83
|
+
- spec/fin/models/instrument_spec.rb
|
84
|
+
- spec/fin/models/model_spec.rb
|
85
|
+
- spec/fin/models/money_limit_spec.rb
|
86
|
+
- spec/fin/models/order_spec.rb
|
87
|
+
- spec/fin/models/position_spec.rb
|
88
|
+
- spec/fin/models/quote_spec.rb
|
89
|
+
- spec/fin/models/shared_examples.rb
|
90
|
+
- spec/fin/order_list_spec.rb
|
91
|
+
- spec/fin/shared_examples.rb
|
92
|
+
- spec/spec_helper.rb
|
93
|
+
- tasks/common.rake
|
94
|
+
- tasks/doc.rake
|
95
|
+
- tasks/gem.rake
|
96
|
+
- tasks/git.rake
|
97
|
+
- tasks/spec.rake
|
98
|
+
- tasks/version.rake
|
99
|
+
- Rakefile
|
100
|
+
- README.rdoc
|
101
|
+
- LICENSE
|
102
|
+
- VERSION
|
103
|
+
- HISTORY
|
104
|
+
- .gitignore
|
109
105
|
has_rdoc: true
|
110
106
|
homepage: http://github.com/arvicco/fin
|
111
107
|
licenses: []
|
112
108
|
|
113
109
|
post_install_message:
|
114
110
|
rdoc_options:
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
111
|
+
- --charset
|
112
|
+
- UTF-8
|
113
|
+
- --main
|
114
|
+
- README.rdoc
|
115
|
+
- --title
|
116
|
+
- order_book
|
121
117
|
require_paths:
|
122
|
-
|
118
|
+
- lib
|
123
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
120
|
none: false
|
125
121
|
requirements:
|
126
|
-
|
127
|
-
|
128
|
-
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
129
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
126
|
none: false
|
131
127
|
requirements:
|
132
|
-
|
133
|
-
|
134
|
-
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: "0"
|
135
131
|
requirements: []
|
136
132
|
|
137
133
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.
|
134
|
+
rubygems_version: 1.6.2
|
139
135
|
signing_key:
|
140
136
|
specification_version: 3
|
141
137
|
summary: Domain models and container structures for market data feeds
|
142
138
|
test_files:
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
139
|
+
- spec/fin/book_spec.rb
|
140
|
+
- spec/fin/changed_list_spec.rb
|
141
|
+
- spec/fin/container_list_spec.rb
|
142
|
+
- spec/fin/deal_list_spec.rb
|
143
|
+
- spec/fin/indexed_list_spec.rb
|
144
|
+
- spec/fin/models/deal_spec.rb
|
145
|
+
- spec/fin/models/instrument_spec.rb
|
146
|
+
- spec/fin/models/model_spec.rb
|
147
|
+
- spec/fin/models/money_limit_spec.rb
|
148
|
+
- spec/fin/models/order_spec.rb
|
149
|
+
- spec/fin/models/position_spec.rb
|
150
|
+
- spec/fin/models/quote_spec.rb
|
151
|
+
- spec/fin/models/shared_examples.rb
|
152
|
+
- spec/fin/order_list_spec.rb
|
153
|
+
- spec/fin/shared_examples.rb
|
154
|
+
- spec/spec_helper.rb
|
data/features/order_book.feature
DELETED
File without changes
|
data/features/support/env.rb
DELETED