fin 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -37,3 +37,7 @@
37
37
  == 0.1.4 / 2011-05-16
38
38
 
39
39
  * Model#each tweak
40
+
41
+ == 0.1.5 / 2011-11-18
42
+
43
+ * Datetime fields read as Integer now
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
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...) for one security(isin)
5
- # It is used as additional index by BookedList subclass (QuoteList, DealList)
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
@@ -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
- when /^[ct]/ # TODO: In future, read t AsLong and convert into DateTime
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 == 'rec_time'
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 == 'rec_time'
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", "rec_time", 16.7, 89.89]
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", "rec_time", 16.7, 89.89]
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.4
5
+ version: 0.1.5
6
6
  platform: ruby
7
7
  authors:
8
- - arvicco
8
+ - arvicco
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-16 00:00:00 +04:00
13
+ date: 2011-11-18 00:00:00 +03:00
14
14
  default_executable:
15
15
  dependencies:
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
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
- - LICENSE
57
- - HISTORY
58
- - README.rdoc
56
+ - LICENSE
57
+ - HISTORY
58
+ - README.rdoc
59
59
  files:
60
- - lib/fin.rb
61
- - lib/legacy.rb
62
- - lib/version.rb
63
- - lib/fin/book.rb
64
- - lib/fin/book_manager.rb
65
- - lib/fin/changed_list.rb
66
- - lib/fin/container_list.rb
67
- - lib/fin/deal_list.rb
68
- - lib/fin/indexed_list.rb
69
- - lib/fin/quote_list.rb
70
- - lib/fin/models/deal.rb
71
- - lib/fin/models/instrument.rb
72
- - lib/fin/models/model.rb
73
- - lib/fin/models/money_limit.rb
74
- - lib/fin/models/order.rb
75
- - lib/fin/models/position.rb
76
- - lib/fin/models/quote.rb
77
- - spec/spec_helper.rb
78
- - spec/fin/book_spec.rb
79
- - spec/fin/changed_list_spec.rb
80
- - spec/fin/container_list_spec.rb
81
- - spec/fin/deal_list_spec.rb
82
- - spec/fin/indexed_list_spec.rb
83
- - spec/fin/order_list_spec.rb
84
- - spec/fin/shared_examples.rb
85
- - spec/fin/models/deal_spec.rb
86
- - spec/fin/models/instrument_spec.rb
87
- - spec/fin/models/model_spec.rb
88
- - spec/fin/models/money_limit_spec.rb
89
- - spec/fin/models/order_spec.rb
90
- - spec/fin/models/position_spec.rb
91
- - spec/fin/models/quote_spec.rb
92
- - spec/fin/models/shared_examples.rb
93
- - features/order_book.feature
94
- - features/step_definitions/order_book_steps.rb
95
- - features/support/env.rb
96
- - features/support/world.rb
97
- - tasks/common.rake
98
- - tasks/doc.rake
99
- - tasks/gem.rake
100
- - tasks/git.rake
101
- - tasks/spec.rake
102
- - tasks/version.rake
103
- - Rakefile
104
- - README.rdoc
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
- - --charset
116
- - UTF-8
117
- - --main
118
- - README.rdoc
119
- - --title
120
- - order_book
111
+ - --charset
112
+ - UTF-8
113
+ - --main
114
+ - README.rdoc
115
+ - --title
116
+ - order_book
121
117
  require_paths:
122
- - lib
118
+ - lib
123
119
  required_ruby_version: !ruby/object:Gem::Requirement
124
120
  none: false
125
121
  requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- version: "0"
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
- - !ruby/object:Gem::Version
134
- version: "0"
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: "0"
135
131
  requirements: []
136
132
 
137
133
  rubyforge_project:
138
- rubygems_version: 1.5.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
- - spec/spec_helper.rb
144
- - spec/fin/book_spec.rb
145
- - spec/fin/changed_list_spec.rb
146
- - spec/fin/container_list_spec.rb
147
- - spec/fin/deal_list_spec.rb
148
- - spec/fin/indexed_list_spec.rb
149
- - spec/fin/order_list_spec.rb
150
- - spec/fin/shared_examples.rb
151
- - spec/fin/models/deal_spec.rb
152
- - spec/fin/models/instrument_spec.rb
153
- - spec/fin/models/model_spec.rb
154
- - spec/fin/models/money_limit_spec.rb
155
- - spec/fin/models/order_spec.rb
156
- - spec/fin/models/position_spec.rb
157
- - spec/fin/models/quote_spec.rb
158
- - spec/fin/models/shared_examples.rb
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
@@ -1,9 +0,0 @@
1
- Feature: something something
2
- In order to something something
3
- A user something something
4
- something something something
5
-
6
- Scenario: something something
7
- Given inspiration
8
- When I create a sweet new gem
9
- Then everyone should see how awesome I am
File without changes
@@ -1,10 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
-
3
- require 'pathname'
4
- require 'bundler'
5
- Bundler.setup
6
- Bundler.require :cucumber
7
-
8
- require 'order_book'
9
-
10
- BASE_PATH = Pathname.new(__FILE__).dirname + '../..'
@@ -1,12 +0,0 @@
1
- module SystemHelper
2
-
3
- def windows?
4
- RUBY_PLATFORM =~ /mswin|windows|mingw/ || cygwin?
5
- end
6
-
7
- def cygwin?
8
- RUBY_PLATFORM =~ /cygwin/
9
- end
10
- end
11
-
12
- World(WinGui, SystemHelper)