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 +4 -4
- data/README.md +2 -1
- data/bin/{rapflag.rb → rapflag} +4 -2
- data/lib/rapflag/config.rb +15 -3
- data/lib/rapflag/fetch.rb +3 -1
- data/lib/rapflag/version.rb +1 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2b8cff390019633066b98ec809a1b2456eb34aa
|
4
|
+
data.tar.gz: 9c18b14083112387fa4f8b6974fb87eac80da22d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 768075044d00f00929d92ec72b0ed1392a6576c8b5825bb84cb384dbe3db21ce4370b6f2cca5315558ffae822fee645d2e8e0a9a1c86a0621ea49784d79c7947
|
7
|
+
data.tar.gz: 72351fc81bc992b056f530d4edf12b3123876a1af46781cc0027136b78bfb704967b6a7d39fc2005677131683954da62b496fcbb61fa672828ddef2e8d4aea5d
|
data/README.md
CHANGED
data/bin/{rapflag.rb → rapflag}
RENAMED
@@ -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
|
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
|
-
|
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
|
data/lib/rapflag/config.rb
CHANGED
@@ -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 =
|
9
|
-
|
10
|
-
|
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']
|
data/lib/rapflag/fetch.rb
CHANGED
@@ -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
|
-
|
57
|
+
puts "Err #{err}"
|
58
|
+
binding.pry if defined?(MiniTest)
|
57
59
|
end
|
58
60
|
|
59
61
|
def fetch_csv_history
|
data/lib/rapflag/version.rb
CHANGED
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.
|
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-
|
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
|
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
|
139
|
+
- bin/rapflag
|
140
140
|
- fixtures/vcr_cassettes/rapflag.yml
|
141
141
|
- lib/rapflag/config.rb
|
142
142
|
- lib/rapflag/fetch.rb
|