tordist 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8284011595f0e408417d88e4b474edd306aac4c7
4
- data.tar.gz: 84b94e1533005b7133cef5ad225ccdfcc7698f1f
3
+ metadata.gz: 839ec4c081227571e2ede6eb901431c568bb33e7
4
+ data.tar.gz: 729c36fc276ba9e18c0a014f4a8d45876b430da9
5
5
  SHA512:
6
- metadata.gz: f47e70324365b068bdfd7247a787f880ed5312b69c65814b3d55e638e014bb1570786e417776710d12b7ba207973e3fa8f608e5225fe28d3d12ad6c4cf012146
7
- data.tar.gz: f85d9cbc6dbe37eca3c63da65a755442ea0f7119471b90fee437e6cbfcfa8f11630e9b83dfd7ae3bb0baeb96cf4546344fcb09cdc67febbddc9e91e4dd15af7d
6
+ metadata.gz: ebfc1f1df07334670eafa66aa159b69efc59d6ee6b21ef510e4f55c6af21bbd1b1554061930355066bd4cdc26031987ac548a1891e12625d7b1ef2cccd6608ec
7
+ data.tar.gz: 2f33f5ef93100b72e798292473096dc926884404772947649685e0710d954fc19e3b7db40884ba9320d7fa6759cf0abc15ee3958ceb8ab4044846b095cc58c15
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tordist (0.1.1)
4
+ tordist (0.1.2)
5
5
  attr_extras
6
6
 
7
7
  GEM
@@ -11,14 +11,14 @@ class Tordist::Generator
11
11
  end
12
12
 
13
13
  def header
14
- return "H#{header_date}#{header_broker}TORDISTM\n"
14
+ return fill_with_chars(92, "H#{header_date}#{@clearing_id}TORDISTM", :following, " ")+"\n"
15
15
  end
16
16
 
17
17
  def body
18
18
  body_string = ""
19
19
  @transactions.each do |transaction|
20
20
  @transaction = transaction
21
- body_string = body_string + "#{type}#{symbol}#{@transaction.broker_alias_code}#{client_digit}#{quantity}#{price}#{@transaction.side}#{liquidation_portfolio}#{nil_user}#{liquidation_type}#{bvmf}#{nil_last_fields}#{@transaction.broker}\n"
21
+ body_string = body_string + "#{type}#{symbol}#{@transaction.broker_alias_code}#{client_digit}#{quantity}#{price}#{@transaction.side}#{liquidation_portfolio}#{nil_user}#{client}#{client_digit}#{liquidation_type}#{bvmf}#{increase_percentage}#{deadline}#{order_number}#{broker}\n"
22
22
  end
23
23
  return body_string
24
24
  end
@@ -29,33 +29,12 @@ class Tordist::Generator
29
29
  @transactions.first.date.strftime("%d/%m/%Y")
30
30
  end
31
31
 
32
- def header_broker
33
- @clearing_id
34
- end
35
-
36
32
  def symbol
37
- symbol_text = @transaction.symbol
38
- remaining_chars = ""
39
- field_size = 12
40
- remaining_chars_size = field_size - @transaction.symbol.size
41
- for i in 1..remaining_chars_size
42
- remaining_chars = remaining_chars + " "
43
- end
44
-
45
- symbol_text = symbol_text + remaining_chars
46
-
33
+ fill_with_chars(12, @transaction.symbol, :following, " ")
47
34
  end
48
35
 
49
36
  def quantity
50
- quantity_text = @transaction.quantity.to_i.to_s
51
- remaining_chars = ""
52
- field_size = 12
53
- remaining_chars_size = field_size - @transaction.quantity.to_i.to_s.size
54
- for i in 0..remaining_chars_size
55
- remaining_chars = remaining_chars + "0"
56
- end
57
-
58
- quantity_text = remaining_chars + quantity_text
37
+ fill_with_chars(12, @transaction.quantity.abs.to_i.to_s, :preceding, "0")
59
38
  end
60
39
 
61
40
  def type
@@ -67,7 +46,7 @@ class Tordist::Generator
67
46
  end
68
47
 
69
48
  def price
70
- "0000000000"
49
+ fill_with_chars(11, "", :preceding, "0")
71
50
  end
72
51
 
73
52
  def liquidation_portfolio
@@ -75,7 +54,15 @@ class Tordist::Generator
75
54
  end
76
55
 
77
56
  def nil_user
78
- "000000000000000"
57
+ fill_with_chars(5, "", :following, "0")
58
+ end
59
+
60
+ def client
61
+ fill_with_chars(9, "", :following, "0")
62
+ end
63
+
64
+ def client_digit
65
+ fill_with_chars(1, "", :following, "0")
79
66
  end
80
67
 
81
68
  def liquidation_type
@@ -83,13 +70,35 @@ class Tordist::Generator
83
70
  end
84
71
 
85
72
  def bvmf
86
- "1"
73
+ fill_with_chars(2, "1", :following, " ")
87
74
  end
88
75
 
89
- def nil_last_fields
90
- " +000000000000000"
76
+ def increase_percentage
77
+ fill_with_chars(12, "+", :following, "0")
91
78
  end
92
79
 
80
+ def deadline
81
+ fill_with_chars(4, "", :following, "0")
82
+ end
93
83
 
84
+ def order_number
85
+ fill_with_chars(9, "", :following, "0")
86
+ end
94
87
 
88
+ def broker
89
+ fill_with_chars(4, @transaction.broker, :preceding, "0")
90
+ end
91
+
92
+ def fill_with_chars(total_size, text, direction, char)
93
+ size = total_size - text.size
94
+ char_text = ""
95
+ for i in 1..size
96
+ char_text = char_text + char
97
+ end
98
+ if (direction == :following)
99
+ return text + char_text
100
+ elsif (direction == :preceding)
101
+ return char_text + text
102
+ end
103
+ end
95
104
  end
@@ -1,3 +1,3 @@
1
1
  module Tordist
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tordist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Investtools
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2017-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.16'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.16'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: guard-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: terminal-notifier
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: attr_extras
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description:
@@ -101,9 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".gitignore"
105
- - ".rspec"
106
- - ".travis.yml"
104
+ - .gitignore
105
+ - .rspec
106
+ - .travis.yml
107
107
  - Gemfile
108
108
  - Gemfile.lock
109
109
  - Guardfile
@@ -116,8 +116,6 @@ files:
116
116
  - lib/tordist/generator.rb
117
117
  - lib/tordist/transaction.rb
118
118
  - lib/tordist/version.rb
119
- - tordist-0.1.0.gem
120
- - tordist-0.1.1.gem
121
119
  - tordist.gemspec
122
120
  homepage: https://github.com/investtools/tordist
123
121
  licenses:
@@ -129,17 +127,17 @@ require_paths:
129
127
  - lib
130
128
  required_ruby_version: !ruby/object:Gem::Requirement
131
129
  requirements:
132
- - - ">="
130
+ - - '>='
133
131
  - !ruby/object:Gem::Version
134
132
  version: '0'
135
133
  required_rubygems_version: !ruby/object:Gem::Requirement
136
134
  requirements:
137
- - - ">="
135
+ - - '>='
138
136
  - !ruby/object:Gem::Version
139
137
  version: '0'
140
138
  requirements: []
141
139
  rubyforge_project:
142
- rubygems_version: 2.6.14
140
+ rubygems_version: 2.4.6
143
141
  signing_key:
144
142
  specification_version: 4
145
143
  summary: Gem to generate tordist file
data/tordist-0.1.0.gem DELETED
Binary file
data/tordist-0.1.1.gem DELETED
Binary file