iron_warbler 2.0.7.40 → 2.0.7.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/iro/datapoint.rb +8 -2
- data/lib/iron_warbler.rb +29 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00d253e5183bd431fc4f47681007d9ce860d7ea71ec825247db81d3f56224d4f
|
4
|
+
data.tar.gz: 8600938ea2f61303da8f2eae2a4775e13b177cb976211a1911a4f5d9d09b1aba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3867a03b4d259f27256a09eda9047b688f3410301429ea9d8a321875e9d753db9028cadf93fb02f2ea1617e0370ad6e920346d68ae5d673ebaacf8e953c389e2
|
7
|
+
data.tar.gz: 6cdc0b4e80653ae44fa231e18007a829f6216a348b4fb6a5279dbf13f88caa7b50ed8d3053344c20680463f3aa5d2d681c6aa0edea48fd3452b8e916ac6ddaf5
|
data/app/models/iro/datapoint.rb
CHANGED
@@ -18,8 +18,14 @@ class Iro::Datapoint
|
|
18
18
|
KIND_TREASURY = 'TREASURY'
|
19
19
|
|
20
20
|
field :symbol ## ticker, but use 'symbol' here
|
21
|
-
|
22
|
-
|
21
|
+
## crypto
|
22
|
+
SYMBOL_BTC = 'BTC'
|
23
|
+
SYMBOL_ETH = 'ETH'
|
24
|
+
## currencies
|
25
|
+
SYMBOL_JPY = 'JPY'
|
26
|
+
SYMBOL_COP = 'COP'
|
27
|
+
SUMBOL_EUR = 'EUR'
|
28
|
+
## treasuries
|
23
29
|
SYMBOL_T1MO = 'T1MO'
|
24
30
|
SYMBOL_T2MO = 'T2MO'
|
25
31
|
SYMBOL_T3MO = 'T3MO'
|
data/lib/iron_warbler.rb
CHANGED
@@ -25,6 +25,35 @@ class Iro::Iro
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.get_currencies
|
29
|
+
out = HTTParty.get "https://api.currencyfreaks.com/v2.0/rates/latest?apikey=#{CURRENCYFREAKS[:key]}&symbols=COP,EUR,JPY"
|
30
|
+
out = out.parsed_response.deep_symbolize_keys!
|
31
|
+
out[:rates].each do |currency, value|
|
32
|
+
|
33
|
+
# opi = OPI.new({
|
34
|
+
# putCall: 'CURRENCY',
|
35
|
+
# symbol: currency,
|
36
|
+
# ticker: currency,
|
37
|
+
# exchangeName: 'currencyfreaks',
|
38
|
+
# mark: value,
|
39
|
+
# lastPrice: value,
|
40
|
+
# timestamp: Time.now.to_date,
|
41
|
+
# })
|
42
|
+
# opi.save!
|
43
|
+
|
44
|
+
datapoint = Iro::Datapoint.new({
|
45
|
+
date: Time.now.to_date,
|
46
|
+
quote_at: Time.now,
|
47
|
+
kind: Iro::Datapoint::KIND_CURRENCY,
|
48
|
+
symbol: currency,
|
49
|
+
value: value,
|
50
|
+
})
|
51
|
+
datapoint.save!
|
52
|
+
|
53
|
+
print '^'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
28
57
|
def self.get_treasuries
|
29
58
|
response = HTTParty.get( "https://home.treasury.gov/resource-center/data-chart-center/interest-rates/daily-treasury-rates.csv/all/#{Time.now.strftime('%Y%m')}?type=daily_treasury_yield_curve&field_tdr_date_value_month=#{Time.now.strftime('%Y%m')}&page&_format=csv")
|
30
59
|
outs = CSV.parse( response.body, { headers: true })
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_warbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.7.
|
4
|
+
version: 2.0.7.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: business_time
|