ledger_get_prices 0.0.5 → 0.0.6
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 +4 -4
- data/lib/ledger_get_prices.rb +4 -3
- data/lib/ledger_get_prices/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e5ce2966b7c715cce97c872e0e1ea75345ec5e9
|
4
|
+
data.tar.gz: 217adb96cbfb8dd4c8d85b70604d2b1e6c59adc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8389c66f9674e1ae505867b16261b14de24bd6a28fdaf27592078dc488a6a99ed15a68f8b1936a256e00528ebd92c114ad7d5205771f34aff633236c7baf72bd
|
7
|
+
data.tar.gz: ba93a69c1f07fb34ab3fc9a14af2266b9a9f5b0ccdc86768d90ad362f6ba688e1267c8b050d2bfc6fae3633269bffe13c1716e58cb412c449226ee9ddca70c82
|
data/lib/ledger_get_prices.rb
CHANGED
@@ -32,7 +32,7 @@ module LedgerGetPrices
|
|
32
32
|
PRICE_DB_PATH = ENV['LEDGER_PRICE_DB'] || ENV['PRICE_HIST'] # PRICE_HIST is <v3
|
33
33
|
DATE_FORMAT = ENV['LEDGER_PRICE_DATE_FORMAT'] || "%Y/%m/%d"
|
34
34
|
PRICE_FORMAT = "P %{date} %{time} %{symbol} %{price}"
|
35
|
-
COMMODITY_BLACKLIST = (ENV['LEDGER_PRICE_COMMODITY_BLACKLIST'] || '
|
35
|
+
COMMODITY_BLACKLIST = (ENV['LEDGER_PRICE_COMMODITY_BLACKLIST'] || '').split(" ")
|
36
36
|
|
37
37
|
# With a bang because it does a file write.
|
38
38
|
def run!
|
@@ -65,8 +65,6 @@ module LedgerGetPrices
|
|
65
65
|
if COMMODITY_BLACKLIST.include?(symbol)
|
66
66
|
puts "Skipping #{symbol}: blacklisted."
|
67
67
|
puts "Use `LEDGER_PRICE_COMMODITY_BLACKLIST` to configure the blacklist."
|
68
|
-
puts "BTC is included by default because yahoo doesn't provide a way to " +
|
69
|
-
"get historical data for it."
|
70
68
|
return []
|
71
69
|
end
|
72
70
|
|
@@ -125,12 +123,15 @@ module LedgerGetPrices
|
|
125
123
|
# @return [Array<String>] Possible Yahoo finance compatible quote strings
|
126
124
|
def possible_quote_strings(commodity: nil)
|
127
125
|
raise "No commodity given" if commodity.nil?
|
126
|
+
# We get all quotes in USD
|
128
127
|
["#{commodity}=X", "USD#{commodity}=X", "#{commodity}"]
|
129
128
|
end
|
130
129
|
|
131
130
|
def commodities
|
132
131
|
# All the commodities we care about.
|
133
132
|
@commodities ||= `ledger commodities`.split("\n").reject { |x| x == "$" }.tap do |c|
|
133
|
+
# Since all quotes will be in USD, we don't need to bother
|
134
|
+
# retrieving USD/USD quotes.
|
134
135
|
c << BASE_CURRENCY if BASE_CURRENCY != 'USD'
|
135
136
|
end
|
136
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ledger_get_prices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Kot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|