rapflag 0.0.1 → 0.0.2

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: 44875993e7dd2c5db62512b8a8baf5f760702e39
4
- data.tar.gz: 2888fcf78ccb8954979a8dc0ec40e02b0f099ea7
3
+ metadata.gz: f2b8cff390019633066b98ec809a1b2456eb34aa
4
+ data.tar.gz: 9c18b14083112387fa4f8b6974fb87eac80da22d
5
5
  SHA512:
6
- metadata.gz: 28170281a25a075a5c78703b01b1df4522c5cdafc984dc2f3f158188e775ac9e48b60e300223a2179373835d399f9eab5e4a82a27f654c1e5ed62b670e0376f1
7
- data.tar.gz: c19989b208d495d251bfb3c77e841780064500492b4ddba084630fde9a70f9174dca46cf9a50f03a02b3b6af28e7b5cc64da0ce773067d8f5793a26b5009cecc
6
+ metadata.gz: 768075044d00f00929d92ec72b0ed1392a6576c8b5825bb84cb384dbe3db21ce4370b6f2cca5315558ffae822fee645d2e8e0a9a1c86a0621ea49784d79c7947
7
+ data.tar.gz: 72351fc81bc992b056f530d4edf12b3123876a1af46781cc0027136b78bfb704967b6a7d39fc2005677131683954da62b496fcbb61fa672828ddef2e8d4aea5d
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # rapflag
2
2
  Bitfinex Exporter for your Taxman.
3
3
 
4
- ### set your key in
4
+ ### set your key, desired currencies in
5
5
  ```
6
6
  ./etc/config.yml
7
7
  ```
8
8
  sample
9
9
  ```
10
10
  ---
11
+ currencies: [ 'USD', 'BTC', 'BFX']
11
12
  api_key: ''
12
13
  secret: ''
13
14
  ```
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ dir = File.expand_path(File.dirname(File.dirname(__FILE__)))
3
+ $LOAD_PATH << File.join(dir, 'lib')
2
4
  require 'rapflag/version'
3
5
  require 'rapflag/config'
4
6
  require 'rapflag/fetch'
@@ -6,7 +8,7 @@ require 'trollop'
6
8
 
7
9
  begin
8
10
  require 'pry'
9
- rescue LOAD_ERROR
11
+ rescue LoadError
10
12
  end
11
13
 
12
14
  Opts = Trollop::options do
@@ -14,7 +16,7 @@ Opts = Trollop::options do
14
16
  end
15
17
 
16
18
  RAPFLAG::Wallets.each do |wallet|
17
- RAPFLAG::Currencies.each do |currency|
19
+ RAPFLAG::Config['currencies'].each do |currency|
18
20
  rap = RAPFLAG::History.new(wallet, currency)
19
21
  rap.fetch_csv_history
20
22
  rap.create_csv_file
@@ -5,14 +5,26 @@ module RAPFLAG
5
5
 
6
6
  # Configure the client with the proper KEY/SECRET, you can create a new one from:
7
7
  # https://www.bitfinex.com/api
8
- config_file = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'etc', 'config.yml'))
9
- unless File.exist?(config_file)
10
- puts "You must first add #{config_file}"
8
+ config_file = nil
9
+ files_to_test = [ File.join(Dir.pwd, 'etc', 'config.yml'),
10
+ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'etc', 'config.yml'))
11
+ ]
12
+ files_to_test.each do |file_to_check|
13
+ if File.exist?(file_to_check)
14
+ config_file = file_to_check
15
+ puts "Using config from #{file_to_check}"
16
+ break
17
+ end
18
+ end
19
+ unless config_file && File.exist?(config_file)
20
+ puts "You must first add. Use one of the following places #{files_to_test}"
11
21
  exit 2
12
22
  end
13
23
 
14
24
  Config= YAML.load_file(config_file)
15
25
  Config['websocket_api_endpoint'] ||= 'wss://api.bitfinex.com/ws'
26
+ Config['currencies'] ||= ['BTC', 'BFX', 'XMR', 'ZEC']
27
+ Config['currencies'] << 'USD' unless Config['currencies'].index('USD')
16
28
  Bitfinex::Client.configure do |conf|
17
29
  conf.api_key = Config['api_key']
18
30
  conf.secret = Config['secret']
@@ -1,6 +1,7 @@
1
1
  require 'csv'
2
2
  require 'open-uri'
3
3
  require 'faraday'
4
+ require 'fileutils'
4
5
 
5
6
  module RAPFLAG
6
7
 
@@ -53,7 +54,8 @@ module RAPFLAG
53
54
  from.eql?('BTC') ? @@btc_to_usd = rates.clone : @@bfx_to_usd = rates.clone
54
55
  rates[key] ? rates[key] : nil
55
56
  rescue => err
56
- binding.pry
57
+ puts "Err #{err}"
58
+ binding.pry if defined?(MiniTest)
57
59
  end
58
60
 
59
61
  def fetch_csv_history
@@ -1,7 +1,4 @@
1
1
  module RAPFLAG
2
-
3
- Currencies = [ 'USD', 'BTC', 'BFX']
4
2
  Wallets = ['trading', 'exchange', 'deposit']
5
-
6
- VERSION='0.0.1'
3
+ VERSION='0.0.2'
7
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapflag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitfinex-rb
@@ -125,7 +125,7 @@ dependencies:
125
125
  description: Bitfinex Exporter for your Taxman
126
126
  email: zdavatz@ywesee.com, ngiger@ywesee.com
127
127
  executables:
128
- - rapflag.rb
128
+ - rapflag
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
@@ -136,7 +136,7 @@ files:
136
136
  - LICENSE
137
137
  - README.md
138
138
  - Rakefile
139
- - bin/rapflag.rb
139
+ - bin/rapflag
140
140
  - fixtures/vcr_cassettes/rapflag.yml
141
141
  - lib/rapflag/config.rb
142
142
  - lib/rapflag/fetch.rb