fin 0.1.5 → 0.1.6
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 +5 -0
- data/VERSION +1 -1
- data/lib/fin/models/deal.rb +5 -4
- data/lib/fin/models/model.rb +3 -3
- data/lib/fin/models/order.rb +4 -3
- data/spec/fin/models/deal_spec.rb +37 -37
- data/spec/fin/models/model_spec.rb +8 -8
- data/spec/fin/models/order_spec.rb +2 -1
- metadata +2 -2
data/HISTORY
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/fin/models/deal.rb
CHANGED
@@ -13,8 +13,11 @@ module Fin
|
|
13
13
|
:amount => :i4, # - �����, ���-�� ������ �����������
|
14
14
|
[:id_deal, :deal_id] => :i8, # - ����� ������
|
15
15
|
[:sess_id, :session_id] => :i4, # ������������� ������
|
16
|
-
:moment => :t, #
|
17
|
-
:pos => :i4, #
|
16
|
+
:moment => :t, # ����� ���������� ������.
|
17
|
+
:pos => :i4, # ���-�� ������� �� ����������� �� ����� ����� ������.
|
18
|
+
:id_ord_sell => :i8, # ����� ������ ��������
|
19
|
+
:id_ord_buy => :i8, # ����� ������ ����������.
|
20
|
+
|
18
21
|
:nosystem => :i1 # 1-������������ ������, 0-�������
|
19
22
|
|
20
23
|
# Optional fields, only for repo/multileg deals:
|
@@ -23,7 +26,6 @@ module Fin
|
|
23
26
|
|
24
27
|
# Optional fields, only for OWN deals:
|
25
28
|
property :code_sell => :c7, # ��� ��������:status_sell,
|
26
|
-
:id_ord_sell => :i8, # ����� ������ ��������
|
27
29
|
:ext_id_sell => :i4, # ������� ����� �� ������ ��������
|
28
30
|
:comment_sell => :c20, # ����������� �� ������ ��������.
|
29
31
|
:trust_sell => :i1, # ������� �������������� ���������� �� ������ ��������
|
@@ -33,7 +35,6 @@ module Fin
|
|
33
35
|
:login_sell => :c20, # ����� ������������ ��������
|
34
36
|
:code_rts_sell => :c7, # ��� ��� ��������
|
35
37
|
:code_buy => :c7, # ��� ����������
|
36
|
-
:id_ord_buy => :i8, # ����� ������ ����������.
|
37
38
|
:ext_id_buy => :i4, # ������� ����� �� ������ ����������
|
38
39
|
:comment_buy => :c20, # ����������� �� ������ ����������
|
39
40
|
:trust_buy => :i1, # ������� �������������� ���������� �� ������ ����������
|
data/lib/fin/models/model.rb
CHANGED
@@ -53,7 +53,7 @@ module Fin
|
|
53
53
|
when /^i[14]/
|
54
54
|
"rec.GetValAsLong('#{name}')"
|
55
55
|
when /^i8/
|
56
|
-
"rec.
|
56
|
+
"rec.GetValAsVariant('#{name}')"
|
57
57
|
when /^[df]/
|
58
58
|
"rec.GetValAsString('#{name}').to_f"
|
59
59
|
when /^[c]/
|
@@ -85,14 +85,14 @@ module Fin
|
|
85
85
|
|
86
86
|
# Extracts attributes from record into a serializable format (Array)
|
87
87
|
# Returns an Array where 1st element is a model_class_id of our Model subclass,
|
88
|
-
#
|
88
|
+
# followed by a list of arguments to its initialize. Class method!
|
89
89
|
def self.to_msg rec
|
90
90
|
extract_attributes(rec).unshift(model_class_id)
|
91
91
|
end
|
92
92
|
|
93
93
|
# Converts OBJECT attributes into a serializable format (Array)
|
94
94
|
# Returns an Array where 1st element is a model_class_id of our Model subclass,
|
95
|
-
#
|
95
|
+
# followed by a list of arguments to its initialize. Instance method!
|
96
96
|
def to_msg
|
97
97
|
inject([self.class.model_class_id]) { |array, (name, _)| array << send(name) }
|
98
98
|
end
|
data/lib/fin/models/order.rb
CHANGED
@@ -34,6 +34,7 @@ module Fin
|
|
34
34
|
:broker_from_rts => :c7, # ��� ��� ����� - ��������� ������
|
35
35
|
:id_deal => :i8, # ������������� ������ �� ������ ������ ������� ������
|
36
36
|
:deal_price => :'d16.5', # ���� ����������� ������
|
37
|
+
:local_stamp => :t, # ��������� ����� ������������
|
37
38
|
:status => :i4, # ������ ������ - ������������ ����� ������� �����:
|
38
39
|
# o 0x01 � ������������
|
39
40
|
# o 0x02 � ���������
|
@@ -43,9 +44,9 @@ module Fin
|
|
43
44
|
# o 0x400000 � ������ �������� ����������� ���������� ��������
|
44
45
|
# o 0x800000 � ������� �������� ������� ������ �� ������� �����-������
|
45
46
|
:action => :i1 # ��������� ��������, ������������ � �������:
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
47
|
+
# o 0 � ������ �������
|
48
|
+
# o 1 � ������ ���������
|
49
|
+
# o 2 � ������ ������� � ������
|
49
50
|
|
50
51
|
def self.index_for rec
|
51
52
|
rec.GetValAsLong('replID')
|
@@ -19,54 +19,54 @@ describe Fin::Deal do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it '#inspect lists ALL properties' do
|
22
|
-
subject.inspect.should == "replID=12,replRev=123,replAct=,isin_id=1234567,price=1234,amount=12345,id_deal=1212,sess_id=1213,moment=time,pos=121212,nosystem=0,id_deal_multileg=0,id_repo=0,code_sell=,
|
22
|
+
subject.inspect.should == "replID=12,replRev=123,replAct=,isin_id=1234567,price=1234,amount=12345,id_deal=1212,sess_id=1213,moment=time,pos=121212,id_ord_sell=123456,id_ord_buy=654321,nosystem=0,id_deal_multileg=0,id_repo=0,code_sell=,ext_id_sell=,comment_sell=,trust_sell=,status_sell=0,hedge_sell=,fee_sell=,login_sell=,code_rts_sell=,code_buy=,ext_id_buy=,comment_buy=,trust_buy=,status_buy=0,hedge_buy=,fee_buy=,login_buy=,code_rts_buy="
|
23
23
|
end
|
24
|
-
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
describe '#index' do
|
26
|
+
it 'should be equal to deal_id' do
|
27
|
+
subject.index.should == subject.deal_id
|
28
|
+
end
|
29
29
|
end
|
30
30
|
end
|
31
|
-
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
describe '#new with empty initializer' do
|
33
|
+
let(:property_hash) { {} }
|
34
|
+
subject { Fin::Deal.new }
|
36
35
|
|
37
|
-
|
36
|
+
it_behaves_like 'model'
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
it 'has all nil properties' do
|
39
|
+
subject.class.attribute_types.each { |prop, _| subject.send(prop).should == nil }
|
40
|
+
end
|
42
41
|
|
43
|
-
|
44
|
-
|
42
|
+
its (:book) {should == nil}
|
43
|
+
end
|
45
44
|
|
46
|
-
|
45
|
+
describe '#new with opts' do
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
47
|
+
let(:property_hash) do
|
48
|
+
{:isin_id => 1234567,
|
49
|
+
:repl_id => 12,
|
50
|
+
:rev => 123,
|
51
|
+
:price => 1234,
|
52
|
+
:amount => 12345,
|
53
|
+
:deal_id => 1212,
|
54
|
+
:sess_id => 1213,
|
55
|
+
:moment => 'time',
|
56
|
+
:status_sell => 0,
|
57
|
+
:status_buy => 0,
|
58
|
+
:id_ord_sell => 123456,
|
59
|
+
:id_ord_buy => 654321,
|
60
|
+
:pos => 121212, # ���-�� ������� �� ����������� �� ����� ����� ������.
|
61
|
+
:nosystem => 0, # 1-������������ ������, 0-�������
|
62
|
+
:id_repo => 0, # ����� ������ ����� ������ ����
|
63
|
+
:id_deal_multileg => 0, # ����� ������ �� ������
|
64
|
+
:book=> 123456,
|
65
|
+
}
|
66
|
+
end
|
67
|
+
subject { Fin::Deal.new property_hash }
|
68
|
+
it_behaves_like 'deal_with_set_properties'
|
67
69
|
end
|
68
|
-
subject { Fin::Deal.new property_hash }
|
69
|
-
it_behaves_like 'deal_with_set_properties'
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -111,14 +111,6 @@ describe Fin::Model, "as a base class for BD models" do
|
|
111
111
|
mock('record').tap do |mock|
|
112
112
|
mock.stub(:GetValAsString) do |field|
|
113
113
|
case field
|
114
|
-
when 'replID'
|
115
|
-
'11'
|
116
|
-
when 'replRev'
|
117
|
-
'12'
|
118
|
-
when 'replAct'
|
119
|
-
'13'
|
120
|
-
when 'longint'
|
121
|
-
'1322222222455664'
|
122
114
|
when 'name'
|
123
115
|
'rec_name'
|
124
116
|
when 'time'
|
@@ -139,8 +131,16 @@ describe Fin::Model, "as a base class for BD models" do
|
|
139
131
|
end
|
140
132
|
mock.stub(:GetValAsVariant) do |field|
|
141
133
|
case field
|
134
|
+
when 'longint'
|
135
|
+
1322222222455664
|
142
136
|
when 'time'
|
143
137
|
20100101003030000
|
138
|
+
when 'replID'
|
139
|
+
11
|
140
|
+
when 'replRev'
|
141
|
+
12
|
142
|
+
when 'replAct'
|
143
|
+
13
|
144
144
|
end
|
145
145
|
end
|
146
146
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: fin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- arvicco
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-23 00:00:00 +03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|