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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2Q0YTExYjdlOTU5NWUyODZkMjYyZTIxNzZmMmRhNzlhNzg5ZTY0Nw==
4
+ ZDJiMjY3NDMyZTZiMjliNWViNWE4NTA4ODhjZGI4NDYwMTdkMTMzMw==
5
5
  data.tar.gz: !binary |-
6
- OTU0ZDhhZTQ5MzY4ZDI0NmY5ZTBkNzZmNThjYzFkZTVhOGZhNTUzMw==
6
+ OTFkMzU0NTEwMDZkY2I5MDRiZjRjNDhhMWU0Njk0NmQ4NGQ4Y2M4Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDk3YjEzYjAxZjAxN2M0MzEwYTgxOTEyYTE5MzY1NTVkMDkzY2IwODIyZjQ5
10
- ZDExZTFjZTE0YjgxYzYzYWRjOGUxNjU1N2Q0OWMzMDg4ZmQ3OTk5MjY5OWVj
11
- NjFkNjVlOWU3NjdlYTM2ZTY3YjlhMzU3YjdhYjc4ZDgzOTc3MmE=
9
+ MmVhZTMyN2Q3ODYzM2VhNjI1YTQ5MGMwNjZmMzAyYWQyNDk3N2M2MjVmZjY4
10
+ NmNkNDU4OWI1NjZkMzJhYjMxZTExMzE5ZTNhNTFjODBkMzBjYjJhOTM3YTMy
11
+ MzkwMjhmNDcxODAzNjA3NDVkMDY4Y2VjYTU2ZTE4YjhmNTJmMWQ=
12
12
  data.tar.gz: !binary |-
13
- NGYxY2U2MWJjODkyZDNhN2I5MzEyYTNmODI0ODdhZDFkNzk4MzAyYTE2YTk4
14
- MTc1NDU4NDFlNTUyNmEwZmFiYTk5ODQ5NDg0NDllZjU5N2NlZDAyODc5YTZj
15
- YTYwMWViYjNiMGRjZTkxYTQ3ZGNjNDhiZTllMzI2NzA0MDI3YzM=
13
+ ZDNmY2Q2NmFkMTU4YWUyNjBlOTNkNDlhNGI4NGQxMzFiM2E3OWNhZGUwOTU3
14
+ YTM5MmJmMTBkYWI5Mzg0MTdhZGFiZjljZTEzZDNhODRiZWE0Y2ZkNWUxYjYz
15
+ YmM5Nzg5ZDZiNDgwYmE2NmM4ZWE5ZmE5MDRmNmE2YzBlNDkwNmY=
@@ -5,26 +5,56 @@ require 'historico_ativos'
5
5
  module HistoricoAtivos
6
6
 
7
7
  if ARGV.size <= 0
8
- puts "Uso: carregar_historico [nome do arquivo]"
9
- puts " exemplo: carregar_historico sample/sample_cota_hist_2003.txt"
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
- puts "Carregando historico do arquivo: #{sample_file}"
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
- start_time = Time.now
16
-
17
- loader = CarregaHistorico.new ParserHeader.new, ParserTrailer.new, ParserAtivo.new
18
- historico = loader.load sample_file
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
- puts "Total de ativos carregados: #{historico.ativos.length}"
41
+ start_time = Time.now
21
42
 
22
- loader.persist historico
43
+ loader = CarregaHistorico.new ParserHeader.new, ParserTrailer.new, ParserAtivo.new
44
+ historico = loader.load sample_file
23
45
 
24
- end_time = Time.now
25
- elapsed_time = (end_time - start_time) * 1000.0
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
@@ -1,4 +1,6 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $:.unshift lib unless $:.include?(lib)
3
+
2
4
  require 'historico_ativos/version'
3
5
 
4
6
  # -*- encoding: utf-8 -*-
@@ -1,3 +1,3 @@
1
1
  module HistoricoAtivos
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bovespa_ingestion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Seixas