bovespa_ingestion 0.3.0 → 0.3.1
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.
- checksums.yaml +8 -8
- data/bin/carregar_historico +44 -14
- data/bovespa_ingestion.gemspec +3 -1
- data/lib/historico_ativos/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDJiMjY3NDMyZTZiMjliNWViNWE4NTA4ODhjZGI4NDYwMTdkMTMzMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTFkMzU0NTEwMDZkY2I5MDRiZjRjNDhhMWU0Njk0NmQ4NGQ4Y2M4Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmVhZTMyN2Q3ODYzM2VhNjI1YTQ5MGMwNjZmMzAyYWQyNDk3N2M2MjVmZjY4
|
10
|
+
NmNkNDU4OWI1NjZkMzJhYjMxZTExMzE5ZTNhNTFjODBkMzBjYjJhOTM3YTMy
|
11
|
+
MzkwMjhmNDcxODAzNjA3NDVkMDY4Y2VjYTU2ZTE4YjhmNTJmMWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDNmY2Q2NmFkMTU4YWUyNjBlOTNkNDlhNGI4NGQxMzFiM2E3OWNhZGUwOTU3
|
14
|
+
YTM5MmJmMTBkYWI5Mzg0MTdhZGFiZjljZTEzZDNhODRiZWE0Y2ZkNWUxYjYz
|
15
|
+
YmM5Nzg5ZDZiNDgwYmE2NmM4ZWE5ZmE5MDRmNmE2YzBlNDkwNmY=
|
data/bin/carregar_historico
CHANGED
@@ -5,26 +5,56 @@ require 'historico_ativos'
|
|
5
5
|
module HistoricoAtivos
|
6
6
|
|
7
7
|
if ARGV.size <= 0
|
8
|
-
|
9
|
-
puts "
|
8
|
+
|
9
|
+
puts "Bovespa Ingestion eh uma lib que permite importar as cotacoes diarias dos ativos "
|
10
|
+
puts "da BM&F Bovespa utilizando os arquivos das cotacoes das series historicas."
|
11
|
+
puts ""
|
12
|
+
puts " Uso: "
|
13
|
+
puts " carregar_historico comando [argumentos...]"
|
14
|
+
puts ""
|
15
|
+
puts " Exemplos:"
|
16
|
+
puts " carregar_historico install"
|
17
|
+
puts " carregar_historico import sample/sample_cota_hist_2003.txt"
|
18
|
+
puts ""
|
19
|
+
puts " Mais informacoes:"
|
20
|
+
puts " https://github.com/seixasfelipe/bovespa-ingestion"
|
21
|
+
|
10
22
|
else
|
11
|
-
sample_file = ARGV[0]
|
12
23
|
|
13
|
-
|
24
|
+
command = ARGV[0]
|
25
|
+
|
26
|
+
if command == 'install'
|
27
|
+
require 'rake'
|
28
|
+
StandaloneMigrations::Tasks.load_tasks
|
29
|
+
Rake::Task['db:migrate'].invoke
|
30
|
+
# system("rake db:migrate")
|
31
|
+
elsif command == 'import'
|
14
32
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
33
|
+
if ARGV.size == 1
|
34
|
+
puts "Eh necessario informar o nome do arquivo a ser importado"
|
35
|
+
else
|
36
|
+
|
37
|
+
sample_file = ARGV[1]
|
38
|
+
|
39
|
+
puts "Carregando historico do arquivo: #{sample_file}"
|
19
40
|
|
20
|
-
|
41
|
+
start_time = Time.now
|
21
42
|
|
22
|
-
|
43
|
+
loader = CarregaHistorico.new ParserHeader.new, ParserTrailer.new, ParserAtivo.new
|
44
|
+
historico = loader.load sample_file
|
23
45
|
|
24
|
-
|
25
|
-
|
46
|
+
puts "Total de ativos carregados: #{historico.ativos.length}"
|
47
|
+
|
48
|
+
loader.persist historico
|
49
|
+
|
50
|
+
end_time = Time.now
|
51
|
+
elapsed_time = (end_time - start_time) * 1000.0
|
52
|
+
|
53
|
+
puts "Historico carregado em #{elapsed_time} ms!"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
26
57
|
|
27
|
-
puts "Historico carregado em #{elapsed_time} ms!"
|
28
58
|
end
|
29
59
|
|
30
|
-
end
|
60
|
+
end
|
data/bovespa_ingestion.gemspec
CHANGED